From 41cf4bb12deb0a58f4aba698c53b83a2addef202 Mon Sep 17 00:00:00 2001 From: Dima Date: Sun, 20 Nov 2022 12:38:53 +0300 Subject: [PATCH] Stub GetLanguageCode --- .../main/cpp/skyline/services/settings/ISettingsServer.cpp | 7 +++++++ .../main/cpp/skyline/services/settings/ISettingsServer.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp b/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp index 602a0c25..23ba8d37 100644 --- a/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp +++ b/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp @@ -8,6 +8,13 @@ namespace skyline::service::settings { ISettingsServer::ISettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + Result ISettingsServer::GetLanguageCode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + auto systemLanguage{language::GetApplicationLanguage(*state.settings->systemLanguage)}; + + response.Push(language::GetLanguageCode(language::GetSystemLanguage(systemLanguage))); + return {}; + } + Result ISettingsServer::GetAvailableLanguageCodes(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { request.outputBuf.at(0).copy_from(span(language::LanguageCodeList).first(constant::OldLanguageCodeListSize)); response.Push(constant::OldLanguageCodeListSize); diff --git a/app/src/main/cpp/skyline/services/settings/ISettingsServer.h b/app/src/main/cpp/skyline/services/settings/ISettingsServer.h index fa1c6042..0d5730aa 100644 --- a/app/src/main/cpp/skyline/services/settings/ISettingsServer.h +++ b/app/src/main/cpp/skyline/services/settings/ISettingsServer.h @@ -14,6 +14,12 @@ namespace skyline::service::settings { public: ISettingsServer(const DeviceState &state, ServiceManager &manager); + /** + * @brief Gets the current system language + * @url https://switchbrew.org/wiki/Settings_services#GetLanguageCode + */ + Result GetLanguageCode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + /** * @brief Reads the available language codes that an application can use (pre 4.0.0) */ @@ -45,6 +51,7 @@ namespace skyline::service::settings { Result GetAvailableLanguageCodeCount2(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); SERVICE_DECL( + SFUNC(0x0, ISettingsServer, GetLanguageCode), SFUNC(0x1, ISettingsServer, GetAvailableLanguageCodes), SFUNC(0x2, ISettingsServer, MakeLanguageCode), SFUNC(0x3, ISettingsServer, GetAvailableLanguageCodeCount),