Skip to content

Commit 922790e

Browse files
authored
Merge pull request #62 from ohaiibuzzle/feat/msync
feat: msync support
2 parents 0c3e29c + 71c23f4 commit 922790e

File tree

10 files changed

+354
-249
lines changed

10 files changed

+354
-249
lines changed

Harbor.xcodeproj/project.pbxproj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
AB0D00442A40A3630019D62F /* BottleDXVK.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00432A40A3630019D62F /* BottleDXVK.swift */; };
11-
AB0D00462A40B27F0019D62F /* DXVKUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00452A40B27F0019D62F /* DXVKUtils.swift */; };
10+
AB0D00442A40A3630019D62F /* BottleDX.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00432A40A3630019D62F /* BottleDX.swift */; };
11+
AB0D00462A40B27F0019D62F /* DXUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00452A40B27F0019D62F /* DXUtils.swift */; };
1212
AB0D004A2A40B7670019D62F /* MenuUIStates.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00492A40B7670019D62F /* MenuUIStates.swift */; };
1313
AB0D004C2A40B8900019D62F /* DXVKInstallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D004B2A40B8900019D62F /* DXVKInstallView.swift */; };
1414
AB0D004E2A40E3D30019D62F /* EnvironmentVarsEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D004D2A40E3D30019D62F /* EnvironmentVarsEditor.swift */; };
@@ -38,6 +38,7 @@
3838
ABC0BFD42A31691500382A42 /* BottleOpsDropdown.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0BFD32A31691500382A42 /* BottleOpsDropdown.swift */; };
3939
ABD56AB32A36E419002A439C /* GPKSafeInstallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABD56AB12A36E419002A439C /* GPKSafeInstallView.swift */; };
4040
ABD56AB42A36E419002A439C /* GPKFastInstallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABD56AB22A36E419002A439C /* GPKFastInstallView.swift */; };
41+
ABDA74592AD904E700802792 /* BottleDetailsCommonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABDA74582AD904E700802792 /* BottleDetailsCommonView.swift */; };
4142
ABF5340A2A3F606A0030677A /* ViewMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF534092A3F606A0030677A /* ViewMenu.swift */; };
4243
ABF5340C2A3F63BE0030677A /* BottleManagementCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF5340B2A3F63BE0030677A /* BottleManagementCardView.swift */; };
4344
ABF5340E2A3F63FE0030677A /* BottleManagementTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF5340D2A3F63FE0030677A /* BottleManagementTableView.swift */; };
@@ -47,8 +48,8 @@
4748
/* End PBXBuildFile section */
4849

