-/*\r
- if (!(Pico.video.reg[12]&1)) {\r
- vidCpyM2 = vidCpyM2_32col;\r
- clearArea(1);\r
- } else vidCpyM2 = vidCpyM2_40col;\r
-\r
- vidCpyM2((unsigned char *)gp2x_screen+320*8, PicoDraw2FB+328*8);\r
- vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
- gp2x_video_setpalette(localPal, 0x40);\r
-*/\r
- PicoOpt = po_old;\r
- currentConfig.EmuOpt = eo_old;\r
-}\r
-\r
-static void simpleWait(int thissec, int lim_time)\r
-{\r
- struct timeval tval;\r
-\r
- spend_cycles(1024);\r
- gettimeofday(&tval, 0);\r
- if(thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
-\r
- while(tval.tv_usec < lim_time)\r
- {\r
- spend_cycles(1024);\r
- gettimeofday(&tval, 0);\r
- if(thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
- }\r
-}\r
-\r
-\r
-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
- 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
- int target_fps, target_frametime, lim_time, vsync_offset, i;\r
- char *notice = 0;\r
-\r
- printf("entered emu_Loop()\n");\r
-\r
- if (gp2x_old_clock != currentConfig.CPUclock) {\r
- printf("changing clock to %i...", currentConfig.CPUclock); fflush(stdout);\r
- set_FCLK(currentConfig.CPUclock);\r
- gp2x_old_clock = currentConfig.CPUclock;\r
- printf(" done\n");\r
- }\r
-\r
- if (gp2x_old_gamma != currentConfig.gamma || (EmuOpt_old&0x1000) != (currentConfig.EmuOpt&0x1000)) {\r
- set_gamma(currentConfig.gamma, !!(currentConfig.EmuOpt&0x1000));\r
- gp2x_old_gamma = currentConfig.gamma;\r
- printf("updated gamma to %i, A_SN's curve: %i\n", currentConfig.gamma, !!(currentConfig.EmuOpt&0x1000));\r
- }\r
-\r
- if ((EmuOpt_old&0x2000) != (currentConfig.EmuOpt&0x2000)) {\r
- if (currentConfig.EmuOpt&0x2000)\r
- set_LCD_custom_rate(Pico.m.pal ? LCDR_100 : LCDR_120);\r
- else unset_LCD_custom_rate();\r
- }\r
-\r
- EmuOpt_old = currentConfig.EmuOpt;\r
- fpsbuff[0] = 0;\r
-\r
- // make sure we are in correct mode\r
- vidResetMode();\r
- Pico.m.dirtyPal = 1;\r
- oldmodes = ((Pico.video.reg[12]&1)<<2) ^ 0xc;\r
- find_combos();\r
-\r
- // pal/ntsc might have changed, reset related stuff\r
- target_fps = Pico.m.pal ? 50 : 60;\r
- target_frametime = 1000000/target_fps;\r
- reset_timing = 1;\r