From 425e5491a85ed1f4fad426a5990428008738a32c Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Fri, 9 Aug 2024 11:58:42 +0300 Subject: [PATCH] added setting for change language (reference to https://github.com/shadps4-emu/shadPS4/wiki/PS4-Modules#supported-languages for values) --- src/common/config.cpp | 13 +++++++++++++ src/common/config.h | 3 +++ src/core/libraries/pad/pad.cpp | 6 ------ src/core/libraries/system/systemservice.cpp | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index c2ea1fe3..a5a0be71 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -43,6 +43,8 @@ u32 m_window_size_H = 720; std::vector m_pkg_viewer; std::vector m_elf_viewer; std::vector m_recent_files; +// Settings +u32 m_language = 1; // english bool isLleLibc() { return isLibc; @@ -207,6 +209,9 @@ std::vector getRecentFiles() { return m_recent_files; } +u32 GetLanguage() { + return m_language; +} void load(const std::filesystem::path& path) { // If the configuration file does not exist, create it and return std::error_code error; @@ -285,6 +290,12 @@ void load(const std::filesystem::path& path) { m_recent_files = toml::find_or>(gui, "recentFiles", {}); m_table_mode = toml::find_or(gui, "gameTableMode", 0); } + + if (data.contains("Settings")) { + const toml::value& settings = data.at("Settings"); + + m_language = toml::find_or(settings, "language", 1); + } } void save(const std::filesystem::path& path) { toml::value data; @@ -339,6 +350,8 @@ void save(const std::filesystem::path& path) { data["GUI"]["elfDirs"] = m_elf_viewer; data["GUI"]["recentFiles"] = m_recent_files; + data["Settings"]["language"] = m_language; + std::ofstream file(path, std::ios::out); file << data; file.close(); diff --git a/src/common/config.h b/src/common/config.h index 637ac746..53c88ec9 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -64,4 +64,7 @@ std::vector getPkgViewer(); std::vector getElfViewer(); std::vector getRecentFiles(); +// settings +u32 GetLanguage(); + }; // namespace Config diff --git a/src/core/libraries/pad/pad.cpp b/src/core/libraries/pad/pad.cpp index 8405a539..d3993550 100644 --- a/src/core/libraries/pad/pad.cpp +++ b/src/core/libraries/pad/pad.cpp @@ -251,9 +251,6 @@ int PS4_SYSV_ABI scePadOutputReport() { } int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) { - if (handle != 1) { - UNREACHABLE_MSG("unknown handle"); - } int connected_count = 0; bool connected = false; Input::State states[64]; @@ -320,9 +317,6 @@ int PS4_SYSV_ABI scePadReadHistory() { int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) { auto* controller = Common::Singleton::Instance(); - if (handle != 1) { - UNREACHABLE_MSG("unknown handle"); - } int connectedCount = 0; bool isConnected = false; Input::State state; diff --git a/src/core/libraries/system/systemservice.cpp b/src/core/libraries/system/systemservice.cpp index b704ccd9..d99ec7c7 100644 --- a/src/core/libraries/system/systemservice.cpp +++ b/src/core/libraries/system/systemservice.cpp @@ -1898,7 +1898,7 @@ s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(int param_id, int* value) { } switch (param_id) { case ORBIS_SYSTEM_SERVICE_PARAM_ID_LANG: - *value = ORBIS_SYSTEM_PARAM_LANG_ENGLISH_US; + *value = Config::GetLanguage(); break; case ORBIS_SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT: *value = ORBIS_SYSTEM_PARAM_DATE_FORMAT_DDMMYYYY;