4950
/* Begin PBXFileReference section */
50-
AB0D00432A40A3630019D62F /* BottleDXVK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleDXVK.swift; sourceTree = "<group>"; };
51-
AB0D00452A40B27F0019D62F /* DXVKUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXVKUtils.swift; sourceTree = "<group>"; };
51+
AB0D00432A40A3630019D62F /* BottleDX.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleDX.swift; sourceTree = "<group>"; };
52+
AB0D00452A40B27F0019D62F /* DXUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXUtils.swift; sourceTree = "<group>"; };
5253
AB0D00492A40B7670019D62F /* MenuUIStates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuUIStates.swift; sourceTree = "<group>"; };
5354
AB0D004B2A40B8900019D62F /* DXVKInstallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXVKInstallView.swift; sourceTree = "<group>"; };
5455
AB0D004D2A40E3D30019D62F /* EnvironmentVarsEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentVarsEditor.swift; sourceTree = "<group>"; };
@@ -80,6 +81,7 @@
8081
ABC0BFD32A31691500382A42 /* BottleOpsDropdown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleOpsDropdown.swift; sourceTree = "<group>"; };
8182
ABD56AB12A36E419002A439C /* GPKSafeInstallView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GPKSafeInstallView.swift; sourceTree = "<group>"; };
8283
ABD56AB22A36E419002A439C /* GPKFastInstallView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GPKFastInstallView.swift; sourceTree = "<group>"; };
84+
ABDA74582AD904E700802792 /* BottleDetailsCommonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleDetailsCommonView.swift; sourceTree = "<group>"; };
8385
ABF534092A3F606A0030677A /* ViewMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewMenu.swift; sourceTree = "<group>"; };
8486
ABF5340B2A3F63BE0030677A /* BottleManagementCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleManagementCardView.swift; sourceTree = "<group>"; };
8587
ABF5340D2A3F63FE0030677A /* BottleManagementTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleManagementTableView.swift; sourceTree = "<group>"; };
@@ -230,6 +232,7 @@
230232
AB6652CC2A3350EC00F3FC5D /* BottleConfigDropdown.swift */,
231233
AB6254332A3CE30D002A6206 /* BottleCardListView.swift */,
232234
AB0D004D2A40E3D30019D62F /* EnvironmentVarsEditor.swift */,
235+
ABDA74582AD904E700802792 /* BottleDetailsCommonView.swift */,
233236
);
234237
path = BottleManagement;
235238
sourceTree = "<group>";
@@ -249,8 +252,8 @@
249252
AB7A80FF2A30CC7100AA71A6 /* BrewUtils.swift */,
250253
AB5CC6D52A30910300AEBB2B /* GPKUtils.swift */,
251254
AB6652C32A3334E600F3FC5D /* XCLIUtils.swift */,
252-
AB0D00452A40B27F0019D62F /* DXVKUtils.swift */,
253-
AB0D00432A40A3630019D62F /* BottleDXVK.swift */,
255+
AB0D00452A40B27F0019D62F /* DXUtils.swift */,
256+
AB0D00432A40A3630019D62F /* BottleDX.swift */,
254257
AB7D8E322A4DDE3400B55527 /* WinetricksUtils.swift */,
255258
);
256259
path = Systems;
@@ -356,12 +359,13 @@
356359
AB5CC6D82A30938A00AEBB2B /* BrewInstallView.swift in Sources */,
357360
ABD56AB42A36E419002A439C /* GPKFastInstallView.swift in Sources */,
358361
FC682EDA2A35FD57000C53D6 /* Environment+GPKUtils.swift in Sources */,
359-
AB0D00442A40A3630019D62F /* BottleDXVK.swift in Sources */,
362+
AB0D00442A40A3630019D62F /* BottleDX.swift in Sources */,
360363
AB0D004C2A40B8900019D62F /* DXVKInstallView.swift in Sources */,
361364
AB0D004E2A40E3D30019D62F /* EnvironmentVarsEditor.swift in Sources */,
362365
AB7A81002A30CC7100AA71A6 /* BrewUtils.swift in Sources */,
363366
AB6652CD2A3350EC00F3FC5D /* BottleConfigDropdown.swift in Sources */,
364367
AB5CC6D62A30910300AEBB2B /* GPKUtils.swift in Sources */,
368+
ABDA74592AD904E700802792 /* BottleDetailsCommonView.swift in Sources */,
365369
AB3BE5EE2A32248D00358BBC /* LaunchExtDropdown.swift in Sources */,
366370
AB5D49C62A3B5B0B008245A6 /* URLExtensions.swift in Sources */,
367371
AB5CC6C22A308BBB00AEBB2B /* ContentView.swift in Sources */,
@@ -382,7 +386,7 @@
382386
AB6652C22A33342B00F3FC5D /* XCLIInstallView.swift in Sources */,
383387
ABF5340A2A3F606A0030677A /* ViewMenu.swift in Sources */,
384388
AB6652C92A3349A400F3FC5D /* HarborMenu.swift in Sources */,
385-
AB0D00462A40B27F0019D62F /* DXVKUtils.swift in Sources */,
389+
AB0D00462A40B27F0019D62F /* DXUtils.swift in Sources */,
386390
FC682EDF2A3604B4000C53D6 /* Environment+XCLIUtils.swift in Sources */,
387391
ABC0BFD42A31691500382A42 /* BottleOpsDropdown.swift in Sources */,
388392
);

