mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 16:40:06 +00:00
Move GetKeyCodeMapImpl to an anonymous namespace
This commit is contained in:
parent
e3d2b646e0
commit
380fbd8cb7
@ -89,6 +89,25 @@ void GetAvailableLanguageCodesImpl(Kernel::HLERequestContext& ctx, std::size_t m
|
|||||||
ctx.WriteBuffer(available_language_codes.data(), copy_size);
|
ctx.WriteBuffer(available_language_codes.data(), copy_size);
|
||||||
PushResponseLanguageCode(ctx, copy_amount);
|
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
|
} // Anonymous namespace
|
||||||
|
|
||||||
LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
|
LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
|
||||||
@ -159,25 +178,6 @@ void SET::GetRegionCode(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(Settings::values.region_index);
|
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) {
|
void SET::GetKeyCodeMap(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
|
LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
|
||||||
GetKeyCodeMapImpl(ctx);
|
GetKeyCodeMapImpl(ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user