bugfixes, refactoring

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@394 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-03-25 19:23:07 +00:00
parent 1ca2ea4f60
commit bdec53c90b
13 changed files with 139 additions and 178 deletions

View file

@ -138,7 +138,6 @@ static int PicoAreaScan(int PmovAction,unsigned int ver, void *PmovFile)
// Pack, scan and unpack the cpu data:
if((PmovAction&3)==1) PicoAreaPackCpu(cpu, 0);
//SekInit(); // notaz: do we really have to do this here?
//PicoMemInit();
SCAN_VAR(cpu,"cpu")
if((PmovAction&3)==2) PicoAreaUnpackCpu(cpu, 0);

View file

@ -7,6 +7,14 @@
/* 12-in-1 and 4-in-1. Assuming 2MB ROMs here. */
static unsigned int carthw_12in1_baddr = 0;
static carthw_state_chunk carthw_12in1_state[] =
{
{ CHUNK_CARTHW, sizeof(carthw_12in1_baddr), &carthw_12in1_baddr },
{ 0, 0, NULL }
};
static unsigned int carthw_12in1_read16(unsigned int a, int realsize)
{
// ??
@ -26,6 +34,7 @@ static void carthw_12in1_write8(unsigned int a, unsigned int d, int realsize)
return;
}
carthw_12in1_baddr = a;
a &= 0x3f; a <<= 16;
len = Pico.romsize - a;
if (len <= 0) {
@ -41,6 +50,11 @@ static void carthw_12in1_reset(void)
carthw_12in1_write8(0xA13000, 0, 0);
}
static void carthw_12in1_statef(void)
{
carthw_12in1_write8(carthw_12in1_baddr, 0, 0);
}
void carthw_12in1_startup(void)
{
void *tmp;
@ -59,6 +73,8 @@ void carthw_12in1_startup(void)
PicoRead16Hook = carthw_12in1_read16;
PicoWrite8Hook = carthw_12in1_write8;
PicoResetHook = carthw_12in1_reset;
PicoLoadStateHook = carthw_12in1_statef;
carthw_chunks = carthw_12in1_state;
}

View file

@ -153,6 +153,8 @@ PICO_INTERNAL int PicoCdSaveState(void *file)
if (carthw_chunks != NULL)
{
carthw_state_chunk *chwc;
if (PicoStateProgressCB)
PicoStateProgressCB("Saving.. cart hw state");
for (chwc = carthw_chunks; chwc->ptr != NULL; chwc++)
CHECKED_WRITE(chwc->chunk, chwc->size, chwc->ptr);
}