hint-less mode updated for SVP, state load callback, etc
[picodrive.git] / Pico / Pico.c
index a76c9e4..2ebe9c9 100644 (file)
@@ -244,12 +244,12 @@ static __inline void SekStep(void)
 \r
 static int CheckIdle(void)\r
 {\r
-  int i, state[0x22];\r
+  int i, state[0x24];\r
 \r
   // See if the state is the same after 2 steps:\r
-  SekState(state); SekStep(); SekStep(); SekState(state+0x11);\r
-  for (i = 0x10; i >= 0; i--)\r
-    if (state[i] != state[i+0x11]) return 0;\r
+  SekState(state); SekStep(); SekStep(); SekState(state+0x12);\r
+  for (i = 0x11; i >= 0; i--)\r
+    if (state[i] != state[i+0x12]) return 0;\r
 \r
   return 1;\r
 }\r
@@ -344,6 +344,10 @@ static int PicoFrameSimple(void)
     lines_step = 14;\r
   }\r
 \r
+  // a hack for VR, to get it running in fast mode\r
+  if (PicoRead16Hook == PicoSVPRead16)\r
+    Pico.ram[0xd864^1] = 0x1a;\r
+\r
   // we don't emulate DMA timing in this mode\r
   if (Pico.m.dma_xfers) {\r
     Pico.m.dma_xfers=0;\r
@@ -391,10 +395,19 @@ static int PicoFrameSimple(void)
     if (PicoLineHook) PicoLineHook(sects*lines_step);\r
   }\r
 \r
+  // another hack for VR (it needs hints to work)\r
+  if (PicoRead16Hook == PicoSVPRead16) {\r
+    Pico.ram[0xd864^1] = 1;\r
+    pv->pending_ints|=0x10;\r
+    if (pv->reg[0]&0x10) SekInterrupt(4);\r
+    SekRunM68k(160);\r
+  }\r
+\r
   // render screen\r
   if (!PicoSkipFrame)\r
   {\r
     if (!(PicoOpt&0x10))\r
+    {\r
       // Draw the screen\r
 #if CAN_HANDLE_240_LINES\r
       if (pv->reg[1]&8) {\r
@@ -405,6 +418,7 @@ static int PicoFrameSimple(void)
 #else\r
       for (y=0;y<224;y++) PicoLine(y);\r
 #endif\r
+    }\r
     else PicoFrameFull();\r
 #ifdef DRAW_FINISH_FUNC\r
     DRAW_FINISH_FUNC();\r