diff --git a/trunk/src/ppu.cpp b/trunk/src/ppu.cpp index eb9fe3f5..c2909ec1 100644 --- a/trunk/src/ppu.cpp +++ b/trunk/src/ppu.cpp @@ -289,6 +289,11 @@ struct PPUREGS { int newppu_get_scanline() { return ppur.status.sl; } int newppu_get_dot() { return ppur.status.cycle; } +void newppu_hacky_emergency_reset() +{ + if(ppur.status.end_cycle == 0) + ppur.reset(); +} static void makeppulut(void) { int x; diff --git a/trunk/src/ppu.h b/trunk/src/ppu.h index a9dc8ca7..a3ec54a1 100644 --- a/trunk/src/ppu.h +++ b/trunk/src/ppu.h @@ -11,6 +11,7 @@ extern void (*GameHBIRQHook)(void), (*GameHBIRQHook2)(void); int newppu_get_scanline(); int newppu_get_dot(); +void newppu_hacky_emergency_reset(); /* For cart.c and banksw.h, mostly */ extern uint8 NTARAM[0x800], *vnapage[4]; diff --git a/trunk/src/state.cpp b/trunk/src/state.cpp index 30593544..0f22f90f 100644 --- a/trunk/src/state.cpp +++ b/trunk/src/state.cpp @@ -974,8 +974,12 @@ void FCEUI_LoadState(const char *fname, bool display_message) loadStateFailed = 1; return; // state doesn't exist; exit cleanly } + if (FCEUSS_Load(fname, display_message)) { + //in case we're loading a savestate made with old ppu, we need to make sure ppur's regs used for dividing are ready to go + newppu_hacky_emergency_reset(); + //mbg todo netplay #if 0 if(FCEUnetplay)