diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2020-06-24 05:05:08 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2020-06-24 05:05:08 +0200 |
commit | 380fbd8cb785aed3594bdcb3f17f9f6d28baa624 (patch) | |
tree | 19b33daaebef7c1b9baa5f5038bb474a57dc5dcb /src/core/hle/service/set | |
parent | Fixed logging output (diff) | |
download | yuzu-380fbd8cb785aed3594bdcb3f17f9f6d28baa624.tar yuzu-380fbd8cb785aed3594bdcb3f17f9f6d28baa624.tar.gz yuzu-380fbd8cb785aed3594bdcb3f17f9f6d28baa624.tar.bz2 yuzu-380fbd8cb785aed3594bdcb3f17f9f6d28baa624.tar.lz yuzu-380fbd8cb785aed3594bdcb3f17f9f6d28baa624.tar.xz yuzu-380fbd8cb785aed3594bdcb3f17f9f6d28baa624.tar.zst yuzu-380fbd8cb785aed3594bdcb3f17f9f6d28baa624.zip |
Diffstat (limited to 'src/core/hle/service/set')
-rw-r--r-- | src/core/hle/service/set/set.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 7daf980ac..e5cfd2101 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -89,6 +89,25 @@ void GetAvailableLanguageCodesImpl(Kernel::HLERequestContext& ctx, std::size_t m ctx.WriteBuffer(available_language_codes.data(), copy_size); PushResponseLanguageCode(ctx, copy_amount); } + +void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { + const auto language_code = available_language_codes[Settings::values.language_index]; + const auto key_code = + std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), + [=](const auto& element) { return element.first == language_code; }); + KeyboardLayout layout = KeyboardLayout::EnglishUs; + if (key_code == language_to_layout.cend()) { + LOG_ERROR(Service_SET, + "Could not find keyboard layout for language index {}, defaulting to English us", + Settings::values.language_index); + } else { + layout = key_code->second; + } + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + ctx.WriteBuffer(&layout, sizeof(KeyboardLayout)); +} } // Anonymous namespace LanguageCode GetLanguageCodeFromIndex(std::size_t index) { @@ -159,25 +178,6 @@ void SET::GetRegionCode(Kernel::HLERequestContext& ctx) { rb.Push(Settings::values.region_index); } -void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { - const auto language_code = available_language_codes[Settings::values.language_index]; - const auto key_code = - std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), - [=](const auto& element) { return element.first == language_code; }); - KeyboardLayout layout = KeyboardLayout::EnglishUs; - if (key_code == language_to_layout.cend()) { - LOG_ERROR(Service_SET, - "Could not find keyboard layout for language index {}, defaulting to English us", - Settings::values.language_index); - } else { - layout = key_code->second; - } - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); - ctx.WriteBuffer(&layout, sizeof(KeyboardLayout)); -} - void SET::GetKeyCodeMap(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); GetKeyCodeMapImpl(ctx); |