Introduce post_fakeboot hook. Switch card to normal mode after NDS_FakeBoot in a cleaner way. R4 is usable again.

This commit is contained in:
thelemonman 2013-10-13 21:56:47 +00:00
parent 960a9774e3
commit 4033c0e470
7 changed files with 33 additions and 11 deletions

View File

@ -42,6 +42,7 @@
#include "firmware.h"
#include "version.h"
#include "path.h"
#include "slot1.h"
//int xxctr=0;
//#define LOG_ARM9
@ -2669,6 +2670,10 @@ bool NDS_FakeBoot()
_MMU_write08<ARMCPU_ARM9>(kCommandline+i, rompath[i]);
_MMU_write08<ARMCPU_ARM9>(kCommandline+rompath.size(), 0);
//--------------------------------
//Call the card post_fakeboot hook to perform additional initialization
slot1_device->post_fakeboot(ARMCPU_ARM9);
slot1_device->post_fakeboot(ARMCPU_ARM7);
delete header;
return true;

View File

@ -173,6 +173,12 @@ public:
}
}
virtual void post_fakeboot(int PROCNUM)
{
// The BIOS leaves the card in NORMAL mode
protocol.mode = eCardMode_NORMAL;
}
void write32_GCDATAIN(u32 val)
{
//bool log = false;
@ -234,4 +240,4 @@ public:
};
ISlot1Interface* construct_Slot1_R4() { return new Slot1_R4(); }
ISlot1Interface* construct_Slot1_R4() { return new Slot1_R4(); }

View File

@ -85,6 +85,11 @@ public:
mSelectedImplementation->auxspi_reset(PROCNUM);
}
virtual void post_fakeboot(int PROCNUM)
{
mSelectedImplementation->post_fakeboot(PROCNUM);
}
virtual void savestate(EMUFILE* os)
{
mSelectedImplementation->savestate(os);

View File

@ -78,6 +78,12 @@ public:
rom.start(operation,protocol.address);
}
virtual void post_fakeboot(int PROCNUM)
{
// The BIOS leaves the card in NORMAL mode
protocol.mode = eCardMode_NORMAL;
}
virtual void savestate(EMUFILE* os)
{
protocol.savestate(os);

View File

@ -234,6 +234,12 @@ public:
}
}
virtual void post_fakeboot(int PROCNUM)
{
// The BIOS leaves the card in NORMAL mode
protocol.mode = eCardMode_NORMAL;
}
virtual void savestate(EMUFILE* os)
{
protocol.savestate(os);

View File

@ -40,15 +40,6 @@ void Slot1Comp_Protocol::reset(ISlot1Comp_Protocol_Client* client)
void Slot1Comp_Protocol::write_command_RAW(GC_Command command)
{
int cmd = command.bytes[0];
if(cmd == 0xB7)
{
//HACK!!!!!!!!!!!!!!!!!!
//switch to normal mode. we should do it in the NDSSystem bootup process.
//WAY cleaner it will be.
mode = eCardMode_NORMAL;
//be suer to forward this command to the NORMAL command handler...
write_command_NORMAL(command);
}
if(cmd == 0x9F)
{
operation = eSlot1Operation_9F_Dummy;
@ -245,4 +236,4 @@ void Slot1Comp_Protocol::loadstate(EMUFILE* is)
delay = is->read32le();
chipId = is->read32le();
gameCode = is->read32le();
}
}

View File

@ -80,6 +80,9 @@ public:
//called when the auxspi burst is ended (SPI chipselect in is going low)
virtual void auxspi_reset(int PROCNUM) {}
//called when NDS_FakeBoot terminates, emulate in here the BIOS behaviour
virtual void post_fakeboot(int PROCNUM) {}
virtual void savestate(EMUFILE* os) {}