\r
\r
/* OPN Mode Register Write */\r
-static void set_timers( int v )\r
+static int set_timers( int v )\r
{\r
+ int change;\r
+\r
/* b7 = CSM MODE */\r
/* b6 = 3 slot mode */\r
/* b5 = reset b */\r
/* b2 = timer enable a */\r
/* b1 = load b */\r
/* b0 = load a */\r
+ change = (ST_mode ^ v) & 0xc0;\r
ST_mode = v;\r
\r
/* reset Timer b flag */\r
/* reset Timer a flag */\r
if( v & 0x10 )\r
ST_status &= ~1;\r
+\r
+ return change;\r
}\r
\r
/* YM2612 write */\r
/* returns 1 if sample affecting state changed */\r
int YM2612Write_940(unsigned int a, unsigned int v)\r
{\r
- int addr; //, ret=1;\r
+ int addr;\r
+ int upd = 1; /* the write affects sample generation */\r
\r
v &= 0xff; /* adjust to 8 bit bus */\r
a &= 3;\r
\r
+ //printf("%05i:%03i: ym w ([%i] %02x)\n", Pico.m.frame_count, Pico.m.scanline, a, v);\r
+\r
switch( a ) {\r
case 0: /* address port 0 */\r
if (!addr_A1 && ST_address == v)\r
(v == 0x24 || v == 0x25 || v == 0x26 || v == 0x2a))\r
return 0;\r
addr_A1 = 0;\r
- //ret=0;\r
+ upd = 0;\r
break;\r
\r
case 1: /* data port 0 */\r
}\r
return 0;\r
case 0x27: /* mode, timer control */\r
- set_timers( v );\r
- break; // other side needs ST.mode for 3slot mode\r
+ if (set_timers( v ))\r
+ break; // other side needs ST.mode for 3slot mode\r
+ return 0;\r
case 0x2a: /* DAC data (YM2612) */\r
dacout = ((int)v - 0x80) << 6; /* level unknown (notaz: 8 seems to be too much) */\r
return 0;\r
case 0x2b: /* DAC Sel (YM2612) */\r
/* b7 = dac enable */\r
dacen = v & 0x80;\r
+ upd = 0;\r
break; // other side has to know this\r
default:\r
break;\r
return 0;\r
ST_address = v;\r
addr_A1 = 1;\r
- //ret=0;\r
+ upd = 0;\r
break;\r
\r
case 3: /* data port 1 */\r
break;\r
}\r
\r
+ //printf("ym pass\n");\r
+\r
if(currentConfig.EmuOpt & 4) {\r
- /* queue this write for 940 */\r
- if (writebuff_ptr < 2047) {\r
- if (shared_ctl->writebuffsel == 1) {\r
- shared_ctl->writebuff0[writebuff_ptr++] = (a<<8)|v;\r
- } else {\r
- shared_ctl->writebuff1[writebuff_ptr++] = (a<<8)|v;\r
+ UINT16 *writebuff = shared_ctl->writebuffsel ? shared_ctl->writebuff0 : shared_ctl->writebuff1;\r
+\r
+ /* detect rapid ym updates */\r
+ if (upd && !(writebuff_ptr & 0x80000000) && Pico.m.scanline < 224) {\r
+ int mid = Pico.m.pal ? 68 : 93;\r
+ if (Pico.m.scanline > mid) {\r
+ //printf("%05i:%03i: rapid ym\n", Pico.m.frame_count, Pico.m.scanline);\r
+ writebuff[writebuff_ptr++ & 0xffff] = 0xfffe;\r
+ writebuff_ptr |= 0x80000000;\r
+ //printf("%05i:%03i: ym w ([%02x] %02x, upd=%i)\n", Pico.m.frame_count, Pico.m.scanline, addr, v, upd);\r
}\r
+ }\r
+\r
+ /* queue this write for 940 */\r
+ if ((writebuff_ptr&0xffff) < 2047) {\r
+ writebuff[writebuff_ptr++ & 0xffff] = (a<<8)|v;\r
} else {\r
printf("warning: writebuff_ptr > 2047 ([%i] %02x)\n", a, v);\r
}\r
\r
addr_A1 = old_A1;\r
\r
- add_job_940(JOB940_PICOSTATELOAD);\r
+// add_job_940(JOB940_PICOSTATELOAD);\r
}\r
\r
\r
else memset32(buffer, 0, length<<stereo);\r
\r
if (shared_ctl->writebuffsel == 1) {\r
- shared_ctl->writebuff0[writebuff_ptr] = 0xffff;\r
+ shared_ctl->writebuff0[writebuff_ptr & 0xffff] = 0xffff;\r
} else {\r
- shared_ctl->writebuff1[writebuff_ptr] = 0xffff;\r
+ shared_ctl->writebuff1[writebuff_ptr & 0xffff] = 0xffff;\r
}\r
writebuff_ptr = 0;\r
\r
int state_slot = 0;\r
int reset_timing = 0;\r
\r
-/*\r
-// tmp\r
-static FILE *logf = NULL;\r
\r
-void pprintf(char *texto, ...)\r
-{\r
- va_list args;\r
-\r
- va_start(args,texto);\r
- vfprintf(logf,texto,args);\r
- va_end(args);\r
- fflush(logf);\r
- sync();\r
-}\r
-*/\r
// utilities\r
static void strlwr(char* string)\r
{\r
}\r
\r
\r
+void scaling_update(void)\r
+{\r
+ PicoOpt &= ~0x4100;\r
+ switch (currentConfig.scaling) {\r
+ default: break; // off\r
+ case 1: // hw hor\r
+ case 2: PicoOpt |= 0x0100; break; // hw hor+vert\r
+ case 3: PicoOpt |= 0x4000; break; // sw hor\r
+ }\r
+}\r
+\r
+\r
int emu_ReadConfig(int game)\r
{\r
FILE *f;\r
currentConfig.KeyBinds[22] = 1<<30; // vol down\r
currentConfig.gamma = 100;\r
currentConfig.PicoCDBuffers = 64;\r
+ currentConfig.scaling = 0;\r
strncpy(cfg, PicoConfigFile, 511);\r
cfg[511] = 0;\r
} else {\r
bread = fread(¤tConfig, 1, sizeof(currentConfig), f);\r
fclose(f);\r
}\r
- printf((bread == sizeof(currentConfig)) ? "(ok)\n" : "(failed)\n");\r
+ printf(bread > 0 ? "(ok)\n" : "(failed)\n");\r
\r
PicoOpt = currentConfig.PicoOpt;\r
PsndRate = currentConfig.PsndRate;\r
actionNames[ 8] = "Z"; actionNames[ 9] = "Y";\r
actionNames[10] = "X"; actionNames[11] = "MODE";\r
}\r
+ scaling_update();\r
// some sanity checks\r
if (currentConfig.CPUclock < 1 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;\r
if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100;\r
currentConfig.KeyBinds[22] = 1<<30; // vol down\r
}\r
\r
- return (bread == sizeof(currentConfig));\r
+ return (bread > 0); // == sizeof(currentConfig));\r
}\r
\r
\r
bwrite = fwrite(¤tConfig, 1, sizeof(currentConfig), f);\r
fflush(f);\r
fclose(f);\r
+#ifndef NO_SYNC\r
sync();\r
+#endif\r
}\r
printf((bwrite == sizeof(currentConfig)) ? "(ok)\n" : "(failed)\n");\r
\r
SRam.changed = 0;\r
}\r
\r
- if (!(currentConfig.EmuOpt & 0x20))\r
- emu_WriteConfig(0);\r
+ if (!(currentConfig.EmuOpt & 0x20)) {\r
+ FILE *f = fopen(PicoConfigFile, "r+b");\r
+ if (!f) emu_WriteConfig(0);\r
+ else {\r
+ // if we already have config, reload it, except last ROM\r
+ fseek(f, sizeof(currentConfig.lastRomFile), SEEK_SET);\r
+ fread(¤tConfig.EmuOpt, 1, sizeof(currentConfig) - sizeof(currentConfig.lastRomFile), f);\r
+ fseek(f, 0, SEEK_SET);\r
+ fwrite(¤tConfig, 1, sizeof(currentConfig), f);\r
+ fflush(f);\r
+ fclose(f);\r
+#ifndef NO_SYNC\r
+ sync();\r
+#endif\r
+ }\r
+ }\r
+\r
free(framebuff);\r
\r
PicoExit();\r
}\r
}\r
\r
- if (notice) osd_text(4, 232, notice);\r
- if (emu_opt & 2)\r
- osd_text(osd_fps_x, 232, fps);\r
+ if (notice || (emu_opt & 2)) {\r
+ int h = 232;\r
+ if (currentConfig.scaling == 2 && !(Pico.video.reg[1]&8)) h -= 8;\r
+ if (notice) osd_text(4, h, notice);\r
+ if (emu_opt & 2)\r
+ osd_text(osd_fps_x, h, fps);\r
+ }\r
if ((emu_opt & 0x400) && (PicoMCD & 1))\r
cd_leds();\r
\r
}\r
Pico.m.dirtyPal = 1;\r
// reset scaling\r
- gp2x_video_RGB_setscaling((PicoOpt&0x100)&&!(Pico.video.reg[12]&1) ? 256 : 320, 240);\r
+ if (currentConfig.scaling == 2 && !(Pico.video.reg[1]&8))\r
+ gp2x_video_RGB_setscaling(8, (PicoOpt&0x100)&&!(Pico.video.reg[12]&1) ? 256 : 320, 224);\r
+ else gp2x_video_RGB_setscaling(0, (PicoOpt&0x100)&&!(Pico.video.reg[12]&1) ? 256 : 320, 240);\r
}\r
\r
\r
vidCpyM2 = vidCpyM2_32col;\r
}\r
}\r
- gp2x_video_RGB_setscaling(scalex, 240);\r
+ if (currentConfig.scaling == 2 && !(modes&8)) // want vertical scaling and game is not in 240 line mode\r
+ gp2x_video_RGB_setscaling(8, scalex, 224);\r
+ else gp2x_video_RGB_setscaling(0, scalex, 240);\r
oldmodes = modes;\r
clearArea(1);\r
}\r
if (frames_shown > frames_done) frames_shown = frames_done;\r
}\r
}\r
-#if 0\r
+#if 1\r
sprintf(fpsbuff, "%05i", Pico.m.frame_count);\r
#endif\r
lim_time = (frames_done+1) * target_frametime;\r
ret = fwrite(sram_data, 1, sram_size, sramFile);\r
ret = (ret != sram_size) ? -1 : 0;\r
fclose(sramFile);\r
+#ifndef NO_SYNC\r
sync();\r
+#endif\r
}\r
}\r
return ret;\r
ret = PmovState(load ? 6 : 5, PmovFile);\r
areaClose(PmovFile);\r
PmovFile = 0;\r
- if (!load) sync();\r
- else Pico.m.dirtyPal=1;\r
+ if (load) Pico.m.dirtyPal=1;\r
+#ifndef NO_SYNC\r
+ else sync();\r
+#endif\r
}\r
else ret = -1;\r
if (!ret)\r
#define FRAMEBUFF_ADDR2 (FRAMEBUFF_ADDR1+0x30000)\r
#define FRAMEBUFF_ADDR3 (FRAMEBUFF_ADDR2+0x30000)\r
\r
-static const int gp2x_screenaddrs[] = { FRAMEBUFF_ADDR0, FRAMEBUFF_ADDR1, FRAMEBUFF_ADDR2, FRAMEBUFF_ADDR3 };\r
+static const int gp2x_screenaddrs[4] = { FRAMEBUFF_ADDR0, FRAMEBUFF_ADDR1, FRAMEBUFF_ADDR2, FRAMEBUFF_ADDR3 };\r
+static int gp2x_screenaddrs_use[4];\r
static unsigned short gp2x_screenaddr_old[4];\r
\r
\r
/* video stuff */\r
void gp2x_video_flip(void)\r
{\r
- unsigned short msw = (unsigned short)(gp2x_screenaddrs[screensel&3] >> 16);\r
+ unsigned short lsw = (unsigned short) gp2x_screenaddrs_use[screensel&3];\r
+ unsigned short msw = (unsigned short)(gp2x_screenaddrs_use[screensel&3] >> 16);\r
\r
gp2x_memregs[0x2910>>1] = msw;\r
gp2x_memregs[0x2914>>1] = msw;\r
- gp2x_memregs[0x290E>>1] = 0;\r
- gp2x_memregs[0x2912>>1] = 0;\r
+ gp2x_memregs[0x290E>>1] = lsw;\r
+ gp2x_memregs[0x2912>>1] = lsw;\r
\r
// jump to other buffer:\r
gp2x_screen = gp2x_screens[++screensel&3];\r
/* doulblebuffered flip */\r
void gp2x_video_flip2(void)\r
{\r
- unsigned short msw = (unsigned short)(gp2x_screenaddrs[screensel&1] >> 16);\r
+ unsigned short msw = (unsigned short)(gp2x_screenaddrs_use[screensel&1] >> 16);\r
\r
gp2x_memregs[0x2910>>1] = msw;\r
gp2x_memregs[0x2914>>1] = msw;\r
\r
\r
// TV Compatible function //\r
-void gp2x_video_RGB_setscaling(int W, int H)\r
+void gp2x_video_RGB_setscaling(int ln_offs, int W, int H)\r
{\r
float escalaw, escalah;\r
int bpp = (gp2x_memregs[0x28DA>>1]>>9)&0x3;\r
+ unsigned short scalw;\r
+\r
+ // set offset\r
+ gp2x_screenaddrs_use[0] = gp2x_screenaddrs[0] + ln_offs * 320 * bpp;\r
+ gp2x_screenaddrs_use[1] = gp2x_screenaddrs[1] + ln_offs * 320 * bpp;\r
+ gp2x_screenaddrs_use[2] = gp2x_screenaddrs[2] + ln_offs * 320 * bpp;\r
+ gp2x_screenaddrs_use[3] = gp2x_screenaddrs[3] + ln_offs * 320 * bpp;\r
\r
escalaw = 1024.0; // RGB Horiz LCD\r
escalah = 320.0; // RGB Vert LCD\r
}\r
\r
// scale horizontal\r
- gp2x_memregs[0x2906>>1]=(unsigned short)((float)escalaw *(W/320.0));\r
+ scalw = (unsigned short)((float)escalaw *(W/320.0));\r
+ /* if there is no horizontal scaling, vertical doesn't work. Here is a nasty wrokaround... */\r
+ if (H != 240 && W == 320) scalw--;\r
+ gp2x_memregs[0x2906>>1]=scalw;\r
// scale vertical\r
gp2x_memregl[0x2908>>2]=(unsigned long)((float)escalah *bpp *(H/240.0));\r
}\r
gp2x_screenaddr_old[2] = gp2x_memregs[0x2912>>1];\r
gp2x_screenaddr_old[3] = gp2x_memregs[0x2914>>1];\r
\r
+ memcpy(gp2x_screenaddrs_use, gp2x_screenaddrs, sizeof(gp2x_screenaddrs));\r
gp2x_memset_all_buffers(0, 0, 320*240*2);\r
\r
// snd\r
return alphasort(d1, d2);\r
}\r
\r
-static char *filter_exts[] = { ".mp3", ".MP3", ".srm", ".brm", "s.gz", ".mds", "bcfg", ".txt", ".htm", "html", ".jpg", ".gpe" };\r
+static char *filter_exts[] = {\r
+ ".mp3", ".MP3", ".srm", ".brm", "s.gz", ".mds", "bcfg", ".txt", ".htm", "html",\r
+ ".jpg", ".gpe", ".cue"\r
+};\r
\r
static int scandir_filter(const struct dirent *ent)\r
{\r
//memset(gp2x_screen, 0, 320*240);\r
gp2x_pd_clone_buffer2();\r
\r
- gp2x_text_out8(tl_x, y, "Scale 32 column mode %s", (currentConfig.PicoOpt&0x100)?"ON":"OFF"); // 0\r
- gp2x_text_out8(tl_x, (y+=10), "Gamma correction %i.%02i", currentConfig.gamma / 100, currentConfig.gamma%100); // 1\r
- gp2x_text_out8(tl_x, (y+=10), "Emulate Z80 %s", (currentConfig.PicoOpt&0x004)?"ON":"OFF"); // 2\r
- gp2x_text_out8(tl_x, (y+=10), "Emulate YM2612 (FM) %s", (currentConfig.PicoOpt&0x001)?"ON":"OFF"); // 3\r
- gp2x_text_out8(tl_x, (y+=10), "Emulate SN76496 (PSG) %s", (currentConfig.PicoOpt&0x002)?"ON":"OFF"); // 4\r
- gp2x_text_out8(tl_x, (y+=10), "gzip savestates %s", (currentConfig.EmuOpt &0x008)?"ON":"OFF"); // 5\r
- gp2x_text_out8(tl_x, (y+=10), "Don't save config on exit %s", (currentConfig.EmuOpt &0x020)?"ON":"OFF"); // 6\r
+ gp2x_text_out8(tl_x, y, "Gamma correction %i.%02i", currentConfig.gamma / 100, currentConfig.gamma%100); // 0\r
+ gp2x_text_out8(tl_x, (y+=10), "Emulate Z80 %s", (currentConfig.PicoOpt&0x004)?"ON":"OFF"); // 1\r
+ gp2x_text_out8(tl_x, (y+=10), "Emulate YM2612 (FM) %s", (currentConfig.PicoOpt&0x001)?"ON":"OFF"); // 2\r
+ gp2x_text_out8(tl_x, (y+=10), "Emulate SN76496 (PSG) %s", (currentConfig.PicoOpt&0x002)?"ON":"OFF"); // 3\r
+ gp2x_text_out8(tl_x, (y+=10), "gzip savestates %s", (currentConfig.EmuOpt &0x008)?"ON":"OFF"); // 4\r
+ gp2x_text_out8(tl_x, (y+=10), "Don't save config on exit %s", (currentConfig.EmuOpt &0x020)?"ON":"OFF"); // 5\r
gp2x_text_out8(tl_x, (y+=10), "needs restart:");\r
- gp2x_text_out8(tl_x, (y+=10), "craigix's RAM timings %s", (currentConfig.EmuOpt &0x100)?"ON":"OFF"); // 8\r
- gp2x_text_out8(tl_x, (y+=10), "squidgehack (now %s %s", mms, (currentConfig.EmuOpt &0x010)?"ON":"OFF"); // 9\r
+ gp2x_text_out8(tl_x, (y+=10), "craigix's RAM timings %s", (currentConfig.EmuOpt &0x100)?"ON":"OFF"); // 7\r
+ gp2x_text_out8(tl_x, (y+=10), "squidgehack (now %s %s", mms, (currentConfig.EmuOpt &0x010)?"ON":"OFF"); // 8\r
gp2x_text_out8(tl_x, (y+=10), "Done");\r
\r
// draw cursor\r
\r
static void amenu_loop_options(void)\r
{\r
- int menu_sel = 0, menu_sel_max = 10;\r
+ int menu_sel = 0, menu_sel_max = 9;\r
unsigned long inp = 0;\r
\r
for(;;)\r
if(inp & GP2X_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
if((inp& GP2X_B)||(inp&GP2X_LEFT)||(inp&GP2X_RIGHT)) { // toggleable options\r
switch (menu_sel) {\r
- case 0: currentConfig.PicoOpt^=0x100; break;\r
- case 2: currentConfig.PicoOpt^=0x004; break;\r
- case 3: currentConfig.PicoOpt^=0x001; break;\r
- case 4: currentConfig.PicoOpt^=0x002; break;\r
- case 5: currentConfig.EmuOpt ^=0x008; break;\r
- case 6: currentConfig.EmuOpt ^=0x020; break;\r
- case 8: currentConfig.EmuOpt ^=0x100; break;\r
- case 9: currentConfig.EmuOpt ^=0x010; break;\r
- case 10: return;\r
+ case 1: currentConfig.PicoOpt^=0x004; break;\r
+ case 2: currentConfig.PicoOpt^=0x001; break;\r
+ case 3: currentConfig.PicoOpt^=0x002; break;\r
+ case 4: currentConfig.EmuOpt ^=0x008; break;\r
+ case 5: currentConfig.EmuOpt ^=0x020; break;\r
+ case 7: currentConfig.EmuOpt ^=0x100; break;\r
+ case 8: currentConfig.EmuOpt ^=0x010; break;\r
+ case 9: return;\r
}\r
}\r
if(inp & (GP2X_X|GP2X_A)) return;\r
if(inp & (GP2X_LEFT|GP2X_RIGHT)) { // multi choise\r
switch (menu_sel) {\r
- case 1:\r
+ case 0:\r
while ((inp = gp2x_joystick_read(1)) & (GP2X_LEFT|GP2X_RIGHT)) {\r
currentConfig.gamma += (inp & GP2X_LEFT) ? -1 : 1;\r
if (currentConfig.gamma < 1) currentConfig.gamma = 1;\r
\r
static void draw_menu_options(int menu_sel)\r
{\r
- int tl_x = 25, tl_y = 40, y;\r
- char monostereo[8], strframeskip[8], *strrend;\r
+ int tl_x = 25, tl_y = 32, y;\r
+ char monostereo[8], strframeskip[8], *strrend, *strscaling;\r
\r
strcpy(monostereo, (currentConfig.PicoOpt&0x08)?"stereo":"mono");\r
if (currentConfig.Frameskip < 0)\r
} else {\r
strrend = " 8bit accurate";\r
}\r
+ switch (currentConfig.scaling) {\r
+ default: strscaling = " OFF"; break;\r
+ case 1: strscaling = "hw horizontal"; break;\r
+ case 2: strscaling = "hw horiz. + vert."; break;\r
+ case 3: strscaling = "sw horizontal"; break;\r
+ }\r
\r
y = tl_y;\r
//memset(gp2x_screen, 0, 320*240);\r
gp2x_pd_clone_buffer2();\r
\r
gp2x_text_out8(tl_x, y, "Renderer: %s", strrend); // 0\r
- gp2x_text_out8(tl_x, (y+=10), "Accurate timing (slower) %s", (currentConfig.PicoOpt&0x040)?"ON":"OFF"); // 1\r
- gp2x_text_out8(tl_x, (y+=10), "Accurate sprites (slower) %s", (currentConfig.PicoOpt&0x080)?"ON":"OFF"); // 2\r
- gp2x_text_out8(tl_x, (y+=10), "Show FPS %s", (currentConfig.EmuOpt &0x002)?"ON":"OFF"); // 3\r
+ gp2x_text_out8(tl_x, (y+=10), "Scaling: %s", strscaling); // 1\r
+ gp2x_text_out8(tl_x, (y+=10), "Accurate timing (slower) %s", (currentConfig.PicoOpt&0x040)?"ON":"OFF"); // 2\r
+ gp2x_text_out8(tl_x, (y+=10), "Accurate sprites (slower) %s", (currentConfig.PicoOpt&0x080)?"ON":"OFF"); // 3\r
+ gp2x_text_out8(tl_x, (y+=10), "Show FPS %s", (currentConfig.EmuOpt &0x002)?"ON":"OFF"); // 4\r
gp2x_text_out8(tl_x, (y+=10), "Frameskip %s", strframeskip);\r
- gp2x_text_out8(tl_x, (y+=10), "Enable sound %s", (currentConfig.EmuOpt &0x004)?"ON":"OFF"); // 5\r
+ gp2x_text_out8(tl_x, (y+=10), "Enable sound %s", (currentConfig.EmuOpt &0x004)?"ON":"OFF"); // 6\r
gp2x_text_out8(tl_x, (y+=10), "Sound Quality: %5iHz %s", currentConfig.PsndRate, monostereo);\r
- gp2x_text_out8(tl_x, (y+=10), "Use ARM940 core for sound %s", (currentConfig.PicoOpt&0x200)?"ON":"OFF"); // 7\r
- gp2x_text_out8(tl_x, (y+=10), "6 button pad %s", (currentConfig.PicoOpt&0x020)?"ON":"OFF"); // 8\r
+ gp2x_text_out8(tl_x, (y+=10), "Use ARM940 core for sound %s", (currentConfig.PicoOpt&0x200)?"ON":"OFF"); // 8\r
+ gp2x_text_out8(tl_x, (y+=10), "6 button pad %s", (currentConfig.PicoOpt&0x020)?"ON":"OFF"); // 9\r
gp2x_text_out8(tl_x, (y+=10), "Genesis Region: %s", region_name(currentConfig.PicoRegion));\r
- gp2x_text_out8(tl_x, (y+=10), "Use SRAM/BRAM savestates %s", (currentConfig.EmuOpt &0x001)?"ON":"OFF"); // 10\r
- gp2x_text_out8(tl_x, (y+=10), "Confirm save overwrites %s", (currentConfig.EmuOpt &0x200)?"ON":"OFF"); // 11\r
- gp2x_text_out8(tl_x, (y+=10), "Save slot %i", state_slot); // 12\r
+ gp2x_text_out8(tl_x, (y+=10), "Use SRAM/BRAM savestates %s", (currentConfig.EmuOpt &0x001)?"ON":"OFF"); // 11\r
+ gp2x_text_out8(tl_x, (y+=10), "Confirm save overwrites %s", (currentConfig.EmuOpt &0x200)?"ON":"OFF"); // 12\r
+ gp2x_text_out8(tl_x, (y+=10), "Save slot %i", state_slot); // 13\r
gp2x_text_out8(tl_x, (y+=10), "GP2X CPU clocks %iMhz", currentConfig.CPUclock);\r
gp2x_text_out8(tl_x, (y+=10), "[Sega/Mega CD options]");\r
- gp2x_text_out8(tl_x, (y+=10), "[advanced options]"); // 15\r
+ gp2x_text_out8(tl_x, (y+=10), "[advanced options]"); // 16\r
gp2x_text_out8(tl_x, (y+=10), "Save cfg as default");\r
if (rom_data)\r
gp2x_text_out8(tl_x, (y+=10), "Save cfg for current game only");\r
} else {\r
actionNames[8] = actionNames[9] = actionNames[10] = actionNames[11] = 0;\r
}\r
+ scaling_update();\r
}\r
\r
static int menu_loop_options(void)\r
{\r
- int menu_sel = 0, menu_sel_max = 16;\r
+ int menu_sel = 0, menu_sel_max = 17;\r
unsigned long inp = 0;\r
\r
if (rom_data) menu_sel_max++;\r
if(inp & GP2X_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
if((inp& GP2X_B)||(inp&GP2X_LEFT)||(inp&GP2X_RIGHT)) { // toggleable options\r
switch (menu_sel) {\r
- case 1: currentConfig.PicoOpt^=0x040; break;\r
- case 2: currentConfig.PicoOpt^=0x080; break;\r
- case 3: currentConfig.EmuOpt ^=0x002; break;\r
- case 5: currentConfig.EmuOpt ^=0x004; break;\r
- case 7: currentConfig.PicoOpt^=0x200; break;\r
- case 8: currentConfig.PicoOpt^=0x020; break;\r
- case 10: currentConfig.EmuOpt ^=0x001; break;\r
- case 11: currentConfig.EmuOpt ^=0x200; break;\r
- case 14: cd_menu_loop_options();\r
+ case 2: currentConfig.PicoOpt^=0x040; break;\r
+ case 3: currentConfig.PicoOpt^=0x080; break;\r
+ case 4: currentConfig.EmuOpt ^=0x002; break;\r
+ case 6: currentConfig.EmuOpt ^=0x004; break;\r
+ case 8: currentConfig.PicoOpt^=0x200; break;\r
+ case 9: currentConfig.PicoOpt^=0x020; break;\r
+ case 11: currentConfig.EmuOpt ^=0x001; break;\r
+ case 12: currentConfig.EmuOpt ^=0x200; break;\r
+ case 15: cd_menu_loop_options();\r
if (engineState == PGS_ReloadRom)\r
return 0; // test BIOS\r
break;\r
- case 15: amenu_loop_options(); break;\r
- case 16: // done (update and write)\r
+ case 16: amenu_loop_options(); break;\r
+ case 17: // done (update and write)\r
menu_options_save();\r
if (emu_WriteConfig(0)) strcpy(menuErrorMsg, "config saved");\r
else strcpy(menuErrorMsg, "failed to write config");\r
return 1;\r
- case 17: // done (update and write for current game)\r
+ case 18: // done (update and write for current game)\r
menu_options_save();\r
if (emu_WriteConfig(1)) strcpy(menuErrorMsg, "config saved");\r
else strcpy(menuErrorMsg, "failed to write config");\r
else if ( currentConfig.EmuOpt &0x80) currentConfig.EmuOpt &= ~0x80;\r
}\r
break;\r
- case 4:\r
+ case 1:\r
+ currentConfig.scaling += (inp & GP2X_LEFT) ? -1 : 1;\r
+ if (currentConfig.scaling < 0) currentConfig.scaling = 0;\r
+ if (currentConfig.scaling > 3) currentConfig.scaling = 3;\r
+ break;\r
+ case 5:\r
currentConfig.Frameskip += (inp & GP2X_LEFT) ? -1 : 1;\r
if (currentConfig.Frameskip < 0) currentConfig.Frameskip = -1;\r
if (currentConfig.Frameskip > 32) currentConfig.Frameskip = 32;\r
break;\r
- case 6:\r
+ case 7:\r
if ((inp & GP2X_RIGHT) && currentConfig.PsndRate == 44100 && !(currentConfig.PicoOpt&0x08)) {\r
currentConfig.PsndRate = 8000; currentConfig.PicoOpt|= 0x08;\r
} else if ((inp & GP2X_LEFT) && currentConfig.PsndRate == 8000 && (currentConfig.PicoOpt&0x08)) {\r
currentConfig.PsndRate = 44100; currentConfig.PicoOpt&=~0x08;\r
} else currentConfig.PsndRate = sndrate_prevnext(currentConfig.PsndRate, inp & GP2X_RIGHT);\r
break;\r
- case 9:\r
+ case 10:\r
region_prevnext(inp & GP2X_RIGHT);\r
break;\r
- case 12:\r
+ case 13:\r
if (inp & GP2X_RIGHT) {\r
state_slot++; if (state_slot > 9) state_slot = 0;\r
} else {state_slot--; if (state_slot < 0) state_slot = 9;\r
}\r
break;\r
- case 13:\r
+ case 14:\r
while ((inp = gp2x_joystick_read(1)) & (GP2X_LEFT|GP2X_RIGHT)) {\r
currentConfig.CPUclock += (inp & GP2X_LEFT) ? -1 : 1;\r
if (currentConfig.CPUclock < 1) currentConfig.CPUclock = 1;\r
if (rom_data) menu_sel = menu_sel_min = 0;\r
if (PicoPatches) menu_sel_max = 9;\r
\r
- for(;;)\r
+ /* make sure action buttons are not pressed on entering menu */\r
+ draw_menu_root(menu_sel);\r
+ while (gp2x_joystick_read(1) & (GP2X_B|GP2X_X|GP2X_SELECT)) usleep(50*1000);\r
+\r
+ for (;;)\r
{\r
draw_menu_root(menu_sel);\r
inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_B|GP2X_X|GP2X_SELECT);\r
\r
// switch to 8bpp\r
gp2x_video_changemode2(8);\r
- gp2x_video_RGB_setscaling(320, 240);\r
+ gp2x_video_RGB_setscaling(0, 320, 240);\r
gp2x_video_flip2();\r
}\r
\r