added setting for change language

(reference to https://github.com/shadps4-emu/shadPS4/wiki/PS4-Modules#supported-languages for values)
This commit is contained in:
georgemoralis 2024-08-09 11:58:42 +03:00
parent 250b2e4969
commit 425e5491a8
4 changed files with 17 additions and 7 deletions

View File

@ -43,6 +43,8 @@ u32 m_window_size_H = 720;
std::vector<std::string> m_pkg_viewer; std::vector<std::string> m_pkg_viewer;
std::vector<std::string> m_elf_viewer; std::vector<std::string> m_elf_viewer;
std::vector<std::string> m_recent_files; std::vector<std::string> m_recent_files;
// Settings
u32 m_language = 1; // english
bool isLleLibc() { bool isLleLibc() {
return isLibc; return isLibc;
@ -207,6 +209,9 @@ std::vector<std::string> getRecentFiles() {
return m_recent_files; return m_recent_files;
} }
u32 GetLanguage() {
return m_language;
}
void load(const std::filesystem::path& path) { void load(const std::filesystem::path& path) {
// If the configuration file does not exist, create it and return // If the configuration file does not exist, create it and return
std::error_code error; std::error_code error;
@ -285,6 +290,12 @@ void load(const std::filesystem::path& path) {
m_recent_files = toml::find_or<std::vector<std::string>>(gui, "recentFiles", {}); m_recent_files = toml::find_or<std::vector<std::string>>(gui, "recentFiles", {});
m_table_mode = toml::find_or<int>(gui, "gameTableMode", 0); m_table_mode = toml::find_or<int>(gui, "gameTableMode", 0);
} }
if (data.contains("Settings")) {
const toml::value& settings = data.at("Settings");
m_language = toml::find_or<int>(settings, "language", 1);
}
} }
void save(const std::filesystem::path& path) { void save(const std::filesystem::path& path) {
toml::value data; toml::value data;
@ -339,6 +350,8 @@ void save(const std::filesystem::path& path) {
data["GUI"]["elfDirs"] = m_elf_viewer; data["GUI"]["elfDirs"] = m_elf_viewer;
data["GUI"]["recentFiles"] = m_recent_files; data["GUI"]["recentFiles"] = m_recent_files;
data["Settings"]["language"] = m_language;
std::ofstream file(path, std::ios::out); std::ofstream file(path, std::ios::out);
file << data; file << data;
file.close(); file.close();

View File

@ -64,4 +64,7 @@ std::vector<std::string> getPkgViewer();
std::vector<std::string> getElfViewer(); std::vector<std::string> getElfViewer();
std::vector<std::string> getRecentFiles(); std::vector<std::string> getRecentFiles();
// settings
u32 GetLanguage();
}; // namespace Config }; // namespace Config

View File

@ -251,9 +251,6 @@ int PS4_SYSV_ABI scePadOutputReport() {
} }
int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) { int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) {
if (handle != 1) {
UNREACHABLE_MSG("unknown handle");
}
int connected_count = 0; int connected_count = 0;
bool connected = false; bool connected = false;
Input::State states[64]; Input::State states[64];
@ -320,9 +317,6 @@ int PS4_SYSV_ABI scePadReadHistory() {
int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) { int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) {
auto* controller = Common::Singleton<Input::GameController>::Instance(); auto* controller = Common::Singleton<Input::GameController>::Instance();
if (handle != 1) {
UNREACHABLE_MSG("unknown handle");
}
int connectedCount = 0; int connectedCount = 0;
bool isConnected = false; bool isConnected = false;
Input::State state; Input::State state;

View File

@ -1898,7 +1898,7 @@ s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(int param_id, int* value) {
} }
switch (param_id) { switch (param_id) {
case ORBIS_SYSTEM_SERVICE_PARAM_ID_LANG: case ORBIS_SYSTEM_SERVICE_PARAM_ID_LANG:
*value = ORBIS_SYSTEM_PARAM_LANG_ENGLISH_US; *value = Config::GetLanguage();
break; break;
case ORBIS_SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT: case ORBIS_SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT:
*value = ORBIS_SYSTEM_PARAM_DATE_FORMAT_DDMMYYYY; *value = ORBIS_SYSTEM_PARAM_DATE_FORMAT_DDMMYYYY;