\r
extern int mmuhack_status;\r
\r
-static const char *gp2xKeyNames[] = {\r
+const char *keyNames[] = {\r
"UP", "???", "LEFT", "???", "DOWN", "???", "RIGHT", "???",\r
"START", "SELECT", "L", "R", "A", "B", "X", "Y",\r
"???", "???", "???", "???", "???", "???", "VOL DOWN", "VOL UP",\r
inp_prev = ret;\r
inp_prevjoy = *joy;\r
\r
+ // handle only 1 event at a time\r
+ for (i = 1; i != 0; i <<= 1)\r
+ if (ret & i) { ret &= i; break; }\r
+\r
return ret;\r
}\r
\r
if (currentConfig.KeyBinds[i] & action_mask)\r
{\r
if (player_idx >= 0 && ((currentConfig.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
+ if (strkeys[0]) { strcat(strkeys, " + "); strcat(strkeys, keyNames[i]); break; }\r
+ else strcpy(strkeys, keyNames[i]);\r
}\r
}\r
for (joy = 0; joy < num_of_joys; joy++)\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
+static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx, int sel)\r
{\r
int x, y, tl_y = 40, i;\r
\r
menu_flip();\r
}\r
\r
-static void key_config_loop(const bind_action_t *opts, int opt_cnt, int player_idx)\r
+static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_idx)\r
{\r
int joy = 0, sel = 0, menu_sel_max = opt_cnt, prev_select = 0, i;\r
unsigned long inp = 0;\r
if (inp & (1 << i)) {\r
int *bind = ¤tConfig.JoyBinds[joy-1][i];\r
if ((*bind & opts[sel].mask) && (player_idx < 0 || player_idx == ((*bind>>16)&3)))\r
- currentConfig.JoyBinds[joy-1][i] &= ~opts[sel].mask;\r
+ *bind &= ~opts[sel].mask;\r
else {\r
// override\r
unbind_action(opts[sel].mask, player_idx, joy);\r
*bind = opts[sel].mask;\r
- if (player_idx >= 0) *bind |= player_idx << 16;\r
+ if (player_idx > 0) *bind |= player_idx << 16;\r
}\r
}\r
}\r
}\r
\r
\r
-// PicoPad[] format: MXYZ SACB RLDU\r
-static bind_action_t ctrl_actions[] =\r
-{\r
- { "UP ", 0x001 },\r
- { "DOWN ", 0x002 },\r
- { "LEFT ", 0x004 },\r
- { "RIGHT ", 0x008 },\r
- { "A ", 0x040 },\r
- { "B ", 0x010 },\r
- { "C ", 0x020 },\r
- { "START ", 0x080 },\r
- { "MODE ", 0x800 },\r
- { "X ", 0x400 },\r
- { "Y ", 0x200 },\r
- { "Z ", 0x100 },\r
-};\r
-\r
// player2_flag, ?, ?, ?, ?, ?, ?, menu\r
// "NEXT SAVE SLOT", "PREV SAVE SLOT", "SWITCH RENDERER", "SAVE STATE",\r
// "LOAD STATE", "VOLUME UP", "VOLUME DOWN", "DONE"\r
-static bind_action_t emuctrl_actions[] =\r
+me_bind_action emuctrl_actions[] =\r
{\r
{ "Load State ", 1<<28 },\r
{ "Save State ", 1<<27 },\r
{ "Volume Up ", 1<<29 },\r
{ "Fast forward ", 1<<22 },\r
{ "Enter Menu ", 1<<23 },\r
+ { NULL, 0 }\r
};\r
\r
static void kc_sel_loop(void)\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(ctrl_actions, is_6button ? 12 : 8, 0); return;\r
- case 1: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 1); return;\r
+ case 0: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 0); return;\r
+ case 1: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 1); return;\r
case 2: key_config_loop(emuctrl_actions,\r
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]), -1); return;\r
case 3: if (!rom_loaded) emu_WriteConfig(0); return;\r
{ NULL, MB_NONE, MA_OPT2_GAMMA, NULL, 0, 0, 0, 1, 1 },\r
{ "A_SN's gamma curve", MB_ONOFF, MA_OPT2_A_SN_GAMMA, ¤tConfig.EmuOpt, 0x1000, 0, 0, 1, 1 },\r
{ "Perfect vsync", MB_ONOFF, MA_OPT2_VSYNC, ¤tConfig.EmuOpt, 0x2000, 0, 0, 1, 1 },\r
- { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x0004, 0, 0, 1, 1 },\r
- { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x0001, 0, 0, 1, 1 },\r
- { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x0002, 0, 0, 1, 1 },\r
+ { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 },\r
+ { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },\r
+ { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 },\r
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x0008, 0, 0, 1, 1 },\r
{ "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x0020, 0, 0, 1, 1 },\r
{ "needs restart:", MB_NONE, MA_NONE, NULL, 0, 0, 0, 1, 0 },\r
{ "craigix's RAM timings", MB_ONOFF, MA_OPT2_RAMTIMINGS, ¤tConfig.EmuOpt, 0x0100, 0, 0, 1, 1 },\r
{ NULL, MB_ONOFF, MA_OPT2_SQUIDGEHACK, ¤tConfig.EmuOpt, 0x0010, 0, 0, 1, 1 },\r
+ { "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 },\r
{ "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1, 0 },\r
};\r
\r
{\r
char curr_path[PATH_MAX], *selfname;\r
FILE *tstf;\r
- if ( (tstf = fopen(currentConfig.lastRomFile, "rb")) )\r
+ if ( (tstf = fopen(lastRomFile, "rb")) )\r
{\r
fclose(tstf);\r
- strcpy(curr_path, currentConfig.lastRomFile);\r
+ strcpy(curr_path, lastRomFile);\r
}\r
else\r
getcwd(curr_path, PATH_MAX);\r
gp2x_memset_all_buffers(0, 0, 320*240*2);\r
menu_gfx_prepare();\r
\r
- if ( (tstf = fopen(currentConfig.lastRomFile, "rb")) )\r
+ if ( (tstf = fopen(lastRomFile, "rb")) )\r
{\r
fclose(tstf);\r
- strcpy(curr_path, currentConfig.lastRomFile);\r
+ strcpy(curr_path, lastRomFile);\r
}\r
else\r
{\r