mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-30 13:14:14 +01:00
service/set: Implement MakeLanguageCode
This function simply converts a given index into a language code.
This commit is contained in:
parent
4b950728fd
commit
7c04fe22b4
@ -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 pre4_0_0_max_entries = 0xF;
|
||||||
constexpr std::size_t post4_0_0_max_entries = 0x40;
|
constexpr std::size_t post4_0_0_max_entries = 0x40;
|
||||||
|
|
||||||
|
constexpr ResultCode ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625};
|
||||||
|
|
||||||
LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
|
LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
|
||||||
return available_language_codes.at(index);
|
return available_language_codes.at(index);
|
||||||
}
|
}
|
||||||
@ -67,6 +69,21 @@ void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) {
|
|||||||
PushResponseLanguageCode(ctx, pre4_0_0_max_entries);
|
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) {
|
void SET::GetAvailableLanguageCodes2(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_SET, "called");
|
LOG_DEBUG(Service_SET, "called");
|
||||||
|
|
||||||
@ -102,7 +119,7 @@ SET::SET() : ServiceFramework("set") {
|
|||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &SET::GetLanguageCode, "GetLanguageCode"},
|
{0, &SET::GetLanguageCode, "GetLanguageCode"},
|
||||||
{1, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
|
{1, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
|
||||||
{2, nullptr, "MakeLanguageCode"},
|
{2, &SET::MakeLanguageCode, "MakeLanguageCode"},
|
||||||
{3, &SET::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
|
{3, &SET::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
|
||||||
{4, nullptr, "GetRegionCode"},
|
{4, nullptr, "GetRegionCode"},
|
||||||
{5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
|
{5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void GetLanguageCode(Kernel::HLERequestContext& ctx);
|
void GetLanguageCode(Kernel::HLERequestContext& ctx);
|
||||||
void GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx);
|
void GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx);
|
||||||
|
void MakeLanguageCode(Kernel::HLERequestContext& ctx);
|
||||||
void GetAvailableLanguageCodes2(Kernel::HLERequestContext& ctx);
|
void GetAvailableLanguageCodes2(Kernel::HLERequestContext& ctx);
|
||||||
void GetAvailableLanguageCodeCount(Kernel::HLERequestContext& ctx);
|
void GetAvailableLanguageCodeCount(Kernel::HLERequestContext& ctx);
|
||||||
void GetAvailableLanguageCodeCount2(Kernel::HLERequestContext& ctx);
|
void GetAvailableLanguageCodeCount2(Kernel::HLERequestContext& ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user