From 5e1a69e717014e761676cb929adc734a9017b48f Mon Sep 17 00:00:00 2001 From: Stossy11 <69031796+stossy11@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:26:37 +1100 Subject: [PATCH] Make Emulation on Main Thread --- .../SudachiEmulationHandler.swift | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Pomelo/Emulation/EmulationHandlers/SudachiEmulationHandler.swift b/Pomelo/Emulation/EmulationHandlers/SudachiEmulationHandler.swift index b90229a..fd827ef 100644 --- a/Pomelo/Emulation/EmulationHandlers/SudachiEmulationHandler.swift +++ b/Pomelo/Emulation/EmulationHandlers/SudachiEmulationHandler.swift @@ -49,15 +49,29 @@ class SudachiEmulationViewModel: ObservableObject { // startGameTimer() // Start the timer when the game starts - DispatchQueue.global(qos: .userInitiated).async { [self] in - if let sudachiGame = self.sudachiGame { - if sudachiGame.fileURL == URL(string: "BootMii") { - self.sudachi.bootMii() + if #available(iOS 17.0, *) { + DispatchQueue.global(qos: .userInitiated).async { [self] in + if let sudachiGame = self.sudachiGame { + if sudachiGame.fileURL == URL(string: "BootMii") { + self.sudachi.bootMii() + } else { + self.sudachi.insert(game: sudachiGame.fileURL) + } } else { - self.sudachi.insert(game: sudachiGame.fileURL) + 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() } - } else { - self.sudachi.bootOS() } }