Cyclone poll detection problem fixed
[libpicofe.git] / gp2x / emu.c
index 8bd1b66..3f2ed3f 100644 (file)
@@ -43,7 +43,7 @@ char romFileName[PATH_MAX];
 \r
 extern int crashed_940;\r
 \r
-static short sndBuffer[2*44100/50];\r
+static short __attribute__((aligned(4))) sndBuffer[2*44100/50];\r
 static struct timeval noticeMsgTime = { 0, 0 };        // when started showing\r
 static int osd_fps_x;\r
 static int combo_keys = 0, combo_acts = 0;     // keys and actions which need button combos\r
@@ -104,11 +104,22 @@ static void find_combos(void)
        combo_keys = combo_acts = 0;\r
        for (act = 0; act < 32; act++)\r
        {\r
-               int keyc = 0;\r
-               if (act == 16) continue; // player2 flag\r
-               for (u = 0; u < 32; u++)\r
+               int keyc = 0, keyc2 = 0;\r
+               if (act == 16 || act == 17) continue; // player2 flag\r
+               if (act > 17)\r
                {\r
-                       if (currentConfig.KeyBinds[u] & (1 << act)) keyc++;\r
+                       for (u = 0; u < 32; u++)\r
+                               if (currentConfig.KeyBinds[u] & (1 << act)) keyc++;\r
+               }\r
+               else\r
+               {\r
+                       for (u = 0; u < 32; u++)\r
+                               if ((currentConfig.KeyBinds[u] & 0x30000) == 0 && // pl. 1\r
+                                       (currentConfig.KeyBinds[u] & (1 << act))) keyc++;\r
+                       for (u = 0; u < 32; u++)\r
+                               if ((currentConfig.KeyBinds[u] & 0x30000) == 1 && // pl. 2\r
+                                       (currentConfig.KeyBinds[u] & (1 << act))) keyc2++;\r
+                       if (keyc2 > keyc) keyc = keyc2;\r
                }\r
                if (keyc > 1)\r
                {\r
@@ -122,6 +133,7 @@ static void find_combos(void)
                        }\r
                }\r
        }\r
+\r
        // printf("combo keys/acts: %08x %08x\n", combo_keys, combo_acts);\r
 }\r
 \r
@@ -629,7 +641,7 @@ static void simpleWait(int thissec, int lim_time)
 void emu_Loop(void)\r
 {\r
        static int gp2x_old_clock = 200;\r
-       static int PsndRate_old = 0, PicoOpt_old = 0, EmuOpt_old = 0, PsndLen_real = 0, pal_old = 0;\r
+       static int PsndRate_old = 0, PicoOpt_old = 0, EmuOpt_old = 0, pal_old = 0;\r
        char fpsbuff[24]; // fps count c string\r
        struct timeval tval; // timing\r
        int thissec = 0, frames_done = 0, frames_shown = 0, oldmodes = 0;\r
@@ -682,7 +694,7 @@ void emu_Loop(void)
                                Reset940(1, 2);\r
                                Pause940(1);\r
                        }\r
-                       sound_rerate(Pico.m.frame_count ? 1 : 0);\r
+                       PsndRerate(Pico.m.frame_count ? 1 : 0);\r
                }\r
                snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
                printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n",\r
@@ -693,7 +705,6 @@ void emu_Loop(void)
                memset(sndBuffer, 0, sizeof(sndBuffer));\r
                PsndOut = sndBuffer;\r
                PsndRate_old = PsndRate;\r
-               PsndLen_real = PsndLen;\r
                PicoOpt_old  = PicoOpt;\r
                pal_old = Pico.m.pal;\r
        } else {\r