Remove func MainThread and add SDL Window code back

This commit is contained in:
Stossy11 2025-02-12 18:18:57 +11:00
parent 839ddab589
commit 114ba3eb57
4 changed files with 21 additions and 20 deletions

View File

@ -17,7 +17,9 @@ extension UIWindow {
// Makes the SDLWindow use the current WindowScene instead of making its own window.
// Also waits for the window to append the on-screen controller
@objc func wdb_makeKeyAndVisible() {
if #unavailable(iOS 17.0) {
let enabled = UserDefaults.standard.bool(forKey: "oldWindowCode")
if #unavailable(iOS 17.0), enabled {
self.windowScene = (UIApplication.shared.connectedScenes.first! as! UIWindowScene)
}
@ -26,7 +28,7 @@ extension UIWindow {
if #available(iOS 17, *) {
Ryujinx.shared.repeatuntilfindLayer()
} else {
} else if UserDefaults.standard.bool(forKey: "isVirtualController") && enabled {
waitForController()
}
}

View File

@ -145,7 +145,7 @@ class Ryujinx {
isRunning = true
MainThread {
RunLoop.current.perform {
let url = URL(string: config.gamepath)
@ -190,22 +190,6 @@ class Ryujinx {
}
func MainThread(_ block: @escaping @Sendable () -> Void) {
if #available(iOS 17.0, *) {
RunLoop.current.perform {
autoreleasepool {
block()
}
}
} else {
DispatchQueue.main.async {
autoreleasepool {
block()
}
}
}
}
func loadGames() -> [Game] {
let fileManager = FileManager.default
guard let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first else { return [] }

View File

@ -37,6 +37,9 @@ struct SettingsView: View {
@AppStorage("performacehud") var performacehud: Bool = false
@AppStorage("oldWindowCode") var windowCode: Bool = false
@State private var showResolutionInfo = false
@State private var showAnisotropicInfo = false
@State private var searchText = ""
@ -68,6 +71,7 @@ struct SettingsView: View {
}
.tint(.blue)
Toggle(isOn: $config.enableTextureRecompression) {
labelWithIcon("Texture Recompression", iconName: "rectangle.compress.vertical")
}
@ -414,6 +418,13 @@ struct SettingsView: View {
Section {
labelWithIcon("JIT Acquisition: \(isJITEnabled() ? "Aquired" : "Not Aquired" )", iconName: "bolt.fill")
if #unavailable(iOS 17) {
Toggle(isOn: $windowCode) {
labelWithIcon("SDL Window", iconName: "macwindow.on.rectangle")
}
.tint(.blue)
}
DisclosureGroup {
Toggle(isOn: $mVKPreFillBuffer) {
@ -464,7 +475,11 @@ struct SettingsView: View {
.textCase(nil)
.headerProminence(.increased)
} footer: {
Text("For advanced users. See page size or add custom arguments for experimental features. (Please don't touch this if you don't know what you're doing)")
if #available(iOS 17, *) {
Text("For advanced users. See page size or add custom arguments for experimental features. (Please don't touch this if you don't know what you're doing).")
} else {
Text("For advanced users. See page size or add custom arguments for experimental features. (Please don't touch this if you don't know what you're doing). If the emulation is not showing (you may hear audio in some games), try enabling \"SDL Window\"")
}
}
}