From c5791764d844744ecda441e003fede16d6091bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 19 Jan 2024 13:44:49 +0100 Subject: [PATCH] Make the i18n T function use std::string_view Buildfixes, crashfixes One more Android buildfix Buildfix Qt --- Common/Data/Text/I18n.cpp | 22 +++++++++++---- Common/Data/Text/I18n.h | 27 ++++++++++++------ Common/GPU/Vulkan/thin3d_vulkan.cpp | 4 +-- Common/GPU/thin3d.h | 2 +- Common/Net/HTTPClient.cpp | 2 +- Common/Net/HTTPClient.h | 2 +- Common/Net/HTTPNaettRequest.cpp | 2 +- Common/Net/HTTPNaettRequest.h | 3 +- Common/Net/HTTPRequest.cpp | 8 +++--- Common/Net/HTTPRequest.h | 6 ++-- Common/StringUtils.cpp | 24 ++++++++++++---- Common/StringUtils.h | 7 +++-- Common/System/OSD.cpp | 4 +-- Common/System/OSD.h | 2 +- Common/System/Request.cpp | 11 +++++--- Common/System/Request.h | 40 +++++++++++++------------- Common/System/System.h | 3 +- Common/UI/Context.cpp | 1 + Common/UI/PopupScreens.cpp | 23 ++++++++------- Common/UI/PopupScreens.h | 44 ++++++++++++++--------------- Common/UI/UIScreen.cpp | 6 ++-- Common/UI/UIScreen.h | 2 +- Common/UI/View.cpp | 8 +++--- Common/UI/View.h | 44 ++++++++++++++--------------- Common/UI/ViewGroup.cpp | 10 +++---- Common/UI/ViewGroup.h | 12 ++++---- Core/Config.cpp | 2 +- Core/Config.h | 4 +-- Core/Dialog/PSPDialog.cpp | 11 ++++---- Core/Dialog/PSPDialog.h | 2 +- Core/Dialog/PSPMsgDialog.cpp | 14 ++++----- Core/Dialog/PSPNetconfDialog.cpp | 33 +++++++++++----------- Core/Dialog/PSPNetconfDialog.h | 2 +- Core/Dialog/PSPNpSigninDialog.cpp | 28 +++++++++--------- Core/Dialog/PSPNpSigninDialog.h | 2 +- Core/Dialog/PSPOskDialog.cpp | 2 +- Core/Dialog/PSPSaveDialog.cpp | 13 ++++----- Core/Dialog/PSPSaveDialog.h | 2 +- Core/HLE/proAdhoc.cpp | 4 +-- Core/RetroAchievements.cpp | 6 ++-- Core/RetroAchievements.h | 2 +- Core/SaveState.cpp | 20 ++++++------- Core/SaveState.h | 3 +- Core/Util/GameManager.cpp | 2 +- Core/Util/GameManager.h | 2 +- Core/Util/PPGeDraw.cpp | 24 +++++++--------- Core/Util/PPGeDraw.h | 9 +++--- GPU/Common/PostShader.cpp | 4 +-- GPU/Common/PostShader.h | 4 +-- GPU/Common/TextureReplacer.cpp | 2 +- Qt/QtMain.cpp | 2 +- Qt/mainwindow.cpp | 2 +- SDL/CocoaBarItems.mm | 22 +++++++-------- SDL/SDLMain.cpp | 5 ++-- UI/ControlMappingScreen.cpp | 2 +- UI/CustomButtonMappingScreen.cpp | 4 +-- UI/CwCheatScreen.cpp | 2 +- UI/DebugOverlay.cpp | 2 +- UI/DevScreens.cpp | 22 +++++++-------- UI/DevScreens.h | 4 +-- UI/DiscordIntegration.cpp | 11 ++++---- UI/DiscordIntegration.h | 4 ++- UI/DisplayLayoutScreen.cpp | 12 ++++---- UI/DisplayLayoutScreen.h | 2 +- UI/EmuScreen.cpp | 8 +++--- UI/GameScreen.cpp | 10 +++---- UI/GameSettingsScreen.cpp | 41 ++++++++++++++------------- UI/GameSettingsScreen.h | 4 +-- UI/GamepadEmu.cpp | 2 +- UI/InstallZipScreen.cpp | 4 +-- UI/JoystickHistoryView.h | 2 +- UI/MainScreen.cpp | 6 ++-- UI/MainScreen.h | 4 +-- UI/MemStickScreen.cpp | 4 +-- UI/MiscScreens.cpp | 26 +++++++++-------- UI/MiscScreens.h | 8 +++--- UI/NativeApp.cpp | 2 +- UI/PauseScreen.cpp | 4 +-- UI/ReportScreen.cpp | 18 ++++++------ UI/RetroAchievementScreens.cpp | 4 +-- UI/Store.cpp | 4 +-- UI/TabbedDialogScreen.cpp | 2 +- UI/TabbedDialogScreen.h | 2 +- UI/TouchControlVisibilityScreen.cpp | 8 +++--- UWP/PPSSPP_UWPMain.cpp | 2 +- Windows/EmuThread.cpp | 6 ++-- Windows/MainWindowMenu.cpp | 2 +- Windows/W32Util/ShellUtil.cpp | 8 +++--- Windows/W32Util/ShellUtil.h | 31 +++++++++----------- Windows/main.cpp | 4 +-- android/jni/app-android.cpp | 4 +-- assets/lang/ar_AE.ini | 2 -- assets/lang/az_AZ.ini | 2 -- assets/lang/bg_BG.ini | 2 -- assets/lang/ca_ES.ini | 2 -- assets/lang/cz_CZ.ini | 2 -- assets/lang/da_DK.ini | 2 -- assets/lang/de_DE.ini | 2 -- assets/lang/dr_ID.ini | 2 -- assets/lang/en_US.ini | 2 -- assets/lang/es_ES.ini | 2 -- assets/lang/es_LA.ini | 2 -- assets/lang/fa_IR.ini | 2 -- assets/lang/fr_FR.ini | 2 -- assets/lang/gl_ES.ini | 2 -- assets/lang/gr_EL.ini | 2 -- assets/lang/he_IL.ini | 2 -- assets/lang/he_IL_invert.ini | 2 -- assets/lang/hr_HR.ini | 2 -- assets/lang/hu_HU.ini | 2 -- assets/lang/id_ID.ini | 2 -- assets/lang/it_IT.ini | 2 -- assets/lang/ja_JP.ini | 2 -- assets/lang/jv_ID.ini | 2 -- assets/lang/ko_KR.ini | 2 -- assets/lang/lo_LA.ini | 2 -- assets/lang/lt-LT.ini | 2 -- assets/lang/ms_MY.ini | 2 -- assets/lang/nl_NL.ini | 2 -- assets/lang/no_NO.ini | 2 -- assets/lang/pl_PL.ini | 2 -- assets/lang/pt_BR.ini | 2 -- assets/lang/pt_PT.ini | 2 -- assets/lang/ro_RO.ini | 2 -- assets/lang/ru_RU.ini | 2 -- assets/lang/sv_SE.ini | 2 -- assets/lang/tg_PH.ini | 2 -- assets/lang/th_TH.ini | 2 -- assets/lang/tr_TR.ini | 2 -- assets/lang/uk_UA.ini | 2 -- assets/lang/vi_VN.ini | 2 -- assets/lang/zh_CN.ini | 2 -- assets/lang/zh_TW.ini | 2 -- ios/main.mm | 2 +- libretro/libretro.cpp | 2 +- 135 files changed, 435 insertions(+), 485 deletions(-) diff --git a/Common/Data/Text/I18n.cpp b/Common/Data/Text/I18n.cpp index 91285f3752aa..51f99607010e 100644 --- a/Common/Data/Text/I18n.cpp +++ b/Common/Data/Text/I18n.cpp @@ -72,20 +72,32 @@ void I18NCategory::Clear() { missedKeyLog_.clear(); } -const char *I18NCategory::T(const char *key, const char *def) { - if (!key) { - return "ERROR"; +std::string_view I18NCategory::T(std::string_view key, std::string_view def) { + auto iter = map_.find(key); + if (iter != map_.end()) { + return iter->second.text.c_str(); + } else { + std::lock_guard guard(missedKeyLock_); + std::string missedKey(key); + if (!def.empty()) + missedKeyLog_[missedKey] = def; + else + missedKeyLog_[missedKey] = std::string(key); + return !def.empty() ? def : key; } +} +const char *I18NCategory::T_cstr(const char *key, const char *def) { auto iter = map_.find(key); if (iter != map_.end()) { return iter->second.text.c_str(); } else { std::lock_guard guard(missedKeyLock_); + std::string missedKey(key); if (def) - missedKeyLog_[key] = def; + missedKeyLog_[missedKey] = def; else - missedKeyLog_[key] = key; + missedKeyLog_[missedKey] = std::string(key); return def ? def : key; } } diff --git a/Common/Data/Text/I18n.h b/Common/Data/Text/I18n.h index 7a2abfdc97cf..5f96ed5483c9 100644 --- a/Common/Data/Text/I18n.h +++ b/Common/Data/Text/I18n.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -81,10 +82,11 @@ class I18NCategory { I18NCategory() {} explicit I18NCategory(const Section §ion); - const char *T(const char *key, const char *def = nullptr); - const char *T(const std::string &key) { - return T(key.c_str(), nullptr); - } + // Faster since the string lengths don't need to be recomputed. + std::string_view T(std::string_view key, std::string_view def = ""); + + // Try to avoid this. Still useful in snprintf. + const char *T_cstr(const char *key, const char *def = nullptr); const std::map Missed() const { std::lock_guard guard(missedKeyLock_); @@ -99,6 +101,7 @@ class I18NCategory { I18NCategory(I18NRepo *repo, const char *name) {} void SetMap(const std::map &m); + // std::less<> is needed to be able to look up string_views in a string-keyed map. std::map> map_; mutable std::mutex missedKeyLock_; std::map missedKeyLog_; @@ -119,12 +122,16 @@ class I18NRepo { // Translate the string, by looking up "key" in the file, and falling back to either def or key, in that order, if the lookup fails. // def can (and usually is) set to nullptr. - const char *T(I18NCat category, const char *key, const char *def = nullptr) { + std::string_view T(I18NCat category, std::string_view key, std::string_view def = "") { if (category == I18NCat::NONE) - return def ? def : key; + return !def.empty() ? def : key; return cats_[(size_t)category]->T(key, def); } - + const char *T_cstr(I18NCat category, const char *key, const char *def = nullptr) { + if (category == I18NCat::NONE) + return def ? def : key; + return cats_[(size_t)category]->T_cstr(key, def); + } void LogMissingKeys() const; private: @@ -142,6 +149,10 @@ extern I18NRepo g_i18nrepo; std::shared_ptr GetI18NCategory(I18NCat cat); -inline const char *T(I18NCat category, const char *key, const char *def = nullptr) { +inline std::string_view T(I18NCat category, std::string_view key, std::string_view def = "") { return g_i18nrepo.T(category, key, def); } + +inline const char *T_cstr(I18NCat category, const char *key, const char *def = "") { + return g_i18nrepo.T_cstr(category, key, def); +} \ No newline at end of file diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index cc1b82f61531..eaace00be079 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -395,12 +395,12 @@ class VKContext : public DrawContext { } return list; } - std::vector GetPresentModeList(const char *currentMarkerString) const override { + std::vector GetPresentModeList(std::string_view currentMarkerString) const override { std::vector list; for (auto mode : vulkan_->GetAvailablePresentModes()) { std::string str = VulkanPresentModeToString(mode); if (mode == vulkan_->GetPresentMode()) { - str += std::string(" (") + currentMarkerString + ")"; + str += std::string(" (") + std::string(currentMarkerString) + ")"; } list.push_back(str); } diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index 41a648c249fa..83101eeb1c30 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -702,7 +702,7 @@ class DrawContext { virtual std::vector GetFeatureList() const { return std::vector(); } virtual std::vector GetExtensionList(bool device, bool enabledOnly) const { return std::vector(); } virtual std::vector GetDeviceList() const { return std::vector(); } - virtual std::vector GetPresentModeList(const char *currentMarkerString) const { return std::vector(); } + virtual std::vector GetPresentModeList(std::string_view currentMarkerString) const { return std::vector(); } virtual std::vector GetSurfaceFormatList() const { return std::vector(); } // Describes the primary shader language that this implementation prefers. diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index 00e07d0b4563..43e94fe85a74 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -498,7 +498,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector +#include #include "Common/Net/HTTPRequest.h" @@ -13,7 +14,7 @@ namespace http { // Really an asynchronous request. class HTTPSRequest : public Request { public: - HTTPSRequest(RequestMethod method, const std::string &url, const std::string &postData, const std::string &postMime, const Path &outfile, ProgressBarMode progressBarMode = ProgressBarMode::DELAYED, const std::string &name = ""); + HTTPSRequest(RequestMethod method, const std::string &url, const std::string &postData, const std::string &postMime, const Path &outfile, ProgressBarMode progressBarMode = ProgressBarMode::DELAYED, std::string_view name = ""); ~HTTPSRequest(); void Start() override; diff --git a/Common/Net/HTTPRequest.cpp b/Common/Net/HTTPRequest.cpp index e0009b0e3596..1633653609b0 100644 --- a/Common/Net/HTTPRequest.cpp +++ b/Common/Net/HTTPRequest.cpp @@ -9,8 +9,8 @@ namespace http { -Request::Request(RequestMethod method, const std::string &url, const std::string &name, bool *cancelled, ProgressBarMode mode) : method_(method), url_(url), name_(name), progress_(cancelled), progressBarMode_(mode) { - INFO_LOG(HTTP, "HTTP %s request: %s (%s)", RequestMethodToString(method), url.c_str(), name.c_str()); +Request::Request(RequestMethod method, const std::string &url, std::string_view name, bool *cancelled, ProgressBarMode mode) : method_(method), url_(url), name_(name), progress_(cancelled), progressBarMode_(mode) { + INFO_LOG(HTTP, "HTTP %s request: %s (%.*s)", RequestMethodToString(method), url.c_str(), (int)name.size(), name.data()); progress_.callback = [=](int64_t bytes, int64_t contentLength, bool done) { std::string message; @@ -64,7 +64,7 @@ std::shared_ptr RequestManager::StartDownloadWithCallback( const Path &outfile, ProgressBarMode mode, std::function callback, - const std::string &name, + std::string_view name, const char *acceptMime) { std::shared_ptr dl; if (IsHttpsUrl(url) && System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) { @@ -92,7 +92,7 @@ std::shared_ptr RequestManager::AsyncPostWithCallback( const std::string &postMime, ProgressBarMode mode, std::function callback, - const std::string &name) { + std::string_view name) { std::shared_ptr dl; if (IsHttpsUrl(url) && System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) { #ifndef HTTPS_NOT_AVAILABLE diff --git a/Common/Net/HTTPRequest.h b/Common/Net/HTTPRequest.h index 4201fc9078fd..b6bfda2701be 100644 --- a/Common/Net/HTTPRequest.h +++ b/Common/Net/HTTPRequest.h @@ -23,7 +23,7 @@ enum class ProgressBarMode { // Abstract request. class Request { public: - Request(RequestMethod method, const std::string &url, const std::string &name, bool *cancelled, ProgressBarMode mode); + Request(RequestMethod method, const std::string &url, std::string_view name, bool *cancelled, ProgressBarMode mode); virtual ~Request() {} void SetAccept(const char *mime) { @@ -93,7 +93,7 @@ class RequestManager { const Path &outfile, ProgressBarMode mode, std::function callback, - const std::string &name = "", + std::string_view name = "", const char *acceptMime = nullptr); std::shared_ptr AsyncPostWithCallback( @@ -102,7 +102,7 @@ class RequestManager { const std::string &postMime, // Use postMime = "application/x-www-form-urlencoded" for standard form-style posts, such as used by retroachievements. For encoding form data manually we have MultipartFormDataEncoder. ProgressBarMode mode, std::function callback, - const std::string &name = ""); + std::string_view name = ""); // Drops finished downloads from the list. void Update(); diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index aec862490c83..1b840698d844 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -56,6 +56,18 @@ size_t truncate_cpy(char *dest, size_t destSize, const char *src) { return len; } +size_t truncate_cpy(char *dest, size_t destSize, std::string_view src) { + if (src.size() > destSize - 1) { + memcpy(dest, src.data(), destSize - 1); + dest[destSize - 1] = 0; + return destSize - 1; + } else { + memcpy(dest, src.data(), src.size()); + dest[src.size()] = 0; + return src.size(); + } +} + const char* safe_string(const char* s) { return s ? s : "(null)"; } @@ -376,8 +388,8 @@ std::string ReplaceAll(std::string_view input, std::string_view src, std::string return result; } -std::string UnescapeMenuString(const char *input, char *shortcutChar) { - size_t len = strlen(input); +std::string UnescapeMenuString(std::string_view input, char *shortcutChar) { + size_t len = input.length(); std::string output; output.reserve(len); bool escaping = false; @@ -402,8 +414,8 @@ std::string UnescapeMenuString(const char *input, char *shortcutChar) { return output; } -std::string ApplySafeSubstitutions(const char *format, std::string_view string1, std::string_view string2, std::string_view string3, std::string_view string4) { - size_t formatLen = strlen(format); +std::string ApplySafeSubstitutions(std::string_view format, std::string_view string1, std::string_view string2, std::string_view string3, std::string_view string4) { + size_t formatLen = format.length(); std::string output; output.reserve(formatLen + 20); for (size_t i = 0; i < formatLen; i++) { @@ -433,8 +445,8 @@ std::string ApplySafeSubstitutions(const char *format, std::string_view string1, return output; } -std::string ApplySafeSubstitutions(const char *format, int i1, int i2, int i3, int i4) { - size_t formatLen = strlen(format); +std::string ApplySafeSubstitutions(std::string_view format, int i1, int i2, int i3, int i4) { + size_t formatLen = format.length(); std::string output; output.reserve(formatLen + 20); for (size_t i = 0; i < formatLen; i++) { diff --git a/Common/StringUtils.h b/Common/StringUtils.h index f9831b435b2f..da1ddf7468ad 100644 --- a/Common/StringUtils.h +++ b/Common/StringUtils.h @@ -92,7 +92,7 @@ std::string ReplaceAll(std::string_view input, std::string_view src, std::string // Takes something like R&eplace and returns Replace, plus writes 'e' to *shortcutChar // if not nullptr. Useful for Windows menu strings. -std::string UnescapeMenuString(const char *input, char *shortcutChar); +std::string UnescapeMenuString(std::string_view input, char *shortcutChar); void SkipSpace(const char **ptr); @@ -101,6 +101,7 @@ template inline size_t truncate_cpy(char(&out)[Count], const char *src) { return truncate_cpy(out, Count, src); } +size_t truncate_cpy(char *dest, size_t destSize, std::string_view src); const char* safe_string(const char* s); @@ -125,5 +126,5 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ // Replaces %1, %2, %3 in format with arg1, arg2, arg3. // Much safer than snprintf and friends. // For mixes of strings and ints, manually convert the ints to strings. -std::string ApplySafeSubstitutions(const char *format, std::string_view string1, std::string_view string2 = "", std::string_view string3 = "", std::string_view string4 = ""); -std::string ApplySafeSubstitutions(const char *format, int i1, int i2 = 0, int i3 = 0, int i4 = 0); +std::string ApplySafeSubstitutions(std::string_view format, std::string_view string1, std::string_view string2 = "", std::string_view string3 = "", std::string_view string4 = ""); +std::string ApplySafeSubstitutions(std::string_view format, int i1, int i2 = 0, int i3 = 0, int i4 = 0); diff --git a/Common/System/OSD.cpp b/Common/System/OSD.cpp index 075c73b5c15b..154b3f58ca2a 100644 --- a/Common/System/OSD.cpp +++ b/Common/System/OSD.cpp @@ -227,7 +227,7 @@ void OnScreenDisplay::ShowLeaderboardSubmitted(const std::string &title, const s g_OSD.Show(OSDType::LEADERBOARD_SUBMITTED, title, value, 3.0f); } -void OnScreenDisplay::SetProgressBar(const std::string &id, std::string &&message, float minValue, float maxValue, float progress, float delay) { +void OnScreenDisplay::SetProgressBar(std::string_view id, std::string_view message, float minValue, float maxValue, float progress, float delay) { _dbg_assert_(!my_isnanorinf(progress)); _dbg_assert_(!my_isnanorinf(minValue)); _dbg_assert_(!my_isnanorinf(maxValue)); @@ -250,7 +250,7 @@ void OnScreenDisplay::SetProgressBar(const std::string &id, std::string &&messag Entry bar; bar.id = id; bar.type = OSDType::PROGRESS_BAR; - bar.text = std::move(message); + bar.text = message; bar.minValue = minValue; bar.maxValue = maxValue; bar.progress = progress; diff --git a/Common/System/OSD.h b/Common/System/OSD.h index d389ef80daef..24cb4b4ab2e4 100644 --- a/Common/System/OSD.h +++ b/Common/System/OSD.h @@ -62,7 +62,7 @@ class OnScreenDisplay { // Progress bar controls // Set is both create and update. If you set maxValue <= minValue, you'll create an "indeterminate" progress // bar that doesn't show a specific amount of progress. - void SetProgressBar(const std::string &id, std::string &&message, float minValue, float maxValue, float progress, float delay_s); + void SetProgressBar(std::string_view id, std::string_view message, float minValue, float maxValue, float progress, float delay_s); void RemoveProgressBar(const std::string &id, bool success, float delay_s); // Call every frame to keep the sidebar visible. Otherwise it'll fade out. diff --git a/Common/System/Request.cpp b/Common/System/Request.cpp index e6be092b0dbd..ccaf5622f1e2 100644 --- a/Common/System/Request.cpp +++ b/Common/System/Request.cpp @@ -31,7 +31,7 @@ const char *RequestTypeAsString(SystemRequestType type) { } } -bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken token, RequestCallback callback, RequestFailedCallback failedCallback, const std::string ¶m1, const std::string ¶m2, int param3) { +bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken token, RequestCallback callback, RequestFailedCallback failedCallback, std::string_view param1, std::string_view param2, int param3) { if (token == NO_REQUESTER_TOKEN) { _dbg_assert_(!callback); _dbg_assert_(!failedCallback); @@ -49,7 +49,10 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken to } VERBOSE_LOG(SYSTEM, "Making system request %s: id %d", RequestTypeAsString(type), requestId); - if (!System_MakeRequest(type, requestId, param1, param2, param3)) { + std::string p1(param1); + std::string p2(param2); + // TODO: Convert to string_view + if (!System_MakeRequest(type, requestId, p1, p2, param3)) { if (callback || failedCallback) { std::lock_guard guard(callbackMutex_); callbackMap_.erase(requestId); @@ -130,7 +133,7 @@ void RequestManager::Clear() { callbackMap_.clear(); } -void System_CreateGameShortcut(const Path &path, const std::string &title) { +void System_CreateGameShortcut(const Path &path, std::string_view title) { g_requestManager.MakeSystemRequest(SystemRequestType::CREATE_GAME_SHORTCUT, NO_REQUESTER_TOKEN, nullptr, nullptr, path.ToString(), title, 0); } @@ -139,6 +142,6 @@ void System_ShowFileInFolder(const Path &path) { g_requestManager.MakeSystemRequest(SystemRequestType::SHOW_FILE_IN_FOLDER, NO_REQUESTER_TOKEN, nullptr, nullptr, path.ToString(), "", 0); } -void System_BrowseForFolder(RequesterToken token, const std::string &title, const Path &initialPath, RequestCallback callback, RequestFailedCallback failedCallback) { +void System_BrowseForFolder(RequesterToken token, std::string_view title, const Path &initialPath, RequestCallback callback, RequestFailedCallback failedCallback) { g_requestManager.MakeSystemRequest(SystemRequestType::BROWSE_FOR_FOLDER, token, callback, failedCallback, title, initialPath.ToCString(), 0); } diff --git a/Common/System/Request.h b/Common/System/Request.h index da54f46838a3..ec8221488464 100644 --- a/Common/System/Request.h +++ b/Common/System/Request.h @@ -27,7 +27,7 @@ class RequestManager { // The callback you pass in will be called on the main thread later. // Params are at the end since it's the part most likely to recieve additions in the future, // now that we have both callbacks. - bool MakeSystemRequest(SystemRequestType type, RequesterToken token, RequestCallback callback, RequestFailedCallback failedCallback, const std::string ¶m1, const std::string ¶m2, int param3); + bool MakeSystemRequest(SystemRequestType type, RequesterToken token, RequestCallback callback, RequestFailedCallback failedCallback, std::string_view param1, std::string_view param2, int param3); // Called by the platform implementation, when it's finished with a request. void PostSystemSuccess(int requestId, const char *responseString, int responseValue = 0); @@ -83,13 +83,13 @@ extern RequestManager g_requestManager; // Wrappers for easy requests. // NOTE: Semantics have changed - this no longer calls the callback on cancellation, instead you // can specify a different callback for that. -inline void System_InputBoxGetString(RequesterToken token, const std::string &title, const std::string &defaultValue, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { +inline void System_InputBoxGetString(RequesterToken token, std::string_view title, std::string_view defaultValue, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { g_requestManager.MakeSystemRequest(SystemRequestType::INPUT_TEXT_MODAL, token, callback, failedCallback, title, defaultValue, 0); } // This one will pop up a special image browser if available. You can also pick // images with the file browser below. -inline void System_BrowseForImage(RequesterToken token, const std::string &title, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { +inline void System_BrowseForImage(RequesterToken token, std::string_view title, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { g_requestManager.MakeSystemRequest(SystemRequestType::BROWSE_FOR_IMAGE, token, callback, failedCallback, title, "", 0); } @@ -103,18 +103,18 @@ enum class BrowseFileType { ANY, }; -inline void System_BrowseForFile(RequesterToken token, const std::string &title, BrowseFileType type, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { +inline void System_BrowseForFile(RequesterToken token, std::string_view title, BrowseFileType type, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { g_requestManager.MakeSystemRequest(SystemRequestType::BROWSE_FOR_FILE, token, callback, failedCallback, title, "", (int)type); } -void System_BrowseForFolder(RequesterToken token, const std::string &title, const Path &initialPath, RequestCallback callback, RequestFailedCallback failedCallback = nullptr); +void System_BrowseForFolder(RequesterToken token, std::string_view title, const Path &initialPath, RequestCallback callback, RequestFailedCallback failedCallback = nullptr); // The returned string is username + '\n' + password. -inline void System_AskUsernamePassword(RequesterToken token, const std::string &title, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { +inline void System_AskUsernamePassword(RequesterToken token, std::string_view title, RequestCallback callback, RequestFailedCallback failedCallback = nullptr) { g_requestManager.MakeSystemRequest(SystemRequestType::ASK_USERNAME_PASSWORD, token, callback, failedCallback, title, "", 0); } -inline void System_CopyStringToClipboard(const std::string &string) { +inline void System_CopyStringToClipboard(std::string_view string) { g_requestManager.MakeSystemRequest(SystemRequestType::COPY_TO_CLIPBOARD, NO_REQUESTER_TOKEN, nullptr, nullptr, string, "", 0); } @@ -122,7 +122,7 @@ inline void System_ExitApp() { g_requestManager.MakeSystemRequest(SystemRequestType::EXIT_APP, NO_REQUESTER_TOKEN, nullptr, nullptr, "", "", 0); } -inline void System_RestartApp(const std::string ¶ms) { +inline void System_RestartApp(std::string_view params) { g_requestManager.MakeSystemRequest(SystemRequestType::RESTART_APP, NO_REQUESTER_TOKEN, nullptr, nullptr, params, "", 0); } @@ -131,50 +131,50 @@ inline void System_RecreateActivity() { } // The design is a little weird, just a holdover from the old message. Can either toggle or set to on or off. -inline void System_ToggleFullscreenState(const std::string ¶m) { +inline void System_ToggleFullscreenState(std::string_view param) { g_requestManager.MakeSystemRequest(SystemRequestType::TOGGLE_FULLSCREEN_STATE, NO_REQUESTER_TOKEN, nullptr, nullptr, param, "", 0); } -inline void System_GraphicsBackendFailedAlert(const std::string ¶m) { +inline void System_GraphicsBackendFailedAlert(std::string_view param) { g_requestManager.MakeSystemRequest(SystemRequestType::GRAPHICS_BACKEND_FAILED_ALERT, NO_REQUESTER_TOKEN, nullptr, nullptr, param, "", 0); } -inline void System_CameraCommand(const std::string &command) { +inline void System_CameraCommand(std::string_view command) { g_requestManager.MakeSystemRequest(SystemRequestType::CAMERA_COMMAND, NO_REQUESTER_TOKEN, nullptr, nullptr, command, "", 0); } -inline void System_GPSCommand(const std::string &command) { +inline void System_GPSCommand(std::string_view command) { g_requestManager.MakeSystemRequest(SystemRequestType::GPS_COMMAND, NO_REQUESTER_TOKEN, nullptr, nullptr, command, "", 0); } -inline void System_InfraredCommand(const std::string &command) { +inline void System_InfraredCommand(std::string_view command) { g_requestManager.MakeSystemRequest(SystemRequestType::INFRARED_COMMAND, NO_REQUESTER_TOKEN, nullptr, nullptr, command, "", 0); } -inline void System_MicrophoneCommand(const std::string &command) { +inline void System_MicrophoneCommand(std::string_view command) { g_requestManager.MakeSystemRequest(SystemRequestType::MICROPHONE_COMMAND, NO_REQUESTER_TOKEN, nullptr, nullptr, command, "", 0); } -inline void System_ShareText(const std::string &text) { +inline void System_ShareText(std::string_view text) { g_requestManager.MakeSystemRequest(SystemRequestType::SHARE_TEXT, NO_REQUESTER_TOKEN, nullptr, nullptr, text, "", 0); } -inline void System_NotifyUIState(const std::string &state) { +inline void System_NotifyUIState(std::string_view state) { g_requestManager.MakeSystemRequest(SystemRequestType::NOTIFY_UI_STATE, NO_REQUESTER_TOKEN, nullptr, nullptr, state, "", 0); } -inline void System_SetWindowTitle(const std::string ¶m) { +inline void System_SetWindowTitle(std::string_view param) { g_requestManager.MakeSystemRequest(SystemRequestType::SET_WINDOW_TITLE, NO_REQUESTER_TOKEN, nullptr, nullptr, param, "", 0); } -inline bool System_SendDebugOutput(const std::string &string) { +inline bool System_SendDebugOutput(std::string_view string) { return g_requestManager.MakeSystemRequest(SystemRequestType::SEND_DEBUG_OUTPUT, NO_REQUESTER_TOKEN, nullptr, nullptr, string, "", 0); } -inline void System_SendDebugScreenshot(const std::string &data, int height) { +inline void System_SendDebugScreenshot(std::string_view data, int height) { g_requestManager.MakeSystemRequest(SystemRequestType::SEND_DEBUG_SCREENSHOT, NO_REQUESTER_TOKEN, nullptr, nullptr, data, "", height); } // Non-inline to avoid including Path.h -void System_CreateGameShortcut(const Path &path, const std::string &title); +void System_CreateGameShortcut(const Path &path, std::string_view title); void System_ShowFileInFolder(const Path &path); diff --git a/Common/System/System.h b/Common/System/System.h index 70cc763db853..08129300908e 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include @@ -28,7 +29,7 @@ enum PermissionStatus { // These APIs must be implemented by every port (for example app-android.cpp, SDLMain.cpp). // Ideally these should be safe to call from any thread. -void System_Toast(const char *text); +void System_Toast(std::string_view text); void System_ShowKeyboard(); // Vibrate either takes a number of milliseconds to vibrate unconditionally, diff --git a/Common/UI/Context.cpp b/Common/UI/Context.cpp index 1a69b6bad6b3..a60325a61cd9 100644 --- a/Common/UI/Context.cpp +++ b/Common/UI/Context.cpp @@ -93,6 +93,7 @@ void UIContext::BeginPipeline(Draw::Pipeline *pipeline, Draw::SamplerState *samp } void UIContext::RebindTexture() const { + _dbg_assert_(uitexture_); if (uitexture_) draw_->BindTexture(0, uitexture_); } diff --git a/Common/UI/PopupScreens.cpp b/Common/UI/PopupScreens.cpp index 57e9e13774f8..5f0094caffd6 100644 --- a/Common/UI/PopupScreens.cpp +++ b/Common/UI/PopupScreens.cpp @@ -99,7 +99,7 @@ UI::EventReturn PopupMultiChoice::HandleClick(UI::EventParams &e) { std::vector choices; for (int i = 0; i < numChoices_; i++) { - choices.push_back(category ? category->T(choices_[i]) : choices_[i]); + choices.push_back(category ? std::string(category->T(choices_[i])) : std::string(choices_[i])); } ListPopupScreen *popupScreen = new ListPopupScreen(ChopTitle(text_), choices, *value_ - minVal_, @@ -154,13 +154,13 @@ std::string PopupMultiChoice::ValueText() const { return valueText_; } -PopupSliderChoice::PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, const std::string &text, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams) +PopupSliderChoice::PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, std::string_view text, ScreenManager *screenManager, std::string_view units, LayoutParams *layoutParams) : AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), defaultValue_(defaultValue), step_(1), units_(units), screenManager_(screenManager) { fmt_ = "%d"; OnClick.Handle(this, &PopupSliderChoice::HandleClick); } -PopupSliderChoice::PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, const std::string &text, int step, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams) +PopupSliderChoice::PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, std::string_view text, int step, ScreenManager *screenManager, std::string_view units, LayoutParams *layoutParams) : AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), defaultValue_(defaultValue), step_(step), units_(units), screenManager_(screenManager) { fmt_ = "%d"; OnClick.Handle(this, &PopupSliderChoice::HandleClick); @@ -175,14 +175,14 @@ void PopupSliderChoice::SetFormat(std::string_view fmt) { } } -PopupSliderChoiceFloat::PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, const std::string &text, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams) +PopupSliderChoiceFloat::PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, std::string_view text, ScreenManager *screenManager, std::string_view units, LayoutParams *layoutParams) : AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), defaultValue_(defaultValue), step_(1.0f), units_(units), screenManager_(screenManager) { _dbg_assert_(maxValue > minValue); fmt_ = "%2.2f"; OnClick.Handle(this, &PopupSliderChoiceFloat::HandleClick); } -PopupSliderChoiceFloat::PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, const std::string &text, float step, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams) +PopupSliderChoiceFloat::PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, std::string_view text, float step, ScreenManager *screenManager, std::string_view units, LayoutParams *layoutParams) : AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), defaultValue_(defaultValue), step_(step), units_(units), screenManager_(screenManager) { _dbg_assert_(step > 0.0f); _dbg_assert_(maxValue > minValue); @@ -222,7 +222,7 @@ EventReturn PopupSliderChoice::HandleChange(EventParams &e) { return EVENT_DONE; } -static bool IsValidNumberFormatString(const std::string &s) { +static bool IsValidNumberFormatString(std::string_view s) { if (s.empty()) return false; size_t percentCount = 0; @@ -518,7 +518,7 @@ void SliderFloatPopupScreen::OnCompleted(DialogResult result) { } } -PopupTextInputChoice::PopupTextInputChoice(RequesterToken token, std::string *value, const std::string &title, const std::string &placeholder, int maxLen, ScreenManager *screenManager, LayoutParams *layoutParams) +PopupTextInputChoice::PopupTextInputChoice(RequesterToken token, std::string *value, std::string_view title, std::string_view placeholder, int maxLen, ScreenManager *screenManager, LayoutParams *layoutParams) : AbstractChoiceWithValueDisplay(title, layoutParams), screenManager_(screenManager), value_(value), placeHolder_(placeholder), maxLen_(maxLen), token_(token) { OnClick.Handle(this, &PopupTextInputChoice::HandleClick); } @@ -682,11 +682,10 @@ std::string ChoiceWithValueDisplay::ValueText() const { } else if (iValue_ != nullptr) { valueText << *iValue_; } - return valueText.str(); } -FileChooserChoice::FileChooserChoice(RequesterToken token, std::string *value, const std::string &text, BrowseFileType fileType, LayoutParams *layoutParams) +FileChooserChoice::FileChooserChoice(RequesterToken token, std::string *value, std::string_view text, BrowseFileType fileType, LayoutParams *layoutParams) : AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), fileType_(fileType), token_(token) { OnClick.Add([=](UI::EventParams &) { System_BrowseForFile(token, text_, fileType, [=](const std::string &returnValue, int) { @@ -704,13 +703,13 @@ FileChooserChoice::FileChooserChoice(RequesterToken token, std::string *value, c std::string FileChooserChoice::ValueText() const { if (value_->empty()) { auto di = GetI18NCategory(I18NCat::DIALOG); - return di->T("Default"); + return std::string(di->T("Default")); } Path path(*value_); return path.GetFilename(); } -FolderChooserChoice::FolderChooserChoice(RequesterToken token, std::string *value, const std::string &text, LayoutParams *layoutParams) +FolderChooserChoice::FolderChooserChoice(RequesterToken token, std::string *value, std::string_view text, LayoutParams *layoutParams) : AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), token_(token) { OnClick.Add([=](UI::EventParams &) { System_BrowseForFolder(token_, text_, Path(*value), [=](const std::string &returnValue, int) { @@ -728,7 +727,7 @@ FolderChooserChoice::FolderChooserChoice(RequesterToken token, std::string *valu std::string FolderChooserChoice::ValueText() const { if (value_->empty()) { auto di = GetI18NCategory(I18NCat::DIALOG); - return di->T("Default"); + return std::string(di->T("Default")); } Path path(*value_); return path.ToVisualString(); diff --git a/Common/UI/PopupScreens.h b/Common/UI/PopupScreens.h index 80167174f955..1eab264abf5a 100644 --- a/Common/UI/PopupScreens.h +++ b/Common/UI/PopupScreens.h @@ -15,11 +15,11 @@ static const int NO_DEFAULT_INT = -1000000; class ListPopupScreen : public PopupScreen { public: - ListPopupScreen(std::string title) : PopupScreen(title) {} - ListPopupScreen(std::string title, const std::vector &items, int selected, std::function callback, bool showButtons = false) + ListPopupScreen(std::string_view title) : PopupScreen(title) {} + ListPopupScreen(std::string_view title, const std::vector &items, int selected, std::function callback, bool showButtons = false) : PopupScreen(title, "OK", "Cancel"), adaptor_(items, selected), callback_(callback), showButtons_(showButtons) { } - ListPopupScreen(std::string title, const std::vector &items, int selected, bool showButtons = false) + ListPopupScreen(std::string_view title, const std::vector &items, int selected, bool showButtons = false) : PopupScreen(title, "OK", "Cancel"), adaptor_(items, selected), showButtons_(showButtons) { } @@ -57,7 +57,7 @@ class ListPopupScreen : public PopupScreen { class MessagePopupScreen : public PopupScreen { public: - MessagePopupScreen(std::string title, std::string message, std::string button1, std::string button2, std::function callback) + MessagePopupScreen(std::string_view title, std::string message, std::string button1, std::string button2, std::function callback) : PopupScreen(title, button1, button2), message_(message), callback_(callback) {} const char *tag() const override { return "MessagePopupScreen"; } @@ -77,7 +77,7 @@ class MessagePopupScreen : public PopupScreen { class SliderPopupScreen : public PopupScreen { public: - SliderPopupScreen(int *value, int minValue, int maxValue, int defaultValue, const std::string &title, int step = 1, const std::string &units = "") + SliderPopupScreen(int *value, int minValue, int maxValue, int defaultValue, std::string_view title, int step = 1, std::string_view units = "") : PopupScreen(title, "OK", "Cancel"), units_(units), value_(value), minValue_(minValue), maxValue_(maxValue), defaultValue_(defaultValue), step_(step) {} void CreatePopupContents(ViewGroup *parent) override; @@ -113,7 +113,7 @@ class SliderPopupScreen : public PopupScreen { class SliderFloatPopupScreen : public PopupScreen { public: - SliderFloatPopupScreen(float *value, float minValue, float maxValue, float defaultValue, const std::string &title, float step = 1.0f, const std::string &units = "", bool liveUpdate = false) + SliderFloatPopupScreen(float *value, float minValue, float maxValue, float defaultValue, std::string_view title, float step = 1.0f, std::string_view units = "", bool liveUpdate = false) : PopupScreen(title, "OK", "Cancel"), units_(units), value_(value), originalValue_(*value), minValue_(minValue), maxValue_(maxValue), defaultValue_(defaultValue), step_(step), liveUpdate_(liveUpdate) {} void CreatePopupContents(UI::ViewGroup *parent) override; @@ -144,7 +144,7 @@ class SliderFloatPopupScreen : public PopupScreen { class TextEditPopupScreen : public PopupScreen { public: - TextEditPopupScreen(std::string *value, const std::string &placeholder, const std::string &title, int maxLen) + TextEditPopupScreen(std::string *value, std::string_view placeholder, std::string_view title, int maxLen) : PopupScreen(title, "OK", "Cancel"), value_(value), placeholder_(placeholder), maxLen_(maxLen) {} void CreatePopupContents(ViewGroup *parent) override; @@ -194,7 +194,7 @@ class PopupContextMenuScreen : public PopupScreen { // Reads and writes value to determine the current selection. class PopupMultiChoice : public AbstractChoiceWithValueDisplay { public: - PopupMultiChoice(int *value, const std::string &text, const char **choices, int minVal, int numChoices, + PopupMultiChoice(int *value, std::string_view text, const char **choices, int minVal, int numChoices, I18NCat category, ScreenManager *screenManager, UI::LayoutParams *layoutParams = nullptr) : AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), choices_(choices), minVal_(minVal), numChoices_(numChoices), category_(category), screenManager_(screenManager) { @@ -246,7 +246,7 @@ class PopupMultiChoice : public AbstractChoiceWithValueDisplay { // Allows passing in a dynamic vector of strings. Saves the string. class PopupMultiChoiceDynamic : public PopupMultiChoice { public: - PopupMultiChoiceDynamic(std::string *value, const std::string &text, std::vector choices, + PopupMultiChoiceDynamic(std::string *value, std::string_view text, std::vector choices, I18NCat category, ScreenManager *screenManager, UI::LayoutParams *layoutParams = nullptr) : UI::PopupMultiChoice(&valueInt_, text, nullptr, 0, (int)choices.size(), category, screenManager, layoutParams), valueStr_(value) { @@ -282,14 +282,14 @@ class PopupMultiChoiceDynamic : public PopupMultiChoice { class PopupSliderChoice : public AbstractChoiceWithValueDisplay { public: - PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, const std::string &text, ScreenManager *screenManager, const std::string &units = "", LayoutParams *layoutParams = 0); - PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, const std::string &text, int step, ScreenManager *screenManager, const std::string &units = "", LayoutParams *layoutParams = 0); + PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, std::string_view text, ScreenManager *screenManager, std::string_view units = "", LayoutParams *layoutParams = 0); + PopupSliderChoice(int *value, int minValue, int maxValue, int defaultValue, std::string_view text, int step, ScreenManager *screenManager, std::string_view units = "", LayoutParams *layoutParams = 0); void SetFormat(std::string_view fmt); - void SetZeroLabel(const std::string &str) { + void SetZeroLabel(std::string_view str) { zeroLabel_ = str; } - void SetNegativeDisable(const std::string &str) { + void SetNegativeDisable(std::string_view str) { negativeLabel_ = str; } @@ -317,8 +317,8 @@ class PopupSliderChoice : public AbstractChoiceWithValueDisplay { class PopupSliderChoiceFloat : public AbstractChoiceWithValueDisplay { public: - PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, const std::string &text, ScreenManager *screenManager, const std::string &units = "", LayoutParams *layoutParams = 0); - PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, const std::string &text, float step, ScreenManager *screenManager, const std::string &units = "", LayoutParams *layoutParams = 0); + PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, std::string_view text, ScreenManager *screenManager, std::string_view units = "", LayoutParams *layoutParams = 0); + PopupSliderChoiceFloat(float *value, float minValue, float maxValue, float defaultValue, std::string_view text, float step, ScreenManager *screenManager, std::string_view units = "", LayoutParams *layoutParams = 0); void SetFormat(std::string_view fmt); void SetZeroLabel(const std::string &str) { @@ -356,7 +356,7 @@ class PopupSliderChoiceFloat : public AbstractChoiceWithValueDisplay { // NOTE: This one will defer to a system-native dialog if possible. class PopupTextInputChoice : public AbstractChoiceWithValueDisplay { public: - PopupTextInputChoice(RequesterToken token, std::string *value, const std::string &title, const std::string &placeholder, int maxLen, ScreenManager *screenManager, LayoutParams *layoutParams = 0); + PopupTextInputChoice(RequesterToken token, std::string *value, std::string_view title, std::string_view placeholder, int maxLen, ScreenManager *screenManager, LayoutParams *layoutParams = 0); Event OnChange; @@ -377,13 +377,13 @@ class PopupTextInputChoice : public AbstractChoiceWithValueDisplay { class ChoiceWithValueDisplay : public AbstractChoiceWithValueDisplay { public: - ChoiceWithValueDisplay(int *value, const std::string &text, LayoutParams *layoutParams = 0) + ChoiceWithValueDisplay(int *value, std::string_view text, LayoutParams *layoutParams = 0) : AbstractChoiceWithValueDisplay(text, layoutParams), iValue_(value) {} - ChoiceWithValueDisplay(std::string *value, const std::string &text, I18NCat category, LayoutParams *layoutParams = 0) + ChoiceWithValueDisplay(std::string *value, std::string_view text, I18NCat category, LayoutParams *layoutParams = 0) : AbstractChoiceWithValueDisplay(text, layoutParams), sValue_(value), category_(category) {} - ChoiceWithValueDisplay(std::string *value, const std::string &text, std::string(*translateCallback)(const char *value), LayoutParams *layoutParams = 0) + ChoiceWithValueDisplay(std::string *value, std::string_view text, std::string(*translateCallback)(std::string_view value), LayoutParams *layoutParams = 0) : AbstractChoiceWithValueDisplay(text, layoutParams), sValue_(value), translateCallback_(translateCallback) { } @@ -393,7 +393,7 @@ class ChoiceWithValueDisplay : public AbstractChoiceWithValueDisplay { std::string *sValue_ = nullptr; int *iValue_ = nullptr; I18NCat category_ = I18NCat::CATEGORY_COUNT; - std::string(*translateCallback_)(const char *value) = nullptr; + std::string(*translateCallback_)(std::string_view value) = nullptr; }; enum class FileChooserFileType { @@ -402,7 +402,7 @@ enum class FileChooserFileType { class FileChooserChoice : public AbstractChoiceWithValueDisplay { public: - FileChooserChoice(RequesterToken token, std::string *value, const std::string &title, BrowseFileType fileType, LayoutParams *layoutParams = nullptr); + FileChooserChoice(RequesterToken token, std::string *value, std::string_view title, BrowseFileType fileType, LayoutParams *layoutParams = nullptr); std::string ValueText() const override; Event OnChange; @@ -415,7 +415,7 @@ class FileChooserChoice : public AbstractChoiceWithValueDisplay { class FolderChooserChoice : public AbstractChoiceWithValueDisplay { public: - FolderChooserChoice(RequesterToken token, std::string *value, const std::string &title, LayoutParams *layoutParams = nullptr); + FolderChooserChoice(RequesterToken token, std::string *value, std::string_view title, LayoutParams *layoutParams = nullptr); std::string ValueText() const override; Event OnChange; diff --git a/Common/UI/UIScreen.cpp b/Common/UI/UIScreen.cpp index f7bdef840fad..9f8338ec9327 100644 --- a/Common/UI/UIScreen.cpp +++ b/Common/UI/UIScreen.cpp @@ -295,13 +295,13 @@ UI::EventReturn UIScreen::OnCancel(UI::EventParams &e) { return UI::EVENT_DONE; } -PopupScreen::PopupScreen(std::string title, std::string button1, std::string button2) +PopupScreen::PopupScreen(std::string_view title, std::string_view button1, std::string_view button2) : title_(title) { auto di = GetI18NCategory(I18NCat::DIALOG); if (!button1.empty()) - button1_ = di->T(button1.c_str()); + button1_ = di->T(button1); if (!button2.empty()) - button2_ = di->T(button2.c_str()); + button2_ = di->T(button2); alpha_ = 0.0f; // inherited } diff --git a/Common/UI/UIScreen.h b/Common/UI/UIScreen.h index d7487bee717d..12c71cb831a4 100644 --- a/Common/UI/UIScreen.h +++ b/Common/UI/UIScreen.h @@ -97,7 +97,7 @@ class UIDialogScreen : public UIScreen { class PopupScreen : public UIDialogScreen { public: - PopupScreen(std::string title, std::string button1 = "", std::string button2 = ""); + PopupScreen(std::string_view title, std::string_view button1 = "", std::string_view button2 = ""); virtual void CreatePopupContents(UI::ViewGroup *parent) = 0; void CreateViews() override; diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index 7a54ff66f0ef..18c573fcb272 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -546,7 +546,7 @@ std::string Choice::DescribeText() const { return ApplySafeSubstitutions(u->T("%1 choice"), text_); } -InfoItem::InfoItem(const std::string &text, const std::string &rightText, LayoutParams *layoutParams) +InfoItem::InfoItem(std::string_view text, std::string_view rightText, LayoutParams *layoutParams) : Item(layoutParams), text_(text), rightText_(rightText) { // We set the colors later once we have a UIContext. bgColor_ = AddTween(new CallbackColorTween(0.1f)); @@ -594,7 +594,7 @@ std::string InfoItem::DescribeText() const { return ApplySafeSubstitutions(u->T("%1: %2"), text_, rightText_); } -ItemHeader::ItemHeader(const std::string &text, LayoutParams *layoutParams) +ItemHeader::ItemHeader(std::string_view text, LayoutParams *layoutParams) : Item(layoutParams), text_(text) { layoutParams_->width = FILL_PARENT; layoutParams_->height = 40; @@ -624,7 +624,7 @@ std::string ItemHeader::DescribeText() const { return ApplySafeSubstitutions(u->T("%1 heading"), text_); } -CollapsibleHeader::CollapsibleHeader(bool *toggle, const std::string &text, LayoutParams *layoutParams) +CollapsibleHeader::CollapsibleHeader(bool *toggle, std::string_view text, LayoutParams *layoutParams) : CheckBox(toggle, text, "", layoutParams) { layoutParams_->width = FILL_PARENT; layoutParams_->height = 40; @@ -1098,7 +1098,7 @@ void TextView::Draw(UIContext &dc) { } } -TextEdit::TextEdit(const std::string &text, const std::string &title, const std::string &placeholderText, LayoutParams *layoutParams) +TextEdit::TextEdit(std::string_view text, std::string_view title, std::string_view placeholderText, LayoutParams *layoutParams) : View(layoutParams), text_(text), title_(title), undo_(text), placeholderText_(placeholderText), textColor_(0xFFFFFFFF), maxLen_(255) { caret_ = (int)text_.size(); diff --git a/Common/UI/View.h b/Common/UI/View.h index db321d1d3949..2372d1ad0678 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -543,15 +543,15 @@ class Clickable : public View { // Right now more flexible image support though. class Button : public Clickable { public: - Button(const std::string &text, LayoutParams *layoutParams = 0) + Button(std::string_view text, LayoutParams *layoutParams = 0) : Clickable(layoutParams), text_(text), imageID_(ImageID::invalid()) {} - Button(const std::string &text, ImageID imageID, LayoutParams *layoutParams = 0) + Button(std::string_view text, ImageID imageID, LayoutParams *layoutParams = 0) : Clickable(layoutParams), text_(text), imageID_(imageID) {} void Click() override; void Draw(UIContext &dc) override; void GetContentDimensions(const UIContext &dc, float &w, float &h) const override; - const std::string &GetText() const { return text_; } + std::string_view GetText() const { return text_; } std::string DescribeText() const override; void SetPadding(int w, int h) { paddingW_ = w; @@ -579,7 +579,7 @@ class Button : public Clickable { class RadioButton : public Clickable { public: - RadioButton(int *value, int thisButtonValue, const std::string &text, LayoutParams *layoutParams = 0) + RadioButton(int *value, int thisButtonValue, std::string_view text, LayoutParams *layoutParams = 0) : Clickable(layoutParams), value_(value), thisButtonValue_(thisButtonValue), text_(text) {} void Click() override; void Draw(UIContext &dc) override; @@ -704,11 +704,11 @@ class ClickableItem : public Clickable { // Use to trigger something or open a submenu screen. class Choice : public ClickableItem { public: - Choice(const std::string &text, LayoutParams *layoutParams = nullptr) + Choice(std::string_view text, LayoutParams *layoutParams = nullptr) : Choice(text, std::string(), false, layoutParams) {} - Choice(const std::string &text, ImageID image, LayoutParams *layoutParams = nullptr) + Choice(std::string_view text, ImageID image, LayoutParams *layoutParams = nullptr) : ClickableItem(layoutParams), text_(text), image_(image) {} - Choice(const std::string &text, const std::string &smallText, bool selected = false, LayoutParams *layoutParams = nullptr) + Choice(std::string_view text, std::string_view smallText, bool selected = false, LayoutParams *layoutParams = nullptr) : ClickableItem(layoutParams), text_(text), smallText_(smallText), image_(ImageID::invalid()) {} Choice(ImageID image, LayoutParams *layoutParams = nullptr) : ClickableItem(layoutParams), image_(image), rightIconImage_(ImageID::invalid()) {} @@ -759,7 +759,7 @@ class Choice : public ClickableItem { // Different key handling. class StickyChoice : public Choice { public: - StickyChoice(const std::string &text, const std::string &smallText = "", LayoutParams *layoutParams = 0) + StickyChoice(std::string_view text, std::string_view smallText = "", LayoutParams *layoutParams = 0) : Choice(text, smallText, false, layoutParams) {} StickyChoice(ImageID buttonImage, LayoutParams *layoutParams = 0) : Choice(buttonImage, layoutParams) {} @@ -779,7 +779,7 @@ class StickyChoice : public Choice { class InfoItem : public Item { public: - InfoItem(const std::string &text, const std::string &rightText, LayoutParams *layoutParams = nullptr); + InfoItem(std::string_view text, std::string_view rightText, LayoutParams *layoutParams = nullptr); void Draw(UIContext &dc) override; std::string DescribeText() const override; @@ -787,13 +787,13 @@ class InfoItem : public Item { // These are focusable so that long lists of them can be keyboard scrolled. bool CanBeFocused() const override { return true; } - void SetText(const std::string &text) { + void SetText(std::string_view text) { text_ = text; } const std::string &GetText() const { return text_; } - void SetRightText(const std::string &text) { + void SetRightText(std::string_view text) { rightText_ = text; } void SetChoiceStyle(bool choiceStyle) { @@ -812,7 +812,7 @@ class InfoItem : public Item { class AbstractChoiceWithValueDisplay : public Choice { public: - AbstractChoiceWithValueDisplay(const std::string &text, LayoutParams *layoutParams = nullptr) + AbstractChoiceWithValueDisplay(std::string_view text, LayoutParams *layoutParams = nullptr) : Choice(text, layoutParams) { } @@ -833,7 +833,7 @@ class AbstractChoiceWithValueDisplay : public Choice { class ChoiceWithCallbackValueDisplay : public AbstractChoiceWithValueDisplay { public: - ChoiceWithCallbackValueDisplay(const std::string &text, std::function valueFunc, LayoutParams *layoutParams = nullptr) + ChoiceWithCallbackValueDisplay(std::string_view text, std::function valueFunc, LayoutParams *layoutParams = nullptr) : AbstractChoiceWithValueDisplay(text, layoutParams), valueFunc_(valueFunc) {} protected: std::string ValueText() const override { @@ -844,7 +844,7 @@ class ChoiceWithCallbackValueDisplay : public AbstractChoiceWithValueDisplay { class ItemHeader : public Item { public: - ItemHeader(const std::string &text, LayoutParams *layoutParams = 0); + ItemHeader(std::string_view text, LayoutParams *layoutParams = 0); void Draw(UIContext &dc) override; std::string DescribeText() const override; void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override; @@ -856,7 +856,7 @@ class ItemHeader : public Item { class PopupHeader : public Item { public: - PopupHeader(const std::string &text, LayoutParams *layoutParams = 0) + PopupHeader(std::string_view text, LayoutParams *layoutParams = 0) : Item(layoutParams), text_(text) { layoutParams_->width = FILL_PARENT; layoutParams_->height = 64; @@ -870,7 +870,7 @@ class PopupHeader : public Item { class CheckBox : public ClickableItem { public: - CheckBox(bool *toggle, const std::string &text, const std::string &smallText = "", LayoutParams *layoutParams = nullptr) + CheckBox(bool *toggle, std::string_view text, std::string_view smallText = "", LayoutParams *layoutParams = nullptr) : ClickableItem(layoutParams), toggle_(toggle), text_(text), smallText_(smallText) { OnClick.Handle(this, &CheckBox::OnClicked); } @@ -899,7 +899,7 @@ class CheckBox : public ClickableItem { class CollapsibleHeader : public CheckBox { public: - CollapsibleHeader(bool *open, const std::string &text, LayoutParams *layoutParams = nullptr); + CollapsibleHeader(bool *open, std::string_view text, LayoutParams *layoutParams = nullptr); void Draw(UIContext &dc) override; void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override; void GetContentDimensions(const UIContext &dc, float &w, float &h) const override; @@ -916,11 +916,11 @@ class CollapsibleHeader : public CheckBox { class BitCheckBox : public CheckBox { public: - BitCheckBox(uint32_t *bitfield, uint32_t bit, const std::string &text, const std::string &smallText = "", LayoutParams *layoutParams = nullptr) + BitCheckBox(uint32_t *bitfield, uint32_t bit, std::string_view text, std::string_view smallText = "", LayoutParams *layoutParams = nullptr) : CheckBox(nullptr, text, smallText, layoutParams), bitfield_(bitfield), bit_(bit) { } - BitCheckBox(int *bitfield, int bit, const std::string &text, const std::string &smallText = "", LayoutParams *layoutParams = nullptr) : BitCheckBox((uint32_t *)bitfield, (uint32_t)bit, text, smallText, layoutParams) {} + BitCheckBox(int *bitfield, int bit, std::string_view text, std::string_view smallText = "", LayoutParams *layoutParams = nullptr) : BitCheckBox((uint32_t *)bitfield, (uint32_t)bit, text, smallText, layoutParams) {} void Toggle() override; bool Toggled() const override; @@ -988,7 +988,7 @@ class TextView : public InertView { void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override; void Draw(UIContext &dc) override; - void SetText(const std::string &text) { text_ = text; } + void SetText(std::string_view text) { text_ = text; } const std::string &GetText() const { return text_; } std::string DescribeText() const override { return GetText(); } void SetSmall(bool small) { small_ = small; } @@ -1016,8 +1016,8 @@ class TextView : public InertView { class TextEdit : public View { public: - TextEdit(const std::string &text, const std::string &title, const std::string &placeholderText, LayoutParams *layoutParams = nullptr); - void SetText(const std::string &text) { text_ = text; scrollPos_ = 0; caret_ = (int)text_.size(); } + TextEdit(std::string_view text, std::string_view title, std::string_view placeholderText, LayoutParams *layoutParams = nullptr); + void SetText(std::string_view text) { text_ = text; scrollPos_ = 0; caret_ = (int)text_.size(); } void SetTextColor(uint32_t color) { textColor_ = color; hasTextColor_ = true; } const std::string &GetText() const { return text_; } void SetMaxLen(size_t maxLen) { maxLen_ = maxLen; } diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 2b4f4ec5a192..45797d30cef9 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -189,7 +189,7 @@ std::string ViewGroup::DescribeText() const { return ss.str(); } -std::string ViewGroup::DescribeListUnordered(const char *heading) const { +std::string ViewGroup::DescribeListUnordered(std::string_view heading) const { std::stringstream ss; ss << heading << "\n"; @@ -206,7 +206,7 @@ std::string ViewGroup::DescribeListUnordered(const char *heading) const { return ss.str(); } -std::string ViewGroup::DescribeListOrdered(const char *heading) const { +std::string ViewGroup::DescribeListOrdered(std::string_view heading) const { std::stringstream ss; ss << heading << "\n"; @@ -973,7 +973,7 @@ void TabHolder::AddBack(UIScreen *parent) { } } -void TabHolder::AddTabContents(const std::string &title, View *tabContents) { +void TabHolder::AddTabContents(std::string_view title, View *tabContents) { tabContents->ReplaceLayoutParams(new AnchorLayoutParams(FILL_PARENT, FILL_PARENT)); tabs_.push_back(tabContents); tabStrip_->AddChoice(title); @@ -1075,7 +1075,7 @@ ChoiceStrip::ChoiceStrip(Orientation orientation, LayoutParams *layoutParams) SetSpacing(0.0f); } -void ChoiceStrip::AddChoice(const std::string &title) { +void ChoiceStrip::AddChoice(std::string_view title) { StickyChoice *c = new StickyChoice(title, "", orientation_ == ORIENT_HORIZONTAL ? nullptr : @@ -1174,7 +1174,7 @@ StickyChoice *ChoiceStrip::Choice(int index) { return nullptr; } -CollapsibleSection::CollapsibleSection(const std::string &title, LayoutParams *layoutParams) : LinearLayout(ORIENT_VERTICAL, layoutParams) { +CollapsibleSection::CollapsibleSection(std::string_view title, LayoutParams *layoutParams) : LinearLayout(ORIENT_VERTICAL, layoutParams) { open_ = &localOpen_; SetSpacing(0.0f); diff --git a/Common/UI/ViewGroup.h b/Common/UI/ViewGroup.h index 76918c9ed725..c5f3d9208d1d 100644 --- a/Common/UI/ViewGroup.h +++ b/Common/UI/ViewGroup.h @@ -82,8 +82,8 @@ class ViewGroup : public View { std::string DescribeText() const override; protected: - std::string DescribeListUnordered(const char *heading) const; - std::string DescribeListOrdered(const char *heading) const; + std::string DescribeListUnordered(std::string_view heading) const; + std::string DescribeListOrdered(std::string_view heading) const; std::vector views_; View *defaultFocusView_ = nullptr; @@ -261,7 +261,7 @@ class ChoiceStrip : public LinearLayout { public: ChoiceStrip(Orientation orientation, LayoutParams *layoutParams = 0); - void AddChoice(const std::string &title); + void AddChoice(std::string_view title); void AddChoice(ImageID buttonImage); int GetSelection() const { return selected_; } @@ -291,7 +291,7 @@ class TabHolder : public LinearLayout { TabHolder(Orientation orientation, float stripSize, LayoutParams *layoutParams = 0); template - T *AddTab(const std::string &title, T *tabContents) { + T *AddTab(std::string_view title, T *tabContents) { AddTabContents(title, (View *)tabContents); return tabContents; } @@ -309,7 +309,7 @@ class TabHolder : public LinearLayout { void PersistData(PersistStatus status, std::string anonId, PersistMap &storage) override; private: - void AddTabContents(const std::string &title, View *tabContents); + void AddTabContents(std::string_view title, View *tabContents); EventReturn OnTabClick(EventParams &e); LinearLayout *tabContainer_ = nullptr; @@ -327,7 +327,7 @@ class CollapsibleHeader; class CollapsibleSection : public LinearLayout { public: - CollapsibleSection(const std::string &title, LayoutParams *layoutParams = nullptr); + CollapsibleSection(std::string_view title, LayoutParams *layoutParams = nullptr); void Update() override; diff --git a/Core/Config.cpp b/Core/Config.cpp index 008ef0c127ed..6a91e5379557 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1057,7 +1057,7 @@ void Config::LoadLangValuesMapping() { } } -const std::map> &Config::GetLangValuesMapping() { +const std::map, std::less<>> &Config::GetLangValuesMapping() { if (langValuesMapping_.empty()) { LoadLangValuesMapping(); } diff --git a/Core/Config.h b/Core/Config.h index a7a8c039f815..c6f6e55a9add 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -606,7 +606,7 @@ struct Config { bool HasRecentIsos() const; void ClearRecentIsos(); - const std::map> &GetLangValuesMapping(); + const std::map, std::less<>> &GetLangValuesMapping(); bool LoadAppendedConfig(); void SetAppendedConfigIni(const Path &path); void UpdateAfterSettingAutoFrameSkip(); @@ -630,7 +630,7 @@ struct Config { std::string gameId_; std::string gameIdTitle_; std::vector recentIsos; - std::map> langValuesMapping_; + std::map, std::less<>> langValuesMapping_; PlayTimeTracker playTimeTracker_; Path iniFilename_; Path controllerIniFilename_; diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index dd05b2441cb1..cbd6b42426f1 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -300,13 +300,12 @@ PPGeImageStyle PSPDialog::FadedImageStyle() { return style; } -void PSPDialog::DisplayButtons(int flags, const char *caption) -{ +void PSPDialog::DisplayButtons(int flags, std::string_view caption) { bool useCaption = false; char safeCaption[65] = {0}; - if (caption != NULL && *caption != '\0') { + if (!caption.empty()) { useCaption = true; - truncate_cpy(safeCaption, caption); + truncate_cpy(safeCaption, sizeof(safeCaption), caption); } PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_LEFT, FONT_SCALE); @@ -318,12 +317,12 @@ void PSPDialog::DisplayButtons(int flags, const char *caption) x2 = 183.5f; } if (flags & DS_BUTTON_OK) { - const char *text = useCaption ? safeCaption : di->T("Enter"); + std::string_view text = useCaption ? safeCaption : di->T("Enter"); PPGeDrawImage(okButtonImg, x2, 256, 11.5f, 11.5f, textStyle); PPGeDrawText(text, x2 + 14.5f, 252, textStyle); } if (flags & DS_BUTTON_CANCEL) { - const char *text = useCaption ? safeCaption : di->T("Back"); + std::string_view text = useCaption ? safeCaption : di->T("Back"); PPGeDrawImage(cancelButtonImg, x1, 256, 11.5f, 11.5f, textStyle); PPGeDrawText(text, x1 + 14.5f, 252, textStyle); } diff --git a/Core/Dialog/PSPDialog.h b/Core/Dialog/PSPDialog.h index 641829c4d40b..8e254f401fb1 100644 --- a/Core/Dialog/PSPDialog.h +++ b/Core/Dialog/PSPDialog.h @@ -97,7 +97,7 @@ class PSPDialog bool IsButtonPressed(int checkButton); bool IsButtonHeld(int checkButton, int &framesHeld, int framesHeldThreshold = 30, int framesHeldRepeatRate = 10); // The caption override is assumed to have a size of 64 bytes. - void DisplayButtons(int flags, const char *caption = NULL); + void DisplayButtons(int flags, std::string_view caption = ""); void ChangeStatus(DialogStatus newStatus, int delayUs); void ChangeStatusInit(int delayUs); void ChangeStatusShutdown(int delayUs); diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index 6b23fde60b64..cb6bc99e4a1c 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -151,7 +151,7 @@ void PSPMsgDialog::FormatErrorCode(uint32_t code) { switch (code) { case SCE_UTILITY_SAVEDATA_ERROR_LOAD_DATA_BROKEN: - snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataDataBroken", "Save data was corrupt."), code); + snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataDataBroken", "Save data was corrupt."), code); break; case SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_MS: @@ -159,23 +159,23 @@ void PSPMsgDialog::FormatErrorCode(uint32_t code) { case SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_MS: case SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_MS: case SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_MS: - snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataNoMS", "Memory stick not inserted."), code); + snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataNoMS", "Memory stick not inserted."), code); break; case SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA: case SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA: case SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA: case SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA: - snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataNoData", "Warning: no save data was found."), code); + snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataNoData", "Warning: no save data was found."), code); break; case SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_FULL: case SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE: - snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataMSFull", "Memory stick full. Check your storage space."), code); + snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataMSFull", "Memory stick full. Check your storage space."), code); break; default: - snprintf(msgText, 512, "%s %08x", err->T("MsgErrorCode", "Error code:"), code); + snprintf(msgText, 512, "%s %08x", err->T_cstr("MsgErrorCode", "Error code:"), code); } } @@ -187,7 +187,7 @@ void PSPMsgDialog::DisplayMessage(const std::string &text, bool hasYesNo, bool h // Without the scrollbar, we have 390 total pixels. float WRAP_WIDTH = 340.0f; - if ((size_t)UTF8StringNonASCIICount(text.c_str()) >= text.size() / 4) { + if ((size_t)UTF8StringNonASCIICount(text) >= text.size() / 4) { WRAP_WIDTH = 376.0f; if (text.size() > 12) { messageStyle.scale = 0.6f; @@ -195,7 +195,7 @@ void PSPMsgDialog::DisplayMessage(const std::string &text, bool hasYesNo, bool h } float totalHeight = 0.0f; - PPGeMeasureText(nullptr, &totalHeight, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); + PPGeMeasureText(nullptr, &totalHeight, text, FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); // The PSP normally only shows about 8 lines at a time. // For improved UX, we intentionally show part of the next line. float visibleHeight = std::min(totalHeight, 175.0f); diff --git a/Core/Dialog/PSPNetconfDialog.cpp b/Core/Dialog/PSPNetconfDialog.cpp index 55143dcf4f95..a5c4c2e8c40c 100644 --- a/Core/Dialog/PSPNetconfDialog.cpp +++ b/Core/Dialog/PSPNetconfDialog.cpp @@ -103,7 +103,7 @@ void PSPNetconfDialog::DrawIndicator() { PPGeDrawImage(456, 248, 20.0f, 20.0f, 1, 10, 1, 10, 10, 10, FadedImageStyle()); } -void PSPNetconfDialog::DisplayMessage(const std::string &text1, const std::string &text2a, const std::string &text2b, const std::string &text3a, const std::string &text3b, bool hasYesNo, bool hasOK) { +void PSPNetconfDialog::DisplayMessage(std::string_view text1, std::string_view text2a, std::string_view text2b, std::string_view text3a, std::string_view text3b, bool hasYesNo, bool hasOK) { auto di = GetI18NCategory(I18NCat::DIALOG); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); @@ -111,12 +111,12 @@ void PSPNetconfDialog::DisplayMessage(const std::string &text1, const std::strin PPGeStyle messageStyleRight = FadedStyle(PPGeAlign::BOX_RIGHT, FONT_SCALE); PPGeStyle messageStyleLeft = FadedStyle(PPGeAlign::BOX_LEFT, FONT_SCALE); - std::string text2 = text2a + " " + text2b; - std::string text3 = text3a + " " + text3b; + std::string text2 = std::string(text2a) + " " + std::string(text2b); + std::string text3 = std::string(text3a) + " " + std::string(text3b); // Without the scrollbar, we have 350 total pixels. float WRAP_WIDTH = 300.0f; - if (UTF8StringNonASCIICount(text1.c_str()) >= (int)text1.size() / 4) { + if (UTF8StringNonASCIICount(text1) >= (int)text1.size() / 4) { WRAP_WIDTH = 336.0f; if (text1.size() > 12) { messageStyle.scale = 0.6f; @@ -124,13 +124,13 @@ void PSPNetconfDialog::DisplayMessage(const std::string &text1, const std::strin } float totalHeight1 = 0.0f; - PPGeMeasureText(nullptr, &totalHeight1, text1.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); + PPGeMeasureText(nullptr, &totalHeight1, text1, FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); float totalHeight2 = 0.0f; if (text2 != " ") - PPGeMeasureText(nullptr, &totalHeight2, text2.c_str(), FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); + PPGeMeasureText(nullptr, &totalHeight2, text2, FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); float totalHeight3 = 0.0f; if (text3 != " ") - PPGeMeasureText(nullptr, &totalHeight3, text3.c_str(), FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); + PPGeMeasureText(nullptr, &totalHeight3, text3, FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); float marginTop = 0.0f; if (text2 != " " || text3 != " ") marginTop = 11.0f; @@ -183,23 +183,23 @@ void PSPNetconfDialog::DisplayMessage(const std::string &text1, const std::strin } PPGeScissor(0, (int)(centerY - h2 - 2), 480, (int)(centerY + h2 + 2)); - PPGeDrawTextWrapped(text1.c_str(), 240.0f, centerY - h2 - scrollPos_, WRAP_WIDTH, 0, messageStyle); + PPGeDrawTextWrapped(text1, 240.0f, centerY - h2 - scrollPos_, WRAP_WIDTH, 0, messageStyle); if (!text2a.empty()) { if (!text2b.empty()) - PPGeDrawTextWrapped(text2a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleRight); + PPGeDrawTextWrapped(text2a, 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleRight); else - PPGeDrawTextWrapped(text2a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyle); + PPGeDrawTextWrapped(text2a, 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyle); } if (!text2b.empty()) - PPGeDrawTextWrapped(text2b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); + PPGeDrawTextWrapped(text2b, 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); if (!text3a.empty()) { if (!text3b.empty()) - PPGeDrawTextWrapped(text3a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleRight); + PPGeDrawTextWrapped(text3a, 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleRight); else - PPGeDrawTextWrapped(text3a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyle); + PPGeDrawTextWrapped(text3a, 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyle); } if (!text3b.empty()) - PPGeDrawTextWrapped(text3b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); + PPGeDrawTextWrapped(text3b, 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); PPGeScissorReset(); // Do we need a scrollbar? @@ -329,7 +329,8 @@ int PSPNetconfDialog::Update(int animSpeed) { if (timedout) { // FIXME: Do we need to show error message? - DisplayMessage(di->T("InternalError", "An internal error has occurred.") + StringFromFormat("\n(%08X)", connResult)); + std::string message(di->T("InternalError", "An internal error has occurred.")); + DisplayMessage(message + StringFromFormat("\n(%08X)", connResult)); DisplayButtons(DS_BUTTON_CANCEL, di->T("Back")); } else { @@ -337,7 +338,7 @@ int PSPNetconfDialog::Update(int animSpeed) { if (g_Config.iWlanAdhocChannel == PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC) channel = "Automatic"; - DisplayMessage(di->T("ConnectingPleaseWait", "Connecting.\nPlease wait..."), di->T("Channel:") + std::string(" ") + di->T(channel)); + DisplayMessage(di->T("ConnectingPleaseWait", "Connecting.\nPlease wait..."), std::string(di->T("Channel:")) + std::string(" ") + std::string(di->T(channel))); // Only Join mode is showing Cancel button on KHBBS and the button will fade out before the dialog is fading out, probably because it's already connected thus can't be canceled anymore if (request.netAction == NETCONF_JOIN_ADHOC) diff --git a/Core/Dialog/PSPNetconfDialog.h b/Core/Dialog/PSPNetconfDialog.h index e2d06f3739d7..97895b3e6460 100644 --- a/Core/Dialog/PSPNetconfDialog.h +++ b/Core/Dialog/PSPNetconfDialog.h @@ -52,7 +52,7 @@ class PSPNetconfDialog: public PSPDialog { } private: - void DisplayMessage(const std::string &text1, const std::string &text2a = "", const std::string &text2b = "", const std::string &text3a = "", const std::string &text3b = "", bool hasYesNo = false, bool hasOK = false); + void DisplayMessage(std::string_view text1, std::string_view text2a = "", std::string_view text2b = "", std::string_view text3a = "", std::string_view text3b = "", bool hasYesNo = false, bool hasOK = false); void DrawBanner(); void DrawIndicator(); diff --git a/Core/Dialog/PSPNpSigninDialog.cpp b/Core/Dialog/PSPNpSigninDialog.cpp index 22caaf2c9d17..57d8cce705a2 100644 --- a/Core/Dialog/PSPNpSigninDialog.cpp +++ b/Core/Dialog/PSPNpSigninDialog.cpp @@ -100,7 +100,7 @@ void PSPNpSigninDialog::DrawLogo() { PPGeDrawImage(416, 22, 64.0f, 64.0f, 1, 10, 1, 10, 64, 64, FadedImageStyle()); } -void PSPNpSigninDialog::DisplayMessage(const std::string &text1, const std::string &text2a, const std::string &text2b, const std::string &text3a, const std::string &text3b, bool hasYesNo, bool hasOK) { +void PSPNpSigninDialog::DisplayMessage(std::string_view text1, std::string_view text2a, std::string_view text2b, std::string_view text3a, std::string_view text3b, bool hasYesNo, bool hasOK) { auto di = GetI18NCategory(I18NCat::DIALOG); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); @@ -108,12 +108,12 @@ void PSPNpSigninDialog::DisplayMessage(const std::string &text1, const std::stri PPGeStyle messageStyleRight = FadedStyle(PPGeAlign::BOX_RIGHT, FONT_SCALE); PPGeStyle messageStyleLeft = FadedStyle(PPGeAlign::BOX_LEFT, FONT_SCALE); - std::string text2 = text2a + " " + text2b; - std::string text3 = text3a + " " + text3b; + std::string text2 = std::string(text2a) + " " + std::string(text2b); + std::string text3 = std::string(text3a) + " " + std::string(text3b); // Without the scrollbar, we have 350 total pixels. float WRAP_WIDTH = 300.0f; - if (UTF8StringNonASCIICount(text1.c_str()) >= (int)text1.size() / 4) { + if (UTF8StringNonASCIICount(text1) >= (int)text1.size() / 4) { WRAP_WIDTH = 336.0f; if (text1.size() > 12) { messageStyle.scale = 0.6f; @@ -121,13 +121,13 @@ void PSPNpSigninDialog::DisplayMessage(const std::string &text1, const std::stri } float totalHeight1 = 0.0f; - PPGeMeasureText(nullptr, &totalHeight1, text1.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); + PPGeMeasureText(nullptr, &totalHeight1, text1, FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); float totalHeight2 = 0.0f; if (text2 != " ") - PPGeMeasureText(nullptr, &totalHeight2, text2.c_str(), FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); + PPGeMeasureText(nullptr, &totalHeight2, text2, FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); float totalHeight3 = 0.0f; if (text3 != " ") - PPGeMeasureText(nullptr, &totalHeight3, text3.c_str(), FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); + PPGeMeasureText(nullptr, &totalHeight3, text3, FONT_SCALE, PPGE_LINE_USE_ELLIPSIS, WRAP_WIDTH); float marginTop = 0.0f; if (text2 != " " || text3 != " ") marginTop = 11.0f; @@ -180,23 +180,23 @@ void PSPNpSigninDialog::DisplayMessage(const std::string &text1, const std::stri } PPGeScissor(0, (int)(centerY - h2 - 2), 480, (int)(centerY + h2 + 2)); - PPGeDrawTextWrapped(text1.c_str(), 240.0f, centerY - h2 - scrollPos_, WRAP_WIDTH, 0, messageStyle); + PPGeDrawTextWrapped(text1, 240.0f, centerY - h2 - scrollPos_, WRAP_WIDTH, 0, messageStyle); if (!text2a.empty()) { if (!text2b.empty()) - PPGeDrawTextWrapped(text2a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleRight); + PPGeDrawTextWrapped(text2a, 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleRight); else - PPGeDrawTextWrapped(text2a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyle); + PPGeDrawTextWrapped(text2a, 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyle); } if (!text2b.empty()) - PPGeDrawTextWrapped(text2b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); + PPGeDrawTextWrapped(text2b, 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); if (!text3a.empty()) { if (!text3b.empty()) - PPGeDrawTextWrapped(text3a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleRight); + PPGeDrawTextWrapped(text3a, 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleRight); else - PPGeDrawTextWrapped(text3a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyle); + PPGeDrawTextWrapped(text3a, 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyle); } if (!text3b.empty()) - PPGeDrawTextWrapped(text3b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); + PPGeDrawTextWrapped(text3b, 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleLeft); PPGeScissorReset(); // Do we need a scrollbar? diff --git a/Core/Dialog/PSPNpSigninDialog.h b/Core/Dialog/PSPNpSigninDialog.h index 5b67b508da5f..525b37cda388 100644 --- a/Core/Dialog/PSPNpSigninDialog.h +++ b/Core/Dialog/PSPNpSigninDialog.h @@ -48,7 +48,7 @@ class PSPNpSigninDialog: public PSPDialog { } private: - void DisplayMessage(const std::string &text1, const std::string &text2a = "", const std::string &text2b = "", const std::string &text3a = "", const std::string &text3b = "", bool hasYesNo = false, bool hasOK = false); + void DisplayMessage(std::string_view text1, std::string_view text2a = "", std::string_view text2b = "", std::string_view text3a = "", std::string_view text3b = "", bool hasYesNo = false, bool hasOK = false); void DrawBanner(); void DrawIndicator(); void DrawLogo(); diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 025d701d05cc..dfcd4a634f2e 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -44,7 +44,7 @@ const static int OSK_INIT_DELAY_US = 300000; const static int OSK_SHUTDOWN_DELAY_US = 40000; -static std::map> languageMapping; +static std::map, std::less<>> languageMapping; const uint8_t numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12, 12, 12}; const uint8_t numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 6, 6, 5, 4, 4, 4, 4}; diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 31f59b29bea5..322315d8bc63 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -347,9 +347,8 @@ void PSPSaveDialog::DisplayBanner(int which) PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_VCENTER, 0.6f); textStyle.hasShadow = false; - const char *title; - switch (which) - { + std::string_view title; + switch (which) { case DB_SAVE: title = di->T("Save"); break; @@ -580,18 +579,18 @@ void PSPSaveDialog::DisplaySaveDataInfo2(bool showNewData) { PPGeDrawText(saveinfoTxt.c_str(), 8, 200, textStyle); } -void PSPSaveDialog::DisplayMessage(const std::string &text, bool hasYesNo) +void PSPSaveDialog::DisplayMessage(std::string_view text, bool hasYesNo) { PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); const float WRAP_WIDTH = 254.0f; float y = 136.0f, h; - PPGeMeasureText(nullptr, &h, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); + PPGeMeasureText(nullptr, &h, text, FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); float h2 = h / 2.0f; if (hasYesNo) { auto di = GetI18NCategory(I18NCat::DIALOG); - const char *choiceText; + std::string_view choiceText; float x, w; if (yesnoChoice == 1) { choiceText = di->T("Yes"); @@ -617,7 +616,7 @@ void PSPSaveDialog::DisplayMessage(const std::string &text, bool hasYesNo) yesnoChoice = 0; } } - PPGeDrawTextWrapped(text.c_str(), 334.0f, y, WRAP_WIDTH, 0, textStyle); + PPGeDrawTextWrapped(text, 334.0f, y, WRAP_WIDTH, 0, textStyle); float sy = 122.0f - h2, ey = 150.0f + h2; PPGeDrawRect(202.0f, sy, 466.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawRect(202.0f, ey, 466.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF)); diff --git a/Core/Dialog/PSPSaveDialog.h b/Core/Dialog/PSPSaveDialog.h index d068a07a6ba0..6c28f716a9d4 100644 --- a/Core/Dialog/PSPSaveDialog.h +++ b/Core/Dialog/PSPSaveDialog.h @@ -94,7 +94,7 @@ class PSPSaveDialog: public PSPDialog { void DisplaySaveIcon(bool checkExists); void DisplaySaveDataInfo1(); void DisplaySaveDataInfo2(bool showNewData = false); - void DisplayMessage(const std::string &text, bool hasYesNo = false); + void DisplayMessage(std::string_view text, bool hasYesNo = false); const std::string GetSelectedSaveDirName() const; void JoinIOThread(); diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 5c99439982d5..8e932d598feb 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -1334,7 +1334,7 @@ void sendChat(const std::string &chatString) { } else { std::lock_guard guard(chatLogLock); auto n = GetI18NCategory(I18NCat::NETWORKING); - chatLog.push_back(n->T("You're in Offline Mode, go to lobby or online hall")); + chatLog.push_back(std::string(n->T("You're in Offline Mode, go to lobby or online hall"))); chatMessageGeneration++; } } @@ -1385,7 +1385,7 @@ int friendFinder(){ g_adhocServerIP.in.sin_addr.s_addr = INADDR_NONE; if (g_Config.bEnableWlan && !net::DNSResolve(g_Config.proAdhocServer, "", &resolved, err)) { ERROR_LOG(SCENET, "DNS Error Resolving %s\n", g_Config.proAdhocServer.c_str()); - g_OSD.Show(OSDType::MESSAGE_ERROR, n->T("DNS Error Resolving ") + g_Config.proAdhocServer); + g_OSD.Show(OSDType::MESSAGE_ERROR, std::string(n->T("DNS Error Resolving ")) + g_Config.proAdhocServer); } if (resolved) { for (auto ptr = resolved; ptr != NULL; ptr = ptr->ai_next) { diff --git a/Core/RetroAchievements.cpp b/Core/RetroAchievements.cpp index af382742ba9d..5ed7ee50e80d 100644 --- a/Core/RetroAchievements.cpp +++ b/Core/RetroAchievements.cpp @@ -147,13 +147,13 @@ size_t GetRichPresenceMessage(char *buffer, size_t bufSize) { return rc_client_get_rich_presence_message(g_rcClient, buffer, bufSize); } -bool WarnUserIfHardcoreModeActive(bool isSaveStateAction, const char *message) { +bool WarnUserIfHardcoreModeActive(bool isSaveStateAction, std::string_view message) { if (!HardcoreModeActive() || (isSaveStateAction && g_Config.bAchievementsSaveStateInHardcoreMode)) { return false; } - const char *showMessage = message; - if (!message) { + std::string_view showMessage = message; + if (message.empty()) { auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); showMessage = ac->T("This feature is not available in Hardcore Mode"); } diff --git a/Core/RetroAchievements.h b/Core/RetroAchievements.h index d158a03a37ed..324976128b01 100644 --- a/Core/RetroAchievements.h +++ b/Core/RetroAchievements.h @@ -75,7 +75,7 @@ bool HardcoreModeActive(); // If no message is specified, a standard "This feature is not available in Hardcore Mode" message will be shown. // Also returns true if hardcore mode is active. // Specify isSaveAction so we can still permit saves (but not loads) in hardcore mode if that option is enabled. -bool WarnUserIfHardcoreModeActive(bool isSaveStateAction, const char *message = nullptr); +bool WarnUserIfHardcoreModeActive(bool isSaveStateAction, std::string_view message = ""); // Returns the length of the string. If (size_t)-1, there's no message. size_t GetRichPresenceMessage(char *buffer, size_t bufSize); diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index a4152f4f4bf3..fdb283e5779c 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -497,7 +497,7 @@ namespace SaveState if (detectSlot(UNDO_STATE_EXTENSION)) { auto sy = GetI18NCategory(I18NCat::SYSTEM); // Allow the number to be positioned where it makes sense. - std::string undo = sy->T("undo %c"); + std::string undo(sy->T("undo %c")); return title + " (" + StringFromFormat(undo.c_str(), slotChar) + ")"; } @@ -517,7 +517,7 @@ namespace SaveState // The file can't be loaded - let's note that. auto sy = GetI18NCategory(I18NCat::SYSTEM); - return filename.GetFilename() + " " + sy->T("(broken)"); + return filename.GetFilename() + " " + std::string(sy->T("(broken)")); } std::string GenerateFullDiscId(const Path &gameFilename) { @@ -581,14 +581,14 @@ namespace SaveState if (g_Config.bEnableStateUndo) { Path backup = GetSysDirectory(DIRECTORY_SAVESTATE) / LOAD_UNDO_NAME; - auto saveCallback = [=](Status status, const std::string &message, void *data) { + auto saveCallback = [=](Status status, std::string_view message, void *data) { if (status != Status::FAILURE) { DeleteIfExists(backup); File::Rename(backup.WithExtraExtension(".tmp"), backup); g_Config.sStateLoadUndoGame = GenerateFullDiscId(gameFilename); g_Config.Save("Saving config for savestate last load undo"); } else { - ERROR_LOG(SAVESTATE, "Saving load undo state failed: %s", message.c_str()); + ERROR_LOG(SAVESTATE, "Saving load undo state failed: %.*s", (int)message.size(), message.data()); } Load(fn, slot, callback, cbUserData); }; @@ -639,7 +639,7 @@ namespace SaveState Path fnUndo = GenerateSaveSlotFilename(gameFilename, slot, UNDO_STATE_EXTENSION); if (!fn.empty()) { Path shot = GenerateSaveSlotFilename(gameFilename, slot, SCREENSHOT_EXTENSION); - auto renameCallback = [=](Status status, const std::string &message, void *data) { + auto renameCallback = [=](Status status, std::string_view message, void *data) { if (status != Status::FAILURE) { if (g_Config.bEnableStateUndo) { DeleteIfExists(fnUndo); @@ -939,12 +939,8 @@ namespace SaveState std::string title; auto sc = GetI18NCategory(I18NCat::SCREEN); - const char *i18nLoadFailure = sc->T("Load savestate failed", ""); - const char *i18nSaveFailure = sc->T("Save State Failed", ""); - if (strlen(i18nLoadFailure) == 0) - i18nLoadFailure = sc->T("Failed to load state"); - if (strlen(i18nSaveFailure) == 0) - i18nSaveFailure = sc->T("Failed to save state"); + const char *i18nLoadFailure = sc->T_cstr("Failed to load state"); + const char *i18nSaveFailure = sc->T_cstr("Failed to save state"); std::string slot_prefix = op.slot >= 0 ? StringFromFormat("(%d) ", op.slot + 1) : ""; std::string errorString; @@ -997,7 +993,7 @@ namespace SaveState } result = CChunkFileReader::Save(op.filename, title, PPSSPP_GIT_VERSION, state); if (result == CChunkFileReader::ERROR_NONE) { - callbackMessage = slot_prefix + sc->T("Saved State"); + callbackMessage = slot_prefix + std::string(sc->T("Saved State")); callbackResult = Status::SUCCESS; #ifndef MOBILE_DEVICE if (g_Config.bSaveLoadResetsAVdumping) { diff --git a/Core/SaveState.h b/Core/SaveState.h index 069a1052eff0..b059725d529a 100644 --- a/Core/SaveState.h +++ b/Core/SaveState.h @@ -19,6 +19,7 @@ #include #include +#include #include #include "Common/File/Path.h" @@ -31,7 +32,7 @@ namespace SaveState WARNING, SUCCESS, }; - typedef std::function Callback; + typedef std::function Callback; static const int NUM_SLOTS = 5; static const char * const STATE_EXTENSION = "ppst"; diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 844983e21a35..7e01533a40ce 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -413,7 +413,7 @@ bool GameManager::DetectTexturePackDest(struct zip *z, int iniIndex, Path &dest) return true; } -void GameManager::SetInstallError(const std::string &err) { +void GameManager::SetInstallError(std::string_view err) { installProgress_ = 0.0f; installError_ = err; InstallDone(); diff --git a/Core/Util/GameManager.h b/Core/Util/GameManager.h index ec4ad5b8c2b3..8ac0c6d0282c 100644 --- a/Core/Util/GameManager.h +++ b/Core/Util/GameManager.h @@ -90,7 +90,7 @@ class GameManager { bool ExtractFile(struct zip *z, int file_index, const Path &outFilename, size_t *bytesCopied, size_t allBytes); bool DetectTexturePackDest(struct zip *z, int iniIndex, Path &dest); - void SetInstallError(const std::string &err); + void SetInstallError(std::string_view err); bool InstallInProgress() const { return installThread_.joinable(); } diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 2e0b69b6c839..bfc2ee64e733 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -137,7 +137,7 @@ void PPGeSetDrawContext(Draw::DrawContext *draw) { } // Overwrite the current text lines buffer so it can be drawn later. -void PPGePrepareText(const char *text, float x, float y, PPGeAlign align, float scale, float lineHeightScale, +void PPGePrepareText(std::string_view text, float x, float y, PPGeAlign align, float scale, float lineHeightScale, int WrapType = PPGE_LINE_NONE, int wrapWidth = 0); // These functions must be called between PPGeBegin and PPGeEnd. @@ -519,7 +519,7 @@ static const AtlasChar *PPGeGetChar(const AtlasFont &atlasfont, unsigned int cva } // Break a single text string into mutiple lines. -static AtlasTextMetrics BreakLines(const char *text, const AtlasFont &atlasfont, float x, float y, +static AtlasTextMetrics BreakLines(std::string_view text, const AtlasFont &atlasfont, float x, float y, PPGeAlign align, float scale, float lineHeightScale, int wrapType, float wrapWidth, bool dryRun) { y += atlasfont.ascend * scale; @@ -773,8 +773,7 @@ static std::string PPGeSanitizeText(std::string_view text) { return SanitizeUTF8(text); } -void PPGeMeasureText(float *w, float *h, const char *text, float scale, int WrapType, int wrapWidth) { - _dbg_assert_(text); +void PPGeMeasureText(float *w, float *h, std::string_view text, float scale, int WrapType, int wrapWidth) { std::string s = PPGeSanitizeText(text); if (HasTextDrawer()) { @@ -809,7 +808,7 @@ void PPGeMeasureText(float *w, float *h, const char *text, float scale, int Wrap if (h) *h = metrics.lineHeight * metrics.numLines; } -void PPGePrepareText(const char *text, float x, float y, PPGeAlign align, float scale, float lineHeightScale, int WrapType, int wrapWidth) +void PPGePrepareText(std::string_view text, float x, float y, PPGeAlign align, float scale, float lineHeightScale, int WrapType, int wrapWidth) { const AtlasFont &atlasfont = g_ppge_atlas.fonts[0]; if (!g_ppge_atlas.IsMetadataLoaded() || g_ppge_atlas.num_fonts < 1) { @@ -1056,10 +1055,7 @@ static void PPGeDecimateTextImages(int age) { } } -void PPGeDrawText(const char *text, float x, float y, const PPGeStyle &style) { - if (!text) { - return; - } +void PPGeDrawText(std::string_view text, float x, float y, const PPGeStyle &style) { std::string str = PPGeSanitizeText(text); if (str.empty()) { return; @@ -1106,7 +1102,7 @@ static std::string_view CropLinesToCount(std::string_view s, int numLines) { return s.substr(0, len); } -void PPGeDrawTextWrapped(const char *text, float x, float y, float wrapWidth, float wrapHeight, const PPGeStyle &style) { +void PPGeDrawTextWrapped(std::string_view text, float x, float y, float wrapWidth, float wrapHeight, const PPGeStyle &style) { std::string s = PPGeSanitizeText(text); if (wrapHeight != 0.0f) { s = StripTrailingWhite(s); @@ -1155,7 +1151,7 @@ void PPGeDrawTextWrapped(const char *text, float x, float y, float wrapWidth, fl int sx = style.hasShadow ? 1 : 0; int sy = style.hasShadow ? 2 : 0; - PPGePrepareText(s.c_str(), x + sx, y + sy, style.align, style.scale, style.scale, PPGE_LINE_USE_ELLIPSIS | PPGE_LINE_WRAP_WORD, wrapWidth); + PPGePrepareText(s, x + sx, y + sy, style.align, style.scale, style.scale, PPGE_LINE_USE_ELLIPSIS | PPGE_LINE_WRAP_WORD, wrapWidth); float scale = style.scale; float lineHeightScale = style.scale; @@ -1176,12 +1172,12 @@ void PPGeDrawTextWrapped(const char *text, float x, float y, float wrapWidth, fl // Try to keep the font as large as possible, so reduce the line height some. scale = reduced * 1.15f; lineHeightScale = reduced; - PPGePrepareText(s.c_str(), x + sx, y + sy, style.align, scale, lineHeightScale, PPGE_LINE_USE_ELLIPSIS | PPGE_LINE_WRAP_WORD, wrapWidth); + PPGePrepareText(s, x + sx, y + sy, style.align, scale, lineHeightScale, PPGE_LINE_USE_ELLIPSIS | PPGE_LINE_WRAP_WORD, wrapWidth); } if (style.hasShadow) { // This doesn't have the nicer shadow because it's so many verts. PPGeDrawCurrentText(style.shadowColor); - PPGePrepareText(s.c_str(), x, y, style.align, scale, lineHeightScale, PPGE_LINE_USE_ELLIPSIS | PPGE_LINE_WRAP_WORD, wrapWidth); + PPGePrepareText(s, x, y, style.align, scale, lineHeightScale, PPGE_LINE_USE_ELLIPSIS | PPGE_LINE_WRAP_WORD, wrapWidth); } PPGeDrawCurrentText(style.color); } @@ -1347,7 +1343,7 @@ void PPGeDisableTexture() std::vector PPGeImage::loadedTextures_; -PPGeImage::PPGeImage(const std::string &pspFilename) +PPGeImage::PPGeImage(std::string_view pspFilename) : filename_(pspFilename) { } diff --git a/Core/Util/PPGeDraw.h b/Core/Util/PPGeDraw.h index ee02acb8cc6a..347a368be81f 100644 --- a/Core/Util/PPGeDraw.h +++ b/Core/Util/PPGeDraw.h @@ -19,6 +19,7 @@ #include #include +#include #include "Common/Render/TextureAtlas.h" @@ -87,12 +88,12 @@ struct PPGeImageStyle { }; // Get the metrics of the bounding box of the text without changing the buffer or state. -void PPGeMeasureText(float *w, float *h, const char *text, float scale, int WrapType = PPGE_LINE_NONE, int wrapWidth = 0); +void PPGeMeasureText(float *w, float *h, std::string_view text, float scale, int WrapType = PPGE_LINE_NONE, int wrapWidth = 0); // Draws some text using the one font we have. // Clears the text buffer when done. -void PPGeDrawText(const char *text, float x, float y, const PPGeStyle &style); -void PPGeDrawTextWrapped(const char *text, float x, float y, float wrapWidth, float wrapHeight, const PPGeStyle &style); +void PPGeDrawText(std::string_view text, float x, float y, const PPGeStyle &style); +void PPGeDrawTextWrapped(std::string_view text, float x, float y, float wrapWidth, float wrapHeight, const PPGeStyle &style); // Draws a "4-patch" for button-like things that can be resized. void PPGeDraw4Patch(ImageID atlasImage, float x, float y, float w, float h, u32 color = 0xFFFFFFFF); @@ -113,7 +114,7 @@ bool PPGeIsFontTextureAddress(u32 addr); class PPGeImage { public: - PPGeImage(const std::string &pspFilename); + PPGeImage(std::string_view pspFilename); PPGeImage(u32 pngPointer, size_t pngSize); ~PPGeImage(); diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index 8cf0967e3366..6ffd58f5b07d 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -257,7 +257,7 @@ void RemoveUnknownPostShaders(std::vector *names) { } } -const ShaderInfo *GetPostShaderInfo(const std::string &name) { +const ShaderInfo *GetPostShaderInfo(std::string_view name) { for (size_t i = 0; i < shaderInfo.size(); i++) { if (shaderInfo[i].section == name) return &shaderInfo[i]; @@ -310,7 +310,7 @@ const std::vector &GetAllPostShaderInfo() { return shaderInfo; } -const TextureShaderInfo *GetTextureShaderInfo(const std::string &name) { +const TextureShaderInfo *GetTextureShaderInfo(std::string_view name) { for (auto &info : textureShaderInfo) { if (info.section == name) { return &info; diff --git a/GPU/Common/PostShader.h b/GPU/Common/PostShader.h index 882290d49f62..8165e66d5a2d 100644 --- a/GPU/Common/PostShader.h +++ b/GPU/Common/PostShader.h @@ -106,13 +106,13 @@ struct TextureShaderInfo { void ReloadAllPostShaderInfo(Draw::DrawContext *draw); -const ShaderInfo *GetPostShaderInfo(const std::string &name); +const ShaderInfo *GetPostShaderInfo(std::string_view name); std::vector GetPostShaderChain(const std::string &name); std::vector GetFullPostShadersChain(const std::vector &names); bool PostShaderChainRequires60FPS(const std::vector &chain); const std::vector &GetAllPostShaderInfo(); -const TextureShaderInfo *GetTextureShaderInfo(const std::string &name); +const TextureShaderInfo *GetTextureShaderInfo(std::string_view name); const std::vector &GetAllTextureShaderInfo(); void RemoveUnknownPostShaders(std::vector *names); diff --git a/GPU/Common/TextureReplacer.cpp b/GPU/Common/TextureReplacer.cpp index 70af848948c4..bca1b4cf0999 100644 --- a/GPU/Common/TextureReplacer.cpp +++ b/GPU/Common/TextureReplacer.cpp @@ -99,7 +99,7 @@ void TextureReplacer::NotifyConfigChanged() { // Somewhat crude message, re-using translation strings. auto d = GetI18NCategory(I18NCat::DEVELOPER); auto di = GetI18NCategory(I18NCat::DIALOG); - g_OSD.Show(OSDType::MESSAGE_INFO, std::string(d->T("Save new textures")) + ": " + di->T("Enabled"), 2.0f); + g_OSD.Show(OSDType::MESSAGE_INFO, std::string(d->T("Save new textures")) + ": " + std::string(di->T("Enabled")), 2.0f); } if (!replaceEnabled_ && wasReplaceEnabled) { diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index b66fd389d487..c20058af25d8 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -419,7 +419,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string } } -void System_Toast(const char *text) {} +void System_Toast(std::string_view text) {} void System_AskForPermission(SystemPermission permission) {} PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; } diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index a0a67456e06e..5897edcb6244 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -149,7 +149,7 @@ void MainWindow::openmsAct() QDesktopServices::openUrl(QUrl(memorystick)); } -void SaveStateActionFinished(SaveState::Status status, const std::string &message, void *userdata) +static void SaveStateActionFinished(SaveState::Status status, std::string_view message, void *userdata) { // TODO: Improve messaging? if (status == SaveState::Status::FAILURE) diff --git a/SDL/CocoaBarItems.mm b/SDL/CocoaBarItems.mm index fc6ca65355f5..90703899f495 100644 --- a/SDL/CocoaBarItems.mm +++ b/SDL/CocoaBarItems.mm @@ -70,11 +70,11 @@ + (instancetype)sharedInstance { } -(NSString *)localizedString: (const char *)key category: (I18NCat)cat { - return @(T(cat, key)); + return @(T_cstr(cat, key)); } -(NSString *)localizedMenuString: (const char *)key { - std::string processed = UnescapeMenuString(T(I18NCat::DESKTOPUI, key), nullptr); + std::string processed = UnescapeMenuString(T_cstr(I18NCat::DESKTOPUI, key), nullptr); return @(processed.c_str()); } @@ -249,7 +249,7 @@ -(void)joinTheDiscord { -(NSMenu *)makeFileSubmenu { std::shared_ptr desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI); -#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str()) +#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T_cstr(key), nil).c_str()) NSMenu *menu = [[NSMenu alloc] initWithTitle:DESKTOPUI_LOCALIZED("File")]; NSMenuItem *openWithSystemFolderBrowserItem = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Load") action:@selector(openSystemFileBrowser) keyEquivalent:@"o"]; @@ -274,10 +274,10 @@ -(NSMenu *)makeGraphicsMenu { std::shared_ptr graphicsLocalization = GetI18NCategory(I18NCat::GRAPHICS); std::shared_ptr desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI); - NSMenu *parent = [[NSMenu alloc] initWithTitle:@(mainSettingsLocalization->T("Graphics"))]; + NSMenu *parent = [[NSMenu alloc] initWithTitle:@(mainSettingsLocalization->T_cstr("Graphics"))]; NSMenu *backendsMenu = [[NSMenu alloc] init]; -#define GRAPHICS_LOCALIZED(key) @(graphicsLocalization->T(key)) -#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str()) +#define GRAPHICS_LOCALIZED(key) @(graphicsLocalization->T_cstr(key)) +#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T_cstr(key), nil).c_str()) NSMenuItem *gpuBackendItem = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Backend") action:nil keyEquivalent:@""]; @@ -333,7 +333,7 @@ -(NSMenu *)makeGraphicsMenu { -(NSMenu *)makeEmulationMenu { std::shared_ptr desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI); -#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str()) +#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T_cstr(key), nil).c_str()) NSMenu *parent = [[NSMenu alloc] initWithTitle:DESKTOPUI_LOCALIZED("Emulation")]; @@ -353,7 +353,7 @@ -(NSMenu *)makeEmulationMenu { -(NSMenu *)makeDebugMenu { std::shared_ptr sysInfoLocalization = GetI18NCategory(I18NCat::SYSINFO); std::shared_ptr desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI); -#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str()) +#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T_cstr(key), nil).c_str()) NSMenu *parent = [[NSMenu alloc] initWithTitle:DESKTOPUI_LOCALIZED("Debugging")]; @@ -434,9 +434,9 @@ -(NSMenu *)makeDebugMenu { -(void)breakAction: (NSMenuItem *)item { std::shared_ptr desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI); -#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str()) +#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T_cstr(key), nil).c_str()) std::shared_ptr developerUILocalization = GetI18NCategory(I18NCat::DEVELOPER); -#define DEVELOPERUI_LOCALIZED(key) @(developerUILocalization->T(key)) +#define DEVELOPERUI_LOCALIZED(key) @(developerUILocalization->T_cstr(key)) if (Core_IsStepping()) { Core_EnableStepping(false, "ui.break"); item.title = DESKTOPUI_LOCALIZED("Break"); @@ -620,7 +620,7 @@ -(NSControlStateValue) controlStateForBool: (BOOL)boolValue { -(void)addOpenRecentlyItem { std::shared_ptr mainmenuLocalization = GetI18NCategory(I18NCat::MAINMENU); -#define MAINMENU_LOCALIZED(key) @(mainmenuLocalization->T(key)) +#define MAINMENU_LOCALIZED(key) @(mainmenuLocalization->T_cstr(key)) std::vector recentIsos = g_Config.RecentIsos(); NSMenuItem *openRecent = [[NSMenuItem alloc] initWithTitle:MAINMENU_LOCALIZED("Recent") action:nil keyEquivalent:@""]; diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 50489bb7cf0e..5cb001c2af2e 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -206,13 +206,12 @@ static void UpdateScreenDPI(SDL_Window *window) { // Simple implementations of System functions - -void System_Toast(const char *text) { +void System_Toast(std::string_view text) { #ifdef _WIN32 std::wstring str = ConvertUTF8ToWString(text); MessageBox(0, str.c_str(), L"Toast!", MB_ICONINFORMATION); #else - puts(text); + printf("%*.s", (int)text.length(), text.data()); #endif } diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index a3646f77ab7a..c95e732783e8 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -353,7 +353,7 @@ void KeyMappingNewKeyDialog::CreatePopupContents(UI::ViewGroup *parent) { std::string pspButtonName = KeyMap::GetPspButtonName(this->pspBtn_); - parent->Add(new TextView(std::string(km->T("Map a new key for")) + " " + mc->T(pspButtonName), new LinearLayoutParams(Margins(10, 0)))); + parent->Add(new TextView(std::string(km->T("Map a new key for")) + " " + std::string(mc->T(pspButtonName)), new LinearLayoutParams(Margins(10, 0)))); parent->Add(new TextView(std::string(mapping_.ToVisualString()), new LinearLayoutParams(Margins(10, 0)))); comboMappingsNotEnabled_ = parent->Add(new NoticeView(NoticeLevel::WARN, km->T("Combo mappings are not enabled"), "", new LinearLayoutParams(Margins(10, 0)))); diff --git a/UI/CustomButtonMappingScreen.cpp b/UI/CustomButtonMappingScreen.cpp index 09ebaa293d4b..1efd0098ba75 100644 --- a/UI/CustomButtonMappingScreen.cpp +++ b/UI/CustomButtonMappingScreen.cpp @@ -33,7 +33,7 @@ class ButtonShapeScreen : public PopupScreen { public: - ButtonShapeScreen(std::string title, int *setting) : PopupScreen(title), setting_(setting) {} + ButtonShapeScreen(std::string_view title, int *setting) : PopupScreen(title), setting_(setting) {} void CreatePopupContents(UI::ViewGroup *parent) override { using namespace UI; @@ -63,7 +63,7 @@ class ButtonShapeScreen : public PopupScreen { class ButtonIconScreen : public PopupScreen { public: - ButtonIconScreen(std::string title, int *setting) : PopupScreen(title), setting_(setting) {} + ButtonIconScreen(std::string_view title, int *setting) : PopupScreen(title), setting_(setting) {} void CreatePopupContents(UI::ViewGroup *parent) override { using namespace UI; diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index 3a80771b42dc..d6d7c1421c30 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -99,7 +99,7 @@ void CwCheatScreen::CreateViews() { std::string root = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT).ToString(); - std::string title = StringFromFormat(cw->T("Import from %s"), "PSP/Cheats/cheat.db"); + std::string title = StringFromFormat(cw->T_cstr("Import from %s"), "PSP/Cheats/cheat.db"); leftColumn->Add(new Choice(title.c_str()))->OnClick.Handle(this, &CwCheatScreen::OnImportCheat); leftColumn->Add(new Choice(mm->T("Browse"), ImageID("I_FOLDER_OPEN")))->OnClick.Handle(this, &CwCheatScreen::OnImportBrowse); diff --git a/UI/DebugOverlay.cpp b/UI/DebugOverlay.cpp index 1405c4d03ef1..6a54cc882b56 100644 --- a/UI/DebugOverlay.cpp +++ b/UI/DebugOverlay.cpp @@ -277,7 +277,7 @@ void DrawCrashDump(UIContext *ctx, const Path &gamePath) { if (ctx->Draw()->GetFontAtlas()->getFont(ubuntu24)) ctx->BindFontTexture(); ctx->Draw()->SetFontScale(1.1f, 1.1f); - ctx->Draw()->DrawTextShadow(ubuntu24, sy->T("Game crashed"), x, y, 0xFFFFFFFF); + ctx->Draw()->DrawTextShadow(ubuntu24, sy->T_cstr("Game crashed"), x, y, 0xFFFFFFFF); char statbuf[4096]; char versionString[256]; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index b5163c5e26e0..829f1a9357d1 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -360,7 +360,7 @@ UI::EventReturn LogConfigScreen::OnLogLevel(UI::EventParams &e) { return UI::EVENT_DONE; } -LogLevelScreen::LogLevelScreen(const std::string &title) : ListPopupScreen(title) { +LogLevelScreen::LogLevelScreen(std::string_view title) : ListPopupScreen(title) { int NUMLOGLEVEL = 6; std::vector list; for (int i = 0; i < NUMLOGLEVEL; ++i) { @@ -521,7 +521,7 @@ void SystemInfoScreen::CreateTabs() { } int totalThreads = cpu_info.num_cores * cpu_info.logical_cpu_count; - std::string cores = StringFromFormat(si->T("%d (%d per core, %d cores)"), totalThreads, cpu_info.logical_cpu_count, cpu_info.num_cores); + std::string cores = StringFromFormat(si->T_cstr("%d (%d per core, %d cores)"), totalThreads, cpu_info.logical_cpu_count, cpu_info.num_cores); cpuInfo->Add(new InfoItem(si->T("Threads"), cores)); #if PPSSPP_PLATFORM(IOS) cpuInfo->Add(new InfoItem(si->T("JIT available"), System_GetPropertyBool(SYSPROP_CAN_JIT) ? di->T("Yes") : di->T("No"))); @@ -532,7 +532,7 @@ void SystemInfoScreen::CreateTabs() { DrawContext *draw = screenManager()->getDrawContext(); const std::string apiNameKey = draw->GetInfoString(InfoField::APINAME); - const char *apiName = gr->T(apiNameKey); + std::string_view apiName = gr->T(apiNameKey); gpuInfo->Add(new InfoItem(si->T("3D API"), apiName)); // TODO: Not really vendor, on most APIs it's a device name (GL calls it vendor though). @@ -585,26 +585,26 @@ void SystemInfoScreen::CreateTabs() { gpuInfo->Add(new InfoItem(si->T("Compressed texture formats"), texCompressionFormats)); CollapsibleSection *osInformation = deviceSpecs->Add(new CollapsibleSection(si->T("OS Information"))); - osInformation->Add(new InfoItem(si->T("Memory Page Size"), StringFromFormat(si->T("%d bytes"), GetMemoryProtectPageSize()))); + osInformation->Add(new InfoItem(si->T("Memory Page Size"), StringFromFormat(si->T_cstr("%d bytes"), GetMemoryProtectPageSize()))); osInformation->Add(new InfoItem(si->T("RW/RX exclusive"), PlatformIsWXExclusive() ? di->T("Active") : di->T("Inactive"))); #if PPSSPP_PLATFORM(ANDROID) osInformation->Add(new InfoItem(si->T("Sustained perf mode"), System_GetPropertyBool(SYSPROP_SUPPORTS_SUSTAINED_PERF_MODE) ? di->T("Supported") : di->T("Unsupported"))); #endif - const char *build = si->T("Release"); + std::string_view build = si->T("Release"); #ifdef _DEBUG build = si->T("Debug"); #endif osInformation->Add(new InfoItem(si->T("PPSSPP build"), build)); CollapsibleSection *audioInformation = deviceSpecs->Add(new CollapsibleSection(si->T("Audio Information"))); - audioInformation->Add(new InfoItem(si->T("Sample rate"), StringFromFormat(si->T("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_SAMPLE_RATE)))); + audioInformation->Add(new InfoItem(si->T("Sample rate"), StringFromFormat(si->T_cstr("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_SAMPLE_RATE)))); int framesPerBuffer = System_GetPropertyInt(SYSPROP_AUDIO_FRAMES_PER_BUFFER); if (framesPerBuffer > 0) { audioInformation->Add(new InfoItem(si->T("Frames per buffer"), StringFromFormat("%d", framesPerBuffer))); } #if PPSSPP_PLATFORM(ANDROID) - audioInformation->Add(new InfoItem(si->T("Optimal sample rate"), StringFromFormat(si->T("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE)))); + audioInformation->Add(new InfoItem(si->T("Optimal sample rate"), StringFromFormat(si->T_cstr("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE)))); audioInformation->Add(new InfoItem(si->T("Optimal frames per buffer"), StringFromFormat("%d", System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER)))); #endif @@ -617,7 +617,7 @@ void SystemInfoScreen::CreateTabs() { displayInfo->Add(new InfoItem(si->T("UI resolution"), StringFromFormat("%dx%d (%s: %0.2f)", g_display.dp_xres, g_display.dp_yres, - si->T("DPI"), + si->T_cstr("DPI"), g_display.dpi))); displayInfo->Add(new InfoItem(si->T("Pixel resolution"), StringFromFormat("%dx%d", g_display.pixel_xres, @@ -634,7 +634,7 @@ void SystemInfoScreen::CreateTabs() { } // Don't show on Windows, since it's always treated as 60 there. - displayInfo->Add(new InfoItem(si->T("Refresh rate"), StringFromFormat(si->T("%0.2f Hz"), (float)System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE)))); + displayInfo->Add(new InfoItem(si->T("Refresh rate"), StringFromFormat(si->T_cstr("%0.2f Hz"), (float)System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE)))); std::string presentModes; if (draw->GetDeviceCaps().presentModesSupported & Draw::PresentMode::FIFO) presentModes += "FIFO, "; if (draw->GetDeviceCaps().presentModesSupported & Draw::PresentMode::IMMEDIATE) presentModes += "IMMEDIATE, "; @@ -811,7 +811,7 @@ void SystemInfoScreen::CreateTabs() { colorFormats->Add(new TextView(format, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true); } - CollapsibleSection *enabledExtensions = gpuExtensions->Add(new CollapsibleSection(std::string(si->T("Vulkan Extensions")) + " (" + di->T("Enabled") + ")")); + CollapsibleSection *enabledExtensions = gpuExtensions->Add(new CollapsibleSection(std::string(si->T("Vulkan Extensions")) + " (" + std::string(di->T("Enabled")) + ")")); std::vector extensions = draw->GetExtensionList(true, true); std::sort(extensions.begin(), extensions.end()); for (auto &extension : extensions) { @@ -1644,7 +1644,7 @@ void RecreateActivity() { INFO_LOG(SYSTEM, "Got back from recreate"); } else { auto gr = GetI18NCategory(I18NCat::GRAPHICS); - System_Toast(gr->T("Must Restart", "You must restart PPSSPP for this change to take effect")); + System_Toast(gr->T_cstr("Must Restart", "You must restart PPSSPP for this change to take effect")); } } diff --git a/UI/DevScreens.h b/UI/DevScreens.h index 551cc719016d..0321aab1a3e3 100644 --- a/UI/DevScreens.h +++ b/UI/DevScreens.h @@ -95,7 +95,7 @@ class LogScreen : public UIDialogScreenWithBackground { class LogLevelScreen : public UI::ListPopupScreen { public: - LogLevelScreen(const std::string &title); + LogLevelScreen(std::string_view title); const char *tag() const override { return "LogLevel"; } @@ -119,7 +119,7 @@ class SystemInfoScreen : public TabbedUIDialogScreenWithGameBackground { class AddressPromptScreen : public PopupScreen { public: - AddressPromptScreen(const std::string &title) : PopupScreen(title, "OK", "Cancel"), addrView_(NULL), addr_(0) { + AddressPromptScreen(std::string_view title) : PopupScreen(title, "OK", "Cancel"), addrView_(NULL), addr_(0) { memset(buttons_, 0, sizeof(buttons_)); } diff --git a/UI/DiscordIntegration.cpp b/UI/DiscordIntegration.cpp index 0a1d172f4f77..b0e58d54f575 100644 --- a/UI/DiscordIntegration.cpp +++ b/UI/DiscordIntegration.cpp @@ -92,7 +92,7 @@ void Discord::Update() { #endif } -void Discord::SetPresenceGame(const char *gameTitle) { +void Discord::SetPresenceGame(std::string_view gameTitle) { if (!IsEnabled()) return; @@ -102,11 +102,10 @@ void Discord::SetPresenceGame(const char *gameTitle) { #ifdef ENABLE_DISCORD auto sc = GetI18NCategory(I18NCat::SCREEN); - + std::string title(gameTitle); DiscordRichPresence discordPresence{}; - discordPresence.state = gameTitle; - std::string details = sc->T("Playing"); - discordPresence.details = details.c_str(); + discordPresence.state = title.c_str(); + discordPresence.details = sc->T_cstr("Playing"); discordPresence.startTimestamp = time(0); discordPresence.largeImageText = "PPSSPP is the best PlayStation Portable emulator around!"; #ifdef GOLD @@ -130,7 +129,7 @@ void Discord::SetPresenceMenu() { auto sc = GetI18NCategory(I18NCat::SCREEN); DiscordRichPresence discordPresence{}; - discordPresence.state = sc->T("In menu"); + discordPresence.state = sc->T_cstr("In menu"); discordPresence.details = ""; discordPresence.startTimestamp = time(0); discordPresence.largeImageText = "PPSSPP is the best PlayStation Portable emulator around!"; diff --git a/UI/DiscordIntegration.h b/UI/DiscordIntegration.h index 4bbca308daaf..df2586eba395 100644 --- a/UI/DiscordIntegration.h +++ b/UI/DiscordIntegration.h @@ -1,5 +1,7 @@ #pragma once +#include + // Simple wrapper around the Discord api. // All platforms should call it, but we only actually take action on @@ -13,7 +15,7 @@ class Discord { void Update(); // Call every frame or at least regularly. Will initialize if necessary. void Shutdown(); - void SetPresenceGame(const char *gameTitle); + void SetPresenceGame(std::string_view gameTitle); void SetPresenceMenu(); void ClearPresence(); diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index d60474556bb6..a1920f989728 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -162,19 +162,19 @@ UI::EventReturn DisplayLayoutScreen::OnPostProcShaderChange(UI::EventParams &e) return UI::EVENT_DONE; } -static std::string PostShaderTranslateName(const char *value) { - if (!strcmp(value, "Off")) { +static std::string PostShaderTranslateName(std::string_view value) { + if (value == "Off") { auto gr = GetI18NCategory(I18NCat::GRAPHICS); // Off is a legacy fake item (gonna migrate off it later). - return gr->T("Add postprocessing shader"); + return std::string(gr->T("Add postprocessing shader")); } const ShaderInfo *info = GetPostShaderInfo(value); if (info) { auto ps = GetI18NCategory(I18NCat::POSTSHADERS); - return ps->T(value, info ? info->name.c_str() : value); + return std::string(ps->T(value, info ? info->name : value)); } else { - return value; + return std::string(value); } } @@ -475,7 +475,7 @@ void PostProcScreen::CreateViews() { continue; if (shaders_[i].section == selectedName) selected = (int)indexTranslation_.size(); - items.push_back(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str())); + items.push_back(std::string(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str()))); indexTranslation_.push_back(i); } adaptor_ = UI::StringVectorListAdaptor(items, selected); diff --git a/UI/DisplayLayoutScreen.h b/UI/DisplayLayoutScreen.h index f4a80b0c8330..d256b94f6d5e 100644 --- a/UI/DisplayLayoutScreen.h +++ b/UI/DisplayLayoutScreen.h @@ -55,7 +55,7 @@ class DisplayLayoutScreen : public UIDialogScreenWithGameBackground { class PostProcScreen : public UI::ListPopupScreen { public: - PostProcScreen(const std::string &title, int id, bool showStereoShaders) + PostProcScreen(std::string_view title, int id, bool showStereoShaders) : ListPopupScreen(title), id_(id), showStereoShaders_(showStereoShaders) { } void CreateViews() override; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 03fdf2de55bc..46fab9618629 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -300,7 +300,7 @@ void EmuScreen::bootGame(const Path &filename) { // Reset views in case controls are in a different place. RecreateViews(); - g_Discord.SetPresenceGame(info->GetTitle().c_str()); + g_Discord.SetPresenceGame(info->GetTitle()); } else { g_Discord.SetPresenceGame(sc->T("Untitled PSP game")); } @@ -429,7 +429,7 @@ void EmuScreen::bootComplete() { auto di = GetI18NCategory(I18NCat::DIALOG); // Stereo rendering is experimental, so let's notify the user it's being used. // Carefully reuse translations for this rare warning. - g_OSD.Show(OSDType::MESSAGE_WARNING, std::string(gr->T("Stereo rendering")) + ": " + di->T("Enabled")); + g_OSD.Show(OSDType::MESSAGE_WARNING, std::string(gr->T("Stereo rendering")) + ": " + std::string(di->T("Enabled"))); } saveStateSlot_ = SaveState::GetCurrentSlot(); @@ -486,13 +486,13 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) { SetExtraAssertInfo(extraAssertInfoStr_.c_str()); } -static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) { +static void AfterSaveStateAction(SaveState::Status status, std::string_view message, void *) { if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { g_OSD.Show(status == SaveState::Status::SUCCESS ? OSDType::MESSAGE_SUCCESS : OSDType::MESSAGE_ERROR, message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } } -static void AfterStateBoot(SaveState::Status status, const std::string &message, void *ignored) { +static void AfterStateBoot(SaveState::Status status, std::string_view message, void *ignored) { AfterSaveStateAction(status, message, ignored); Core_EnableStepping(false); System_Notify(SystemNotification::DISASSEMBLY); diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index ef467ad63b77..a28796dea078 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -301,23 +301,23 @@ ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) { if (info->Ready(GameInfoFlags::SIZE | GameInfoFlags::UNCOMPRESSED_SIZE)) { char temp[256]; if (tvGameSize_) { - snprintf(temp, sizeof(temp), "%s: %s", ga->T("Game"), NiceSizeFormat(info->gameSizeOnDisk).c_str()); + snprintf(temp, sizeof(temp), "%s: %s", ga->T_cstr("Game"), NiceSizeFormat(info->gameSizeOnDisk).c_str()); if (info->gameSizeUncompressed != info->gameSizeOnDisk) { size_t len = strlen(temp); - snprintf(temp + len, sizeof(temp) - len, " (%s: %s)", ga->T("Uncompressed"), NiceSizeFormat(info->gameSizeUncompressed).c_str()); + snprintf(temp + len, sizeof(temp) - len, " (%s: %s)", ga->T_cstr("Uncompressed"), NiceSizeFormat(info->gameSizeUncompressed).c_str()); } tvGameSize_->SetText(temp); } if (tvSaveDataSize_) { if (info->saveDataSize > 0) { - snprintf(temp, sizeof(temp), "%s: %s", ga->T("SaveData"), NiceSizeFormat(info->saveDataSize).c_str()); + snprintf(temp, sizeof(temp), "%s: %s", ga->T_cstr("SaveData"), NiceSizeFormat(info->saveDataSize).c_str()); tvSaveDataSize_->SetText(temp); } else { tvSaveDataSize_->SetVisibility(UI::V_GONE); } } if (info->installDataSize > 0 && tvInstallDataSize_) { - snprintf(temp, sizeof(temp), "%s: %1.2f %s", ga->T("InstallData"), (float) (info->installDataSize) / 1024.f / 1024.f, ga->T("MB")); + snprintf(temp, sizeof(temp), "%s: %1.2f %s", ga->T_cstr("InstallData"), (float) (info->installDataSize) / 1024.f / 1024.f, ga->T_cstr("MB")); tvInstallDataSize_->SetText(temp); tvInstallDataSize_->SetVisibility(UI::V_VISIBLE); } @@ -543,7 +543,7 @@ UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) { class SetBackgroundPopupScreen : public PopupScreen { public: - SetBackgroundPopupScreen(const std::string &title, const Path &gamePath) + SetBackgroundPopupScreen(std::string_view title, const Path &gamePath) : PopupScreen(title), gamePath_(gamePath) { timeStart_ = time_now_d(); } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 57d871971253..c9633ec95d69 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -159,13 +159,13 @@ static bool UsingHardwareTextureScaling() { return g_Config.bTexHardwareScaling && GetGPUBackend() == GPUBackend::VULKAN && !g_Config.bSoftwareRendering; } -static std::string TextureTranslateName(const char *value) { +static std::string TextureTranslateName(std::string_view value) { const TextureShaderInfo *info = GetTextureShaderInfo(value); if (info) { auto ts = GetI18NCategory(I18NCat::TEXTURESHADERS); - return ts->T(value, info ? info->name.c_str() : value); + return std::string(ts->T(value, info ? info->name.c_str() : value)); } else { - return value; + return std::string(value); } } @@ -206,13 +206,13 @@ bool PathToVisualUsbPath(Path path, std::string &outPath) { return false; } -static std::string PostShaderTranslateName(const char *value) { +static std::string PostShaderTranslateName(std::string_view value) { const ShaderInfo *info = GetPostShaderInfo(value); if (info) { auto ps = GetI18NCategory(I18NCat::POSTSHADERS); - return ps->T(value, info ? info->name.c_str() : value); + return std::string(ps->T(value, info ? info->name : value)); } else { - return value; + return std::string(value); } } @@ -645,7 +645,7 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) { #if defined(SDL) std::vector audioDeviceList; SplitString(System_GetProperty(SYSPROP_AUDIO_DEVICE_LIST), '\0', audioDeviceList); - audioDeviceList.insert(audioDeviceList.begin(), a->T("Auto")); + audioDeviceList.insert(audioDeviceList.begin(), a->T_cstr("Auto")); PopupMultiChoiceDynamic *audioDevice = audioSettings->Add(new PopupMultiChoiceDynamic(&g_Config.sAudioDevice, a->T("Device"), audioDeviceList, I18NCat::NONE, screenManager())); audioDevice->OnChoice.Handle(this, &GameSettingsScreen::OnAudioDevice); sdlAudio = true; @@ -700,7 +700,7 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings) Choice *customizeTilt = controlsSettings->Add(new ChoiceWithCallbackValueDisplay(co->T("Tilt control setup"), []() -> std::string { auto co = GetI18NCategory(I18NCat::CONTROLS); if ((u32)g_Config.iTiltInputType < (u32)g_numTiltTypes) { - return co->T(g_tiltTypes[g_Config.iTiltInputType]); + return std::string(co->T(g_tiltTypes[g_Config.iTiltInputType])); } return ""; })); @@ -819,12 +819,12 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings) // Compound view just like the audio file choosers class MacAddressChooser : public UI::LinearLayout { public: - MacAddressChooser(RequesterToken token, Path gamePath, std::string *value, const std::string &title, ScreenManager *screenManager, UI::LayoutParams *layoutParams = nullptr); + MacAddressChooser(RequesterToken token, Path gamePath, std::string *value, std::string_view title, ScreenManager *screenManager, UI::LayoutParams *layoutParams = nullptr); }; static constexpr UI::Size ITEM_HEIGHT = 64.f; -MacAddressChooser::MacAddressChooser(RequesterToken token, Path gamePath_, std::string *value, const std::string &title, ScreenManager *screenManager, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams) { +MacAddressChooser::MacAddressChooser(RequesterToken token, Path gamePath_, std::string *value, std::string_view title, ScreenManager *screenManager, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams) { using namespace UI; SetSpacing(5.0f); if (!layoutParams) { @@ -846,9 +846,9 @@ MacAddressChooser::MacAddressChooser(RequesterToken token, Path gamePath_, std:: auto n = GetI18NCategory(I18NCat::NETWORKING); auto di = GetI18NCategory(I18NCat::DIALOG); - const char *confirmMessage = n->T("ChangeMacSaveConfirm", "Generate a new MAC address?"); - const char *warningMessage = n->T("ChangeMacSaveWarning", "Some games verify the MAC address when loading savedata, so this may break old saves."); - std::string combined = g_Config.sMACAddress + "\n\n" + std::string(confirmMessage) + "\n\n" + warningMessage; + std::string_view confirmMessage = n->T("ChangeMacSaveConfirm", "Generate a new MAC address?"); + std::string_view warningMessage = n->T("ChangeMacSaveWarning", "Some games verify the MAC address when loading savedata, so this may break old saves."); + std::string combined = g_Config.sMACAddress + "\n\n" + std::string(confirmMessage) + "\n\n" + std::string(warningMessage); auto confirmScreen = new PromptScreen( gamePath_, @@ -1003,13 +1003,13 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) { systemSettings->Add(new ItemHeader(sy->T("UI"))); - auto langCodeToName = [](const char *value) -> std::string { + auto langCodeToName = [](std::string_view value) -> std::string { auto &mapping = g_Config.GetLangValuesMapping(); auto iter = mapping.find(value); if (iter != mapping.end()) { return iter->second.first; } - return value; + return std::string(value); }; systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.sLanguageIni, sy->T("Language"), langCodeToName))->OnClick.Add([&](UI::EventParams &e) { @@ -1285,7 +1285,8 @@ UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) { UI::EventReturn GameSettingsScreen::OnAdhocGuides(UI::EventParams &e) { auto n = GetI18NCategory(I18NCat::NETWORKING); - System_LaunchUrl(LaunchUrlType::BROWSER_URL, n->T("MultiplayerHowToURL", "https://github.com/hrydgard/ppsspp/wiki/How-to-play-multiplayer-games-with-PPSSPP")); + std::string url(n->T("MultiplayerHowToURL", "https://github.com/hrydgard/ppsspp/wiki/How-to-play-multiplayer-games-with-PPSSPP")); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str()); return UI::EVENT_DONE; } @@ -1927,7 +1928,7 @@ UI::EventReturn GameSettingsScreen::OnRestoreDefaultSettings(UI::EventParams &e) new PromptScreen(gamePath_, dev->T("RestoreGameDefaultSettings", "Are you sure you want to restore the game-specific settings back to the ppsspp defaults?\n"), di->T("OK"), di->T("Cancel"), std::bind(&GameSettingsScreen::CallbackRestoreDefaults, this, std::placeholders::_1))); } else { - const char *title = sy->T("Restore Default Settings"); + std::string_view title = sy->T("Restore Default Settings"); screenManager()->push(new RestoreSettingsScreen(title)); } return UI::EVENT_DONE; @@ -1955,7 +1956,7 @@ UI::EventReturn DeveloperToolsScreen::OnOpenTexturesIniFile(UI::EventParams &e) } else { // Can't do much here, let's send a "toast" so the user sees that something happened. auto dev = GetI18NCategory(I18NCat::DEVELOPER); - System_Toast((generatedFilename.ToVisualString() + ": " + dev->T("Texture ini file created")).c_str()); + System_Toast((generatedFilename.ToVisualString() + ": " + dev->T_cstr("Texture ini file created")).c_str()); } hasTexturesIni_ = HasIni::YES; @@ -2318,7 +2319,7 @@ void GestureMappingScreen::CreateViews() { vert->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogGestureSensibility, 0.01f, 5.0f, 1.0f, co->T("Sensitivity"), 0.01f, screenManager(), "x"))->SetEnabledPtr(&g_Config.bAnalogGesture); } -RestoreSettingsScreen::RestoreSettingsScreen(const char *title) +RestoreSettingsScreen::RestoreSettingsScreen(std::string_view title) : PopupScreen(title, "OK", "Cancel") {} void RestoreSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) { @@ -2329,7 +2330,7 @@ void RestoreSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) { auto mm = GetI18NCategory(I18NCat::MAINMENU); auto dev = GetI18NCategory(I18NCat::DEVELOPER); - const char *text = dev->T( + std::string_view text = dev->T( "RestoreDefaultSettings", "Restore these settings back to their defaults?\nYou can't undo this.\nPlease restart PPSSPP after restoring settings."); diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 1ee708817ff4..94be03002527 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -168,7 +168,7 @@ class DeveloperToolsScreen : public UIDialogScreenWithGameBackground { class HostnameSelectScreen : public PopupScreen { public: - HostnameSelectScreen(std::string *value, const std::string &title) + HostnameSelectScreen(std::string *value, std::string_view title) : PopupScreen(title, "OK", "Cancel"), value_(value) { resolver_ = std::thread([](HostnameSelectScreen *thiz) { thiz->ResolverThread(); @@ -237,7 +237,7 @@ class GestureMappingScreen : public UIDialogScreenWithGameBackground { class RestoreSettingsScreen : public PopupScreen { public: - RestoreSettingsScreen(const char *title); + RestoreSettingsScreen(std::string_view title); void CreatePopupContents(UI::ViewGroup *parent) override; const char *tag() const override { return "RestoreSettingsScreen"; } diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index e6b6693a4b5e..cdc7bf4a72f7 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -86,7 +86,7 @@ GamepadView::GamepadView(const char *key, UI::LayoutParams *layoutParams) : UI:: std::string GamepadView::DescribeText() const { auto co = GetI18NCategory(I18NCat::CONTROLS); - return co->T(key_); + return std::string(co->T(key_)); } void MultiTouchButton::GetContentDimensions(const UIContext &dc, float &w, float &h) const { diff --git a/UI/InstallZipScreen.cpp b/UI/InstallZipScreen.cpp index e4351c25c6f2..a85f898a61db 100644 --- a/UI/InstallZipScreen.cpp +++ b/UI/InstallZipScreen.cpp @@ -54,7 +54,7 @@ void InstallZipScreen::CreateViews() { ZipFileContents contents = DetectZipFileContents(zipPath_, &zipInfo); if (contents == ZipFileContents::ISO_FILE || contents == ZipFileContents::PSP_GAME_DIR) { - std::string question = iz->T("Install game from ZIP file?"); + std::string_view question = iz->T("Install game from ZIP file?"); leftColumn->Add(new TextView(question, ALIGN_LEFT, false, new AnchorLayoutParams(10, 10, NONE, NONE))); leftColumn->Add(new TextView(shortFilename, ALIGN_LEFT, false, new AnchorLayoutParams(10, 60, NONE, NONE))); @@ -68,7 +68,7 @@ void InstallZipScreen::CreateViews() { returnToHomebrew_ = true; } else if (contents == ZipFileContents::TEXTURE_PACK) { - std::string question = iz->T("Install textures from ZIP file?"); + std::string_view question = iz->T("Install textures from ZIP file?"); leftColumn->Add(new TextView(question, ALIGN_LEFT, false, new AnchorLayoutParams(10, 10, NONE, NONE))); leftColumn->Add(new TextView(shortFilename, ALIGN_LEFT, false, new AnchorLayoutParams(10, 60, NONE, NONE))); diff --git a/UI/JoystickHistoryView.h b/UI/JoystickHistoryView.h index bbdb8f0fdd86..df6e2be721d7 100644 --- a/UI/JoystickHistoryView.h +++ b/UI/JoystickHistoryView.h @@ -12,7 +12,7 @@ enum class StickHistoryViewType { class JoystickHistoryView : public UI::InertView { public: - JoystickHistoryView(StickHistoryViewType type, std::string title, UI::LayoutParams *layoutParams = nullptr) + JoystickHistoryView(StickHistoryViewType type, std::string_view title, UI::LayoutParams *layoutParams = nullptr) : UI::InertView(layoutParams), title_(title), type_(type) {} void Draw(UIContext &dc) override; diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 1087837d81d5..76350967dfa2 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -467,7 +467,7 @@ void DirButton::Draw(UIContext &dc) { dc.FillRect(style.background, bounds_); - const std::string text = GetText(); + std::string text(GetText()); ImageID image = ImageID("I_FOLDER"); if (text == "..") { @@ -509,7 +509,7 @@ void DirButton::Draw(UIContext &dc) { } } -GameBrowser::GameBrowser(int token, const Path &path, BrowseFlags browseFlags, bool *gridStyle, ScreenManager *screenManager, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams) +GameBrowser::GameBrowser(int token, const Path &path, BrowseFlags browseFlags, bool *gridStyle, ScreenManager *screenManager, std::string_view lastText, std::string_view lastLink, UI::LayoutParams *layoutParams) : LinearLayout(UI::ORIENT_VERTICAL, layoutParams), path_(path), gridStyle_(gridStyle), browseFlags_(browseFlags), lastText_(lastText), lastLink_(lastLink), screenManager_(screenManager), token_(token) { using namespace UI; path_.SetUserAgent(StringFromFormat("PPSSPP/%s", PPSSPP_GIT_VERSION)); @@ -1306,7 +1306,7 @@ void MainScreen::CreateViews() { UI::Margins buttonMargins(0, 0); UI::Drawable solid(0xFFbd9939); upgradeBar_->SetBG(solid); - upgradeBar_->Add(new TextView(u->T("New version of PPSSPP available") + std::string(": ") + g_Config.upgradeVersion, new LinearLayoutParams(1.0f, textMargins))); + upgradeBar_->Add(new TextView(std::string(u->T("New version of PPSSPP available")) + std::string(": ") + g_Config.upgradeVersion, new LinearLayoutParams(1.0f, textMargins))); #if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(WINDOWS) upgradeBar_->Add(new Button(u->T("Download"), new LinearLayoutParams(buttonMargins)))->OnClick.Handle(this, &MainScreen::OnDownloadUpgrade); #else diff --git a/UI/MainScreen.h b/UI/MainScreen.h index 1e8d98521f3b..8c8ae4056f0f 100644 --- a/UI/MainScreen.h +++ b/UI/MainScreen.h @@ -44,7 +44,7 @@ bool LaunchFile(ScreenManager *screenManager, const Path &path); class GameBrowser : public UI::LinearLayout { public: - GameBrowser(int token, const Path &path, BrowseFlags browseFlags, bool *gridStyle, ScreenManager *screenManager, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams = nullptr); + GameBrowser(int token, const Path &path, BrowseFlags browseFlags, bool *gridStyle, ScreenManager *screenManager, std::string_view lastText, std::string_view lastLink, UI::LayoutParams *layoutParams = nullptr); UI::Event OnChoice; UI::Event OnHoldChoice; @@ -191,7 +191,7 @@ class UmdReplaceScreen : public UIDialogScreenWithBackground { class GridSettingsScreen : public PopupScreen { public: - GridSettingsScreen(std::string label) : PopupScreen(label) {} + GridSettingsScreen(std::string_view label) : PopupScreen(label) {} void CreatePopupContents(UI::ViewGroup *parent) override; UI::Event OnRecentChanged; diff --git a/UI/MemStickScreen.cpp b/UI/MemStickScreen.cpp index 5f4e412d8e19..33b44e479953 100644 --- a/UI/MemStickScreen.cpp +++ b/UI/MemStickScreen.cpp @@ -223,7 +223,7 @@ void MemStickScreen::CreateViews() { AddExplanation(leftColumn, (MemStickScreen::Choice)choice_, extraView); } - std::string privateString = iz->T("Use App Private Data"); + std::string privateString(iz->T("Use App Private Data")); if (initialSetup_) { privateString = StringFromFormat("%s (%s)", iz->T("Skip for now"), privateString.c_str()); @@ -236,7 +236,7 @@ void MemStickScreen::CreateViews() { leftColumn->Add(new Spacer(new LinearLayoutParams(FILL_PARENT, 12.0f, 0.0f))); - const char *confirmButtonText = nullptr; + std::string_view confirmButtonText = nullptr; ImageID confirmButtonImage = ImageID::invalid(); switch (choice_) { case CHOICE_BROWSE_FOLDER: diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 54a6f04d99c4..a038f5e6f56a 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -507,11 +507,11 @@ void UIDialogScreenWithBackground::sendMessage(UIMessage message, const char *va HandleCommonMessages(message, value, screenManager(), this); } -PromptScreen::PromptScreen(const Path &gamePath, std::string message, std::string yesButtonText, std::string noButtonText, std::function callback) +PromptScreen::PromptScreen(const Path &gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText, std::function callback) : UIDialogScreenWithGameBackground(gamePath), message_(message), callback_(callback) { auto di = GetI18NCategory(I18NCat::DIALOG); - yesButtonText_ = di->T(yesButtonText.c_str()); - noButtonText_ = di->T(noButtonText.c_str()); + yesButtonText_ = di->T(yesButtonText); + noButtonText_ = di->T(noButtonText); } void PromptScreen::CreateViews() { @@ -557,7 +557,7 @@ void PromptScreen::TriggerFinish(DialogResult result) { UIDialogScreenWithBackground::TriggerFinish(result); } -TextureShaderScreen::TextureShaderScreen(const std::string &title) : ListPopupScreen(title) {} +TextureShaderScreen::TextureShaderScreen(std::string_view title) : ListPopupScreen(title) {} void TextureShaderScreen::CreateViews() { auto ps = GetI18NCategory(I18NCat::TEXTURESHADERS); @@ -568,7 +568,7 @@ void TextureShaderScreen::CreateViews() { for (int i = 0; i < (int)shaders_.size(); i++) { if (shaders_[i].section == g_Config.sTextureShaderName) selected = i; - items.push_back(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str())); + items.push_back(std::string(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str()))); } adaptor_ = UI::StringVectorListAdaptor(items, selected); @@ -581,7 +581,7 @@ void TextureShaderScreen::OnCompleted(DialogResult result) { g_Config.sTextureShaderName = shaders_[listView_->GetSelected()].section; } -NewLanguageScreen::NewLanguageScreen(const std::string &title) : ListPopupScreen(title) { +NewLanguageScreen::NewLanguageScreen(std::string_view title) : ListPopupScreen(title) { // Disable annoying encoding warning #ifdef _MSC_VER #pragma warning(disable:4566) @@ -761,7 +761,7 @@ void LogoScreen::DrawForeground(UIContext &dc) { auto gr = GetI18NCategory(I18NCat::GRAPHICS); char temp[256]; // Manually formatting UTF-8 is fun. \xXX doesn't work everywhere. - snprintf(temp, sizeof(temp), "%s Henrik Rydg%c%crd", cr->T("created", "Created by"), 0xC3, 0xA5); + snprintf(temp, sizeof(temp), "%s Henrik Rydg%c%crd", cr->T_cstr("created", "Created by"), 0xC3, 0xA5); if (System_GetPropertyBool(SYSPROP_APP_GOLD)) { dc.Draw()->DrawImage(ImageID("I_ICONGOLD"), bounds.centerX() - 120, bounds.centerY() - 30, 1.2f, 0xFFFFFFFF, ALIGN_CENTER); } else { @@ -772,7 +772,7 @@ void LogoScreen::DrawForeground(UIContext &dc) { dc.SetFontScale(1.0f, 1.0f); dc.SetFontStyle(dc.theme->uiFont); dc.DrawText(temp, bounds.centerX(), bounds.centerY() + 40, textColor, ALIGN_CENTER); - dc.DrawText(cr->T("license", "Free Software under GPL 2.0+"), bounds.centerX(), bounds.centerY() + 70, textColor, ALIGN_CENTER); + dc.DrawText(cr->T_cstr("license", "Free Software under GPL 2.0+"), bounds.centerX(), bounds.centerY() + 70, textColor, ALIGN_CENTER); int ppsspp_org_y = bounds.h / 2 + 130; dc.DrawText("www.ppsspp.org", bounds.centerX(), ppsspp_org_y, textColor, ALIGN_CENTER); @@ -785,7 +785,7 @@ void LogoScreen::DrawForeground(UIContext &dc) { // Add some emoji for testing. apiName += CodepointToUTF8(0x1F41B) + CodepointToUTF8(0x1F41C) + CodepointToUTF8(0x1F914); #endif - dc.DrawText(gr->T(apiName), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER); + dc.DrawText(gr->T_cstr(apiName.c_str()), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER); #endif dc.Flush(); @@ -897,7 +897,7 @@ void CreditsScreen::DrawForeground(UIContext &dc) { specialthankssolarmystic += cr->T("testing"); specialthankssolarmystic += ')'; - const char *credits[] = { + std::string_view credits[] = { System_GetPropertyBool(SYSPROP_APP_GOLD) ? "PPSSPP Gold" : "PPSSPP", "", cr->T("title", "A fast and portable PSP emulator"), @@ -1029,13 +1029,15 @@ void CreditsScreen::DrawForeground(UIContext &dc) { float t = (float)(time_now_d() - startTime_) * 60.0; float y = bounds.y2() - fmodf(t, (float)totalHeight); + std::string line; for (int i = 0; i < numItems; i++) { float alpha = linearInOut(y+32, 64, bounds.y2() - 192, 64); uint32_t textColor = colorAlpha(dc.theme->infoStyle.fgColor, alpha); if (alpha > 0.0f) { dc.SetFontScale(ease(alpha), ease(alpha)); - dc.DrawText(credits[i], bounds.centerX(), y, textColor, ALIGN_HCENTER); + line = credits[i]; + dc.DrawText(line.c_str(), bounds.centerX(), y, textColor, ALIGN_HCENTER); dc.SetFontScale(1.0f, 1.0f); } y += itemHeight; @@ -1053,7 +1055,7 @@ SettingInfoMessage::SettingInfoMessage(int align, float cutOffY, UI::AnchorLayou Add(new UI::Spacer(10.0f)); } -void SettingInfoMessage::Show(const std::string &text, const UI::View *refView) { +void SettingInfoMessage::Show(std::string_view text, const UI::View *refView) { if (refView) { Bounds b = refView->GetBounds(); const UI::AnchorLayoutParams *lp = GetLayoutParams()->As(); diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index da816c686156..1f03df3a7cd5 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -87,7 +87,7 @@ class UIDialogScreenWithGameBackground : public UIDialogScreenWithBackground { class PromptScreen : public UIDialogScreenWithGameBackground { public: - PromptScreen(const Path& gamePath, std::string message, std::string yesButtonText, std::string noButtonText, + PromptScreen(const Path& gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText, std::function callback = &NoOpVoidBool); void CreateViews() override; @@ -108,7 +108,7 @@ class PromptScreen : public UIDialogScreenWithGameBackground { class NewLanguageScreen : public UI::ListPopupScreen { public: - NewLanguageScreen(const std::string &title); + NewLanguageScreen(std::string_view title); const char *tag() const override { return "NewLanguage"; } @@ -120,7 +120,7 @@ class NewLanguageScreen : public UI::ListPopupScreen { class TextureShaderScreen : public UI::ListPopupScreen { public: - TextureShaderScreen(const std::string &title); + TextureShaderScreen(std::string_view title); void CreateViews() override; @@ -185,7 +185,7 @@ class SettingInfoMessage : public UI::LinearLayout { public: SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp); - void Show(const std::string &text, const UI::View *refView = nullptr); + void Show(std::string_view text, const UI::View *refView = nullptr); void Draw(UIContext &dc) override; std::string GetText() const; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 89ce32f92f43..0f3a3ffe0394 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -733,7 +733,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch g_BackgroundAudio.SFX().LoadSamples(); if (!boot_filename.empty() && stateToLoad.Valid()) { - SaveState::Load(stateToLoad, -1, [](SaveState::Status status, const std::string &message, void *) { + SaveState::Load(stateToLoad, -1, [](SaveState::Status status, std::string_view message, void *) { if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { g_OSD.Show(status == SaveState::Status::SUCCESS ? OSDType::MESSAGE_SUCCESS : OSDType::MESSAGE_ERROR, message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 9ed84dc732ee..2b384e44bb18 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -56,7 +56,7 @@ #include "UI/DisplayLayoutScreen.h" #include "UI/RetroAchievementScreens.h" -static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) { +static void AfterSaveStateAction(SaveState::Status status, std::string_view message, void *) { if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { g_OSD.Show(status == SaveState::Status::SUCCESS ? OSDType::MESSAGE_SUCCESS : OSDType::MESSAGE_ERROR, message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); @@ -374,7 +374,7 @@ void GamePauseScreen::CreateViews() { } // And tack on an explanation for why savestate options are not available. - const char *notAvailable = ac->T("Save states not available in Hardcore Mode"); + std::string_view notAvailable = ac->T("Save states not available in Hardcore Mode"); leftColumnItems->Add(new NoticeView(NoticeLevel::INFO, notAvailable, "")); } diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index 36f5162fdfe6..361540bce76c 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -41,7 +41,7 @@ using namespace UI; class RatingChoice : public LinearLayout { public: - RatingChoice(const char *captionKey, int *value, LayoutParams *layoutParams = 0); + RatingChoice(std::string_view captionKey, int *value, LayoutParams *layoutParams = 0); RatingChoice *SetEnabledPtrs(bool *enabled); @@ -54,7 +54,7 @@ class RatingChoice : public LinearLayout { virtual int TotalChoices() { return 3; } - void AddChoice(int i, const std::string &title); + void AddChoice(int i, std::string_view title); StickyChoice *GetChoice(int i) { return static_cast(group_->GetViewByIndex(i)); } @@ -67,7 +67,7 @@ class RatingChoice : public LinearLayout { int *value_; }; -RatingChoice::RatingChoice(const char *captionKey, int *value, LayoutParams *layoutParams) +RatingChoice::RatingChoice(std::string_view captionKey, int *value, LayoutParams *layoutParams) : LinearLayout(ORIENT_VERTICAL, layoutParams), value_(value) { SetSpacing(0.0f); @@ -109,7 +109,7 @@ void RatingChoice::SetupChoices() { AddChoice(2, rp->T("Great")); } -void RatingChoice::AddChoice(int i, const std::string &title) { +void RatingChoice::AddChoice(int i, std::string_view title) { auto c = group_->Add(new StickyChoice(title, "")); c->OnClick.Handle(this, &RatingChoice::OnChoiceClick); } @@ -356,7 +356,7 @@ void ReportScreen::UpdateCRCInfo() { void ReportScreen::UpdateOverallDescription() { auto rp = GetI18NCategory(I18NCat::REPORTING); - const char *desc; + std::string_view desc; uint32_t c = 0xFFFFFFFF; switch (overall_) { case ReportingOverallScore::PERFECT: desc = rp->T("Perfect Description", "Flawless emulation for the entire game - great!"); break; @@ -486,7 +486,7 @@ void ReportFinishScreen::ShowSuggestions() { bool shownConfig = false; bool valid = false; for (const auto &item : suggestions) { - const char *suggestion = nullptr; + std::string_view suggestion = ""; if (item == "Upgrade") { suggestion = rp->T("SuggestionUpgrade", "Upgrade to a newer PPSSPP build"); } else if (item == "Downgrade") { @@ -504,15 +504,15 @@ void ReportFinishScreen::ShowSuggestions() { // Ignore unknown configs, hopefully we recognized "Upgrade" at least. } - if (suggestion) { + if (!suggestion.empty()) { valid = true; - resultItems_->Add(new TextView(std::string(" - ") + suggestion, FLAG_WRAP_TEXT, false))->SetShadow(true); + resultItems_->Add(new TextView(std::string(" - ") + std::string(suggestion), FLAG_WRAP_TEXT, false))->SetShadow(true); } } if (!valid) { // No actual valid versions. Let's just say upgrade and hope the server's not broken. - resultItems_->Add(new TextView(std::string(" - ") + rp->T("SuggestionUpgrade", "Upgrade to a newer PPSSPP build"), FLAG_WRAP_TEXT, false))->SetShadow(true); + resultItems_->Add(new TextView(std::string(" - ") + rp->T_cstr("SuggestionUpgrade", "Upgrade to a newer PPSSPP build"), FLAG_WRAP_TEXT, false))->SetShadow(true); } } } diff --git a/UI/RetroAchievementScreens.cpp b/UI/RetroAchievementScreens.cpp index 2dfc3ea62c65..cc67bba679b9 100644 --- a/UI/RetroAchievementScreens.cpp +++ b/UI/RetroAchievementScreens.cpp @@ -20,14 +20,14 @@ static inline const char *DeNull(const char *ptr) { // Compound view, creating a FileChooserChoice inside. class AudioFileChooser : public UI::LinearLayout { public: - AudioFileChooser(RequesterToken token, std::string *value, const std::string &title, UI::UISound sound, UI::LayoutParams *layoutParams = nullptr); + AudioFileChooser(RequesterToken token, std::string *value, std::string_view title, UI::UISound sound, UI::LayoutParams *layoutParams = nullptr); UI::UISound sound_; }; static constexpr UI::Size ITEM_HEIGHT = 64.f; -AudioFileChooser::AudioFileChooser(RequesterToken token, std::string *value, const std::string &title, UI::UISound sound, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams), sound_(sound) { +AudioFileChooser::AudioFileChooser(RequesterToken token, std::string *value, std::string_view title, UI::UISound sound, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams), sound_(sound) { using namespace UI; SetSpacing(2.0f); if (!layoutParams) { diff --git a/UI/Store.cpp b/UI/Store.cpp index 592ae739dc7c..4cd558227a7a 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -332,7 +332,7 @@ void ProductView::CreateViews() { } float size = entry_.size / (1024.f * 1024.f); - Add(new TextView(StringFromFormat("%s: %.2f %s", st->T("Size"), size, st->T("MB")))); + Add(new TextView(StringFromFormat("%s: %.2f %s", st->T_cstr("Size"), size, st->T_cstr("MB")))); } void ProductView::Update() { @@ -494,7 +494,7 @@ void StoreScreen::CreateViews() { if (connectionError_ || loading_) { auto st = GetI18NCategory(I18NCat::STORE); content = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f)); - content->Add(new TextView(loading_ ? std::string(st->T("Loading...")) : StringFromFormat("%s: %d", st->T("Connection Error"), resultCode_))); + content->Add(new TextView(loading_ ? std::string(st->T("Loading...")) : StringFromFormat("%s: %d", st->T_cstr("Connection Error"), resultCode_))); if (!loading_) { content->Add(new Button(di->T("Retry")))->OnClick.Handle(this, &StoreScreen::OnRetry); diff --git a/UI/TabbedDialogScreen.cpp b/UI/TabbedDialogScreen.cpp index 87f27b9fba5f..15efd54bb99b 100644 --- a/UI/TabbedDialogScreen.cpp +++ b/UI/TabbedDialogScreen.cpp @@ -6,7 +6,7 @@ #include "Common/System/Display.h" #include "UI/TabbedDialogScreen.h" -UI::LinearLayout *TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag, const std::string &title, bool isSearch) { +UI::LinearLayout *TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag, std::string_view title, bool isSearch) { using namespace UI; ViewGroup *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); scroll->SetTag(tag); diff --git a/UI/TabbedDialogScreen.h b/UI/TabbedDialogScreen.h index 70e13101767b..d01819f89918 100644 --- a/UI/TabbedDialogScreen.h +++ b/UI/TabbedDialogScreen.h @@ -11,7 +11,7 @@ class TabbedUIDialogScreenWithGameBackground : public UIDialogScreenWithGameBack public: TabbedUIDialogScreenWithGameBackground(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} - UI::LinearLayout *AddTab(const char *tag, const std::string &title, bool isSearch = false); + UI::LinearLayout *AddTab(const char *tag, std::string_view title, bool isSearch = false); void CreateViews() override; diff --git a/UI/TouchControlVisibilityScreen.cpp b/UI/TouchControlVisibilityScreen.cpp index 8fee0169c24a..d96951fbfb17 100644 --- a/UI/TouchControlVisibilityScreen.cpp +++ b/UI/TouchControlVisibilityScreen.cpp @@ -28,7 +28,7 @@ static const int leftColumnWidth = 140; class CheckBoxChoice : public UI::Choice { public: - CheckBoxChoice(const std::string &text, UI::CheckBox *checkbox, UI::LayoutParams *lp) + CheckBoxChoice(std::string_view text, UI::CheckBox *checkbox, UI::LayoutParams *lp) : Choice(text, lp), checkbox_(checkbox) { OnClick.Handle(this, &CheckBoxChoice::HandleClick); } @@ -113,11 +113,11 @@ void TouchControlVisibilityScreen::CreateViews() { char translated[256]; int i = 0; if (sscanf(toggle.key.c_str(), "Custom %d", &i) == 1) { - snprintf(translated, sizeof(translated), mc->T("Custom %d"), i); + snprintf(translated, sizeof(translated), mc->T_cstr("Custom %d"), i); } else { - truncate_cpy(translated, mc->T(toggle.key)); + truncate_cpy(translated, sizeof(translated), mc->T(toggle.key)); } - choice = new Choice(std::string(translated) + " (" + mc->T("tap to customize") + ")", "", false, new LinearLayoutParams(1.0f)); + choice = new Choice(std::string(translated) + " (" + std::string(mc->T("tap to customize")) + ")", "", false, new LinearLayoutParams(1.0f)); choice->OnClick.Add(toggle.handle); } else if (toggle.img.isValid()) { choice = new CheckBoxChoice(toggle.img, checkbox, new LinearLayoutParams(1.0f)); diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 5f7f9d6e9f81..5a2d2109614a 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -402,7 +402,7 @@ float System_GetPropertyFloat(SystemProperty prop) { } } -void System_Toast(const char *str) {} +void System_Toast(std::string_view str) {} bool System_GetPropertyBool(SystemProperty prop) { switch (prop) { diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index e0ae538222a0..052253fbde73 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -188,7 +188,7 @@ void MainThreadFunc() { auto err = GetI18NCategory(I18NCat::ERRORS); const char *defaultErrorAll = "PPSSPP failed to startup with any graphics backend. Try upgrading your graphics and other drivers."; - const char *genericError = err->T("GenericAllStartupError", defaultErrorAll); + std::string_view genericError = err->T("GenericAllStartupError", defaultErrorAll); std::wstring title = ConvertUTF8ToWString(err->T("GenericGraphicsError", "Graphics Error")); MessageBox(0, ConvertUTF8ToWString(genericError).c_str(), title.c_str(), MB_OK); @@ -220,7 +220,7 @@ void MainThreadFunc() { const char *defaultErrorVulkan = "Failed initializing graphics. Try upgrading your graphics drivers.\n\nWould you like to try switching to OpenGL?\n\nError message:"; const char *defaultErrorOpenGL = "Failed initializing graphics. Try upgrading your graphics drivers.\n\nWould you like to try switching to DirectX 9?\n\nError message:"; const char *defaultErrorDirect3D9 = "Failed initializing graphics. Try upgrading your graphics drivers and directx 9 runtime.\n\nWould you like to try switching to OpenGL?\n\nError message:"; - const char *genericError; + std::string_view genericError; GPUBackend nextBackend = GPUBackend::DIRECT3D9; switch (g_Config.iGPUBackend) { case (int)GPUBackend::DIRECT3D9: @@ -237,7 +237,7 @@ void MainThreadFunc() { genericError = err->T("GenericOpenGLError", defaultErrorOpenGL); break; } - std::string full_error = StringFromFormat("%s\n\n%s", genericError, error_string.c_str()); + std::string full_error = StringFromFormat("%.*s\n\n%s", (int)genericError.size(), genericError.data(), error_string.c_str()); std::wstring title = ConvertUTF8ToWString(err->T("GenericGraphicsError", "Graphics Error")); bool yes = IDYES == MessageBox(0, ConvertUTF8ToWString(full_error).c_str(), title.c_str(), MB_ICONERROR | MB_YESNO); ERROR_LOG(BOOT, "%s", full_error.c_str()); diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index c07eef4c6730..22ab1e0e8680 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -359,7 +359,7 @@ namespace MainWindow { }); } - static void SaveStateActionFinished(SaveState::Status status, const std::string &message, void *userdata) { + static void SaveStateActionFinished(SaveState::Status status, std::string_view message, void *userdata) { if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { g_OSD.Show(status == SaveState::Status::SUCCESS ? OSDType::MESSAGE_SUCCESS : OSDType::MESSAGE_ERROR, message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } diff --git a/Windows/W32Util/ShellUtil.cpp b/Windows/W32Util/ShellUtil.cpp index 4f03d3a1c804..32c5d3b2723d 100644 --- a/Windows/W32Util/ShellUtil.cpp +++ b/Windows/W32Util/ShellUtil.cpp @@ -12,8 +12,7 @@ #include #include -namespace W32Util -{ +namespace W32Util { std::string BrowseForFolder(HWND parent, std::string_view title, std::string_view initialPath) { std::wstring titleString = ConvertUTF8ToWString(title); return BrowseForFolder(parent, titleString.c_str(), initialPath); @@ -224,11 +223,12 @@ HRESULT CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszArguments, LPCWSTR lpszPathL return hres; } -bool CreateDesktopShortcut(const std::string &argumentPath, std::string gameTitle) { +bool CreateDesktopShortcut(std::string_view argumentPath, std::string_view gameTitleStr) { // Get the desktop folder wchar_t *pathbuf = new wchar_t[4096]; SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, pathbuf); + std::string gameTitle(gameTitleStr); // Sanitize the game title for banned characters. const char bannedChars[] = "<>:\"/\\|?*"; for (size_t i = 0; i < gameTitle.size(); i++) { @@ -255,7 +255,7 @@ bool CreateDesktopShortcut(const std::string &argumentPath, std::string gameTitl // Need to flip the slashes in the filename. - std::string sanitizedArgument = argumentPath; + std::string sanitizedArgument(argumentPath); for (size_t i = 0; i < sanitizedArgument.size(); i++) { if (sanitizedArgument[i] == '/') { sanitizedArgument[i] = '\\'; diff --git a/Windows/W32Util/ShellUtil.h b/Windows/W32Util/ShellUtil.h index 033f90ab8170..fb0247e7f35b 100644 --- a/Windows/W32Util/ShellUtil.h +++ b/Windows/W32Util/ShellUtil.h @@ -5,21 +5,18 @@ #include #include -namespace W32Util { - -// Can't make initialPath a string_view, need the null so might as well require it. -std::string BrowseForFolder(HWND parent, std::string_view title, std::string_view initialPath); -std::string BrowseForFolder(HWND parent, const wchar_t *title, std::string_view initialPath); - -bool BrowseForFileName(bool _bLoad, HWND _hParent, - const wchar_t *_pTitle, const wchar_t *_pInitialFolder, const wchar_t *_pFilter, const wchar_t *_pExtension, - std::string& _strFileName); - -std::vector BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const wchar_t *_pTitle, - const wchar_t *_pInitialFolder, const wchar_t *_pFilter, const wchar_t *_pExtension); - -std::string UserDocumentsPath(); - -bool CreateDesktopShortcut(const std::string &argumentPath, std::string gameTitle); - +namespace W32Util +{ + // Can't make initialPath a string_view, need the null so might as well require it. + std::string BrowseForFolder(HWND parent, std::string_view title, std::string_view initialPath); + std::string BrowseForFolder(HWND parent, const wchar_t *title, std::string_view initialPath); + bool BrowseForFileName (bool _bLoad, HWND _hParent, const wchar_t*_pTitle, + const wchar_t *_pInitialFolder,const wchar_t *_pFilter,const wchar_t*_pExtension, + std::string& _strFileName); + std::vector BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const wchar_t*_pTitle, + const wchar_t*_pInitialFolder,const wchar_t*_pFilter,const wchar_t*_pExtension); + + std::string UserDocumentsPath(); + + bool CreateDesktopShortcut(std::string_view argumentPath, std::string_view gameTitle); } // namespace diff --git a/Windows/main.cpp b/Windows/main.cpp index 72e9021ae552..2e0eed488f23 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -626,7 +626,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string case SystemRequestType::GRAPHICS_BACKEND_FAILED_ALERT: { auto err = GetI18NCategory(I18NCat::ERRORS); - const char *backendSwitchError = err->T("GenericBackendSwitchCrash", "PPSSPP crashed while starting. This usually means a graphics driver problem. Try upgrading your graphics drivers.\n\nGraphics backend has been switched:"); + std::string_view backendSwitchError = err->T("GenericBackendSwitchCrash", "PPSSPP crashed while starting. This usually means a graphics driver problem. Try upgrading your graphics drivers.\n\nGraphics backend has been switched:"); std::wstring full_error = ConvertUTF8ToWString(StringFromFormat("%s %s", backendSwitchError, param1.c_str())); std::wstring title = ConvertUTF8ToWString(err->T("GenericGraphicsError", "Graphics Error")); MessageBox(MainWindow::GetHWND(), full_error.c_str(), title.c_str(), MB_OK); @@ -664,7 +664,7 @@ void EnableCrashingOnCrashes() { FreeLibrary(kernel32); } -void System_Toast(const char *text) { +void System_Toast(std::string_view text) { // Not-very-good implementation. Will normally not be used on Windows anyway. std::wstring str = ConvertUTF8ToWString(text); MessageBox(0, str.c_str(), L"Toast!", MB_ICONINFORMATION); diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 76d41e8d5e07..6dcb3d79a5f7 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -391,8 +391,8 @@ static void PushCommand(std::string cmd, std::string param) { } // Android implementation of callbacks to the Java part of the app -void System_Toast(const char *text) { - PushCommand("toast", text); +void System_Toast(std::string_view text) { + PushCommand("toast", std::string(text)); } void System_ShowKeyboard() { diff --git a/assets/lang/ar_AE.ini b/assets/lang/ar_AE.ini index edbdd7e1248a..dca4788d3435 100644 --- a/assets/lang/ar_AE.ini +++ b/assets/lang/ar_AE.ini @@ -1142,7 +1142,6 @@ Failed to save state = Failed to save state fixed = ‎السرعة: الجانبي GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = ‎الحالة تم تحميلها Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1154,7 +1153,6 @@ Playing = جاري اللعب PressESC = ‎إضغط خروج للدخول علي قائمة التوقف المؤقت. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = ‎فشل في حفظ الحالة! Saved State = ‎حُفظت الحالة saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/az_AZ.ini b/assets/lang/az_AZ.ini index b5416f6e23ed..dbb8c916dc8a 100644 --- a/assets/lang/az_AZ.ini +++ b/assets/lang/az_AZ.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = Speed: alternate GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = State loaded Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Press ESC to open the pause menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Failed to save state! Saved State = State saved saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/bg_BG.ini b/assets/lang/bg_BG.ini index cd25221fd549..7df358436be6 100644 --- a/assets/lang/bg_BG.ini +++ b/assets/lang/bg_BG.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = Speed: alternate GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = Състояние заредено Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Натиснете ESC за да отворите pause menu-то. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Неуспех при запис на състоянието! Saved State = Състояние запазено saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/ca_ES.ini b/assets/lang/ca_ES.ini index 42dd94662816..e1abd0c184cd 100644 --- a/assets/lang/ca_ES.ini +++ b/assets/lang/ca_ES.ini @@ -1134,7 +1134,6 @@ Failed to save state = Error en desar l'estat. fixed = Velocitat: alternativa GLToolsWarning = AVÍS: "GLTools" detectat, pot causar problemes. In menu = Al menú -Load savestate failed = Error en carregar l'estat desat. Loaded State = Estat carregat. Loaded. Game may refuse to save over different savedata. = Carregat. El joc pot no guardar sobre dades diferents. Loaded. Game may refuse to save over newer savedata. = Carregat. El joc pot no guardar sobre dades més actuals. @@ -1146,7 +1145,6 @@ Playing = Reproduint... PressESC = Prem Esc per obrir el menú de pausa. replaceTextures_false = Les textures no seran reemplaçades. replaceTextures_true = Reemplaçament de textures activat. -Save State Failed = Error en desar l'estat. Saved State = Estat desat. saveNewTextures_false = Desat de textures desactivat. saveNewTextures_true = Les textures seran desades al disc. diff --git a/assets/lang/cz_CZ.ini b/assets/lang/cz_CZ.ini index 55975912d0f1..a0b6640f6464 100644 --- a/assets/lang/cz_CZ.ini +++ b/assets/lang/cz_CZ.ini @@ -1134,7 +1134,6 @@ Failed to save state = Uložení stavu selhalo fixed = Rychlost: alternativní GLToolsWarning = VAROVÁNÍ: Zjištěny GLTools, můžou způsobovat problémy In menu = In menu -Load savestate failed = Načtení uloženého stavu selhalo Loaded State = Stav načten Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Stiskněte ESC k otevření nabídky při pozastavení. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Nepodařilo se uložit stav! Saved State = Stav uložen saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/da_DK.ini b/assets/lang/da_DK.ini index dfe5567e13de..49d53fcb20cc 100644 --- a/assets/lang/da_DK.ini +++ b/assets/lang/da_DK.ini @@ -1134,7 +1134,6 @@ Failed to save state = Kunne ikke gemme tilstand fixed = Hastighed: fast GLToolsWarning = ADVARSEL: GLTools detekteret, kan give problemer In menu = In menu -Load savestate failed = Hentning af spil-status fejlede Loaded State = Indlæste status Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Tryk ESC for at åbne pause menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Kunne ikke gemme status! Saved State = Gemte status saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/de_DE.ini b/assets/lang/de_DE.ini index 6a72cb999cb7..364081b38450 100644 --- a/assets/lang/de_DE.ini +++ b/assets/lang/de_DE.ini @@ -1134,7 +1134,6 @@ Failed to save state = Speichern des Standes fehlgeschlagen fixed = Geschwindigkeit: Fest GLToolsWarning = WARNUNG: GLTools erkannt, dies kann zu Problemen führen. In menu = Im Menü -Load savestate failed = Laden des Speicherstandes fehlgeschlagen Loaded State = Spielstand geladen Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Spiele PressESC = Drücke ESC um das Pausemenü zu öffnen. replaceTextures_false = Texturen werden nicht länger ersetzt. replaceTextures_true = Texturersetzung ist aktiviert. -Save State Failed = Erstellung des Spielstands fehlgeschlagen! Saved State = Spielstand gespeichert saveNewTextures_false = Speichern von Texturen wurde deaktiviert. saveNewTextures_true = Texturen werden nun im Speicher abgelegt. diff --git a/assets/lang/dr_ID.ini b/assets/lang/dr_ID.ini index 13aa215b2f45..8c47648bec52 100644 --- a/assets/lang/dr_ID.ini +++ b/assets/lang/dr_ID.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = Lassinna: sembarang GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = Tibukka'mi loadna Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Pissi'ki' ESC ta melako menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Gagal i mangnganna mane! Saved State = Tiannami Savena saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index 1675d3def4a7..de942736f1a0 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -1158,7 +1158,6 @@ Failed to save state = Failed to save state fixed = Speed: alternate GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = State loaded Loaded. Save in game, restart, and load for less bugs. = Loaded. Save in game, restart, and load for less bugs. Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. @@ -1170,7 +1169,6 @@ Playing = Playing PressESC = Press ESC to open the pause menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Failed to save state! Saved State = State saved saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/es_ES.ini b/assets/lang/es_ES.ini index d33e62ccd1b1..39f01bcd3a36 100644 --- a/assets/lang/es_ES.ini +++ b/assets/lang/es_ES.ini @@ -1135,7 +1135,6 @@ Failed to save state = Error al guardar el estado. fixed = Velocidad: alternativa GLToolsWarning = AVISO: "GLTools" detectado, puede causar problemas. In menu = En menú -Load savestate failed = Error al cargar el estado guardado. Loaded State = Estado cargado. Loaded. Game may refuse to save over different savedata. = Cargado. El juego puede no guardar sobre datos distintos. Loaded. Game may refuse to save over newer savedata. = Cargado. El juego puede no guardar sobre datos más actuales. @@ -1147,7 +1146,6 @@ Playing = Reproduciendo... PressESC = Presiona Esc para abrir el menú de pausa. replaceTextures_false = Las texturas no serán reemplazadas. replaceTextures_true = Reemplazo de texturas activado. -Save State Failed = Error al guardar el estado. Saved State = Estado guardado. saveNewTextures_false = Guardado de texturas desactivado. saveNewTextures_true = Las texturas serán guardadas en disco. diff --git a/assets/lang/es_LA.ini b/assets/lang/es_LA.ini index a1acfa226ec7..14e0f02e6b9f 100644 --- a/assets/lang/es_LA.ini +++ b/assets/lang/es_LA.ini @@ -1136,7 +1136,6 @@ Failed to save state = Error al guardar el estado. fixed = Velocidad: fija GLToolsWarning = ADVERTENCIA: GLTools detectado, puede causar problemas. In menu = En menú -Load savestate failed = Falló al abrir el estado. Loaded State = Estado cargado. Loaded. Game may refuse to save over different savedata. = Cargado. El juego puede no guardar sobre datos distintos. Loaded. Game may refuse to save over newer savedata. = Cargado. El juego puede no guardar sobre datos más actuales. @@ -1148,7 +1147,6 @@ Playing = Reproduciendo PressESC = ESC: Pausar emulador. replaceTextures_false = Texturas ya no son remplazadas. replaceTextures_true = Remplazo de texturas activado. -Save State Failed = Falló al guardar estado. Saved State = Estado almacenado. saveNewTextures_false = No se guarda las texturas. saveNewTextures_true = Las texturas se guardan en el almacenamiento local. diff --git a/assets/lang/fa_IR.ini b/assets/lang/fa_IR.ini index 2f8daaf40eb4..2645aa97df93 100644 --- a/assets/lang/fa_IR.ini +++ b/assets/lang/fa_IR.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = ‎سرعت: متناوب GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = ‎بارگیری شد Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = ‎.را برای منوی سریع فشار دهید ESC دکمه replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = ‎!خطا در ذخیره سازی Saved State = ‎ذخیره شد saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/fr_FR.ini b/assets/lang/fr_FR.ini index b4bc0d85cc1e..1eb434cd8d84 100644 --- a/assets/lang/fr_FR.ini +++ b/assets/lang/fr_FR.ini @@ -1125,7 +1125,6 @@ Failed to save state = Échec de la sauvegarde de l'état fixed = Vitesse alternative 1 GLToolsWarning = Avertissement : GLTools détecté, cela peut poser des problèmes. In menu = Dans les menus -Load savestate failed = Échec du chargement de l'état Loaded State = État chargé ! Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1137,7 +1136,6 @@ Playing = En jeu PressESC = Appuyer sur "Échap" pour ouvrir le menu Pause. replaceTextures_false = Les textures ne sont plus remplacées. replaceTextures_true = Le remplacement des textures est activé. -Save State Failed = Échec de la sauvegarde de l'état ! Saved State = État sauvegardé ! saveNewTextures_false = La sauvegarde des textures a été désactivée. saveNewTextures_true = Les textures seront maintenant sauvegardées\nsur votre espace de stockage. diff --git a/assets/lang/gl_ES.ini b/assets/lang/gl_ES.ini index 0cf4d8b8d37e..6f939fe5c66d 100644 --- a/assets/lang/gl_ES.ini +++ b/assets/lang/gl_ES.ini @@ -1134,7 +1134,6 @@ Failed to save state = Error ó gardar o estado fixed = Velocidad: alternativa GLToolsWarning = AVISO: GLTools detectado, pode causar problemas. In menu = In menu -Load savestate failed = Erro ó cargar o estado gardado Loaded State = Estado cargado Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Presiona Esc para abrir o menú de pausa. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Erro ó gardar o estado. Saved State = Estado gardado saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/gr_EL.ini b/assets/lang/gr_EL.ini index 5e2167df42aa..75a7d94b0d15 100644 --- a/assets/lang/gr_EL.ini +++ b/assets/lang/gr_EL.ini @@ -1134,7 +1134,6 @@ Failed to save state = Σφάλμα αποθήκευσης σημείου απο fixed = Ταχύτητα: καθορισμένη GLToolsWarning = ΠΡΟΣΟΧΗ: Η εφαρμογή GLTools εντοπίστηκε, ενδέχεται να προκαλέσει προβλήματα. In menu = Σε menu -Load savestate failed = Σφάλμα φόρτωσης σημείου αποθήκευσης Loaded State = Σημείο αποθήκευσης φορτώθηκε Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Παίζει PressESC = Πατήστε το ESC για να ανοίξετε το μενού παύσης. replaceTextures_false = Οι υφές δεν αντικαθίστανται πια. replaceTextures_true = Αντικατάσταση υφών ενεργοποιημένη. -Save State Failed = Σφάλμα αποθήκευσης σημείου! Saved State = Σημείο αποθήκευσης αποθηκεύτηκε saveNewTextures_false = Αποθήκευση υφών απενεργοποιημένη. saveNewTextures_true = Οι υφές θα αποθηκευτούν στο αποθηκευτικό σας χώρο. diff --git a/assets/lang/he_IL.ini b/assets/lang/he_IL.ini index 20548be59954..9b78773cd009 100644 --- a/assets/lang/he_IL.ini +++ b/assets/lang/he_IL.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = יותר מהיר GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = מצב נטען Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = לחץ על ESC כדי לפתוח את התפריט. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = תקלה בשמירת המצב! Saved State = מצב נשמר saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/he_IL_invert.ini b/assets/lang/he_IL_invert.ini index 259ce3a05afe..bdaf770f5da2 100644 --- a/assets/lang/he_IL_invert.ini +++ b/assets/lang/he_IL_invert.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = ריהמ רתוי GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = ןעטנ בצמ Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = .טירפתה תא חותפל ידכ ESC לע ץחל replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = !בצמה תרימשב הלקת Saved State = רמשנ בצמ saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/hr_HR.ini b/assets/lang/hr_HR.ini index b33f2ffca0d0..33fb3257eba8 100644 --- a/assets/lang/hr_HR.ini +++ b/assets/lang/hr_HR.ini @@ -1134,7 +1134,6 @@ Failed to save state = Nije moguće spremiti state fixed = Speed: alternate GLToolsWarning = UPOZORENJE: GLTools uočen, može stvarati probleme. In menu = In menu -Load savestate failed = Učitavanje savestate-a nije moguće Loaded State = State učitan Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Pritisni ESC za otvaranje izbornika. replaceTextures_false = Teksture se više ne primjenjuju. replaceTextures_true = Mijenjanje tekstura je upaljeno. -Save State Failed = Nije moguće spremiti state! Saved State = State spremljen saveNewTextures_false = Spremanje tekstura je isključeno. saveNewTextures_true = Teksture ce sada biti spremljene u datotekama. diff --git a/assets/lang/hu_HU.ini b/assets/lang/hu_HU.ini index d9bdd3bf5a8d..c54092c02326 100644 --- a/assets/lang/hu_HU.ini +++ b/assets/lang/hu_HU.ini @@ -1134,7 +1134,6 @@ Failed to save state = Állápotmentés készítése sikertelen fixed = Sebesség: alternatív GLToolsWarning = FIGYELMNEZTETÉS: GLTools észlelve, problémákat okozhat. In menu = Menüben -Load savestate failed = Állapotmentés betöltése sikertelen Loaded State = Állapotmentés betöltve Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Lejátszás PressESC = Nyomd meg az ESC-et a menühöz. replaceTextures_false = A textúrák nincsenek többé kicserélve. replaceTextures_true = A textúra csere be van kapcsolva. -Save State Failed = Hiba az állás mentése közben! Saved State = Állapotmentés elkészítve saveNewTextures_false = Textúra mentés letiltva. saveNewTextures_true = A textúrák mostantól el lesznek mentve a tárhelyeden. diff --git a/assets/lang/id_ID.ini b/assets/lang/id_ID.ini index d4c54195c0da..9ea3f4c64fdb 100644 --- a/assets/lang/id_ID.ini +++ b/assets/lang/id_ID.ini @@ -1134,7 +1134,6 @@ Failed to save state = Gagal menyimpan status permainan fixed = Kecepatan: alternatif GLToolsWarning = Peringatan: GLTools terdeteksi, mungkin akan menyebabkan masalah. In menu = Dalam menu -Load savestate failed = Gagal memuat simpanan status permainan Loaded State = Status/keadaan termuat Loaded. Game may refuse to save over different savedata. = Sarat. Permainan mungkin menolak untuk menyimpan lebih dari simpanan data yang berbeda. Loaded. Game may refuse to save over newer savedata. = Sarat. Permainan mungkin menolak untuk menyimpan lebih dari simpanan data yang lebih baru. @@ -1146,7 +1145,6 @@ Playing = Bermain PressESC = Tekan ESC untuk membuka menu jeda. replaceTextures_false = Tekstur tidak lagi diganti. replaceTextures_true = Penggantian tekstur diaktifkan. -Save State Failed = Gagal menyimpan status permainan! Saved State = Status permainan tersimpan saveNewTextures_false = Penyimpanan tekstur dinonaktifkan. saveNewTextures_true = Tekstur sekarang akan disimpan ke penyimpanan anda. diff --git a/assets/lang/it_IT.ini b/assets/lang/it_IT.ini index 0061ad0e3c88..0bdefb3f3629 100644 --- a/assets/lang/it_IT.ini +++ b/assets/lang/it_IT.ini @@ -1138,7 +1138,6 @@ Loaded. Save in game, restart, and load for less bugs. = Caricato. Salvataggio i fixed = Velocità: alternata GLToolsWarning = AVVISO: rilevato GLTools, potrebbe causare problemi In menu = Nei menu -Load savestate failed = Caricamento salvataggio di stato fallito Loaded State = Stato Caricato LoadStateDoesntExist = Caricamento stato fallito: lo stato non esiste! LoadStateWrongVersion = Caricamento stato fallito: lo stato è di una versione precedente di PPSSPP! @@ -1147,7 +1146,6 @@ Playing = Sta giocando PressESC = Premere ESC per aprire il Menu Pausa replaceTextures_false = Le texture non verranno più sostituite. replaceTextures_true = La sostituzione delle texture è stata attivata. -Save State Failed = Salvataggio stato fallito! Saved State = Stato Salvato saveNewTextures_false = Il salvataggio delle texture è stato disattivato. saveNewTextures_true = Le texture verranno salvate su disco. diff --git a/assets/lang/ja_JP.ini b/assets/lang/ja_JP.ini index fec2e0e65c31..23545eeec523 100644 --- a/assets/lang/ja_JP.ini +++ b/assets/lang/ja_JP.ini @@ -1134,7 +1134,6 @@ Failed to save state = ステートのセーブに失敗しました fixed = 速度: カスタム速度1 GLToolsWarning = 警告: GLToolsを検出しました。問題が起きるかもしれません。 In menu = In menu -Load savestate failed = セーブステートのロードに失敗しました Loaded State = ステートをロードしました Loaded. Game may refuse to save over different savedata. = ロードしました。 異なるセーブデータである場合セーブが拒否される場合があります。 Loaded. Game may refuse to save over newer savedata. = ロードしました。最新のセーブデータがある場合セーブが拒否される場合があります。 @@ -1146,7 +1145,6 @@ Playing = プレイ中 PressESC = ESCを押すと一時停止メニューを開きます。 replaceTextures_false = テクスチャが置き換えられなくなりました。 replaceTextures_true = テクスチャの置き換えが有効になりました。 -Save State Failed = ステートのセーブに失敗しました。 Saved State = ステートをセーブしました saveNewTextures_false = テクスチャの保存が無効になりました。 saveNewTextures_true = テクスチャがストレージに保存されます。 diff --git a/assets/lang/jv_ID.ini b/assets/lang/jv_ID.ini index 1848ad4db8d2..0600609fbffe 100644 --- a/assets/lang/jv_ID.ini +++ b/assets/lang/jv_ID.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = Kecepatan: ora-tetep GLToolsWarning = PERINGATAN: GLTools terdeteksi, mungkin menyebabkan masalah. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = Penyimpenan-cepet dimuat Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Tekan ESC kanggo ing Menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Gagal memuat-cepet! Saved State = Penyimpenan-cepet berhasil saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/ko_KR.ini b/assets/lang/ko_KR.ini index fda669f65daf..7a051a3325fe 100644 --- a/assets/lang/ko_KR.ini +++ b/assets/lang/ko_KR.ini @@ -1134,7 +1134,6 @@ Failed to save state = 상태를 저장하지 못함 fixed = 속도: 대체 GLToolsWarning = 경고: GLTools가 감지되어 문제를 일으킬 수 있습니다. In menu = 메뉴에서 -Load savestate failed = 저장 상태 불러오기 실패 Loaded State = 불러온 상태 Loaded. Save in game, restart, and load for less bugs. = 불러왔습니다. 버그를 줄이기 위해 게임을 저장하고 다시 시작하고 불러오세요. Loaded. Game may refuse to save over different savedata. = 불러왔습니다. 게임이 다른 저장 데이터에 대한 저장을 거부할 수 있습니다. @@ -1146,7 +1145,6 @@ Playing = 게임 중 PressESC = 일시 중지 메뉴를 열려면 ESC를 누르세요. replaceTextures_false = 텍스처가 더 이상 교체되지 않습니다. replaceTextures_true = 텍스처 교체가 활성화되었습니다. -Save State Failed = 상태 저장 실패! Saved State = 저장된 상태 saveNewTextures_false = 텍스처 저장이 비활성화되었습니다. saveNewTextures_true = 이제 텍스처가 저장 공간에 저장됩니다. diff --git a/assets/lang/lo_LA.ini b/assets/lang/lo_LA.ini index fd5eaae399ce..8cb3b5b99ed8 100644 --- a/assets/lang/lo_LA.ini +++ b/assets/lang/lo_LA.ini @@ -1134,7 +1134,6 @@ Failed to save state = ລົ້ມເຫຼວໃນການບັນທຶກ fixed = ຄວາມໄວ: ຕາມທີ່ປັບໃຊ້ GLToolsWarning = ລະວັງ: ກວດພົບ GLTools, ອາດເກີດບັນຫາໄດ້. In menu = In menu -Load savestate failed = ໂຫຼດໄຟລ໌ບັນທຶກລົ້ມເຫຼວ Loaded State = ໂຫຼດໄຟລ໌ບັນທຶກແລ້ວ Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = ກົດ ESC ເພື່ອເປີດເມນູຢຸດຊົ່ວຄາວ replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = ເກີດຂໍ້ຜິດພາດໃນການບັນທຶກເກມ! Saved State = ເຊບເກມ saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/lt-LT.ini b/assets/lang/lt-LT.ini index 572fa63d6342..2459a0dae8df 100644 --- a/assets/lang/lt-LT.ini +++ b/assets/lang/lt-LT.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = Greitis: alternatyvus GLToolsWarning = ĮSPĖJIMAS: "GLTools" surastas, gali kelti problemų! In menu = In menu -Load savestate failed = Load savestate failed Loaded State = Statusas pakrautas Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Paspauskite ESC, kad atidarytumėte pauzės meniu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Nepavyko pakrauti išsaugojimo statuso! Saved State = Statusas išsaugotas saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/ms_MY.ini b/assets/lang/ms_MY.ini index d8f998ee5106..1b49e80c3e1a 100644 --- a/assets/lang/ms_MY.ini +++ b/assets/lang/ms_MY.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = Kelajuan: Alternatif GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = State dimuat Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Tekan ESC untuk membuka menu jeda. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Gagal untuk simpan state! Saved State = State disimpan saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/nl_NL.ini b/assets/lang/nl_NL.ini index be6bfc9c8dbf..898e3606c691 100644 --- a/assets/lang/nl_NL.ini +++ b/assets/lang/nl_NL.ini @@ -1134,7 +1134,6 @@ Failed to save state = Kon de savestate niet opslaan fixed = Snelheid: alternatief GLToolsWarning = WAARSCHUWING: GLTools gedetecteerd, kan problemen veroorzaken. In menu = In menu -Load savestate failed = Laden van savestate mislukt Loaded State = Savestate geladen Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Druk op ESC om het pauzemenu te openen replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Opslaan van savestate mislukt! Saved State = Savestate opgeslagen saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/no_NO.ini b/assets/lang/no_NO.ini index 2256ac95db5c..4bd3105d0af5 100644 --- a/assets/lang/no_NO.ini +++ b/assets/lang/no_NO.ini @@ -1134,7 +1134,6 @@ Failed to save state = Failed to save state fixed = Hastighet: alternativ GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Load savestate failed Loaded State = Åpnet status Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Press ESC to open the pause menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Mislyktes å lagre fil! Saved State = Lagret status saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/pl_PL.ini b/assets/lang/pl_PL.ini index 07e975df716e..6ab84cbf5577 100644 --- a/assets/lang/pl_PL.ini +++ b/assets/lang/pl_PL.ini @@ -1140,7 +1140,6 @@ Failed to save state = Nie można zapisać stanu fixed = Prędkość: alternatywna GLToolsWarning = UWAGA: Wykryto GLTools, może powodować problemy. In menu = W menu -Load savestate failed = Nie można wczytać zapisu stanu Loaded State = Wczytano stan gry Loaded. Game may refuse to save over different savedata. = Wczytano. Gra może odmówić zapisywania w przypadku różnych zapisów. Loaded. Game may refuse to save over newer savedata. = Wczytano. Gra może odmówić nadpisywania nowszych zapisów. @@ -1152,7 +1151,6 @@ Playing = W grze PressESC = Naciśnij klawisz ESC, aby otworzyć menu pauzy. replaceTextures_false = Tekstury nie są już podmieniane. replaceTextures_true = Podmiana tekstur włączona. -Save State Failed = Nie można wczytać zapisu stanu! Saved State = Stan zapisany saveNewTextures_false = Zapisywanie tekstur wyłączone. saveNewTextures_true = Tekstury będą zapisywane na nośnik. diff --git a/assets/lang/pt_BR.ini b/assets/lang/pt_BR.ini index 4d5b46c09781..237038459813 100644 --- a/assets/lang/pt_BR.ini +++ b/assets/lang/pt_BR.ini @@ -1158,7 +1158,6 @@ Failed to save state = Falhou em salvar o state fixed = Velocidade: alternativa GLToolsWarning = AVISO: GLTools detectado, pode causar problemas. In menu = No menu -Load savestate failed = Falhou em carregar o state Loaded State = State carregado Loaded. Save in game, restart, and load for less bugs. = Carregado. Salve no jogo, reinicie e carregue pra menos bugs. Loaded. Game may refuse to save over different savedata. = Carregado. O jogo pode recusar a salvar sobre os dados diferentes dos salvamentos. @@ -1170,7 +1169,6 @@ Playing = Jogando PressESC = Pressione ESC pra abrir o menu da pausa. replaceTextures_false = As texturas não estão mais sendo substituídas. replaceTextures_true = A substituição das texturas está ativada. -Save State Failed = Falhou em salvar o state! Saved State = State salvo saveNewTextures_false = O salvamento das texturas foi desativado. saveNewTextures_true = As texturas agora serão salvas no seu armazenamento. diff --git a/assets/lang/pt_PT.ini b/assets/lang/pt_PT.ini index 7f07843dba54..ec0bd8bb3d2c 100644 --- a/assets/lang/pt_PT.ini +++ b/assets/lang/pt_PT.ini @@ -1160,7 +1160,6 @@ Failed to save state = Erro ao salvar o Estado fixed = Velocidade: alternativa GLToolsWarning = AVISO: GLTools detectado, poderá causar problemas. In menu = No menu -Load savestate failed = Erro ao carregar o Estado Loaded State = Estado carregado Loaded. Save in game, restart, and load for less bugs. = Carregado. Salva no jogo, reinicia e carrega para menos erros. Loaded. Game may refuse to save over different savedata. = Carregado. O jogo poderá recusar-se a salvar dados diferentes dos salvamentos. @@ -1172,7 +1171,6 @@ Playing = Jogando PressESC = Pressione a tecla Esc para abrir o menu de pausa. replaceTextures_false = As texturas não estão mais a ser substituídas. replaceTextures_true = A substituição das texturas está ativada. -Save State Failed = Erro ao salvar o Estado! Saved State = Estado salvo saveNewTextures_false = O salvamento das texturas foi desativado. saveNewTextures_true = As texturas agora serão salvas no teu armazenamento. diff --git a/assets/lang/ro_RO.ini b/assets/lang/ro_RO.ini index e828d9f83de0..98e712406bdb 100644 --- a/assets/lang/ro_RO.ini +++ b/assets/lang/ro_RO.ini @@ -1135,7 +1135,6 @@ Failed to save state = Eroare la salvare de stare fixed = Viteză: alternare GLToolsWarning = AVERTIZARE: GLTools detectat, poate cauza probleme. In menu = In menu -Load savestate failed = Eroare la încărcare de stare Loaded State = Stare încărcată Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1147,7 +1146,6 @@ Playing = Playing PressESC = Apasă ESC pt. a deschide meniul pauză. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Eroare la salvare de stare! Saved State = Stare salvată saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/ru_RU.ini b/assets/lang/ru_RU.ini index 03f854a84f87..9b4843eeec88 100644 --- a/assets/lang/ru_RU.ini +++ b/assets/lang/ru_RU.ini @@ -1134,7 +1134,6 @@ Failed to save state = Не удалось сохранить состояние fixed = Скорость: другая GLToolsWarning = ВНИМАНИЕ: обнаружен GLTools, это может вызвать проблемы. In menu = В меню -Load savestate failed = Загрузка состояния не удалась Loaded State = Состояние загружено Loaded. Game may refuse to save over different savedata. = Загружено. Игра может отказаться сохранять поверх других сохранений. Loaded. Game may refuse to save over newer savedata. = Загружено. Игра может отказаться сохранять поверх более новых сохранений. @@ -1146,7 +1145,6 @@ Playing = В игре PressESC = Нажмите ESC, чтобы открыть меню паузы. replaceTextures_false = Текстуры больше не будут подменяться. replaceTextures_true = Включена подмена текстур. -Save State Failed = Не удалось сохранить состояние! Saved State = Состояние сохранено saveNewTextures_false = Сохранение текстур отключено. saveNewTextures_true = Текстуры будут сохраняться в вашем хранилище. diff --git a/assets/lang/sv_SE.ini b/assets/lang/sv_SE.ini index c97a73d46c24..621b7acfeadf 100644 --- a/assets/lang/sv_SE.ini +++ b/assets/lang/sv_SE.ini @@ -1135,7 +1135,6 @@ Failed to save state = Misslyckades spara state fixed = Hastighet: alternativ GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = I menyn -Load savestate failed = Misslyckades ladda state Loaded State = State laddat Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1147,7 +1146,6 @@ Playing = Playing PressESC = Tryck ESC för att öppna pausemenyn. replaceTextures_false = Texturer ersätts inte längre. replaceTextures_true = Textur-ersättning är igång. -Save State Failed = Misslyckades spara state! Saved State = State sparat saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/tg_PH.ini b/assets/lang/tg_PH.ini index b914e79c98fb..52d3f1e3b658 100644 --- a/assets/lang/tg_PH.ini +++ b/assets/lang/tg_PH.ini @@ -1134,7 +1134,6 @@ Failed to save state = Pumalya sa pag save ng savestate fixed = Bilis: Salitan GLToolsWarning = WARNING: GLTools detected, may cause problems. In menu = In menu -Load savestate failed = Pumalya sa pag load ng savestate Loaded State = Estado ay nai-load Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Pindutin ang ESC para mabuksan ang pause menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Pumalya sa pag-save! Saved State = Estado ay nai-save saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/th_TH.ini b/assets/lang/th_TH.ini index 8fd269bde6d3..ba5cb2f72dda 100644 --- a/assets/lang/th_TH.ini +++ b/assets/lang/th_TH.ini @@ -1144,7 +1144,6 @@ Failed to save state = ล้มเหลวในการเซฟสเตท fixed = ความเร็ว: ตามที่ปรับใช้ GLToolsWarning = ระวัง: ตรวจพบ GLTools อาจก่อให้เกิดปัญหารบกวน In menu = ในเมนู -Load savestate failed = ล้มเหลวในการโหลดเซฟสเตท Loaded State = โหลดสเตทเกมเรียบร้อย Loaded. Game may refuse to save over different savedata. = โหลดสเตทเรียบร้อยแล้ว ระบบของเกมอาจจะสับสน เมื่อบันทึกด้วยข้อมูลที่แตกต่างจากเซฟธรรมดา Loaded. Game may refuse to save over newer savedata. = โหลดสเตทเรียบร้อยแล้ว ระบบของเกมอาจจะสับสน เมื่อบันทึกด้วยข้อมูลที่ใหม่กว่าเซฟธรรมดา @@ -1156,7 +1155,6 @@ Playing = กำลังเล่น PressESC = กดปุ่ม ESC เพื่อเปิดเมนูหยุดชั่วขณะ replaceTextures_false = ยกเลิกการแทนที่พื้นผิวจากแหล่งที่เก็บข้อมูล replaceTextures_true = เปิดใช้งานการแทนที่พื้นผิวจากแหล่งที่เก็บข้อมูล -Save State Failed = เกิดข้อผิดพลาดในการเซฟสเตทเกม! Saved State = เซฟสเตทเกมเรียบร้อย saveNewTextures_false = ยกเลิกการบันทึกพื้นผิวลงในแหล่งที่เก็บข้อมูล saveNewTextures_true = เปิดใช้งานการบันทึกพื้นผิวลงในแหล่งที่เก็บข้อมูล diff --git a/assets/lang/tr_TR.ini b/assets/lang/tr_TR.ini index 5afcab705a91..8da299225364 100644 --- a/assets/lang/tr_TR.ini +++ b/assets/lang/tr_TR.ini @@ -1135,7 +1135,6 @@ Failed to save state = Durum kaydedilemedi. fixed = Hız: Alternatif GLToolsWarning = UYARI: GLTools algılandı, problemlere sebep olabilir. In menu = Menüde -Load savestate failed = Durum kaydı yüklenemedi. Loaded State = Durum yüklendi. Loaded. Game may refuse to save over different savedata. = Yüklendi. Oyun belki farklı verilerin üzerine kaydetmeyi reddedebilir. Loaded. Game may refuse to save over newer savedata. = Yüklendi. Oyun belki yeni verilerin üzerine kaydetmeyi reddedebilir. @@ -1147,7 +1146,6 @@ Playing = Oynatılıyor... PressESC = PPSSPP menüsünü açmak için ESC'ye basın. replaceTextures_false = Dokular artık değiştirilmiyor. replaceTextures_true = Doku değiştirme etkinleştirildi. -Save State Failed = Durum kaydı yapılamadı! Saved State = Durum kaydedildi. saveNewTextures_false = Doku kaydetme devre dışı bırakıldı. saveNewTextures_true = Dokular şimdi cihazınıza kaydedilecek. diff --git a/assets/lang/uk_UA.ini b/assets/lang/uk_UA.ini index a756f6de691d..15e78c945109 100644 --- a/assets/lang/uk_UA.ini +++ b/assets/lang/uk_UA.ini @@ -1134,7 +1134,6 @@ Failed to save state = Не вдалося зберегти стан fixed = Альтернативна швидкість GLToolsWarning = ПОПЕРЕДЖЕННЯ: виявлено GLTools, можуть бути проблеми. In menu = В меню -Load savestate failed = Не вдалося завантажити збереження Loaded State = Стан завантажено Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = У грі PressESC = Натисніть ESC для переходу в меню replaceTextures_false = Текстури більше не будуть підмінятися. replaceTextures_true = Ввімкнена заміна текстур. -Save State Failed = Не вдалось зберегти стан! Saved State = Стан збережено saveNewTextures_false = Збереження текстур вимкнено. saveNewTextures_true = Текстури будуть зберігатися у вашому сховищі. diff --git a/assets/lang/vi_VN.ini b/assets/lang/vi_VN.ini index 87e7b0465888..07912062a69f 100644 --- a/assets/lang/vi_VN.ini +++ b/assets/lang/vi_VN.ini @@ -1134,7 +1134,6 @@ Failed to save state = Thất bại trong việc lưu trò chơi fixed = Tốc độ: alternate GLToolsWarning = WARNING: Phát hiện GLTools, có thể gây ra vấn đề. In menu = In menu -Load savestate failed = Lưu trò chơi thất bại Loaded State = Đã load xong Loaded. Game may refuse to save over different savedata. = Loaded. Game may refuse to save over different savedata. Loaded. Game may refuse to save over newer savedata. = Loaded. Game may refuse to save over newer savedata. @@ -1146,7 +1145,6 @@ Playing = Playing PressESC = Nhấn ESC để mở menu. replaceTextures_false = Textures no longer are being replaced. replaceTextures_true = Texture replacement is enabled. -Save State Failed = Không save được! Saved State = Đã save xong saveNewTextures_false = Texture saving was disabled. saveNewTextures_true = Textures will now be saved to your storage. diff --git a/assets/lang/zh_CN.ini b/assets/lang/zh_CN.ini index a1d7da832792..78ad85983438 100644 --- a/assets/lang/zh_CN.ini +++ b/assets/lang/zh_CN.ini @@ -1135,7 +1135,6 @@ Failed to save state = 无法保存即时存档 fixed = 速度:预设1 GLToolsWarning = 警告:检测到GLTools,可能会导致问题。 In menu = 在菜单中 -Load savestate failed = 无法读取即时存档 Loaded State = 已读取即时存档 Loaded. Game may refuse to save over different savedata. = 已读取,游戏可能无法保存在别的存档中。 Loaded. Game may refuse to save over newer savedata. = 已读取,游戏可能无法保存在进度提前的存档。 @@ -1147,7 +1146,6 @@ Playing = 游戏中 PressESC = 按下ESC键打开暂停菜单。 replaceTextures_false = 纹理替换已关闭。 replaceTextures_true = 纹理替换已启用。 -Save State Failed = 无法保存即时存档 Saved State = 已保存即时存档 saveNewTextures_false = 纹理转储已停止。 saveNewTextures_true = 开始转储新纹理。 diff --git a/assets/lang/zh_TW.ini b/assets/lang/zh_TW.ini index 34749058cb39..b0ed1dde35bf 100644 --- a/assets/lang/zh_TW.ini +++ b/assets/lang/zh_TW.ini @@ -1134,7 +1134,6 @@ Failed to save state = 無法儲存存檔 fixed = 速度:替代 GLToolsWarning = 警告:偵測到 GLTools,可能會造成問題 In menu = 選單中 -Load savestate failed = 無法載入存檔 Loaded State = 存檔已載入 Loaded. Save in game, restart, and load for less bugs. = 已載入,在遊戲中儲存、重新啟動,然後載入,將會減少錯誤 Loaded. Game may refuse to save over different savedata. = 已載入,遊戲可能會拒絕覆寫不同的存檔 @@ -1146,7 +1145,6 @@ Playing = 正在遊玩 PressESC = 按下 ESC 以開啟暫停選單 replaceTextures_false = 紋理將不再被取代 replaceTextures_true = 紋理取代已啟用 -Save State Failed = 無法儲存存檔! Saved State = 已存檔 saveNewTextures_false = 紋理儲存已停用 saveNewTextures_true = 紋理將儲存至您的儲存空間 diff --git a/ios/main.mm b/ios/main.mm index 2b2eaa94323c..f9c0c1143069 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -427,7 +427,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string } } -void System_Toast(const char *text) {} +void System_Toast(std::string_view text) {} void System_AskForPermission(SystemPermission permission) {} PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; } diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 88615489bd2e..9ec91fc3cea7 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -1714,7 +1714,7 @@ void System_PostUIMessage(UIMessage message, const std::string ¶m) {} void NativeFrame(GraphicsContext *graphicsContext) {} void NativeResized() {} -void System_Toast(const char *str) {} +void System_Toast(std::string_view str) {} inline int16_t Clamp16(int32_t sample) { if (sample < -32767) return -32767;