X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2Femu.c;h=19f3c6768a4b8d1383239f6ce88c83f7a51c9c39;hb=c060a9ab9c428e1ed9c4159b56529a2a36031e44;hp=14080a51e02e8bf481773dc180595d4fba75b790;hpb=b06778874d140bd5187cb74444ddc40931b9bd1d;p=picodrive.git diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 14080a5..19f3c67 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -55,7 +55,7 @@ int reset_timing = 0; #define PICO_PEN_ADJUST_X 4 #define PICO_PEN_ADJUST_Y 2 -static int pico_pen_x = 320/2, pico_pen_y = 240/2, pico_inp_mode = 0; +static int pico_pen_x = 320/2, pico_pen_y = 240/2; static void emu_msg_cb(const char *msg); static void emu_msg_tray_open(void); @@ -436,31 +436,10 @@ static void emu_msg_tray_open(void) static void RunEventsPico(unsigned int events, unsigned int gp2x_keys) { - if (events & (1 << 3)) { - pico_inp_mode++; - if (pico_inp_mode > 2) pico_inp_mode = 0; - switch (pico_inp_mode) { - case 2: strcpy(noticeMsg, "Input: Pen on Pad "); break; - case 1: strcpy(noticeMsg, "Input: Pen on Storyware"); break; - case 0: strcpy(noticeMsg, "Input: Joytick "); - PicoPicohw.pen_pos[0] = PicoPicohw.pen_pos[1] = 0x8000; - break; - } - gettimeofday(¬iceMsgTime, 0); - } - if (events & (1 << 4)) { - PicoPicohw.page--; - if (PicoPicohw.page < 0) PicoPicohw.page = 0; - sprintf(noticeMsg, "Page %i ", PicoPicohw.page); - gettimeofday(¬iceMsgTime, 0); - } - if (events & (1 << 5)) { - PicoPicohw.page++; - if (PicoPicohw.page > 6) PicoPicohw.page = 6; - sprintf(noticeMsg, "Page %i ", PicoPicohw.page); - gettimeofday(¬iceMsgTime, 0); - } - if (pico_inp_mode != 0) { + emu_RunEventsPico(events); + + if (pico_inp_mode != 0) + { PicoPad[0] &= ~0x0f; // release UDLR if (gp2x_keys & GP2X_UP) { pico_pen_y--; if (pico_pen_y < 0) pico_pen_y = 0; } if (gp2x_keys & GP2X_DOWN) { pico_pen_y++; if (pico_pen_y > 239-PICO_PEN_ADJUST_Y) pico_pen_y = 239-PICO_PEN_ADJUST_Y; } @@ -512,31 +491,6 @@ static void update_volume(int has_changed, int is_up) } } -static void change_fast_forward(int set_on) -{ - static void *set_PsndOut = NULL; - static int set_Frameskip, set_EmuOpt, is_on = 0; - - if (set_on && !is_on) { - set_PsndOut = PsndOut; - set_Frameskip = currentConfig.Frameskip; - set_EmuOpt = currentConfig.EmuOpt; - PsndOut = NULL; - currentConfig.Frameskip = 8; - currentConfig.EmuOpt &= ~4; - is_on = 1; - } - else if (!set_on && is_on) { - PsndOut = set_PsndOut; - currentConfig.Frameskip = set_Frameskip; - currentConfig.EmuOpt = set_EmuOpt; - PsndRerate(1); - update_volume(0, 0); - reset_timing = 1; - is_on = 0; - } -} - static void RunEvents(unsigned int which) { if (which & 0x1800) // save or load (but not both) @@ -668,14 +622,16 @@ static void updateKeys(void) if (events & 0x6000) update_volume(1, events & 0x2000); - if ((events ^ prevEvents) & 0x40) - change_fast_forward(events & 0x40); + if ((events ^ prevEvents) & 0x40) { + emu_changeFastForward(events & 0x40); + update_volume(0, 0); + reset_timing = 1; + } events &= ~prevEvents; if (PicoAHW == PAHW_PICO) RunEventsPico(events, keys); - if (events) RunEvents(events); if (movie_data) emu_updateMovie(); @@ -1044,7 +1000,7 @@ void emu_Loop(void) frames_done++; frames_shown++; } - change_fast_forward(0); + emu_changeFastForward(0); if (PicoAHW & PAHW_MCD) PicoCDBufferFree();