ABC turbo
[libpicofe.git] / psp / emu.c
index bdf6a6e..d6bc20c 100644 (file)
--- a/psp/emu.c
+++ b/psp/emu.c
@@ -151,6 +151,7 @@ void emu_prepareDefaultConfig(void)
        defaultConfig.scale = 1.20;    // fullscreen
        defaultConfig.hscale40 = 1.25;
        defaultConfig.hscale32 = 1.56;
+       defaultConfig.turbo_rate = 15;
 }
 
 void emu_setDefaultConfig(void)
@@ -292,7 +293,8 @@ static void EmuScanPrepare(void)
        HighCol = (unsigned char *)VRAM_CACHED_STUFF + 8;
        if (!(Pico.video.reg[1]&8)) HighCol += 8*512;
 
-       dynamic_palette = 0;
+       if (dynamic_palette > 0)
+               dynamic_palette--;
        if (Pico.m.dirtyPal)
                do_pal_update(1, 1);
        if ((rendstatus & PDRAW_ACC_SPRITES) && !(Pico.video.reg[0xC]&8))
@@ -317,7 +319,7 @@ static int EmuScanSlowEnd(unsigned int num)
        if (Pico.m.dirtyPal) {
                if (!dynamic_palette) {
                        do_slowmode_lines(num);
-                       dynamic_palette = 1;
+                       dynamic_palette = 3; // last for 2 more frames
                }
                do_pal_update(1, 0);
        }
@@ -861,8 +863,11 @@ static void updateKeys(void)
                }
        }
 
-       PicoPad[0] = (unsigned short) allActions[0];
-       PicoPad[1] = (unsigned short) allActions[1];
+       PicoPad[0] = allActions[0] & 0xfff;
+       PicoPad[1] = allActions[1] & 0xfff;
+
+       if (allActions[0] & 0x7000) emu_DoTurbo(&PicoPad[0], allActions[0]);
+       if (allActions[1] & 0x7000) emu_DoTurbo(&PicoPad[1], allActions[1]);
 
        events = (allActions[0] | allActions[1]) >> 16;