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:
parent
960a9774e3
commit
4033c0e470
|
@ -42,6 +42,7 @@
|
||||||
#include "firmware.h"
|
#include "firmware.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
#include "slot1.h"
|
||||||
|
|
||||||
//int xxctr=0;
|
//int xxctr=0;
|
||||||
//#define LOG_ARM9
|
//#define LOG_ARM9
|
||||||
|
@ -2669,6 +2670,10 @@ bool NDS_FakeBoot()
|
||||||
_MMU_write08<ARMCPU_ARM9>(kCommandline+i, rompath[i]);
|
_MMU_write08<ARMCPU_ARM9>(kCommandline+i, rompath[i]);
|
||||||
_MMU_write08<ARMCPU_ARM9>(kCommandline+rompath.size(), 0);
|
_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;
|
delete header;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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)
|
void write32_GCDATAIN(u32 val)
|
||||||
{
|
{
|
||||||
//bool log = false;
|
//bool log = false;
|
||||||
|
@ -234,4 +240,4 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ISlot1Interface* construct_Slot1_R4() { return new Slot1_R4(); }
|
ISlot1Interface* construct_Slot1_R4() { return new Slot1_R4(); }
|
||||||
|
|
|
@ -85,6 +85,11 @@ public:
|
||||||
mSelectedImplementation->auxspi_reset(PROCNUM);
|
mSelectedImplementation->auxspi_reset(PROCNUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void post_fakeboot(int PROCNUM)
|
||||||
|
{
|
||||||
|
mSelectedImplementation->post_fakeboot(PROCNUM);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void savestate(EMUFILE* os)
|
virtual void savestate(EMUFILE* os)
|
||||||
{
|
{
|
||||||
mSelectedImplementation->savestate(os);
|
mSelectedImplementation->savestate(os);
|
||||||
|
|
|
@ -78,6 +78,12 @@ public:
|
||||||
rom.start(operation,protocol.address);
|
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)
|
virtual void savestate(EMUFILE* os)
|
||||||
{
|
{
|
||||||
protocol.savestate(os);
|
protocol.savestate(os);
|
||||||
|
|
|
@ -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)
|
virtual void savestate(EMUFILE* os)
|
||||||
{
|
{
|
||||||
protocol.savestate(os);
|
protocol.savestate(os);
|
||||||
|
|
|
@ -40,15 +40,6 @@ void Slot1Comp_Protocol::reset(ISlot1Comp_Protocol_Client* client)
|
||||||
void Slot1Comp_Protocol::write_command_RAW(GC_Command command)
|
void Slot1Comp_Protocol::write_command_RAW(GC_Command command)
|
||||||
{
|
{
|
||||||
int cmd = command.bytes[0];
|
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)
|
if(cmd == 0x9F)
|
||||||
{
|
{
|
||||||
operation = eSlot1Operation_9F_Dummy;
|
operation = eSlot1Operation_9F_Dummy;
|
||||||
|
@ -245,4 +236,4 @@ void Slot1Comp_Protocol::loadstate(EMUFILE* is)
|
||||||
delay = is->read32le();
|
delay = is->read32le();
|
||||||
chipId = is->read32le();
|
chipId = is->read32le();
|
||||||
gameCode = is->read32le();
|
gameCode = is->read32le();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,9 @@ public:
|
||||||
|
|
||||||
//called when the auxspi burst is ended (SPI chipselect in is going low)
|
//called when the auxspi burst is ended (SPI chipselect in is going low)
|
||||||
virtual void auxspi_reset(int PROCNUM) {}
|
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) {}
|
virtual void savestate(EMUFILE* os) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue