diff --git a/Common/System/System.h b/Common/System/System.h index a1e3c936a2..aaa49f988e 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -138,7 +138,7 @@ enum class SystemNotification { UI, MEM_VIEW, DISASSEMBLY, - DEBUG_MODE, + DEBUG_MODE_CHANGE, BOOT_DONE, // this is sent from EMU thread! Make sure that Host handles it properly! SYMBOL_MAP_UPDATED, SWITCH_UMD_UPDATED, diff --git a/Core/Core.cpp b/Core/Core.cpp index af371a29b6..3423b714a7 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -368,20 +368,19 @@ bool Core_Run(GraphicsContext *ctx) { void Core_EnableStepping(bool step, const char *reason, u32 relatedAddress) { if (step) { - host->SetDebugMode(true); Core_UpdateState(CORE_STEPPING); steppingCounter++; _assert_msg_(reason != nullptr, "No reason specified for break"); steppingReason = reason; steppingAddress = relatedAddress; } else { - host->SetDebugMode(false); // Clear the exception if we resume. Core_ResetException(); coreState = CORE_RUNNING; coreStatePending = false; m_StepCond.notify_all(); } + System_Notify(SystemNotification::DEBUG_MODE_CHANGE); } bool Core_NextFrame() { diff --git a/Core/Host.h b/Core/Host.h index 7a298c7a88..35800789da 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -27,8 +27,6 @@ class Host { public: virtual ~Host() {} - virtual void SetDebugMode(bool mode) { } - virtual bool InitGraphics(std::string *error_string, GraphicsContext **ctx) = 0; virtual void ShutdownGraphics() = 0; diff --git a/Qt/QtHost.h b/Qt/QtHost.h index ee782f53d3..e3a2c6ab37 100644 --- a/Qt/QtHost.h +++ b/Qt/QtHost.h @@ -21,6 +21,8 @@ #include "UI/OnScreenDisplay.h" #include "Qt/mainwindow.h" +#include "Core/Debugger/SymbolMap.h" + class QtHost : public Host { public: @@ -29,8 +31,6 @@ public: mainWindow = mainWindow_; } - void SetDebugMode(bool mode) override {} - bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; } void ShutdownGraphics() override {} diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index 8228e33411..3571c615ca 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -40,6 +40,8 @@ #include "Common/Profiler/Profiler.h" #include "QtMain.h" +#include "QtHost.h" +#include "Qt/mainwindow.h" #include "Common/Data/Text/I18n.h" #include "Common/Thread/ThreadUtil.h" #include "Common/Data/Encoding/Utf8.h" @@ -57,6 +59,7 @@ static float refreshRate = 60.f; static int browseFileEvent = -1; static int browseFolderEvent = -1; QTCamera *qtcamera = nullptr; +MainWindow *g_mainWindow; #ifdef SDL SDL_AudioSpec g_retFmt; @@ -259,7 +262,7 @@ void System_Notify(SystemNotification notification) { switch (notification) { case SystemNotification::BOOT_DONE: g_symbolMap->SortSymbols(); - mainWindow->Notify(MainWindowMsg::BOOT_DONE); + g_mainWindow->Notify(MainWindowMsg::BOOT_DONE); break; case SystemNotification::SYMBOL_MAP_UPDATED: if (g_symbolMap) @@ -782,6 +785,12 @@ int main(int argc, char *argv[]) NativeInit(argc, (const char **)argv, savegame_dir.c_str(), external_dir.c_str(), nullptr); + g_mainWindow = new MainWindow(nullptr, g_Config.UseFullScreen()); + g_mainWindow->show(); + if (host == nullptr) { + host = new QtHost(g_mainWindow); + } + // TODO: Support other backends than GL, like Vulkan, in the Qt backend. g_Config.iGPUBackend = (int)GPUBackend::OPENGL; diff --git a/UI/HostTypes.h b/UI/HostTypes.h index 38d889e4cf..20c50eb87b 100644 --- a/UI/HostTypes.h +++ b/UI/HostTypes.h @@ -24,8 +24,6 @@ class NativeHost : public Host { public: NativeHost() {} - void SetDebugMode(bool mode) override { } - bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; } void ShutdownGraphics() override {} diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e482eca117..ff4010b1fe 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -834,14 +834,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch std::string sysName = System_GetProperty(SYSPROP_NAME); isOuya = KeyMap::IsOuya(sysName); -#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI) - MainWindow *mainWindow = new MainWindow(nullptr, g_Config.UseFullScreen()); - mainWindow->show(); - if (host == nullptr) { - host = new QtHost(mainWindow); - } -#endif - // We do this here, instead of in NativeInitGraphics, because the display may be reset. // When it's reset we don't want to forget all our managed things. CheckFailedGPUBackends(); diff --git a/UWP/UWPHost.cpp b/UWP/UWPHost.cpp index e87c9e970f..3922030448 100644 --- a/UWP/UWPHost.cpp +++ b/UWP/UWPHost.cpp @@ -75,8 +75,6 @@ void UWPHost::UpdateSound() { void UWPHost::ShutdownSound() { } -void UWPHost::SetDebugMode(bool mode) {} - void UWPHost::PollControllers() { for (const auto& device : this->input) { diff --git a/UWP/UWPHost.h b/UWP/UWPHost.h index 77e0c94101..8f0841c687 100644 --- a/UWP/UWPHost.h +++ b/UWP/UWPHost.h @@ -12,8 +12,6 @@ public: UWPHost(); ~UWPHost(); - void SetDebugMode(bool mode) override; - // If returns false, will return a null context bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override; void PollControllers() override; diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index fd6e743455..8f1ab5fb92 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -189,11 +189,6 @@ void WindowsHost::UpdateSound() { void WindowsHost::ShutdownSound() { } -void WindowsHost::SetDebugMode(bool mode) { - if (disasmWindow) - PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)mode); -} - void WindowsHost::PollControllers() { static int checkCounter = 0; static const int CHECK_FREQUENCY = 71; diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h index 086162de4e..aedee34cc9 100644 --- a/Windows/WindowsHost.h +++ b/Windows/WindowsHost.h @@ -34,8 +34,6 @@ public: UpdateConsolePosition(); } - void SetDebugMode(bool mode) override; - // If returns false, will return a null context bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override; void PollControllers() override; diff --git a/Windows/main.cpp b/Windows/main.cpp index 6136c3b108..4bf24d4d34 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -384,9 +384,8 @@ void System_Notify(SystemNotification notification) { g_symbolMap->SortSymbols(); PostMessage(MainWindow::GetHWND(), WM_USER + 1, 0, 0); - bool mode = !g_Config.bAutoRun; if (disasmWindow) - PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)mode); + PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)Core_IsStepping()); break; } @@ -421,6 +420,11 @@ void System_Notify(SystemNotification notification) { case SystemNotification::SWITCH_UMD_UPDATED: PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_SWITCHUMD_UPDATED, 0, 0); break; + + case SystemNotification::DEBUG_MODE_CHANGE: + if (disasmWindow) + PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)Core_IsStepping()); + break; } } diff --git a/headless/StubHost.h b/headless/StubHost.h index 37586f6e4d..e8b3463787 100644 --- a/headless/StubHost.h +++ b/headless/StubHost.h @@ -26,8 +26,6 @@ // TODO: Get rid of this junk class HeadlessHost : public Host { public: - void SetDebugMode(bool mode) override { } - void SetGraphicsCore(GPUCore core) { gpuCore_ = core; } bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override {return false;} void ShutdownGraphics() override {}