diff options
author | Lioncash <mathew1800@gmail.com> | 2018-11-29 05:47:01 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-11-30 15:08:03 +0100 |
commit | 7c04fe22b4b954613b0fbabb7033675614955f12 (patch) | |
tree | b45ca0ea685e31a7ac73a4374e65d31f13f872f2 /src/core/hle/service/set/set.cpp | |
parent | configure_input: Amend clang-format discrepancies (diff) | |
download | yuzu-7c04fe22b4b954613b0fbabb7033675614955f12.tar yuzu-7c04fe22b4b954613b0fbabb7033675614955f12.tar.gz yuzu-7c04fe22b4b954613b0fbabb7033675614955f12.tar.bz2 yuzu-7c04fe22b4b954613b0fbabb7033675614955f12.tar.lz yuzu-7c04fe22b4b954613b0fbabb7033675614955f12.tar.xz yuzu-7c04fe22b4b954613b0fbabb7033675614955f12.tar.zst yuzu-7c04fe22b4b954613b0fbabb7033675614955f12.zip |
Diffstat (limited to 'src/core/hle/service/set/set.cpp')
-rw-r--r-- | src/core/hle/service/set/set.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 40a9144f9..0c7f281c9 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -35,6 +35,8 @@ constexpr std::array<LanguageCode, 17> available_language_codes = {{ constexpr std::size_t pre4_0_0_max_entries = 0xF; constexpr std::size_t post4_0_0_max_entries = 0x40; +constexpr ResultCode ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625}; + LanguageCode GetLanguageCodeFromIndex(std::size_t index) { return available_language_codes.at(index); } @@ -67,6 +69,21 @@ void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) { PushResponseLanguageCode(ctx, pre4_0_0_max_entries); } +void SET::MakeLanguageCode(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto index = rp.Pop<u32>(); + + if (index >= available_language_codes.size()) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ERR_INVALID_LANGUAGE); + return; + } + + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(RESULT_SUCCESS); + rb.PushEnum(available_language_codes[index]); +} + void SET::GetAvailableLanguageCodes2(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_SET, "called"); @@ -102,7 +119,7 @@ SET::SET() : ServiceFramework("set") { static const FunctionInfo functions[] = { {0, &SET::GetLanguageCode, "GetLanguageCode"}, {1, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"}, - {2, nullptr, "MakeLanguageCode"}, + {2, &SET::MakeLanguageCode, "MakeLanguageCode"}, {3, &SET::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"}, {4, nullptr, "GetRegionCode"}, {5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"}, |