qt: Do not run emulator on separate thread on Mac. (#1849)

This commit is contained in:
squidbus 2024-12-22 06:31:59 -08:00 committed by GitHub
parent 14dc136832
commit ab5240d8d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1098,10 +1098,16 @@ void MainWindow::StartEmulator(std::filesystem::path path) {
QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Game is already running!"))); QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Game is already running!")));
return; return;
} }
isGameRunning = true;
#ifdef __APPLE__
// SDL on macOS requires main thread.
Core::Emulator emulator;
emulator.Run(path);
#else
std::thread emulator_thread([=] { std::thread emulator_thread([=] {
Core::Emulator emulator; Core::Emulator emulator;
emulator.Run(path); emulator.Run(path);
}); });
emulator_thread.detach(); emulator_thread.detach();
isGameRunning = true; #endif
} }