X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FPico.c;h=2ebe9c9b9cf60380bee79b76b453c2fe221e9641;hb=fad248933b6676d30ccf419858b4ee10cc123fc5;hp=c47cf19002dc87c8a9aa063c4a58993de45ba602;hpb=48df6e9e54f7c11263f5462f960b8cc2ecdc52e4;p=picodrive.git diff --git a/Pico/Pico.c b/Pico/Pico.c index c47cf19..2ebe9c9 100644 --- a/Pico/Pico.c +++ b/Pico/Pico.c @@ -64,6 +64,9 @@ int PicoReset(int hard) if (Pico.romsize<=0) return 1; + /* must call now, so that banking is reset, and correct vectors get fetched */ + if (PicoResetHook) PicoResetHook(); + PicoMemReset(); SekReset(); // s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games). @@ -79,7 +82,7 @@ int PicoReset(int hard) Pico.video.pending_ints=0; emustatus = 0; - if(hard) { + if (hard) { // clear all memory of the emulated machine memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram); } @@ -142,8 +145,6 @@ int PicoReset(int hard) PsndReset(); // pal must be known here - if (PicoResetHook) PicoResetHook(); - if (PicoMCD & 1) { PicoResetMCD(hard); return 0; @@ -243,12 +244,12 @@ static __inline void SekStep(void) static int CheckIdle(void) { - int i, state[0x22]; + int i, state[0x24]; // See if the state is the same after 2 steps: - SekState(state); SekStep(); SekStep(); SekState(state+0x11); - for (i = 0x10; i >= 0; i--) - if (state[i] != state[i+0x11]) return 0; + SekState(state); SekStep(); SekStep(); SekState(state+0x12); + for (i = 0x11; i >= 0; i--) + if (state[i] != state[i+0x12]) return 0; return 1; } @@ -343,6 +344,10 @@ static int PicoFrameSimple(void) lines_step = 14; } + // a hack for VR, to get it running in fast mode + if (PicoRead16Hook == PicoSVPRead16) + Pico.ram[0xd864^1] = 0x1a; + // we don't emulate DMA timing in this mode if (Pico.m.dma_xfers) { Pico.m.dma_xfers=0; @@ -390,10 +395,19 @@ static int PicoFrameSimple(void) if (PicoLineHook) PicoLineHook(sects*lines_step); } + // another hack for VR (it needs hints to work) + if (PicoRead16Hook == PicoSVPRead16) { + Pico.ram[0xd864^1] = 1; + pv->pending_ints|=0x10; + if (pv->reg[0]&0x10) SekInterrupt(4); + SekRunM68k(160); + } + // render screen if (!PicoSkipFrame) { if (!(PicoOpt&0x10)) + { // Draw the screen #if CAN_HANDLE_240_LINES if (pv->reg[1]&8) { @@ -404,6 +418,7 @@ static int PicoFrameSimple(void) #else for (y=0;y<224;y++) PicoLine(y); #endif + } else PicoFrameFull(); #ifdef DRAW_FINISH_FUNC DRAW_FINISH_FUNC();