Skip to content

Commit

Permalink
Merge pull request #85 from MythicApp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
vapidinfinity authored Jun 13, 2024
2 parents 9b77a32 + d3e81e1 commit 8adeb50
Show file tree
Hide file tree
Showing 43 changed files with 1,386 additions and 950 deletions.
54 changes: 38 additions & 16 deletions Mythic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,19 @@
6A2935662BFCFAFD0035CE4B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2934F02BFCFAFD0035CE4B /* AppDelegate.swift */; };
6A2935672BFCFAFD0035CE4B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6A2934F12BFCFAFD0035CE4B /* Assets.xcassets */; };
6A2935682BFCFAFD0035CE4B /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 6A2934F22BFCFAFD0035CE4B /* Credits.rtf */; };
6A2935692BFCFAFD0035CE4B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6A2934F32BFCFAFD0035CE4B /* Info.plist */; };
6A29356A2BFCFAFD0035CE4B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 6A2934F42BFCFAFD0035CE4B /* Localizable.xcstrings */; };
6A29356B2BFCFAFD0035CE4B /* MythicApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2934F62BFCFAFD0035CE4B /* MythicApp.swift */; };
6A34366E2B8D7F1200D35BCA /* Shimmer in Frameworks */ = {isa = PBXBuildFile; productRef = 6A34366D2B8D7F1200D35BCA /* Shimmer */; };
6A371B592AE7DFBF0054BF7A /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 6A371B582AE7DFBF0054BF7A /* ZIPFoundation */; };
6A496A732C1AF75B00FD637B /* Game.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A496A722C1AF75600FD637B /* Game.swift */; };
6A71D3D92BFD01AB00A2C74D /* legendary in Resources */ = {isa = PBXBuildFile; fileRef = 6A71D3D82BFD01AB00A2C74D /* legendary */; };
6A71D3DD2BFD024D00A2C74D /* Auth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A71D3DC2BFD024D00A2C74D /* Auth.swift */; };
6A7A81162B77093600D19E32 /* ColorfulX in Frameworks */ = {isa = PBXBuildFile; productRef = 6A7A81152B77093600D19E32 /* ColorfulX */; };
6AACEF752C18846700258A7E /* exeIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6AACEF742C18846700258A7E /* exeIcon.icns */; };
6AAD31152B08693D0035FA69 /* SemanticVersion in Frameworks */ = {isa = PBXBuildFile; productRef = 6AAD31142B08693D0035FA69 /* SemanticVersion */; };
6AC45E092C1B2FD500ED9F64 /* SettingsFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E082C1B2FC800ED9F64 /* SettingsFormView.swift */; };
6AC742DD2B9314AB000EA1B2 /* SwordRPC in Frameworks */ = {isa = PBXBuildFile; productRef = 6AC742DC2B9314AB000EA1B2 /* SwordRPC */; };
6AF630D92C077A17001F4E10 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AF630D82C077A17001F4E10 /* UserDefaults.swift */; };
6AFC027E2ABDB5D40004AB77 /* SwiftyJSON in Frameworks */ = {isa = PBXBuildFile; productRef = 6AFC027D2ABDB5D40004AB77 /* SwiftyJSON */; };
6AFC02812ABE02970004AB77 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 6AFC02802ABE02970004AB77 /* Sparkle */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -149,9 +152,13 @@
6A2934F42BFCFAFD0035CE4B /* Localizable.xcstrings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
6A2934F52BFCFAFD0035CE4B /* Mythic.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Mythic.entitlements; sourceTree = "<group>"; };
6A2934F62BFCFAFD0035CE4B /* MythicApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MythicApp.swift; sourceTree = "<group>"; };
6A496A722C1AF75600FD637B /* Game.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = "<group>"; };
6A71D3D82BFD01AB00A2C74D /* legendary */ = {isa = PBXFileReference; lastKnownFileType = folder; path = legendary; sourceTree = "<group>"; };
6A71D3DC2BFD024D00A2C74D /* Auth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Auth.swift; sourceTree = "<group>"; };
6AACEF742C18846700258A7E /* exeIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = exeIcon.icns; sourceTree = "<group>"; };
6AB474952AACBBE900AB9C63 /* Mythic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mythic.app; sourceTree = BUILT_PRODUCTS_DIR; };
6AC45E082C1B2FC800ED9F64 /* SettingsFormView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsFormView.swift; sourceTree = "<group>"; };
6AF630D82C077A17001F4E10 /* UserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -194,14 +201,7 @@
6A2934BB2BFCFAFD0035CE4B /* Extensions */ = {
isa = PBXGroup;
children = (
6A2934B32BFCFAFD0035CE4B /* Bundle.swift */,
6A2934B42BFCFAFD0035CE4B /* Color.swift */,
6A2934B52BFCFAFD0035CE4B /* Data.swift */,
6A2934B62BFCFAFD0035CE4B /* Logger.swift */,
6A2934B72BFCFAFD0035CE4B /* Process.swift */,
6A2934B82BFCFAFD0035CE4B /* Task.swift */,
6A2934B92BFCFAFD0035CE4B /* URL.swift */,
6A2934BA2BFCFAFD0035CE4B /* Workspace.swift */,
6AD44DE52C0A29BF00824C06 /* Built-in */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -242,6 +242,7 @@
6A2934C12BFCFAFD0035CE4B /* Local */,
6A2934C42BFCFAFD0035CE4B /* Wine */,
6A2934C52BFCFAFD0035CE4B /* FileLocations.swift */,
6A496A722C1AF75600FD637B /* Game.swift */,
6A2934C62BFCFAFD0035CE4B /* Global.swift */,
6A2934C72BFCFAFD0035CE4B /* NetworkMonitor.swift */,
6A2934C82BFCFAFD0035CE4B /* Rosetta.swift */,
Expand All @@ -253,8 +254,8 @@
6A2934CF2BFCFAFD0035CE4B /* Extensions */ = {
isa = PBXGroup;
children = (
6A2934CB2BFCFAFD0035CE4B /* EpicImport.swift */,
6A2934CC2BFCFAFD0035CE4B /* GameImport.swift */,
6A2934CB2BFCFAFD0035CE4B /* EpicImport.swift */,
6A2934CE2BFCFAFD0035CE4B /* LocalImport.swift */,
);
path = Extensions;
Expand Down Expand Up @@ -288,6 +289,7 @@
6A2934DF2BFCFAFD0035CE4B /* Models */ = {
isa = PBXGroup;
children = (
6AC45E082C1B2FC800ED9F64 /* SettingsFormView.swift */,
6A2934DB2BFCFAFD0035CE4B /* CompactGameCard.swift */,
6A2934DC2BFCFAFD0035CE4B /* GameCard.swift */,
6A2934DD2BFCFAFD0035CE4B /* GameInstallProgressView.swift */,
Expand Down Expand Up @@ -343,6 +345,7 @@
6A2934EF2BFCFAFD0035CE4B /* Views */,
6A2934CA2BFCFAFD0035CE4B /* Utilities */,
6A2934F12BFCFAFD0035CE4B /* Assets.xcassets */,
6AACEF742C18846700258A7E /* exeIcon.icns */,
6A2934F22BFCFAFD0035CE4B /* Credits.rtf */,
6A2934F32BFCFAFD0035CE4B /* Info.plist */,
6A2934F42BFCFAFD0035CE4B /* Localizable.xcstrings */,
Expand All @@ -369,6 +372,22 @@
name = Products;
sourceTree = "<group>";
};
6AD44DE52C0A29BF00824C06 /* Built-in */ = {
isa = PBXGroup;
children = (
6A2934B32BFCFAFD0035CE4B /* Bundle.swift */,
6A2934B42BFCFAFD0035CE4B /* Color.swift */,
6A2934B52BFCFAFD0035CE4B /* Data.swift */,
6A2934B62BFCFAFD0035CE4B /* Logger.swift */,
6A2934B72BFCFAFD0035CE4B /* Process.swift */,
6A2934B82BFCFAFD0035CE4B /* Task.swift */,
6A2934B92BFCFAFD0035CE4B /* URL.swift */,
6A2934BA2BFCFAFD0035CE4B /* Workspace.swift */,
6AF630D82C077A17001F4E10 /* UserDefaults.swift */,
);
path = "Built-in";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -410,7 +429,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1500;
LastUpgradeCheck = 1520;
LastUpgradeCheck = 1540;
TargetAttributes = {
6AB474942AACBBE900AB9C63 = {
CreatedOnToolsVersion = 15.0;
Expand Down Expand Up @@ -455,7 +474,7 @@
6A29356A2BFCFAFD0035CE4B /* Localizable.xcstrings in Resources */,
6A71D3D92BFD01AB00A2C74D /* legendary in Resources */,
6A2935682BFCFAFD0035CE4B /* Credits.rtf in Resources */,
6A2935692BFCFAFD0035CE4B /* Info.plist in Resources */,
6AACEF752C18846700258A7E /* exeIcon.icns in Resources */,
6A2935672BFCFAFD0035CE4B /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -495,6 +514,7 @@
6A2935622BFCFAFD0035CE4B /* NotImplementedView.swift in Sources */,
6A2935612BFCFAFD0035CE4B /* GameListEvoView.swift in Sources */,
6A29354F2BFCFAFD0035CE4B /* DownloadsEvo.swift in Sources */,
6A496A732C1AF75B00FD637B /* Game.swift in Sources */,
6A2935602BFCFAFD0035CE4B /* BottleListView.swift in Sources */,
6A29355E2BFCFAFD0035CE4B /* StopDownloadAlert.swift in Sources */,
6A2935662BFCFAFD0035CE4B /* AppDelegate.swift in Sources */,
Expand All @@ -513,6 +533,7 @@
6A2935382BFCFAFD0035CE4B /* Logger.swift in Sources */,
6A2935372BFCFAFD0035CE4B /* Data.swift in Sources */,
6A2935482BFCFAFD0035CE4B /* EpicImport.swift in Sources */,
6AC45E092C1B2FD500ED9F64 /* SettingsFormView.swift in Sources */,
6A29353D2BFCFAFD0035CE4B /* LegendaryInterface.swift in Sources */,
6A2935422BFCFAFD0035CE4B /* WineInterfaceExt.swift in Sources */,
6A2935552BFCFAFD0035CE4B /* CompactGameCard.swift in Sources */,
Expand All @@ -539,6 +560,7 @@
6A29353C2BFCFAFD0035CE4B /* Workspace.swift in Sources */,
6A2935452BFCFAFD0035CE4B /* NetworkMonitor.swift in Sources */,
6A29356B2BFCFAFD0035CE4B /* MythicApp.swift in Sources */,
6AF630D92C077A17001F4E10 /* UserDefaults.swift in Sources */,
6A2935342BFCFAFD0035CE4B /* EngineExt.swift in Sources */,
6A2935392BFCFAFD0035CE4B /* Process.swift in Sources */,
6A2935492BFCFAFD0035CE4B /* GameImport.swift in Sources */,
Expand Down Expand Up @@ -681,7 +703,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2642;
CURRENT_PROJECT_VERSION = 2754;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
DEVELOPMENT_TEAM = 67ZBY275P8;
Expand All @@ -704,7 +726,7 @@
);
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Mythic/legendary/_internal";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = "0.1.1-dirty";
MARKETING_VERSION = "0.2.0-dirty";
PRODUCT_BUNDLE_IDENTIFIER = xyz.blackxfiied.Mythic;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -726,7 +748,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2642;
CURRENT_PROJECT_VERSION = 2754;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
DEVELOPMENT_TEAM = 67ZBY275P8;
Expand All @@ -749,7 +771,7 @@
);
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Mythic/legendary/_internal";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = "0.1.1-alpha";
MARKETING_VERSION = "0.2.0-alpha";
PRODUCT_BUNDLE_IDENTIFIER = xyz.blackxfiied.Mythic;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion Mythic.xcodeproj/xcshareddata/xcschemes/Mythic.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
46 changes: 37 additions & 9 deletions Mythic/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,55 @@ class AppDelegate: NSObject, NSApplicationDelegate { // https://arc.net/l/quote/
var networkMonitor: NetworkMonitor?

func applicationDidFinishLaunching(_: Notification) {
setenv("CX_ROOT", Bundle.main.bundlePath, 1)

// MARK: initialize default UserDefaults Values
defaults.register(defaults: [
"discordRPC": true
])

// MARK: Bottle removal if folder was deleted externally
if let bottles = Wine.allBottles {
for (key, value) in bottles where !files.fileExists(atPath: value.url.path(percentEncoded: false)) {
Wine.allBottles?.removeValue(forKey: key)
// MARK: Bottle cleanup in the event of external deletion
Wine.bottleURLs = Wine.bottleURLs.filter { files.fileExists(atPath: $0.path(percentEncoded: false)) }

// MARK: 0.1.x bottle migration
if let data = defaults.data(forKey: "allBottles"),
let decodedData = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: [String: Any]] {

Logger.app.log("Older bottle format detected, commencing bottle management system migration")

var iterations = 0
var convertedBottles: [Wine.Bottle] = .init()

for (name, bottle) in decodedData {
guard let urlArray = bottle["url"] as? [String: String], // unable to cast directly to URL
let relativeURL = urlArray["relative"],
let url: URL = .init(string: relativeURL.removingPercentEncoding ?? relativeURL) else {
return
}

var settings = Wine.defaultBottleSettings
guard let oldSettings = bottle["settings"] as? [String: Bool] else { Logger.file.warning("Unable to read old bottle settings; using default"); continue }
settings.metalHUD = oldSettings["metalHUD"] ?? settings.metalHUD
settings.msync = oldSettings["msync"] ?? settings.msync
settings.retinaMode = oldSettings["retinaMode"] ?? settings.retinaMode

convertedBottles.append(.init(name: name, url: url, settings: settings))
Wine.bottleURLs.insert(url)
iterations += 1
Logger.app.log("converted \(url.prettyPath()) (\(iterations)/\(decodedData.count))")
}

Logger.file.notice("Bottle management system migration complete.")
defaults.removeObject(forKey: "allBottles")
}

// MARK: DiscordRPC Connection and Delegation Setting
discordRPC.delegate = self
if defaults.bool(forKey: "discordRPC") { _ = discordRPC.connect() }

if Engine.exists { _ = Wine.allBottles } // creates default bottle automatically because of custom getter

// MARK: Applications folder disclaimer
// TODO: possibly turn this into an onboarding-style message.
// #if !DEBUG
#if !DEBUG
let currentAppURL = Bundle.main.bundleURL
let optimalAppURL = FileLocations.globalApplications?.appendingPathComponent(currentAppURL.lastPathComponent)

Expand Down Expand Up @@ -74,7 +102,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { // https://arc.net/l/quote/
}
}
}
// #endif
#endif

// MARK: Notification Authorisation Request and Delegation Setting
notifications.delegate = self
Expand Down Expand Up @@ -140,7 +168,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { // https://arc.net/l/quote/
}

func applicationWillTerminate(_: Notification) {
if defaults.bool(forKey: "quitOnAppClose") { Wine.killAll() }
if defaults.bool(forKey: "quitOnAppClose") { try? Wine.killAll() }
Legendary.stopAllCommands(forced: true)
}
}
Expand Down
4 changes: 3 additions & 1 deletion Mythic/Assets.xcassets/EngineIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"images" : [
{
"filename" : "Engine Icon.png",
"filename" : "Engine-GPTKv2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Engine-GPTKv2@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Engine-GPTKv2@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8adeb50

Please sign in to comment.