diff --git a/Core/Core.cpp b/Core/Core.cpp index 95864b197a..af371a29b6 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -308,8 +308,8 @@ void Core_ProcessStepping() { static int lastSteppingCounter = -1; if (lastSteppingCounter != steppingCounter) { CBreakPoints::ClearTemporaryBreakPoints(); - host->UpdateDisassembly(); - host->UpdateMemView(); + System_Notify(SystemNotification::DISASSEMBLY); + System_Notify(SystemNotification::MEM_VIEW); lastSteppingCounter = steppingCounter; } @@ -320,15 +320,15 @@ void Core_ProcessStepping() { if (doStep && coreState == CORE_STEPPING) { Core_SingleStep(); // Update disasm dialog. - host->UpdateDisassembly(); - host->UpdateMemView(); + System_Notify(SystemNotification::DISASSEMBLY); + System_Notify(SystemNotification::MEM_VIEW); } } // Many platforms, like Android, do not call this function but handle things on their own. // Instead they simply call NativeRender and NativeUpdate directly. bool Core_Run(GraphicsContext *ctx) { - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); while (true) { if (GetUIState() != UISTATE_INGAME) { Core_StateProcessed(); diff --git a/Core/Debugger/Breakpoints.cpp b/Core/Debugger/Breakpoints.cpp index 5ce977ec45..cd3df9bf99 100644 --- a/Core/Debugger/Breakpoints.cpp +++ b/Core/Debugger/Breakpoints.cpp @@ -19,6 +19,7 @@ #include #include +#include "Common/System/System.h" #include "Common/Log.h" #include "Core/Core.h" #include "Core/Debugger/Breakpoints.h" @@ -674,7 +675,7 @@ void CBreakPoints::Update(u32 addr) { } // Redraw in order to show the breakpoint. - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); } bool CBreakPoints::ValidateLogFormat(DebugInterface *cpu, const std::string &fmt) { diff --git a/Core/Debugger/WebSocket/GameSubscriber.cpp b/Core/Debugger/WebSocket/GameSubscriber.cpp index efa8ff2da6..4ca0f3e5cb 100644 --- a/Core/Debugger/WebSocket/GameSubscriber.cpp +++ b/Core/Debugger/WebSocket/GameSubscriber.cpp @@ -55,8 +55,9 @@ void WebSocketGameReset(DebuggerRequest &req) { ERROR_LOG(BOOT, "Error resetting: %s", resetError.c_str()); return req.Fail("Could not reset"); } + System_Notify(SystemNotification::BOOT_DONE); - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); req.Respond(); } diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 8ad8a5196a..c7591f13d7 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -17,6 +17,7 @@ #include +#include "Common/System/System.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" #include "Common/Serialize/SerializeMap.h" @@ -104,8 +105,9 @@ void __UmdDoState(PointerWrap &p) if (s > 1) { Do(p, UMDReplacePermit); - if (UMDReplacePermit) - host->UpdateUI(); + if (UMDReplacePermit) { + System_Notify(SystemNotification::UI); + } } if (s > 2) { Do(p, umdInsertChangeEvent); diff --git a/Core/Host.h b/Core/Host.h index ff5179b3e2..5fc61c220e 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -27,9 +27,6 @@ class Host { public: virtual ~Host() {} - virtual void UpdateUI() {} - virtual void UpdateMemView() {} - virtual void UpdateDisassembly() {} virtual void NotifySymbolMapUpdated() {} virtual void SetDebugMode(bool mode) { } virtual void NotifySwitchUMDUpdated() {} diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index c35d1c9230..6386ca09ee 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -1080,7 +1080,7 @@ namespace SaveState return; } System_Notify(SystemNotification::BOOT_DONE); - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); needsRestart = false; } } diff --git a/Core/System.cpp b/Core/System.cpp index 8303f08a15..4f6510f07e 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -124,8 +124,7 @@ void UpdateUIState(GlobalUIState newState) { // Never leave the EXIT state. if (globalUIState != newState && globalUIState != UISTATE_EXIT) { globalUIState = newState; - if (host) - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); const char *state = nullptr; switch (globalUIState) { case UISTATE_EXIT: state = "exit"; break; diff --git a/Qt/QtHost.h b/Qt/QtHost.h index f559265494..a9816f7be4 100644 --- a/Qt/QtHost.h +++ b/Qt/QtHost.h @@ -30,16 +30,6 @@ public: mainWindow = mainWindow_; } - void UpdateUI() override { - mainWindow->updateMenus(); - } - - void UpdateMemView() override { - } - void UpdateDisassembly() override { - mainWindow->updateMenus(); - } - void SetDebugMode(bool mode) override {} bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; } diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 09ee8b2629..e5c03ba69b 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -355,8 +355,7 @@ void EmuScreen::bootGame(const Path &filename) { void EmuScreen::bootComplete() { UpdateUIState(UISTATE_INGAME); System_Notify(SystemNotification::BOOT_DONE); - - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); NOTICE_LOG(BOOT, "Loading %s...", PSP_CoreParameter().fileToStart.c_str()); autoLoad(); @@ -448,7 +447,7 @@ static void AfterSaveStateAction(SaveState::Status status, const std::string &me static void AfterStateBoot(SaveState::Status status, const std::string &message, void *ignored) { AfterSaveStateAction(status, message, ignored); Core_EnableStepping(false); - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); } void EmuScreen::sendMessage(const char *message, const char *value) { @@ -461,12 +460,12 @@ void EmuScreen::sendMessage(const char *message, const char *value) { bootPending_ = false; stopRender_ = true; invalid_ = true; - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); } else if (!strcmp(message, "reset")) { PSP_Shutdown(); bootPending_ = true; invalid_ = true; - host->UpdateDisassembly(); + System_Notify(SystemNotification::DISASSEMBLY); std::string resetError; if (!PSP_InitStart(PSP_CoreParameter(), &resetError)) { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index b368e8114f..6556a57193 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -913,8 +913,7 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) { auto langScreen = new NewLanguageScreen(sy->T("Language")); langScreen->OnChoice.Add([&](UI::EventParams &e) { screenManager()->RecreateAllViews(); - if (host) - host->UpdateUI(); + System_Notify(SystemNotification::UI); return UI::EVENT_DONE; }); if (e.v) @@ -1362,7 +1361,7 @@ void GameSettingsScreen::onFinish(DialogResult result) { g_Config.unloadGameConfig(); } - host->UpdateUI(); + System_Notify(SystemNotification::UI); KeyMap::UpdateNativeMenuKeys(); @@ -1895,7 +1894,7 @@ void GameSettingsScreen::CallbackRestoreDefaults(bool yes) { if (yes) { g_Config.RestoreDefaults(RestoreSettingsBits::SETTINGS); } - host->UpdateUI(); + System_Notify(SystemNotification::UI); } UI::EventReturn GameSettingsScreen::OnRestoreDefaultSettings(UI::EventParams &e) { diff --git a/UI/HostTypes.h b/UI/HostTypes.h index 2cdc0a9d84..de5b35fdee 100644 --- a/UI/HostTypes.h +++ b/UI/HostTypes.h @@ -24,11 +24,6 @@ class NativeHost : public Host { public: NativeHost() {} - void UpdateUI() override {} - - void UpdateMemView() override {} - void UpdateDisassembly() override {} - void SetDebugMode(bool mode) override { } bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; } diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index ba2b3e9276..682fe85074 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -964,9 +964,7 @@ UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) { UI::EventReturn GameBrowser::OnRecentClear(UI::EventParams &e) { screenManager_->RecreateAllViews(); - if (host) { - host->UpdateUI(); - } + System_Notify(SystemNotification::UI); return UI::EVENT_DONE; } diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 170844f6a4..c99684bbe0 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -431,9 +431,7 @@ void HandleCommonMessages(const char *message, const char *value, ScreenManager auto langScreen = new NewLanguageScreen(sy->T("Language")); langScreen->OnChoice.Add([](UI::EventParams &) { NativeMessageReceived("recreateviews", ""); - if (host) { - host->UpdateUI(); - } + System_Notify(SystemNotification::UI); return UI::EVENT_DONE; }); manager->push(langScreen); diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index a1630b9166..1529a18887 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -438,13 +438,6 @@ bool System_GetPropertyBool(SystemProperty prop) { void System_Notify(SystemNotification notification) { switch (notification) { - case SystemNotification::BOOT_DONE: - g_symbolMap->SortSymbols(); - - SetDebugMode(false); - Core_EnableStepping(false); - break; - default: break; } diff --git a/UWP/UWPHost.cpp b/UWP/UWPHost.cpp index f8ddcfc22d..58c30f704d 100644 --- a/UWP/UWPHost.cpp +++ b/UWP/UWPHost.cpp @@ -64,7 +64,6 @@ void UWPHost::ShutdownGraphics() { } void UWPHost::SetWindowTitle(const char *message) { - // Should really be done differently } void UWPHost::InitSound() { @@ -76,15 +75,6 @@ void UWPHost::UpdateSound() { void UWPHost::ShutdownSound() { } -void UWPHost::UpdateUI() { -} - -void UWPHost::UpdateMemView() { -} - -void UWPHost::UpdateDisassembly() { -} - void UWPHost::SetDebugMode(bool mode) {} void UWPHost::PollControllers() { diff --git a/UWP/UWPHost.h b/UWP/UWPHost.h index 4e604222bb..038bf9becb 100644 --- a/UWP/UWPHost.h +++ b/UWP/UWPHost.h @@ -12,9 +12,6 @@ public: UWPHost(); ~UWPHost(); - void UpdateMemView() override; - void UpdateDisassembly() override; - void UpdateUI() override; void SetDebugMode(bool mode) override; // If returns false, will return a null context diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index c4225d95d8..5c3798bc7c 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -161,7 +161,7 @@ void MainThreadFunc() { // Let's continue (and probably crash) just so they have a way to keep trying. } - host->UpdateUI(); + System_Notify(SystemNotification::UI); std::string error_string; bool success = host->InitGraphics(&error_string, &g_graphicsContext); diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index d39c172abe..f270d79c02 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -189,26 +189,6 @@ void WindowsHost::UpdateSound() { void WindowsHost::ShutdownSound() { } -void WindowsHost::UpdateUI() { - PostMessage(mainWindow_, MainWindow::WM_USER_UPDATE_UI, 0, 0); - - int peers = GetInstancePeerCount(); - if (PPSSPP_ID >= 1 && peers != lastNumInstances_) { - lastNumInstances_ = peers; - PostMessage(mainWindow_, MainWindow::WM_USER_WINDOW_TITLE_CHANGED, 0, 0); - } -} - -void WindowsHost::UpdateMemView() { - if (memoryWindow) - PostDialogMessage(memoryWindow, WM_DEB_UPDATE); -} - -void WindowsHost::UpdateDisassembly() { - if (disasmWindow) - PostDialogMessage(disasmWindow, WM_DEB_UPDATE); -} - void WindowsHost::SetDebugMode(bool mode) { if (disasmWindow) PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)mode); diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h index 94436f5479..42e7e62094 100644 --- a/Windows/WindowsHost.h +++ b/Windows/WindowsHost.h @@ -34,9 +34,6 @@ public: UpdateConsolePosition(); } - void UpdateMemView() override; - void UpdateDisassembly() override; - void UpdateUI() override; void SetDebugMode(bool mode) override; // If returns false, will return a null context @@ -74,7 +71,6 @@ private: GraphicsContext *gfx_ = nullptr; size_t numDinputDevices_ = 0; std::wstring lastTitle_; - int lastNumInstances_ = 0; std::list> input; }; diff --git a/Windows/main.cpp b/Windows/main.cpp index af0f555e8d..b10e10321e 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -47,6 +47,7 @@ #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/SaveState.h" +#include "Core/Instance.h" #include "Windows/EmuThread.h" #include "Windows/WindowsAudio.h" #include "ext/disarm.h" @@ -110,6 +111,7 @@ int g_activeWindow = 0; static std::thread inputBoxThread; static bool inputBoxRunning = false; +int g_lastNumInstances = 0; void System_ShowFileInFolder(const char *path) { // SHParseDisplayName can't handle relative paths, so normalize first. @@ -377,6 +379,7 @@ static BOOL PostDialogMessage(Dialog *dialog, UINT message, WPARAM wParam = 0, L void System_Notify(SystemNotification notification) { switch (notification) { case SystemNotification::BOOT_DONE: + { if (g_symbolMap) g_symbolMap->SortSymbols(); PostMessage(MainWindow::GetHWND(), WM_USER + 1, 0, 0); @@ -386,6 +389,29 @@ void System_Notify(SystemNotification notification) { PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)mode); break; } + + case SystemNotification::UI: + { + PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_UPDATE_UI, 0, 0); + + int peers = GetInstancePeerCount(); + if (PPSSPP_ID >= 1 && peers != g_lastNumInstances) { + g_lastNumInstances = peers; + PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_WINDOW_TITLE_CHANGED, 0, 0); + } + break; + } + + case SystemNotification::MEM_VIEW: + if (memoryWindow) + PostDialogMessage(memoryWindow, WM_DEB_UPDATE); + break; + + case SystemNotification::DISASSEMBLY: + if (disasmWindow) + PostDialogMessage(disasmWindow, WM_DEB_UPDATE); + break; + } } void System_SendMessage(const char *command, const char *parameter) { diff --git a/headless/StubHost.h b/headless/StubHost.h index 585baf4646..d952802e73 100644 --- a/headless/StubHost.h +++ b/headless/StubHost.h @@ -26,11 +26,6 @@ // TODO: Get rid of this junk class HeadlessHost : public Host { public: - void UpdateUI() override {} - - void UpdateMemView() override {} - void UpdateDisassembly() override {} - void SetDebugMode(bool mode) override { } void SetGraphicsCore(GPUCore core) { gpuCore_ = core; }