#include "fonts.h"\r
#include "gp2x.h"\r
\r
+#include "../../input.h"\r
+#include "../../state.h"\r
+\r
#ifndef _DIRENT_HAVE_D_TYPE\r
#error "need d_type for file browser\r
#endif\r
\r
+static int GP2X_PORT_REV =\r
+#include "rev.h"\r
+;\r
+\r
extern char lastLoadedGameName[PATH_MAX];\r
-extern int mmuhack_status;\r
-//extern int state_slot; // TODO\r
+extern int mmuhack_status;\r
+extern int soundvol;\r
extern uint8 Exit; // exit emu loop flag\r
+extern int InitSound(void);\r
+\r
+#define CONFIGURABLE_KEYS (GP2X_UP|GP2X_LEFT|GP2X_DOWN|GP2X_RIGHT|GP2X_START|GP2X_SELECT|GP2X_L|GP2X_R|GP2X_A|GP2X_B|GP2X_X|GP2X_Y|GP2X_PUSH)\r
\r
static char *gp2xKeyNames[] = {\r
"UP", "01???", "LEFT", "03???", "DOWN", "05???", "RIGHT", "07???",\r
}\r
\r
static char *filter_exts[] = {\r
- // TODO\r
- ".mp3", ".MP3", ".srm", ".brm", "s.gz", ".mds", "bcfg", ".txt", ".htm", "html",\r
- ".jpg", ".gpe", ".cue"\r
+ ".gpe", ".png", "ck.o", ".txt"\r
};\r
\r
static int scandir_filter(const struct dirent *ent)\r
if(inp & GP2X_X) return 1;\r
}\r
}\r
+#endif\r
\r
// -------------- key config --------------\r
\r
return name;\r
}\r
\r
-static void draw_key_config(int curr_act, int is_p2)\r
+static char *action_binds(int player_idx, int action_mask)\r
{\r
- char strkeys[32*5];\r
+ static char strkeys[32*5];\r
int joy, i;\r
\r
strkeys[0] = 0;\r
- for (i = 0; i < 32; i++)\r
+ for (i = 0; i < 32; i++) // i is key index\r
{\r
- if (currentConfig.KeyBinds[i] & (1 << curr_act))\r
+ if (Settings.KeyBinds[i] & action_mask)\r
{\r
- if (curr_act < 16 && (currentConfig.KeyBinds[i] & (1 << 16)) != (is_p2 << 16)) continue;\r
+ if (player_idx >= 0 && ((Settings.KeyBinds[i] >> 16) & 3) != player_idx) continue;\r
if (strkeys[0]) { strcat(strkeys, " + "); strcat(strkeys, gp2xKeyNames[i]); break; }\r
else strcpy(strkeys, gp2xKeyNames[i]);\r
}\r
{\r
for (i = 0; i < 32; i++)\r
{\r
- if (currentConfig.JoyBinds[joy][i] & (1 << curr_act))\r
+ if (Settings.JoyBinds[joy][i] & action_mask)\r
{\r
- if (curr_act < 16 && (currentConfig.JoyBinds[joy][i] & (1 << 16)) != (is_p2 << 16)) continue;\r
+ if (player_idx >= 0 && ((Settings.KeyBinds[i] >> 16) & 3) != player_idx) continue;\r
if (strkeys[0]) {\r
strcat(strkeys, ", "); strcat(strkeys, usb_joy_key_name(joy + 1, i));\r
break;\r
}\r
}\r
\r
- //memset(gp2x_screen, 0, 320*240);\r
+ return strkeys;\r
+}\r
+\r
+static void unbind_action(int action)\r
+{\r
+ int i, u;\r
+\r
+ for (i = 0; i < 32; i++)\r
+ Settings.KeyBinds[i] &= ~action;\r
+ for (u = 0; u < 4; u++)\r
+ for (i = 0; i < 32; i++)\r
+ Settings.JoyBinds[u][i] &= ~action;\r
+}\r
+\r
+static int count_bound_keys(int action, int is_joy)\r
+{\r
+ int i, u, keys = 0;\r
+\r
+ if (is_joy)\r
+ {\r
+ for (u = 0; u < 4; u++)\r
+ for (i = 0; i < 32; i++)\r
+ if (Settings.JoyBinds[u][i] & action) keys++;\r
+ }\r
+ else\r
+ {\r
+ for (i = 0; i < 32; i++)\r
+ if (Settings.KeyBinds[i] & action) keys++;\r
+ }\r
+ return keys;\r
+}\r
+\r
+typedef struct { char *name; int mask; } bind_action_t;\r
+\r
+static void draw_key_config(const bind_action_t *opts, int opt_cnt, int player_idx, int sel)\r
+{\r
+ int x, y, tl_y = 40, i;\r
+\r
gp2x_fceu_copy_bg();\r
- gp2x_text_out15(60, 40, "Action: %s", actionNames[curr_act]);\r
- gp2x_text_out15(60, 60, "Keys: %s", strkeys);\r
+ if (player_idx >= 0)\r
+ gp2x_text_out15(80, 20, "Player %i controls", player_idx + 1);\r
+ else gp2x_text_out15(80, 20, "Emulator controls");\r
+\r
+ x = 40; y = tl_y;\r
+ for (i = 0; i < opt_cnt; i++, y+=10)\r
+ gp2x_text_out15(x, y, "%s : %s", opts[i].name, action_binds(player_idx, opts[i].mask));\r
+\r
+ gp2x_text_out15(x, y, "Done");\r
+\r
+ // draw cursor\r
+ gp2x_text_out15(x - 16, tl_y + sel*10, ">");\r
\r
- gp2x_text_out15(30, 180, "Use SELECT to change action");\r
- gp2x_text_out15(30, 190, "Press a key to bind/unbind");\r
- gp2x_text_out15(30, 200, "Select \"Done\" action and");\r
- gp2x_text_out15(30, 210, " press any key to finish");\r
+ if (sel < opt_cnt) {\r
+ gp2x_text_out15(30, 190, "Press a button to bind/unbind");\r
+ gp2x_text_out15(30, 200, "Use VOL+ to clear");\r
+ gp2x_text_out15(30, 210, "To bind UP/DOWN, hold VOL-");\r
+ gp2x_text_out15(30, 220, "Select \"Done\" to exit");\r
+ } else {\r
+ gp2x_text_out15(30, 220, "Press B or X to exit");\r
+ }\r
gp2x_video_flip();\r
}\r
\r
-static void key_config_loop(int is_p2)\r
+static void key_config_loop(const bind_action_t *opts, int opt_cnt, int player_idx)\r
{\r
- int curr_act = 0, joy = 0, i;\r
+ int joy = 0, sel = 0, menu_sel_max = opt_cnt, i;\r
unsigned long inp = 0;\r
\r
for (;;)\r
{\r
- draw_key_config(curr_act, is_p2);\r
- inp = wait_for_input_usbjoy(CONFIGURABLE_KEYS, &joy);\r
+ draw_key_config(opts, opt_cnt, player_idx, sel);\r
+ inp = wait_for_input_usbjoy(CONFIGURABLE_KEYS|GP2X_VOL_DOWN|GP2X_VOL_UP, &joy);\r
// printf("got %08lX from joy %i\n", inp, joy);\r
if (joy == 0) {\r
- if (inp & GP2X_SELECT) {\r
- curr_act++;\r
- while (!actionNames[curr_act] && curr_act < 32) curr_act++;\r
- if (curr_act > 31) curr_act = 0;\r
+ if (!(inp & GP2X_VOL_DOWN)) {\r
+ if(inp & GP2X_UP ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }\r
+ if(inp & GP2X_DOWN) { sel++; if (sel > menu_sel_max) sel = 0; continue; }\r
}\r
+ if (sel >= opt_cnt) {\r
+ if (inp & (GP2X_B|GP2X_X)) break;\r
+ else continue;\r
+ }\r
+ // if we are here, we want to bind/unbind something\r
+ if (inp & GP2X_VOL_UP)\r
+ unbind_action(opts[sel].mask);\r
inp &= CONFIGURABLE_KEYS;\r
- inp &= ~GP2X_SELECT;\r
- }\r
- if (curr_act == 31 && inp) break;\r
- if (joy == 0) {\r
for (i = 0; i < 32; i++)\r
if (inp & (1 << i)) {\r
- currentConfig.KeyBinds[i] ^= (1 << curr_act);\r
- if (is_p2) currentConfig.KeyBinds[i] |= (1 << 16); // player 2 flag\r
- else currentConfig.KeyBinds[i] &= ~(1 << 16);\r
+ if (count_bound_keys(opts[sel].mask, 0) >= 2)\r
+ Settings.KeyBinds[i] &= ~opts[sel].mask; // allow to unbind only\r
+ else Settings.KeyBinds[i] ^= opts[sel].mask;\r
+ if (player_idx >= 0) {\r
+ Settings.KeyBinds[i] &= ~(3 << 16);\r
+ Settings.KeyBinds[i] |= player_idx << 16;\r
+ }\r
}\r
- } else {\r
+ } else if (sel < opt_cnt) {\r
for (i = 0; i < 32; i++)\r
if (inp & (1 << i)) {\r
- currentConfig.JoyBinds[joy-1][i] ^= (1 << curr_act);\r
- if (is_p2) currentConfig.JoyBinds[joy-1][i] |= (1 << 16);\r
- else currentConfig.JoyBinds[joy-1][i] &= ~(1 << 16);\r
+ if (count_bound_keys(opts[sel].mask, 1) >= 1) // disallow combos for usbjoy\r
+ Settings.JoyBinds[joy-1][i] &= ~opts[sel].mask;\r
+ else Settings.JoyBinds[joy-1][i] ^= opts[sel].mask;\r
+ if (player_idx >= 0) {\r
+ Settings.JoyBinds[joy-1][i] &= ~(3 << 16);\r
+ Settings.JoyBinds[joy-1][i] |= player_idx << 16;\r
+ }\r
}\r
}\r
}\r
char joyname[36];\r
\r
y = tl_y;\r
- //memset(gp2x_screen, 0, 320*240);\r
gp2x_fceu_copy_bg();\r
gp2x_text_out15(tl_x, y, "Player 1");\r
gp2x_text_out15(tl_x, (y+=10), "Player 2");\r
+ gp2x_text_out15(tl_x, (y+=10), "Emulator controls");\r
gp2x_text_out15(tl_x, (y+=10), "Done");\r
\r
// draw cursor\r
gp2x_text_out15(tl_x, (y+=10), "none");\r
}\r
\r
-\r
gp2x_video_flip();\r
}\r
\r
+// b_turbo,a_turbo RLDU SEBA\r
+static bind_action_t ctrl_actions[] =\r
+{\r
+ { "UP ", 0x010 },\r
+ { "DOWN ", 0x020 },\r
+ { "LEFT ", 0x040 },\r
+ { "RIGHT ", 0x080 },\r
+ { "A ", 0x001 },\r
+ { "B ", 0x002 },\r
+ { "A TURBO", 0x100 },\r
+ { "B TURBO", 0x200 },\r
+ { "START ", 0x008 },\r
+ { "SELECT ", 0x004 },\r
+};\r
+\r
+static bind_action_t emuctrl_actions[] =\r
+{\r
+ { "Save State ", 1<<31 },\r
+ { "Load State ", 1<<30 },\r
+ { "Next State Slot ", 1<<29 },\r
+ { "Prev State Slot ", 1<<28 },\r
+ { "FDS Insert/Eject ", 1<<27 },\r
+ { "FDS Select Disk ", 1<<26 },\r
+ { "VSUni Insert Coin", 1<<25 },\r
+};\r
+\r
static void kc_sel_loop(void)\r
{\r
- int menu_sel = 2, menu_sel_max = 2;\r
+ int menu_sel = 3, menu_sel_max = 3;\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) {\r
switch (menu_sel) {\r
- case 0: key_config_loop(0); return;\r
- case 1: key_config_loop(1); return;\r
+ case 0: key_config_loop(ctrl_actions, 10, 0); return;\r
+ case 1: key_config_loop(ctrl_actions, 8, 1); return;\r
+ case 2: key_config_loop(emuctrl_actions,\r
+ sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]), -1); return;\r
default: return;\r
}\r
}\r
if(inp & GP2X_X) return;\r
}\r
}\r
-#endif\r
\r
\r
+// --------- FCEU options ----------\r
\r
-// --------- advanced options ----------\r
-#if 0\r
-static void draw_amenu_options(int menu_sel)\r
+static void draw_fcemenu_options(int menu_sel)\r
{\r
int tl_x = 25, tl_y = 60, y;\r
- char *mms = mmuhack_status ? "active) " : "inactive)";\r
\r
y = tl_y;\r
- //memset(gp2x_screen, 0, 320*240);\r
gp2x_fceu_copy_bg();\r
\r
- gp2x_text_out15(tl_x, y, "Gamma correction %i.%02i", currentConfig.gamma / 100, currentConfig.gamma%100); // 0\r
- gp2x_text_out15(tl_x, (y+=10), "Don't save last used ROM %s", (currentConfig.EmuOpt &0x020)?"ON":"OFF"); // 5\r
- gp2x_text_out15(tl_x, (y+=10), "needs restart:");\r
- gp2x_text_out15(tl_x, (y+=10), "craigix's RAM timings %s", (currentConfig.EmuOpt &0x100)?"ON":"OFF"); // 7\r
- gp2x_text_out15(tl_x, (y+=10), "squidgehack (now %s %s", mms, (currentConfig.EmuOpt &0x010)?"ON":"OFF"); // 8\r
+ gp2x_text_out15(tl_x, y, " %s", "OFF"); // 0\r
gp2x_text_out15(tl_x, (y+=10), "Done");\r
\r
// draw cursor\r
gp2x_video_flip();\r
}\r
\r
-static void amenu_loop_options(void)\r
+static void fcemenu_loop_options(void)\r
{\r
- int menu_sel = 0, menu_sel_max = 9;\r
+ int menu_sel = 0, menu_sel_max = 1;\r
unsigned long inp = 0;\r
\r
for(;;)\r
{\r
- draw_amenu_options(menu_sel);\r
+ draw_fcemenu_options(menu_sel);\r
inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_B|GP2X_X|GP2X_A);\r
if(inp & GP2X_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = 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: break;\r
- case 9: return;\r
+ case 0: break;\r
+ case 1: 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 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
- if (currentConfig.gamma > 300) currentConfig.gamma = 300;\r
- draw_amenu_options(menu_sel);\r
- usleep(18*1000);\r
- }\r
break;\r
}\r
}\r
}\r
}\r
-#endif\r
\r
// -------------- options --------------\r
\r
static void draw_menu_options(int menu_sel)\r
{\r
int tl_x = 25, tl_y = 32, y;\r
- char monostereo[8], strframeskip[8], *strscaling, *strssconfirm;\r
+ char strframeskip[8], *strscaling, *strssconfirm;\r
+ char *mms = mmuhack_status ? "active) " : "inactive)";\r
\r
- //strcpy(monostereo, (currentConfig.PicoOpt&0x08)?"stereo":"mono");\r
if (Settings.frameskip < 0)\r
strcpy(strframeskip, "Auto");\r
else sprintf(strframeskip, "%i", Settings.frameskip);\r
}\r
\r
y = tl_y;\r
- //memset(gp2x_screen, 0, 320*240);\r
gp2x_fceu_copy_bg();\r
\r
- gp2x_text_out15(tl_x, (y+=10), "Scaling: %s", strscaling); // 0\r
+ gp2x_text_out15(tl_x, y, "Scaling: %s", strscaling); // 0\r
gp2x_text_out15(tl_x, (y+=10), "Show FPS %s", Settings.showfps?"ON":"OFF"); // 1\r
gp2x_text_out15(tl_x, (y+=10), "Frameskip %s", strframeskip); // 2\r
- gp2x_text_out15(tl_x, (y+=10), "Enable sound %s", /*(currentConfig.EmuOpt &0x004)?"ON":*/"OFF"); // 3\r
- gp2x_text_out15(tl_x, (y+=10), "Sound Quality: %5iHz %s", 0, "" /*currentConfig.PsndRate, monostereo*/); // 4\r
- gp2x_text_out15(tl_x, (y+=10), "Region: %s",\r
- Settings.region_force == 2 ? "NTSC" : Settings.region_force == 1 ? "PAL" : "OFF"); // 5\r
+ gp2x_text_out15(tl_x, (y+=10), "Enable sound %s", soundvol?"ON":"OFF");\r
+ gp2x_text_out15(tl_x, (y+=10), "Sound Rate: %5iHz", Settings.sound_rate); // 4\r
+ gp2x_text_out15(tl_x, (y+=10), "Force Region: %s",\r
+ Settings.region_force == 2 ? "PAL" : Settings.region_force == 1 ? "NTSC" : "OFF"); // 5\r
gp2x_text_out15(tl_x, (y+=10), "Use SRAM savestates %s", "OFF");\r
- gp2x_text_out15(tl_x, (y+=10), "Confirm savestate %s", strssconfirm);\r
- gp2x_text_out15(tl_x, (y+=10), "Save slot %i", 0/*state_slot*/); // 8\r
- gp2x_text_out15(tl_x, (y+=10), "GP2X CPU clock %iMhz", Settings.cpuclock);\r
- gp2x_text_out15(tl_x, (y+=10), "[advanced options]"); // 10\r
+ gp2x_text_out15(tl_x, (y+=10), "Turbo rate %iHz", (Settings.turbo_rate_add*60/2) >> 24);\r
+ gp2x_text_out15(tl_x, (y+=10), "Confirm savestate %s", strssconfirm); // 8\r
+ gp2x_text_out15(tl_x, (y+=10), "Save slot %i", CurrentState);\r
+ gp2x_text_out15(tl_x, (y+=10), "Faster RAM timings %s", Settings.ramtimings?"ON":"OFF");\r
+ gp2x_text_out15(tl_x, (y+=10), "squidgehack (now %s %s", mms, Settings.mmuhack?"ON":"OFF"); // 11\r
+ gp2x_text_out15(tl_x, (y+=10), "Gamma correction %i.%02i", Settings.gamma / 100, Settings.gamma%100);\r
+ gp2x_text_out15(tl_x, (y+=10), "GP2X CPU clock %iMhz", Settings.cpuclock); // 13\r
+ gp2x_text_out15(tl_x, (y+=10), "[FCE Ultra options]");\r
gp2x_text_out15(tl_x, (y+=10), "Save cfg as default");\r
if (fceugi)\r
gp2x_text_out15(tl_x, (y+=10), "Save cfg for current game only");\r
gp2x_video_flip();\r
}\r
\r
-/*\r
static int sndrate_prevnext(int rate, int dir)\r
{\r
int i, rates[] = { 8000, 11025, 16000, 22050, 44100 };\r
if (i < 0) return dir ? 11025 : 8000;\r
return rates[i];\r
}\r
-*/\r
+\r
static void int_incdec(int *p, int inc, int min, int max)\r
{\r
*p += inc;\r
else if (*p > max) *p = max;\r
}\r
\r
+static void config_commit(void)\r
+{\r
+ gp2x_cpuclock_gamma_update();\r
+ if (Settings.region_force)\r
+ FCEUI_SetVidSystem(Settings.region_force - 1);\r
+}\r
+\r
static int menu_loop_options(void)\r
{\r
- int menu_sel = 0, menu_sel_max = 11;\r
+ static int menu_sel = 0;\r
+ int menu_sel_max = 15;\r
unsigned long inp = 0;\r
\r
if (fceugi) 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: Settings.showfps = !Settings.showfps; break;\r
- //case 6: Settings. = !Settings.showfps; break;\r
- //case 16: amenu_loop_options(); break;\r
- case 17: // done (update and write)\r
- //if (emu_WriteConfig(0)) strcpy(menuErrorMsg, "config saved");\r
- //else strcpy(menuErrorMsg, "failed to write config");\r
+ case 1: Settings.showfps = !Settings.showfps; break;\r
+ case 3: soundvol = soundvol ? 0 : 100; break;\r
+ case 10: Settings.ramtimings = !Settings.ramtimings; break;\r
+ case 11: Settings.mmuhack = !Settings.mmuhack; break;\r
+ case 14: fcemenu_loop_options(); break;\r
+ case 15: // done (update and write)\r
+ config_commit();\r
+ SaveConfig(NULL);\r
return 1;\r
- case 18: // done (update and write for current game)\r
- //if (emu_WriteConfig(1)) strcpy(menuErrorMsg, "config saved");\r
- //else strcpy(menuErrorMsg, "failed to write config");\r
+ case 16: // done (update and write for current game)\r
+ config_commit();\r
+ if (lastLoadedGameName[0])\r
+ SaveConfig(lastLoadedGameName);\r
return 1;\r
}\r
}\r
if(inp & (GP2X_X|GP2X_A)) {\r
+ config_commit();\r
return 0; // done (update, no write)\r
}\r
if(inp & (GP2X_LEFT|GP2X_RIGHT)) { // multi choise\r
switch (menu_sel) {\r
case 0: int_incdec(&Settings.scaling, (inp & GP2X_LEFT) ? -1 : 1, 0, 3); break;\r
case 2: int_incdec(&Settings.frameskip, (inp & GP2X_LEFT) ? -1 : 1, -1, 32); break;\r
-/*\r
case 4:\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
+ Settings.sound_rate = sndrate_prevnext(Settings.sound_rate, inp & GP2X_RIGHT);\r
+ InitSound();\r
break;\r
-*/\r
case 5: int_incdec(&Settings.region_force, (inp & GP2X_LEFT) ? -1 : 1, 0, 2); break;\r
- case 7: int_incdec(&Settings.sstate_confirm, (inp & GP2X_LEFT) ? -1 : 1, 0, 3); break;\r
- //case 8: int_incdec(&Settings., (inp & GP2X_LEFT) ? -1 : 1, 0, 9); break;\r
- case 14:\r
+ case 7: {\r
+ int hz = Settings.turbo_rate_add*60/2 >> 24;\r
+ int_incdec(&hz, (inp & GP2X_LEFT) ? -1 : 1, 1, 30);\r
+ Settings.turbo_rate_add = (hz*2 << 24) / 60 + 1;\r
+ break;\r
+ }\r
+ case 8: int_incdec(&Settings.sstate_confirm, (inp & GP2X_LEFT) ? -1 : 1, 0, 3); break;\r
+ case 9: int_incdec(&CurrentState, (inp & GP2X_LEFT) ? -1 : 1, 0, 9); break;\r
+ case 12: int_incdec(&Settings.gamma, (inp & GP2X_LEFT) ? -1 : 1, 0, 300); break;\r
+ case 13:\r
while ((inp = gp2x_joystick_read(1)) & (GP2X_LEFT|GP2X_RIGHT)) {\r
Settings.cpuclock += (inp & GP2X_LEFT) ? -1 : 1;\r
- if (Settings.cpuclock < 1) Settings.cpuclock = 1;\r
+ if (Settings.cpuclock < 0) Settings.cpuclock = 0; // 0 ~ do not change\r
draw_menu_options(menu_sel);\r
usleep(50*1000);\r
}\r
\r
static void draw_menu_credits(void)\r
{\r
- int tl_x = 15, tl_y = 70, y;\r
- //memset(gp2x_screen, 0, 320*240);\r
+ char vstr[16];\r
+\r
+ //int tl_x = 15, tl_y = 70;\r
gp2x_fceu_copy_bg();\r
\r
- // TODO\r
+ sprintf(vstr, "GPFCE v" GP2X_PORT_VERSION " rev%i", GP2X_PORT_REV);\r
+ gp2x_text_out15(20, 30, vstr);\r
+ gp2x_text_out15(20, 40, "(c) notaz, 2007");\r
+\r
+ gp2x_text_out15(20, 70, "Based on FCE Ultra versions");\r
+ gp2x_text_out15(20, 80, "0.81 and 0.98.15");\r
+\r
+ gp2x_text_out15(20, 110, " - Credits - ");\r
+ gp2x_text_out15(20, 130, "Bero: FCE");\r
+ gp2x_text_out15(20, 140, "Xodnizel: FCE Ultra");\r
+ gp2x_text_out15(20, 150, "zzhu8192: original port");\r
+ gp2x_text_out15(20, 160, "rlyeh: minimal lib");\r
+ gp2x_text_out15(20, 170, "Hermes, theoddbot, god_at_hell:");\r
+ gp2x_text_out15(20, 180, " cpuctrl, gamma libs");\r
+ gp2x_text_out15(20, 190, "Squidge: squidgehack");\r
\r
gp2x_video_flip();\r
}\r
\r
static void draw_menu_root(int menu_sel)\r
{\r
- int tl_x = 70, tl_y = 70, y;\r
+ int tl_x = 30, tl_y = 128, y;\r
gp2x_fceu_copy_bg();\r
\r
y = tl_y;\r
y += 30;\r
}\r
gp2x_text_out15(tl_x, (y+=10), "Load new ROM");\r
- gp2x_text_out15(tl_x, (y+=10), "Change options");\r
- gp2x_text_out15(tl_x, (y+=10), "Configure controls");\r
+ gp2x_text_out15(tl_x, (y+=10), "Options");\r
+ gp2x_text_out15(tl_x, (y+=10), "Controls");\r
gp2x_text_out15(tl_x, (y+=10), "Credits");\r
gp2x_text_out15(tl_x, (y+=10), "Exit");\r
// TODO\r
// draw cursor\r
gp2x_text_out15(tl_x - 16, tl_y + menu_sel*10, ">");\r
// error\r
- if (menuErrorMsg[0]) gp2x_text_out15(5, 226, menuErrorMsg);\r
+ if (menuErrorMsg[0]) gp2x_text_out15(1, 230, menuErrorMsg);\r
+ else {\r
+ char vstr[16];\r
+ sprintf(vstr, "v" GP2X_PORT_VERSION " r%i", GP2X_PORT_REV);\r
+ gp2x_text_out15(320-strlen(vstr)*8-1, 230, vstr);\r
+ }\r
gp2x_video_flip();\r
}\r
\r
\r
static int menu_loop_root(void)\r
{\r
- int ret, menu_sel = 4, menu_sel_max = 8, menu_sel_min = 4;\r
+ int ret, menu_sel_max = 8, menu_sel_min = 4;\r
+ static int menu_sel = 4;\r
unsigned long inp = 0;\r
char curr_path[PATH_MAX], *selfname;\r
FILE *tstf;\r
getcwd(curr_path, PATH_MAX);\r
}\r
\r
- if (fceugi) menu_sel = menu_sel_min = 0;\r
+ if (fceugi) menu_sel_min = 0;\r
// TODO if (PicoPatches) menu_sel_max = 9;\r
+ if (menu_sel < menu_sel_min || menu_sel > menu_sel_max)\r
+ menu_sel = menu_sel_min;\r
\r
/* make sure action buttons are not pressed on entering menu */\r
draw_menu_root(menu_sel);\r
if (fceugi) {\r
/*if(savestate_menu_loop(0))\r
continue;*/\r
+ FCEUI_SaveState();\r
+ Exit = 0;\r
+ while (gp2x_joystick_read(1) & GP2X_B) usleep(50*1000);\r
return 0;\r
}\r
break;\r
if (fceugi) {\r
/*if(savestate_menu_loop(1))\r
continue;*/\r
+ FCEUI_LoadState();\r
+ Exit = 0;\r
+ while (gp2x_joystick_read(1) & GP2X_B) usleep(50*1000);\r
return 0;\r
}\r
break;\r
case 3: // reset game\r
if (fceugi) {\r
+ FCEU_DoSimpleCommand(FCEUNPCMD_RESET);\r
+ Exit = 0;\r
return 0;\r
}\r
break;\r
if (ret == 1) continue; // status update\r
break;\r
case 6: // controls\r
- // TODO kc_sel_loop();\r
+ kc_sel_loop();\r
break;\r
case 7: // credits\r
draw_menu_credits();\r
\r
// switch bpp\r
gp2x_video_changemode(16);\r
+ gp2x_video_set_offs(0);\r
gp2x_video_RGB_setscaling(0, 320, 240);\r
gp2x_video_flip();\r
}\r