From 98c9d8d9e79355a54e59123cf10bac1da78c1c6b Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 29 Jan 2007 23:39:15 +0000 Subject: [PATCH] savestates works git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@26 be3aeb3a-fb24-0410-a615-afba39da0efa --- gp2x/940ctl_ym2612.c | 19 +++++++++++++++++++ gp2x/emu.c | 13 +++++++++---- linux/940ctl_ym2612.c | 4 ++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/gp2x/940ctl_ym2612.c b/gp2x/940ctl_ym2612.c index 1352172..63d1e48 100644 --- a/gp2x/940ctl_ym2612.c +++ b/gp2x/940ctl_ym2612.c @@ -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; +} + + diff --git a/gp2x/emu.c b/gp2x/emu.c index 17e7028..633a780 100644 --- a/gp2x/emu.c +++ b/gp2x/emu.c @@ -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; } diff --git a/linux/940ctl_ym2612.c b/linux/940ctl_ym2612.c index 4458a2f..2cfa57b 100644 --- a/linux/940ctl_ym2612.c +++ b/linux/940ctl_ym2612.c @@ -269,4 +269,8 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 } +int mp3_get_offset(void) +{ + return 0; +} -- 2.39.2