From adccc480a0620b6eb6945393673f24b109779910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 24 Mar 2023 21:39:02 +0100 Subject: [PATCH] Another one bites the dust (SendUIMessage) --- Common/System/Request.h | 1 + Common/System/System.h | 3 +++ Core/Host.h | 1 - Core/PSPLoaders.cpp | 2 +- Qt/QtHost.h | 4 ---- UI/HostTypes.h | 8 -------- UI/NativeApp.cpp | 4 ++++ headless/Headless.cpp | 1 + unittest/UnitTest.cpp | 1 + 9 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Common/System/Request.h b/Common/System/Request.h index 58ce9065b8..713c184640 100644 --- a/Common/System/Request.h +++ b/Common/System/Request.h @@ -130,3 +130,4 @@ inline void System_SetWindowTitle(const std::string ¶m) { // Non-inline to avoid including Path.h void System_CreateGameShortcut(const Path &path, const std::string &title); + diff --git a/Common/System/System.h b/Common/System/System.h index 9dd6182f60..de8fa429a4 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -200,6 +200,9 @@ std::vector System_GetCameraDeviceList(); bool System_AudioRecordingIsAvailable(); bool System_AudioRecordingState(); +// This will be changed to take an enum. Currently simply implemented by forwarding to NativeMessageReceived. +void System_PostUIMessage(const std::string &message, const std::string ¶m); + // For these functions, most platforms will use the implementation provided in UI/AudioCommon.cpp, // no need to implement separately. void System_AudioGetDebugStats(char *buf, size_t bufSize); diff --git a/Core/Host.h b/Core/Host.h index 5a0f5aaea8..85153234c2 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -31,7 +31,6 @@ public: virtual void ToggleDebugConsoleVisibility() {} virtual void NotifyUserMessage(const std::string &message, float duration = 1.0f, u32 color = 0x00FFFFFF, const char *id = nullptr) {} - virtual void SendUIMessage(const std::string &message, const std::string &value) {} virtual void SendDebugOutput(const std::string &output) {} virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) {} diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index ccf9a349dc..c0556f47de 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -307,7 +307,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) { //in case we didn't go through EmuScreen::boot g_Config.loadGameConfig(id, g_paramSFO.GetValueString("TITLE")); - host->SendUIMessage("config_loaded", ""); + System_PostUIMessage("config_loaded", ""); INFO_LOG(LOADER, "Loading %s...", bootpath.c_str()); PSPLoaders_Shutdown(); diff --git a/Qt/QtHost.h b/Qt/QtHost.h index a78ae11a2d..233ee8d1ca 100644 --- a/Qt/QtHost.h +++ b/Qt/QtHost.h @@ -41,10 +41,6 @@ public: osm.Show(message, duration, color, -1, true, id); } - void SendUIMessage(const std::string &message, const std::string &value) override { - NativeMessageReceived(message.c_str(), value.c_str()); - } - private: Path SymbolMapFilename(Path currentFilename); MainWindow* mainWindow; diff --git a/UI/HostTypes.h b/UI/HostTypes.h index 05c8e40158..f3915fee53 100644 --- a/UI/HostTypes.h +++ b/UI/HostTypes.h @@ -23,15 +23,7 @@ class NativeHost : public Host { public: - NativeHost() {} - - void UpdateSound() override {} - void NotifyUserMessage(const std::string &message, float duration = 1.0f, u32 color = 0x00FFFFFF, const char *id = nullptr) override { osm.Show(message, duration, color, -1, true, id); } - - void SendUIMessage(const std::string &message, const std::string &value) override { - NativeMessageReceived(message.c_str(), value.c_str()); - } }; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 6cc4b029e5..2db4d1c315 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1354,6 +1354,10 @@ void NativeMessageReceived(const char *message, const char *value) { pendingMessages.push_back(pendingMessage); } +void System_PostUIMessage(const std::string &message, const std::string &value) { + NativeMessageReceived(message.c_str(), value.c_str()); +} + void NativeResized() { // NativeResized can come from any thread so we just set a flag, then process it later. VERBOSE_LOG(G3D, "NativeResized - setting flag"); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 41bef6df75..edae486134 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -115,6 +115,7 @@ bool System_GetPropertyBool(SystemProperty prop) { } } void System_Notify(SystemNotification notification) {} +void System_PostUIMessage(const std::string &message, const std::string ¶m) {} bool System_MakeRequest(SystemRequestType type, int requestId, const std::string ¶m1, const std::string ¶m2, int param3) { return false; } void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function cb) { cb(false, ""); } void System_AskForPermission(SystemPermission permission) {} diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index e89637a185..80827b8485 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -88,6 +88,7 @@ bool System_GetPropertyBool(SystemProperty prop) { } } void System_Notify(SystemNotification notification) {} +void System_PostUIMessage(const std::string &message, const std::string ¶m) {} void System_AudioGetDebugStats(char *buf, size_t bufSize) { if (buf) buf[0] = '\0'; } void System_AudioClear() {} void System_AudioPushSamples(const s32 *audio, int numSamples) {}