Skip to content

Commit

Permalink
feat: msync support
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaiibuzzle committed Oct 13, 2023
1 parent 0b19f11 commit 71c23f4
Show file tree
Hide file tree
Showing 10 changed files with 354 additions and 249 deletions.
20 changes: 12 additions & 8 deletions Harbor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
AB0D00442A40A3630019D62F /* BottleDXVK.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00432A40A3630019D62F /* BottleDXVK.swift */; };
AB0D00462A40B27F0019D62F /* DXVKUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00452A40B27F0019D62F /* DXVKUtils.swift */; };
AB0D00442A40A3630019D62F /* BottleDX.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00432A40A3630019D62F /* BottleDX.swift */; };
AB0D00462A40B27F0019D62F /* DXUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00452A40B27F0019D62F /* DXUtils.swift */; };
AB0D004A2A40B7670019D62F /* MenuUIStates.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D00492A40B7670019D62F /* MenuUIStates.swift */; };
AB0D004C2A40B8900019D62F /* DXVKInstallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D004B2A40B8900019D62F /* DXVKInstallView.swift */; };
AB0D004E2A40E3D30019D62F /* EnvironmentVarsEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0D004D2A40E3D30019D62F /* EnvironmentVarsEditor.swift */; };
Expand Down Expand Up @@ -38,6 +38,7 @@
ABC0BFD42A31691500382A42 /* BottleOpsDropdown.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0BFD32A31691500382A42 /* BottleOpsDropdown.swift */; };
ABD56AB32A36E419002A439C /* GPKSafeInstallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABD56AB12A36E419002A439C /* GPKSafeInstallView.swift */; };
ABD56AB42A36E419002A439C /* GPKFastInstallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABD56AB22A36E419002A439C /* GPKFastInstallView.swift */; };
ABDA74592AD904E700802792 /* BottleDetailsCommonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABDA74582AD904E700802792 /* BottleDetailsCommonView.swift */; };
ABF5340A2A3F606A0030677A /* ViewMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF534092A3F606A0030677A /* ViewMenu.swift */; };
ABF5340C2A3F63BE0030677A /* BottleManagementCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF5340B2A3F63BE0030677A /* BottleManagementCardView.swift */; };
ABF5340E2A3F63FE0030677A /* BottleManagementTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF5340D2A3F63FE0030677A /* BottleManagementTableView.swift */; };
Expand All @@ -47,8 +48,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
AB0D00432A40A3630019D62F /* BottleDXVK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleDXVK.swift; sourceTree = "<group>"; };
AB0D00452A40B27F0019D62F /* DXVKUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXVKUtils.swift; sourceTree = "<group>"; };
AB0D00432A40A3630019D62F /* BottleDX.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleDX.swift; sourceTree = "<group>"; };
AB0D00452A40B27F0019D62F /* DXUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXUtils.swift; sourceTree = "<group>"; };
AB0D00492A40B7670019D62F /* MenuUIStates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuUIStates.swift; sourceTree = "<group>"; };
AB0D004B2A40B8900019D62F /* DXVKInstallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXVKInstallView.swift; sourceTree = "<group>"; };
AB0D004D2A40E3D30019D62F /* EnvironmentVarsEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentVarsEditor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -80,6 +81,7 @@
ABC0BFD32A31691500382A42 /* BottleOpsDropdown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleOpsDropdown.swift; sourceTree = "<group>"; };
ABD56AB12A36E419002A439C /* GPKSafeInstallView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GPKSafeInstallView.swift; sourceTree = "<group>"; };
ABD56AB22A36E419002A439C /* GPKFastInstallView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GPKFastInstallView.swift; sourceTree = "<group>"; };
ABDA74582AD904E700802792 /* BottleDetailsCommonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleDetailsCommonView.swift; sourceTree = "<group>"; };
ABF534092A3F606A0030677A /* ViewMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewMenu.swift; sourceTree = "<group>"; };
ABF5340B2A3F63BE0030677A /* BottleManagementCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleManagementCardView.swift; sourceTree = "<group>"; };
ABF5340D2A3F63FE0030677A /* BottleManagementTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleManagementTableView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -230,6 +232,7 @@
AB6652CC2A3350EC00F3FC5D /* BottleConfigDropdown.swift */,
AB6254332A3CE30D002A6206 /* BottleCardListView.swift */,
AB0D004D2A40E3D30019D62F /* EnvironmentVarsEditor.swift */,
ABDA74582AD904E700802792 /* BottleDetailsCommonView.swift */,
);
path = BottleManagement;
sourceTree = "<group>";
Expand All @@ -249,8 +252,8 @@
AB7A80FF2A30CC7100AA71A6 /* BrewUtils.swift */,
AB5CC6D52A30910300AEBB2B /* GPKUtils.swift */,
AB6652C32A3334E600F3FC5D /* XCLIUtils.swift */,
AB0D00452A40B27F0019D62F /* DXVKUtils.swift */,
AB0D00432A40A3630019D62F /* BottleDXVK.swift */,
AB0D00452A40B27F0019D62F /* DXUtils.swift */,
AB0D00432A40A3630019D62F /* BottleDX.swift */,
AB7D8E322A4DDE3400B55527 /* WinetricksUtils.swift */,
);
path = Systems;
Expand Down Expand Up @@ -356,12 +359,13 @@
AB5CC6D82A30938A00AEBB2B /* BrewInstallView.swift in Sources */,
ABD56AB42A36E419002A439C /* GPKFastInstallView.swift in Sources */,
FC682EDA2A35FD57000C53D6 /* Environment+GPKUtils.swift in Sources */,
AB0D00442A40A3630019D62F /* BottleDXVK.swift in Sources */,
AB0D00442A40A3630019D62F /* BottleDX.swift in Sources */,
AB0D004C2A40B8900019D62F /* DXVKInstallView.swift in Sources */,
AB0D004E2A40E3D30019D62F /* EnvironmentVarsEditor.swift in Sources */,
AB7A81002A30CC7100AA71A6 /* BrewUtils.swift in Sources */,
AB6652CD2A3350EC00F3FC5D /* BottleConfigDropdown.swift in Sources */,
AB5CC6D62A30910300AEBB2B /* GPKUtils.swift in Sources */,
ABDA74592AD904E700802792 /* BottleDetailsCommonView.swift in Sources */,
AB3BE5EE2A32248D00358BBC /* LaunchExtDropdown.swift in Sources */,
AB5D49C62A3B5B0B008245A6 /* URLExtensions.swift in Sources */,
AB5CC6C22A308BBB00AEBB2B /* ContentView.swift in Sources */,
Expand All @@ -382,7 +386,7 @@
AB6652C22A33342B00F3FC5D /* XCLIInstallView.swift in Sources */,
ABF5340A2A3F606A0030677A /* ViewMenu.swift in Sources */,
AB6652C92A3349A400F3FC5D /* HarborMenu.swift in Sources */,
AB0D00462A40B27F0019D62F /* DXVKUtils.swift in Sources */,
AB0D00462A40B27F0019D62F /* DXUtils.swift in Sources */,
FC682EDF2A3604B4000C53D6 /* Environment+XCLIUtils.swift in Sources */,
ABC0BFD42A31691500382A42 /* BottleOpsDropdown.swift in Sources */,
);
Expand Down
41 changes: 41 additions & 0 deletions Harbor/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,16 @@
}
}
},
"sheet.advConf.DXBackend" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "DirectX Backend"
}
}
}
},
"sheet.advConf.dxvkToggle" : {
"localizations" : {
"en" : {
Expand All @@ -736,6 +746,7 @@
}
},
"sheet.advConf.eSyncToggle" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
Expand Down Expand Up @@ -831,6 +842,26 @@
}
}
},
"sheet.advConf.SyncPrimitives" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Synchronization Primitives"
}
}
}
},
"sheet.advConf.SyncPrimitives.none" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "None"
}
}
}
},
"sheet.advConf.title %@" : {
"localizations" : {
"en" : {
Expand Down Expand Up @@ -1039,6 +1070,16 @@
}
}
},
"sheet.fastGPKInstall.fastArchiveDetected" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Detected HarborBuilder's bottle with bundled GPTK!"
}
}
}
},
"sheet.fastGPKInstall.subtitle" : {
"localizations" : {
"en" : {
Expand Down
24 changes: 20 additions & 4 deletions Harbor/Models/HarborBottle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import AppKit
import Observation

enum WineSyncronizationPrimatives: String, Codable {
case none = "None"
case eSync = "ESync"
case mSync = "MSync"
}

struct HarborBottle: Identifiable, Equatable, Codable {
var id: UUID
var name: String = "New Bottle"
Expand All @@ -17,12 +23,14 @@ struct HarborBottle: Identifiable, Equatable, Codable {
var primaryApplicationArgument: String = ""
var primaryApplicationWorkDir: String = ""
var enableHUD: Bool = false
var enableESync: Bool = false
var syncPrimitives: WineSyncronizationPrimatives = .none
var pleaseShutUp: Bool = true
var envVars: [String: String] = .init()

// swiftlint:disable cyclomatic_complexity
// This function is a bit too complex right now
func launchApplication(_ application: String, arguments: [String] = [], environmentVars: [String: String] = [:],
workDir: String = "", isUnixPath: Bool = false) {
workDir: String = "", isUnixPath: Bool = true) {
let task = Process()
task.launchPath = "/usr/local/opt/game-porting-toolkit/bin/wine64"
task.arguments = ["start"]
Expand All @@ -47,8 +55,14 @@ struct HarborBottle: Identifiable, Equatable, Codable {
if enableHUD {
task.environment?["MTL_HUD_ENABLED"] = "1"
}
if enableESync {

switch syncPrimitives {
case .none:
break
case .eSync:
task.environment?["WINEESYNC"] = "1"
case .mSync:
task.environment?["WINEMSYNC"] = "1"
}

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

func launchExtApplication(_ application: String, arguments: [String] = [], environmentVars: [String: String] = [:],
workDir: String = "") {
Expand Down Expand Up @@ -166,7 +181,8 @@ struct HarborBottle: Identifiable, Equatable, Codable {
.decodeIfPresent(String.self, forKey: .primaryApplicationArgument) ?? ""
primaryApplicationWorkDir = try container.decodeIfPresent(String.self, forKey: .primaryApplicationWorkDir) ?? ""
enableHUD = try container.decodeIfPresent(Bool.self, forKey: .enableHUD) ?? false
enableESync = try container.decodeIfPresent(Bool.self, forKey: .enableESync) ?? false
syncPrimitives = try container
.decodeIfPresent(WineSyncronizationPrimatives.self, forKey: .syncPrimitives) ?? .none
pleaseShutUp = try container.decodeIfPresent(Bool.self, forKey: .pleaseShutUp) ?? true
envVars = try container.decodeIfPresent([String: String].self, forKey: .envVars) ?? [:]
}
Expand Down
2 changes: 1 addition & 1 deletion Harbor/Systems/BottleDX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class BottleDX {

func removeDXVKFromBottle(bottle: HarborBottle) {
let bottlePath = bottle.path

for override in dxvkOverrides {
let overridePath = bottlePath.appendingPathComponent("drive_c/windows/system32/\(override).dll")
// remove the symlink
Expand Down
Loading

0 comments on commit 71c23f4

Please sign in to comment.