fix SCFG_MC cartridge inserted bit

This commit is contained in:
RSDuck 2022-08-21 22:11:22 +02:00
parent 22b312bc43
commit d56219c33c
3 changed files with 14 additions and 1 deletions

View File

@ -159,7 +159,7 @@ void Reset()
SCFG_Clock7 = 0x0187; SCFG_Clock7 = 0x0187;
SCFG_EXT[0] = 0x8307F100; SCFG_EXT[0] = 0x8307F100;
SCFG_EXT[1] = 0x93FFFB06; SCFG_EXT[1] = 0x93FFFB06;
SCFG_MC = 0x0010;//0x0011; SCFG_MC = 0x0010 | (~((u32)NDSCart::CartInserted)&1);//0x0011;
SCFG_RST = 0; SCFG_RST = 0;
DSi_DSP::SetRstLine(false); DSi_DSP::SetRstLine(false);
@ -248,6 +248,14 @@ void DoSavestate(Savestate* file)
SDIO->DoSavestate(file); SDIO->DoSavestate(file);
} }
void SetCartInserted(bool inserted)
{
if (inserted)
SCFG_MC &= ~1;
else
SCFG_MC |= 1;
}
void DecryptModcryptArea(u32 offset, u32 size, u8* iv) void DecryptModcryptArea(u32 offset, u32 size, u8* iv)
{ {
AES_ctx ctx; AES_ctx ctx;

View File

@ -59,6 +59,8 @@ void Reset();
void DoSavestate(Savestate* file); void DoSavestate(Savestate* file);
void SetCartInserted(bool inserted);
void SetupDirectBoot(); void SetupDirectBoot();
void SoftReset(); void SoftReset();

View File

@ -1679,6 +1679,7 @@ bool LoadROM(const u8* romdata, u32 romlen)
} }
CartInserted = true; CartInserted = true;
DSi::SetCartInserted(true);
u32 irversion = 0; u32 irversion = 0;
if ((gamecode & 0xFF) == 'I') if ((gamecode & 0xFF) == 'I')
@ -1738,6 +1739,8 @@ void EjectCart()
CartROMSize = 0; CartROMSize = 0;
CartID = 0; CartID = 0;
DSi::SetCartInserted(false);
// CHECKME: does an eject imply anything for the ROM/SPI transfer registers? // CHECKME: does an eject imply anything for the ROM/SPI transfer registers?
} }