слава україні

This commit is contained in:
ndeadly 2022-03-24 19:04:58 +11:00
parent 419c80e8f2
commit bb805477f6
5 changed files with 43 additions and 8 deletions

View file

@ -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);
}

View file

@ -15,6 +15,7 @@
*/
#include "switch_controller.hpp"
#include "../utils.hpp"
#include "../mcmitm_config.hpp"
#include <string>
namespace ams::controller {
@ -88,6 +89,16 @@ namespace ams::controller {
auto switch_report = reinterpret_cast<SwitchReportData *>(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<SwitchSubcommandResponse *>(&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);

View file

@ -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;
}
}

View file

@ -33,7 +33,8 @@ namespace ams::mitm {
} misc;
};
void InitializeConfig();
MissionControlConfig *GetGlobalConfig(void);
void ParseIniConfig(void);
SetLanguage GetSystemLanguage();
}

View file

@ -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();