remove requirement for initmem7/9.bin (but this requires augmented BIOS dumps, we'll get there)

This commit is contained in:
Arisotura 2020-06-02 00:25:29 +02:00
parent ee9fe327e2
commit d0af89924e
3 changed files with 17 additions and 43 deletions

View File

@ -129,9 +129,6 @@ void Reset()
memcpy(NDS::ARM9->ITCM, ITCMInit, 0x8000);
for (u32 i = 0; i < 0x3C00; i+=4)
ARM7Write32(0x03FFC400+i, *(u32*)&ARM7Init[i]);
DSi_I2C::Reset();
DSi_AES::Reset();
@ -151,6 +148,9 @@ void Reset()
NDS::MapSharedWRAM(3);
for (u32 i = 0; i < 0x3C00; i+=4)
ARM7Write32(0x03FFC400+i, *(u32*)&ARM7Init[i]);
u32 eaddr = 0x03FFE6E4;
ARM7Write32(eaddr+0x00, *(u32*)&eMMC_CID[0]);
ARM7Write32(eaddr+0x04, *(u32*)&eMMC_CID[4]);
@ -178,9 +178,6 @@ void SoftReset()
memcpy(NDS::ARM9->ITCM, ITCMInit, 0x8000);
for (u32 i = 0; i < 0x3C00; i+=4)
ARM7Write32(0x03FFC400+i, *(u32*)&ARM7Init[i]);
DSi_AES::Reset();
LoadNAND();
@ -204,6 +201,9 @@ void SoftReset()
NDS::MapSharedWRAM(3);
for (u32 i = 0; i < 0x3C00; i+=4)
ARM7Write32(0x03FFC400+i, *(u32*)&ARM7Init[i]);
u32 eaddr = 0x03FFE6E4;
ARM7Write32(eaddr+0x00, *(u32*)&eMMC_CID[0]);
ARM7Write32(eaddr+0x04, *(u32*)&eMMC_CID[4]);
@ -433,32 +433,16 @@ bool LoadNAND()
}
memset(ITCMInit, 0, 0x8000);
memcpy(&ITCMInit[0x4400], &ARM9iBIOS[0x87F4], 0x400);
memcpy(&ITCMInit[0x4800], &ARM9iBIOS[0x9920], 0x80);
memcpy(&ITCMInit[0x4894], &ARM9iBIOS[0x99A0], 0x1048);
memcpy(&ITCMInit[0x58DC], &ARM9iBIOS[0xA9E8], 0x1048);
memset(ARM7Init, 0, 0x3C00);
f = fopen("initmem9.bin", "rb");
if (f)
{
// first 0x2524 bytes are loaded to 0x01FFC400
u32 dstaddr = 0x01FFC400;
fread(&ITCMInit[dstaddr & 0x7FFF], /*0x2524*/0x3C00, 1, f);
fclose(f);
}
else
{
printf("DSi ARM9 meminit not found\n");
}
f = fopen("initmem7.bin", "rb");
if (f)
{
fread(ARM7Init, 0x3C00, 1, f);
fclose(f);
}
else
{
printf("DSi ARM7 meminit not found\n");
}
memcpy(&ARM7Init[0x0000], &ARM7iBIOS[0x8188], 0x200);
memcpy(&ARM7Init[0x0200], &ARM7iBIOS[0xB5D8], 0x40);
memcpy(&ARM7Init[0x0254], &ARM7iBIOS[0xC6D0], 0x1048);
memcpy(&ARM7Init[0x129C], &ARM7iBIOS[0xD718], 0x1048);
return true;
}

View File

@ -34,9 +34,6 @@ extern u64 ConsoleID;
extern DSi_SDHost* SDMMC;
extern DSi_SDHost* SDIO;
extern u8 ITCMInit[0x8000];
extern u8 ARM7Init[0x3C00];
bool Init();
void DeInit();

View File

@ -562,17 +562,10 @@ void Key1_ApplyKeycode(u32* keycode, u32 mod)
void Key1_InitKeycode(bool dsi, u32 idcode, u32 level, u32 mod)
{
// TODO: source the key data from different possible places
if (NDS::ConsoleType == 1)
{
if (dsi)
memcpy(Key1_KeyBuf, &DSi::ARM7Init[0x254], 0x1048); // hax
else
memcpy(Key1_KeyBuf, &DSi::ITCMInit[0x4894], 0x1048); // hax
}
if (dsi && NDS::ConsoleType==1)
memcpy(Key1_KeyBuf, &DSi::ARM7iBIOS[0xC6D0], 0x1048); // hax
else
{
memcpy(Key1_KeyBuf, &NDS::ARM7BIOS[0x30], 0x1048); // hax
}
u32 keycode[3] = {idcode, idcode>>1, idcode<<1};
if (level >= 1) Key1_ApplyKeycode(keycode, mod);