Skip to content

Commit

Permalink
feat: adding an alternate window fix mode for apps that are able to h…
Browse files Browse the repository at this point in the history
…andle display by themselves (PlayCover#842)
  • Loading branch information
ohaiibuzzle committed Mar 6, 2023
1 parent 9240be7 commit eca78b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions PlayCover/Model/AppSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct AppSettingsData: Codable {
var playChainDebugging = false
var inverseScreenValues = false
var metalHUD = false
var windowFixMethod = 0

init() {}

Expand All @@ -50,6 +51,7 @@ struct AppSettingsData: Codable {
playChainDebugging = try container.decodeIfPresent(Bool.self, forKey: .playChainDebugging) ?? false
inverseScreenValues = try container.decodeIfPresent(Bool.self, forKey: .inverseScreenValues) ?? false
metalHUD = try container.decodeIfPresent(Bool.self, forKey: .metalHUD) ?? false
windowFixMethod = try container.decodeIfPresent(Int.self, forKey: .windowFixMethod) ?? 0
}
}

Expand Down
21 changes: 18 additions & 3 deletions PlayCover/Views/AppSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,25 @@ struct GraphicsView: View {
Spacer()
}
}
HStack {
VStack(alignment: .leading) {
if #available(macOS 13.2, *) {
Toggle("settings.toggle.windowExperimentalFix", isOn: $settings.settings.inverseScreenValues)
.help("settings.toggle.windowExperimentalFix.help")
HStack {
Toggle("settings.picker.windowFix", isOn: $settings.settings.inverseScreenValues)
.help("settings.picker.windowFix.help")
.onChange(of: settings.settings.inverseScreenValues) { _ in
settings.settings.windowFixMethod = 0
}
Spacer()
// Dropdown to choose fix method
Picker("", selection: $settings.settings.windowFixMethod) {
Text("settings.picker.windowFixMethod.0").tag(0)
Text("settings.picker.windowFixMethod.1").tag(1)
}
.frame(alignment: .leading)
.help("settings.picker.windowFixMethod.help")
.disabled(!settings.settings.inverseScreenValues)
.disabled(settings.settings.resolution != 0)
}
Spacer()
}
Toggle("settings.toggle.disableDisplaySleep", isOn: $settings.settings.disableTimeout)
Expand Down
6 changes: 4 additions & 2 deletions PlayCover/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@
"settings.text.customWidth" = "Width";
"settings.text.detectedResolution" = "Detected Resolution:";
"settings.picker.aspectRatio" = "Aspect ratio:";
"settings.toggle.windowExperimentalFix.help" = "Attempts to fix your app scene if you have problems with it";
"settings.toggle.windowExperimentalFix" = "Fix window issues";
"settings.picker.windowFix" = "Fix window display issues";
"settings.picker.windowFix.help" = "Apply window fixes that may helps your apps display normally";
"settings.picker.windowFixMethod.0" = "Normal";
"settings.picker.windowFixMethod.1" = "Alternate";
"settings.toggle.disableDisplaySleep" = "Disable display sleep";
"settings.toggle.disableDisplaySleep.help" = "Prevent display from turning off while this app is running";
"settings.noPlayTools" = "PlayTools is not installed in this app";
Expand Down

0 comments on commit eca78b7

Please sign in to comment.