mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 05:09:46 -06:00
make firmware settings override also apply in DSi mode
This commit is contained in:
@ -816,7 +816,7 @@ bool LoadNAND()
|
|||||||
memcpy(&ARM7Init[0x0254], &ARM7iBIOS[0xC6D0], 0x1048);
|
memcpy(&ARM7Init[0x0254], &ARM7iBIOS[0xC6D0], 0x1048);
|
||||||
memcpy(&ARM7Init[0x129C], &ARM7iBIOS[0xD718], 0x1048);
|
memcpy(&ARM7Init[0x129C], &ARM7iBIOS[0xD718], 0x1048);
|
||||||
|
|
||||||
DSi_NAND::PatchTSC();
|
DSi_NAND::PatchUserData();
|
||||||
|
|
||||||
DSi_NAND::DeInit();
|
DSi_NAND::DeInit();
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "DSi.h"
|
#include "DSi.h"
|
||||||
#include "DSi_AES.h"
|
#include "DSi_AES.h"
|
||||||
#include "DSi_NAND.h"
|
#include "DSi_NAND.h"
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
#include "sha1/sha1.hpp"
|
#include "sha1/sha1.hpp"
|
||||||
#include "tiny-AES-c/aes.hpp"
|
#include "tiny-AES-c/aes.hpp"
|
||||||
@ -510,7 +511,7 @@ void ReadUserData(u8* data)
|
|||||||
f_close(&file);
|
f_close(&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PatchTSC()
|
void PatchUserData()
|
||||||
{
|
{
|
||||||
FRESULT res;
|
FRESULT res;
|
||||||
|
|
||||||
@ -532,6 +533,36 @@ void PatchTSC()
|
|||||||
f_lseek(&file, 0);
|
f_lseek(&file, 0);
|
||||||
f_read(&file, contents, 0x1B0, &nres);
|
f_read(&file, contents, 0x1B0, &nres);
|
||||||
|
|
||||||
|
// override user settings, if needed
|
||||||
|
if (Platform::GetConfigBool(Platform::Firm_OverrideSettings))
|
||||||
|
{
|
||||||
|
// setting up username
|
||||||
|
std::string orig_username = Platform::GetConfigString(Platform::Firm_Username);
|
||||||
|
std::u16string username = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(orig_username);
|
||||||
|
size_t usernameLength = std::min(username.length(), (size_t) 10);
|
||||||
|
memset(contents + 0xD0, 0, 11 * sizeof(char16_t));
|
||||||
|
memcpy(contents + 0xD0, username.data(), usernameLength * sizeof(char16_t));
|
||||||
|
|
||||||
|
// setting language
|
||||||
|
contents[0x8E] = Platform::GetConfigInt(Platform::Firm_Language);
|
||||||
|
|
||||||
|
// setting up color
|
||||||
|
contents[0xCC] = Platform::GetConfigInt(Platform::Firm_Color);
|
||||||
|
|
||||||
|
// setting up birthday
|
||||||
|
contents[0xCE] = Platform::GetConfigInt(Platform::Firm_BirthdayMonth);
|
||||||
|
contents[0xCF] = Platform::GetConfigInt(Platform::Firm_BirthdayDay);
|
||||||
|
|
||||||
|
// setup message
|
||||||
|
std::string orig_message = Platform::GetConfigString(Platform::Firm_Message);
|
||||||
|
std::u16string message = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(orig_message);
|
||||||
|
size_t messageLength = std::min(message.length(), (size_t) 26);
|
||||||
|
memset(contents + 0xE6, 0, 27 * sizeof(char16_t));
|
||||||
|
memcpy(contents + 0xE6, message.data(), messageLength * sizeof(char16_t));
|
||||||
|
|
||||||
|
// TODO: make other items configurable?
|
||||||
|
}
|
||||||
|
|
||||||
// fix touchscreen coords
|
// fix touchscreen coords
|
||||||
*(u16*)&contents[0xB8] = 0;
|
*(u16*)&contents[0xB8] = 0;
|
||||||
*(u16*)&contents[0xBA] = 0;
|
*(u16*)&contents[0xBA] = 0;
|
||||||
|
@ -42,7 +42,7 @@ void GetIDs(u8* emmc_cid, u64& consoleid);
|
|||||||
void ReadHardwareInfo(u8* dataS, u8* dataN);
|
void ReadHardwareInfo(u8* dataS, u8* dataN);
|
||||||
|
|
||||||
void ReadUserData(u8* data);
|
void ReadUserData(u8* data);
|
||||||
void PatchTSC();
|
void PatchUserData();
|
||||||
|
|
||||||
void ListTitles(u32 category, std::vector<u32>& titlelist);
|
void ListTitles(u32 category, std::vector<u32>& titlelist);
|
||||||
bool TitleExists(u32 category, u32 titleid);
|
bool TitleExists(u32 category, u32 titleid);
|
||||||
|
Reference in New Issue
Block a user