X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FArea.c;h=d8833a43f755e0393e23a1ede0241243227b1a30;hb=4b9c58882616c5205a5ad5c9350f20a3d22bd7e1;hp=17646693913752b64b90830cd2e9f1f030990146;hpb=03e4f2a349247334666c87abe3a908df72d23051;p=picodrive.git diff --git a/Pico/Area.c b/Pico/Area.c index 1764669..d8833a4 100644 --- a/Pico/Area.c +++ b/Pico/Area.c @@ -28,6 +28,8 @@ areaeof *areaEof = (areaeof *) 0; areaseek *areaSeek = (areaseek *) 0; areaclose *areaClose = (areaclose *) 0; +void (*PicoLoadStateHook)(void) = NULL; + // Scan one variable and callback static int ScanVar(void *data,int len,char *name,void *PmovFile,int PmovAction) @@ -136,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); @@ -174,10 +175,14 @@ int PmovState(int PmovAction, void *PmovFile) int minimum=0; unsigned char head[32]; - if (PicoMCD & 1) + if ((PicoAHW & PAHW_MCD) || carthw_chunks != NULL) { if (PmovAction&1) return PicoCdSaveState(PmovFile); - if (PmovAction&2) return PicoCdLoadState(PmovFile); + if (PmovAction&2) { + int ret = PicoCdLoadState(PmovFile); + if (PicoLoadStateHook) PicoLoadStateHook(); + return ret; + } } memset(head,0,sizeof(head)); @@ -197,6 +202,8 @@ int PmovState(int PmovAction, void *PmovFile) // Scan memory areas: PicoAreaScan(PmovAction, *(unsigned int *)(head+0x8), PmovFile); + if ((PmovAction&2) && PicoLoadStateHook) PicoLoadStateHook(); + return 0; }