Make Emulation on Main Thread

This commit is contained in:
Stossy11 2024-12-01 13:26:37 +11:00
parent 310a339433
commit 5e1a69e717

View File

@ -49,6 +49,7 @@ class SudachiEmulationViewModel: ObservableObject {
// startGameTimer() // Start the timer when the game starts
if #available(iOS 17.0, *) {
DispatchQueue.global(qos: .userInitiated).async { [self] in
if let sudachiGame = self.sudachiGame {
if sudachiGame.fileURL == URL(string: "BootMii") {
@ -60,6 +61,19 @@ class SudachiEmulationViewModel: ObservableObject {
self.sudachi.bootOS()
}
}
} else {
DispatchQueue.main.async {
if let sudachiGame = self.sudachiGame {
if sudachiGame.fileURL == URL(string: "BootMii") {
self.sudachi.bootMii()
} else {
self.sudachi.insert(game: sudachiGame.fileURL)
}
} else {
self.sudachi.bootOS()
}
}
}
if UserDefaults.standard.bool(forKey: "pomeloRPC") {
startRPCTimer()