diff --git a/mc_mitm/source/controllers/emulated_switch_controller.cpp b/mc_mitm/source/controllers/emulated_switch_controller.cpp index d9e21b4..9bfc7f8 100644 --- a/mc_mitm/source/controllers/emulated_switch_controller.cpp +++ b/mc_mitm/source/controllers/emulated_switch_controller.cpp @@ -426,7 +426,14 @@ namespace ams::controller { } }; - R_TRY(this->VirtualSpiFlashRead(read_addr, response.data.spi_flash_read.data, read_size)); + R_TRY(this->VirtualSpiFlashRead(read_addr, response.data.spi_flash_read.data, read_size)); + + if (read_addr == 0x6050) { + if (ams::mitm::GetSystemLanguage() == 10) { + uint8_t data[] = {0xff, 0xd7, 0x00, 0x00, 0x57, 0xb7, 0x00, 0x57, 0xb7, 0x00, 0x57, 0xb7}; + std::memcpy(response.data.spi_flash_read.data, data, sizeof(data)); + } + } return this->FakeSubCmdResponse(&response); } diff --git a/mc_mitm/source/controllers/switch_controller.cpp b/mc_mitm/source/controllers/switch_controller.cpp index 197c67f..749cd25 100644 --- a/mc_mitm/source/controllers/switch_controller.cpp +++ b/mc_mitm/source/controllers/switch_controller.cpp @@ -15,6 +15,7 @@ */ #include "switch_controller.hpp" #include "../utils.hpp" +#include "../mcmitm_config.hpp" #include namespace ams::controller { @@ -88,6 +89,16 @@ namespace ams::controller { auto switch_report = reinterpret_cast(m_input_report.data); if (switch_report->id == 0x30) { this->ApplyButtonCombos(&switch_report->input0x30.buttons); + } else if (switch_report->id == 0x21) { + auto response = reinterpret_cast(&switch_report->input0x21.response); + if (response->id == SubCmd_SpiFlashRead) { + if (response->data.spi_flash_read.address == 0x6050) { + if (ams::mitm::GetSystemLanguage() == 10) { + uint8_t data[] = {0xff, 0xd7, 0x00, 0x00, 0x57, 0xb7, 0x00, 0x57, 0xb7, 0x00, 0x57, 0xb7}; + std::memcpy(response->data.spi_flash_read.data, data, sizeof(data)); + } + } + } } return bluetooth::hid::report::WriteHidReportBuffer(&m_address, &m_input_report); diff --git a/mc_mitm/source/mcmitm_config.cpp b/mc_mitm/source/mcmitm_config.cpp index cbc8b11..e380c4d 100644 --- a/mc_mitm/source/mcmitm_config.cpp +++ b/mc_mitm/source/mcmitm_config.cpp @@ -23,6 +23,8 @@ namespace ams::mitm { constexpr const char *config_file_location = "sdmc:/config/MissionControl/missioncontrol.ini"; + SetLanguage g_system_language; + MissionControlConfig g_global_config = { .general = { .enable_rumble = true, @@ -88,10 +90,6 @@ namespace ams::mitm { } - MissionControlConfig *GetGlobalConfig(void) { - return &g_global_config; - } - void ParseIniConfig(void) { /* Open the file. */ fs::FileHandle file; @@ -106,4 +104,22 @@ namespace ams::mitm { util::ini::ParseFile(file, &g_global_config, ConfigIniHandler); } + void InitializeConfig() { + ParseIniConfig(); + + R_ABORT_UNLESS(setInitialize()); + ON_SCOPE_EXIT { setExit(); }; + u64 language_code = 0; + R_ABORT_UNLESS(setGetSystemLanguage(&language_code)); + R_ABORT_UNLESS(setMakeLanguage(language_code, &g_system_language)); + } + + MissionControlConfig *GetGlobalConfig(void) { + return &g_global_config; + } + + SetLanguage GetSystemLanguage() { + return g_system_language; + } + } diff --git a/mc_mitm/source/mcmitm_config.hpp b/mc_mitm/source/mcmitm_config.hpp index 3555efd..21a75f4 100644 --- a/mc_mitm/source/mcmitm_config.hpp +++ b/mc_mitm/source/mcmitm_config.hpp @@ -33,7 +33,8 @@ namespace ams::mitm { } misc; }; + void InitializeConfig(); MissionControlConfig *GetGlobalConfig(void); - void ParseIniConfig(void); + SetLanguage GetSystemLanguage(); } diff --git a/mc_mitm/source/mcmitm_main.cpp b/mc_mitm/source/mcmitm_main.cpp index 1948238..3e8c0b0 100644 --- a/mc_mitm/source/mcmitm_main.cpp +++ b/mc_mitm/source/mcmitm_main.cpp @@ -77,8 +77,8 @@ namespace ams { } void Main() { - // Parse global module settings ini from sd card - mitm::ParseIniConfig(); + // Initialise module configuration + mitm::InitializeConfig(); // Start initialisation thread mitm::StartInitialize();