Harbor/Localizable.xcstrings

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,16 @@
719719
}
720720
}
721721
},
722+
"sheet.advConf.DXBackend" : {
723+
"localizations" : {
724+
"en" : {
725+
"stringUnit" : {
726+
"state" : "translated",
727+
"value" : "DirectX Backend"
728+
}
729+
}
730+
}
731+
},
722732
"sheet.advConf.dxvkToggle" : {
723733
"localizations" : {
724734
"en" : {
@@ -736,6 +746,7 @@
736746
}
737747
},
738748
"sheet.advConf.eSyncToggle" : {
749+
"extractionState" : "stale",
739750
"localizations" : {
740751
"en" : {
741752
"stringUnit" : {
@@ -831,6 +842,26 @@
831842
}
832843
}
833844
},
845+
"sheet.advConf.SyncPrimitives" : {
846+
"localizations" : {
847+
"en" : {
848+
"stringUnit" : {
849+
"state" : "translated",
850+
"value" : "Synchronization Primitives"
851+
}
852+
}
853+
}
854+
},
855+
"sheet.advConf.SyncPrimitives.none" : {
856+
"localizations" : {
857+
"en" : {
858+
"stringUnit" : {
859+
"state" : "translated",
860+
"value" : "None"
861+
}
862+
}
863+
}
864+
},
834865
"sheet.advConf.title %@" : {
835866
"localizations" : {
836867
"en" : {
@@ -1039,6 +1070,16 @@
10391070
}
10401071
}
10411072
},
1073+
"sheet.fastGPKInstall.fastArchiveDetected" : {
1074+
"localizations" : {
1075+
"en" : {
1076+
"stringUnit" : {
1077+
"state" : "translated",
1078+
"value" : "Detected HarborBuilder's bottle with bundled GPTK!"
1079+
}
1080+
}
1081+
}
1082+
},
10421083
"sheet.fastGPKInstall.subtitle" : {
10431084
"localizations" : {
10441085
"en" : {

Harbor/Models/HarborBottle.swift

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import Foundation
99
import AppKit
1010
import Observation
1111

12+
enum WineSyncronizationPrimatives: String, Codable {
13+
case none = "None"
14+
case eSync = "ESync"
15+
case mSync = "MSync"
16+
}
17+
1218
struct HarborBottle: Identifiable, Equatable, Codable {
1319
var id: UUID
1420
var name: String = "New Bottle"
@@ -17,12 +23,14 @@ struct HarborBottle: Identifiable, Equatable, Codable {
1723
var primaryApplicationArgument: String = ""
1824
var primaryApplicationWorkDir: String = ""
1925
var enableHUD: Bool = false
20-
var enableESync: Bool = false
26+
var syncPrimitives: WineSyncronizationPrimatives = .none
2127
var pleaseShutUp: Bool = true
2228
var envVars: [String: String] = .init()
2329

30+
// swiftlint:disable cyclomatic_complexity
31+
// This function is a bit too complex right now
2432
func launchApplication(_ application: String, arguments: [String] = [], environmentVars: [String: String] = [:],
25-
workDir: String = "", isUnixPath: Bool = false) {
33+
workDir: String = "", isUnixPath: Bool = true) {
2634
let task = Process()
2735
task.launchPath = "/usr/local/opt/game-porting-toolkit/bin/wine64"
2836
task.arguments = ["start"]
@@ -47,8 +55,14 @@ struct HarborBottle: Identifiable, Equatable, Codable {
4755
if enableHUD {
4856
task.environment?["MTL_HUD_ENABLED"] = "1"
4957
}
50-
if enableESync {
58+
59+
switch syncPrimitives {
60+
case .none:
61+
break
62+
case .eSync:
5163
task.environment?["WINEESYNC"] = "1"
64+
case .mSync:
65+
task.environment?["WINEMSYNC"] = "1"
5266
}
5367

5468
if !envVars.isEmpty {
@@ -68,6 +82,7 @@ struct HarborBottle: Identifiable, Equatable, Codable {
6882
HarborUtils.shared.quickError(error.localizedDescription)
6983
}
7084
}
85+
// swiftlint:enable cyclomatic_complexity
7186

7287
func launchExtApplication(_ application: String, arguments: [String] = [], environmentVars: [String: String] = [:],
7388
workDir: String = "") {
@@ -166,7 +181,8 @@ struct HarborBottle: Identifiable, Equatable, Codable {
166181
.decodeIfPresent(String.self, forKey: .primaryApplicationArgument) ?? ""
167182
primaryApplicationWorkDir = try container.decodeIfPresent(String.self, forKey: .primaryApplicationWorkDir) ?? ""
168183
enableHUD = try container.decodeIfPresent(Bool.self, forKey: .enableHUD) ?? false
169-
enableESync = try container.decodeIfPresent(Bool.self, forKey: .enableESync) ?? false
184+
syncPrimitives = try container
185+
.decodeIfPresent(WineSyncronizationPrimatives.self, forKey: .syncPrimitives) ?? .none
170186
pleaseShutUp = try container.decodeIfPresent(Bool.self, forKey: .pleaseShutUp) ?? true
171187
envVars = try container.decodeIfPresent([String: String].self, forKey: .envVars) ?? [:]
172188
}

Harbor/Systems/BottleDX.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class BottleDX {
124124

125125
func removeDXVKFromBottle(bottle: HarborBottle) {
126126
let bottlePath = bottle.path
127-
127+
128128
for override in dxvkOverrides {
129129
let overridePath = bottlePath.appendingPathComponent("drive_c/windows/system32/\(override).dll")
130130
// remove the symlink

0 commit comments

Comments
 (0)