savestates works

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@26 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-01-29 23:39:15 +00:00
parent 979ba09f05
commit 98c9d8d9e7
3 changed files with 32 additions and 4 deletions

View file

@ -576,3 +576,22 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023
}
int mp3_get_offset(void)
{
int offs1024 = 0;
int cdda_on;
cdda_on = (PicoMCD & 1) && (currentConfig.EmuOpt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) &&
(Pico_mcd->scd.Status_CDC & 1) && loaded_mp3 && shared_ctl->mp3_offs < shared_ctl->mp3_len;
if (cdda_on) {
offs1024 = shared_ctl->mp3_offs << 7;
offs1024 /= shared_ctl->mp3_len;
offs1024 <<= 3;
}
printf("offs1024=%i (%i/%i)\n", offs1024, shared_ctl->mp3_offs, shared_ctl->mp3_len);
return offs1024;
}

View file

@ -1264,7 +1264,6 @@ size_t gzWrite2(void *p, size_t _size, size_t _n, void *file)
return gzwrite(file, p, _n);
}
typedef unsigned int (*STATE_SL_FUNC)(void *, unsigned int, unsigned int, void *);
int emu_SaveLoadGame(int load, int sram)
{
@ -1326,6 +1325,7 @@ int emu_SaveLoadGame(int load, int sram)
areaRead = gzRead2;
areaWrite = gzWrite2;
areaEof = (areaeof *) gzeof;
areaSeek = (areaseek *) gzseek;
if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY);
} else
saveFname[strlen(saveFname)-3] = 0;
@ -1335,18 +1335,23 @@ int emu_SaveLoadGame(int load, int sram)
areaRead = (arearw *) fread;
areaWrite = (arearw *) fwrite;
areaEof = (areaeof *) feof;
areaSeek = (areaseek *) fseek;
}
}
if(PmovFile) {
PmovState(load ? 6 : 5, PmovFile);
strcpy(noticeMsg, load ? "GAME LOADED " : "GAME SAVED ");
ret = PmovState(load ? 6 : 5, PmovFile);
if(areaRead == gzRead2)
gzclose(PmovFile);
else fclose ((FILE *) PmovFile);
PmovFile = 0;
if (!load) sync();
else Pico.m.dirtyPal=1;
} else {
}
else ret = -1;
if (!ret)
strcpy(noticeMsg, load ? "GAME LOADED " : "GAME SAVED ");
else
{
strcpy(noticeMsg, load ? "LOAD FAILED " : "SAVE FAILED ");
ret = -1;
}

View file

@ -269,4 +269,8 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023
}
int mp3_get_offset(void)
{
return 0;
}