\r
\r
\r
-// order must match that of currentConfig_t\r
-\r
-struct {\r
- int EmuOpt;\r
- int PicoOpt;\r
- int PsndRate;\r
- int PicoRegion;\r
- int Frameskip;\r
- int CPUclock;\r
-} tmp_opts;\r
-int tmp_gamma;\r
-\r
// --------- sega/mega cd options ----------\r
\r
static void draw_cd_menu_options(int menu_sel, char *b_us, char *b_eu, char *b_jp)\r
gp2x_text_out8(tl_x, y, "USA BIOS: %s", b_us); // 0\r
gp2x_text_out8(tl_x, (y+=10), "EUR BIOS: %s", b_eu); // 1\r
gp2x_text_out8(tl_x, (y+=10), "JAP BIOS: %s", b_jp); // 2\r
- gp2x_text_out8(tl_x, (y+=10), "CD LEDs %s", (tmp_opts.EmuOpt &0x400)?"ON":"OFF"); // 3\r
- gp2x_text_out8(tl_x, (y+=10), "CDDA audio (using mp3s) %s", (tmp_opts.EmuOpt &0x800)?"ON":"OFF"); // 4\r
+ gp2x_text_out8(tl_x, (y+=10), "CD LEDs %s", (currentConfig.EmuOpt &0x400)?"ON":"OFF"); // 3\r
+ gp2x_text_out8(tl_x, (y+=10), "CDDA audio (using mp3s) %s", (currentConfig.EmuOpt &0x800)?"ON":"OFF"); // 4\r
gp2x_text_out8(tl_x, (y+=10), "Done");\r
\r
// draw cursor\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 3: tmp_opts.EmuOpt ^=0x400; break;\r
- case 4: tmp_opts.EmuOpt ^=0x800; break;\r
+ case 3: currentConfig.EmuOpt ^=0x400; break;\r
+ case 4: currentConfig.EmuOpt ^=0x800; break;\r
case 5: return;\r
}\r
}\r
\r
y = tl_y;\r
memset(gp2x_screen, 0, 320*240);\r
- gp2x_text_out8(tl_x, y, "Scale 32 column mode %s", (tmp_opts.PicoOpt&0x100)?"ON":"OFF"); // 0\r
- gp2x_text_out8(tl_x, (y+=10), "Gamma correction %i.%02i", tmp_gamma / 100, tmp_gamma%100); // 1\r
- gp2x_text_out8(tl_x, (y+=10), "Emulate Z80 %s", (tmp_opts.PicoOpt&0x004)?"ON":"OFF"); // 2\r
- gp2x_text_out8(tl_x, (y+=10), "Emulate YM2612 (FM) %s", (tmp_opts.PicoOpt&0x001)?"ON":"OFF"); // 3\r
- gp2x_text_out8(tl_x, (y+=10), "Emulate SN76496 (PSG) %s", (tmp_opts.PicoOpt&0x002)?"ON":"OFF"); // 4\r
- gp2x_text_out8(tl_x, (y+=10), "gzip savestates %s", (tmp_opts.EmuOpt &0x008)?"ON":"OFF"); // 5\r
- gp2x_text_out8(tl_x, (y+=10), "Don't save config on exit %s", (tmp_opts.EmuOpt &0x020)?"ON":"OFF"); // 6\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+=10), "needs restart:");\r
- gp2x_text_out8(tl_x, (y+=10), "craigix's RAM timings %s", (tmp_opts.EmuOpt &0x100)?"ON":"OFF"); // 8\r
- gp2x_text_out8(tl_x, (y+=10), "squidgehack (now %s %s", mms, (tmp_opts.EmuOpt &0x010)?"ON":"OFF"); // 9\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), "Done");\r
\r
// draw cursor\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: tmp_opts.PicoOpt^=0x100; break;\r
- case 2: tmp_opts.PicoOpt^=0x004; break;\r
- case 3: tmp_opts.PicoOpt^=0x001; break;\r
- case 4: tmp_opts.PicoOpt^=0x002; break;\r
- case 5: tmp_opts.EmuOpt ^=0x008; break;\r
- case 6: tmp_opts.EmuOpt ^=0x020; break;\r
- case 8: tmp_opts.EmuOpt ^=0x100; break;\r
- case 9: tmp_opts.EmuOpt ^=0x010; break;\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
}\r
}\r
switch (menu_sel) {\r
case 1:\r
while ((inp = gp2x_joystick_read(1)) & (GP2X_LEFT|GP2X_RIGHT)) {\r
- tmp_gamma += (inp & GP2X_LEFT) ? -1 : 1;\r
- if (tmp_gamma < 1) tmp_gamma = 1;\r
- if (tmp_gamma > 300) tmp_gamma = 300;\r
+ currentConfig.gamma += (inp & GP2X_LEFT) ? -1 : 1;\r
+ if (currentConfig.gamma < 1) currentConfig.gamma = 1;\r
+ if (currentConfig.gamma > 300) currentConfig.gamma = 300;\r
draw_amenu_options(menu_sel);\r
usleep(18*1000);\r
}\r
\r
// -------------- options --------------\r
\r
-static char *region_name(unsigned int code)\r
+static const char *region_name(unsigned int code)\r
{\r
- char *names[] = { "Auto", "Japan NTSC", "Japan PAL", "USA", "Europe" };\r
- int i = 0;\r
- code <<= 1;\r
- while((code >>=1)) i++;\r
- if (i > 4) return "unknown";\r
- return names[i];\r
+ static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };\r
+ static const char *names_short[] = { "", " JP", " JP", " US", " EU" };\r
+ int u, i = 0;\r
+ if (code) {\r
+ code <<= 1;\r
+ while((code >>= 1)) i++;\r
+ if (i > 4) return "unknown";\r
+ return names[i];\r
+ } else {\r
+ static char name[24];\r
+ strcpy(name, "Auto:");\r
+ for (u = 0; u < 3; u++) {\r
+ i = 0; code = ((PicoAutoRgnOrder >> u*4) & 0xf) << 1;\r
+ while((code >>= 1)) i++;\r
+ strcat(name, names_short[i]);\r
+ }\r
+ return name;\r
+ }\r
}\r
\r
static void draw_menu_options(int menu_sel)\r
int tl_x = 25, tl_y = 40, y;\r
char monostereo[8], strframeskip[8], *strrend;\r
\r
- strcpy(monostereo, (tmp_opts.PicoOpt&0x08)?"stereo":"mono");\r
- if (tmp_opts.Frameskip < 0)\r
+ strcpy(monostereo, (currentConfig.PicoOpt&0x08)?"stereo":"mono");\r
+ if (currentConfig.Frameskip < 0)\r
strcpy(strframeskip, "Auto");\r
- else sprintf(strframeskip, "%i", tmp_opts.Frameskip);\r
- if (tmp_opts.PicoOpt&0x10) {\r
+ else sprintf(strframeskip, "%i", currentConfig.Frameskip);\r
+ if (currentConfig.PicoOpt&0x10) {\r
strrend = " 8bit fast";\r
- } else if (tmp_opts.EmuOpt&0x80) {\r
+ } else if (currentConfig.EmuOpt&0x80) {\r
strrend = "16bit accurate";\r
} else {\r
strrend = " 8bit accurate";\r
y = tl_y;\r
memset(gp2x_screen, 0, 320*240);\r
gp2x_text_out8(tl_x, y, "Renderer: %s", strrend); // 0\r
- gp2x_text_out8(tl_x, (y+=10), "Accurate timing (slower) %s", (tmp_opts.PicoOpt&0x040)?"ON":"OFF"); // 1\r
- gp2x_text_out8(tl_x, (y+=10), "Accurate sprites (slower) %s", (tmp_opts.PicoOpt&0x080)?"ON":"OFF"); // 2\r
- gp2x_text_out8(tl_x, (y+=10), "Show FPS %s", (tmp_opts.EmuOpt &0x002)?"ON":"OFF"); // 3\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), "Frameskip %s", strframeskip);\r
- gp2x_text_out8(tl_x, (y+=10), "Enable sound %s", (tmp_opts.EmuOpt &0x004)?"ON":"OFF"); // 5\r
- gp2x_text_out8(tl_x, (y+=10), "Sound Quality: %5iHz %s", tmp_opts.PsndRate, monostereo);\r
- gp2x_text_out8(tl_x, (y+=10), "Use ARM940 core for sound %s", (tmp_opts.PicoOpt&0x200)?"ON":"OFF"); // 7\r
- gp2x_text_out8(tl_x, (y+=10), "6 button pad %s", (tmp_opts.PicoOpt&0x020)?"ON":"OFF"); // 8\r
- gp2x_text_out8(tl_x, (y+=10), "Genesis Region: %s", region_name(tmp_opts.PicoRegion));\r
- gp2x_text_out8(tl_x, (y+=10), "Use SRAM/BRAM savestates %s", (tmp_opts.EmuOpt &0x001)?"ON":"OFF"); // 10\r
- gp2x_text_out8(tl_x, (y+=10), "Confirm save overwrites %s", (tmp_opts.EmuOpt &0x200)?"ON":"OFF"); // 11\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), "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), "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), "GP2X CPU clocks %iMhz", tmp_opts.CPUclock);\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), "Save cfg as default");\r
return rates[i];\r
}\r
\r
+static void region_prevnext(int right)\r
+{\r
+ // jp_ntsc=1, jp_pal=2, usa=4, eu=8\r
+ static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };\r
+ int i;\r
+ if (right) {\r
+ if (!currentConfig.PicoRegion) {\r
+ for (i = 0; i < 6; i++)\r
+ if (rgn_orders[i] == PicoAutoRgnOrder) break;\r
+ if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1];\r
+ else currentConfig.PicoRegion=1;\r
+ }\r
+ else currentConfig.PicoRegion<<=1;\r
+ if (currentConfig.PicoRegion > 8) currentConfig.PicoRegion = 8;\r
+ } else {\r
+ if (!currentConfig.PicoRegion) {\r
+ for (i = 0; i < 6; i++)\r
+ if (rgn_orders[i] == PicoAutoRgnOrder) break;\r
+ if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1];\r
+ }\r
+ else currentConfig.PicoRegion>>=1;\r
+ }\r
+}\r
+\r
static void menu_options_save(void)\r
{\r
- memcpy(¤tConfig.EmuOpt, &tmp_opts.EmuOpt, sizeof(tmp_opts));\r
- currentConfig.gamma = tmp_gamma;\r
PicoOpt = currentConfig.PicoOpt;\r
PsndRate = currentConfig.PsndRate;\r
PicoRegionOverride = currentConfig.PicoRegion;\r
unsigned long inp = 0;\r
\r
if (rom_data) menu_sel_max++;\r
- memcpy(&tmp_opts.EmuOpt, ¤tConfig.EmuOpt, sizeof(tmp_opts));\r
- tmp_gamma = currentConfig.gamma;\r
- tmp_opts.PicoOpt = PicoOpt;\r
- tmp_opts.PsndRate = PsndRate;\r
- tmp_opts.PicoRegion = PicoRegionOverride;\r
+ currentConfig.PicoOpt = PicoOpt;\r
+ currentConfig.PsndRate = PsndRate;\r
+ currentConfig.PicoRegion = PicoRegionOverride;\r
\r
for(;;)\r
{\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: tmp_opts.PicoOpt^=0x040; break;\r
- case 2: tmp_opts.PicoOpt^=0x080; break;\r
- case 3: tmp_opts.EmuOpt ^=0x002; break;\r
- case 5: tmp_opts.EmuOpt ^=0x004; break;\r
- case 7: tmp_opts.PicoOpt^=0x200; break;\r
- case 8: tmp_opts.PicoOpt^=0x020; break;\r
- case 10: tmp_opts.EmuOpt ^=0x001; break;\r
- case 11: tmp_opts.EmuOpt ^=0x200; break;\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
if (engineState == PGS_ReloadRom)\r
return 0; // test BIOS\r
return 1;\r
}\r
}\r
- if(inp & GP2X_X) return 0; // done (no update or write)\r
- if(inp & GP2X_A) {\r
+ if(inp & (GP2X_X|GP2X_A)) {\r
menu_options_save();\r
return 0; // done (update, no write)\r
}\r
switch (menu_sel) {\r
case 0:\r
if (inp & GP2X_LEFT) {\r
- if ( tmp_opts.PicoOpt&0x10) tmp_opts.PicoOpt&= ~0x10;\r
- else if (!(tmp_opts.EmuOpt &0x80))tmp_opts.EmuOpt |= 0x80;\r
- else if ( tmp_opts.EmuOpt &0x80) break;\r
+ if ( currentConfig.PicoOpt&0x10) currentConfig.PicoOpt&= ~0x10;\r
+ else if (!(currentConfig.EmuOpt &0x80))currentConfig.EmuOpt |= 0x80;\r
+ else if ( currentConfig.EmuOpt &0x80) break;\r
} else {\r
- if ( tmp_opts.PicoOpt&0x10) break;\r
- else if (!(tmp_opts.EmuOpt &0x80))tmp_opts.PicoOpt|= 0x10;\r
- else if ( tmp_opts.EmuOpt &0x80) tmp_opts.EmuOpt &= ~0x80;\r
+ if ( currentConfig.PicoOpt&0x10) break;\r
+ else if (!(currentConfig.EmuOpt &0x80))currentConfig.PicoOpt|= 0x10;\r
+ else if ( currentConfig.EmuOpt &0x80) currentConfig.EmuOpt &= ~0x80;\r
}\r
break;\r
case 4:\r
- tmp_opts.Frameskip += (inp & GP2X_LEFT) ? -1 : 1;\r
- if (tmp_opts.Frameskip < 0) tmp_opts.Frameskip = -1;\r
- if (tmp_opts.Frameskip > 32) tmp_opts.Frameskip = 32;\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
- if ((inp & GP2X_RIGHT) && tmp_opts.PsndRate == 44100 && !(tmp_opts.PicoOpt&0x08)) {\r
- tmp_opts.PsndRate = 8000; tmp_opts.PicoOpt|= 0x08;\r
- } else if ((inp & GP2X_LEFT) && tmp_opts.PsndRate == 8000 && (tmp_opts.PicoOpt&0x08)) {\r
- tmp_opts.PsndRate = 44100; tmp_opts.PicoOpt&=~0x08;\r
- } else tmp_opts.PsndRate = sndrate_prevnext(tmp_opts.PsndRate, inp & GP2X_RIGHT);\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
- if (inp & GP2X_RIGHT) {\r
- if (tmp_opts.PicoRegion) tmp_opts.PicoRegion<<=1; else tmp_opts.PicoRegion=1;\r
- if (tmp_opts.PicoRegion > 8) tmp_opts.PicoRegion = 8;\r
- } else tmp_opts.PicoRegion>>=1;\r
+ region_prevnext(inp & GP2X_RIGHT);\r
break;\r
case 12:\r
if (inp & GP2X_RIGHT) {\r
break;\r
case 13:\r
while ((inp = gp2x_joystick_read(1)) & (GP2X_LEFT|GP2X_RIGHT)) {\r
- tmp_opts.CPUclock += (inp & GP2X_LEFT) ? -1 : 1;\r
- if (tmp_opts.CPUclock < 1) tmp_opts.CPUclock = 1;\r
+ currentConfig.CPUclock += (inp & GP2X_LEFT) ? -1 : 1;\r
+ if (currentConfig.CPUclock < 1) currentConfig.CPUclock = 1;\r
draw_menu_options(menu_sel);\r
usleep(50*1000);\r
}\r