From de4b735409189c2038693faa1d02045d282bd3f5 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 8 Jul 2017 13:50:46 -0700 Subject: [PATCH] Qt: Fix patch loading while a game is running --- CHANGES | 1 + src/platform/qt/GameController.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index f0c378502..c74e4c920 100644 --- a/CHANGES +++ b/CHANGES @@ -168,6 +168,7 @@ Bugfixes: - Qt: Fix translation initialization (fixes mgba.io/i/776) - PSP2: Use custom localtime_r since newlib version is broken (fixes mgba.io/i/560) - GBA SIO: Improve SIO Normal dummy driver (fixes mgba.io/i/520) + - Qt: Fix patch loading while a game is running Misc: - Qt: Add language selector - GBA Timer: Improve accuracy of timers diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index 8a6f63c87..b9d3d52d9 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -543,10 +543,16 @@ void GameController::replaceGame(const QString& path) { } void GameController::loadPatch(const QString& path) { - if (m_gameOpen) { + if (isLoaded()) { closeGame(); - m_patch = path; - openGame(); + } + if (m_gameOpen) { + QTimer::singleShot(10, this, [this, path]() { + loadPatch(path); + if (!m_gameOpen) { + openGame(); + } + }); } else { m_patch = path; }