diff --git a/Common/System/System.h b/Common/System/System.h index 5e594f2d62..f984c01faf 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -311,7 +311,7 @@ bool System_AudioRecordingIsAvailable(); bool System_AudioRecordingState(); // This will be changed to take an enum. Replacement for the old NativeMessageReceived. -void System_PostUIMessage(UIMessage message, const std::string ¶m = ""); +void System_PostUIMessage(UIMessage message, std::string_view param = ""); // For these functions, most platforms will use the implementation provided in UI/AudioCommon.cpp, // no need to implement separately. diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index a78e8e70eb..082624fabd 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -130,7 +130,7 @@ void MainWindow::loadAct() { QFileInfo info(filename); g_Config.currentDirectory = Path(info.absolutePath().toStdString()); - System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, filename.toStdString().c_str()); + System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, filename.toStdString()); } } diff --git a/SDL/CocoaBarItems.mm b/SDL/CocoaBarItems.mm index 2c607e9ca4..a76cbe02f7 100644 --- a/SDL/CocoaBarItems.mm +++ b/SDL/CocoaBarItems.mm @@ -641,7 +641,7 @@ TOGGLE_METHOD(FullScreen, g_Config.bFullScreen, System_MakeRequest(SystemRequest } -(void)openRecentItem: (NSMenuItem *)item { - System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, g_recentFiles.GetRecentFiles()[item.tag].c_str()); + System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, g_recentFiles.GetRecentFiles()[item.tag]); } -(void)openSystemFileBrowser { diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e4bc67d6a0..8421e409fe 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1509,11 +1509,11 @@ void NativeAccelerometer(float tiltX, float tiltY, float tiltZ) { HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_ACCELEROMETER_Z] = tiltZ; } -void System_PostUIMessage(UIMessage message, const std::string &value) { +void System_PostUIMessage(UIMessage message, std::string_view param) { std::lock_guard lock(g_pendingMutex); PendingMessage pendingMessage; pendingMessage.message = message; - pendingMessage.value = value; + pendingMessage.value = param; pendingMessages.push_back(pendingMessage); } diff --git a/UI/TabbedDialogScreen.cpp b/UI/TabbedDialogScreen.cpp index a68b2ab13b..c4b3dd81dd 100644 --- a/UI/TabbedDialogScreen.cpp +++ b/UI/TabbedDialogScreen.cpp @@ -82,7 +82,7 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() { searchSettings->Add(new ItemHeader(se->T("Find settings"))); searchSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Add([=](UI::EventParams &e) { - System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, std::string(StripSpaces(searchFilter_))); + System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, StripSpaces(searchFilter_)); return UI::EVENT_DONE; }); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 3fa6094274..60b38f2eeb 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -93,7 +93,7 @@ bool System_GetPropertyBool(SystemProperty prop) { } } void System_Notify(SystemNotification notification) {} -void System_PostUIMessage(UIMessage message, const std::string ¶m) {} +void System_PostUIMessage(UIMessage message, std::string_view param) {} void System_RunOnMainThread(std::function) {} bool System_MakeRequest(SystemRequestType type, int requestId, const std::string ¶m1, const std::string ¶m2, int64_t param3, int64_t param4) { switch (type) { diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 9dea246397..9f805f25f3 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -1999,7 +1999,7 @@ void System_Notify(SystemNotification notification) { } } bool System_MakeRequest(SystemRequestType type, int requestId, const std::string ¶m1, const std::string ¶m2, int64_t param3, int64_t param4) { return false; } -void System_PostUIMessage(UIMessage message, const std::string ¶m) {} +void System_PostUIMessage(UIMessage message, std::string_view param) {} void System_RunOnMainThread(std::function) {} void NativeFrame(GraphicsContext *graphicsContext) {} void NativeResized() {} diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index d9c0d38877..f967c574a9 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -112,7 +112,7 @@ bool System_GetPropertyBool(SystemProperty prop) { } } void System_Notify(SystemNotification notification) {} -void System_PostUIMessage(UIMessage message, const std::string ¶m) {} +void System_PostUIMessage(UIMessage message, std::string_view param) {} void System_RunOnMainThread(std::function) {} void System_AudioGetDebugStats(char *buf, size_t bufSize) { if (buf) buf[0] = '\0'; } void System_AudioClear() {}