#define NL "\n"
+static void mystrip(char *str)
+{
+ int i, len;
+
+ len = strlen(str);
+ for (i = 0; i < len; i++)
+ if (str[i] != ' ') break;
+ if (i > 0) memmove(str, str + i, len - i + 1);
+ len = strlen(str);
+ for (i = len - 1; i >= 0; i--)
+ if (str[i] != ' ') break;
+ str[i+1] = 0;
+}
+
+
static int seek_sect(FILE *f, const char *section)
{
char line[128], *tmp;
fprintf(f, NL);
}
+
+static const char *joyKeyNames[32] =
+{
+ "UP", "DOWN", "LEFT", "RIGHT", "b1", "b2", "b3", "b4",
+ "b5", "b6", "b7", "b8", "b9", "b10", "b11", "b12",
+ "b13", "b14", "b15", "b16", "b17", "b19", "b19", "b20",
+ "b21", "b22", "b23", "b24", "b25", "b26", "b27", "b28"
+};
+
+static void keys_write(FILE *fn, const char *bind_str, const int binds[32],
+ const int def_binds[32], const char *names[32], int no_defaults)
+{
+ int t, i;
+ char act[48];
+
+ for (t = 0; t < 32; t++)
+ {
+ act[0] = act[31] = 0;
+ if (no_defaults && binds[t] == def_binds[t])
+ continue;
+ if (strcmp(names[t], "???") == 0) continue;
+#ifdef __GP2X__
+ if (strcmp(names[t], "SELECT") == 0) continue;
+#endif
+ for (i = 0; i < sizeof(me_ctrl_actions) / sizeof(me_ctrl_actions[0]); i++) {
+ if (me_ctrl_actions[i].mask & binds[t]) {
+ sprintf(act, "player%i ", ((binds[t]>>16)&1)+1);
+ strncpy(act + 8, me_ctrl_actions[i].name, 31);
+ break;
+ }
+ }
+ if (act[0] == 0)
+ {
+ for (i = 0; emuctrl_actions[i].name != NULL; i++)
+ if (emuctrl_actions[i].mask & binds[t]) {
+ strncpy(act, emuctrl_actions[i].name, 31);
+ break;
+ }
+ }
+ mystrip(act);
+
+ fprintf(fn, "%s %s = %s" NL, bind_str, names[t], act);
+ }
+}
+
+
static int default_var(const menu_entry *me)
{
switch (me->id)
case MA_OPT2_ENABLE_Z80:
case MA_OPT2_ENABLE_YM2612:
case MA_OPT2_ENABLE_SN76496:
+ case MA_OPT2_SVP_DYNAREC:
case MA_CDOPT_CDDA:
case MA_CDOPT_PCM:
case MA_CDOPT_SAVERAM:
}
}
}
+
+ // save key config
+ keys_write(fn, "bind", currentConfig.KeyBinds, defaultConfig.KeyBinds, keyNames, no_defaults);
+ keys_write(fn, "bind_joy0", currentConfig.JoyBinds[0], defaultConfig.JoyBinds[0], joyKeyNames, 1);
+ keys_write(fn, "bind_joy1", currentConfig.JoyBinds[1], defaultConfig.JoyBinds[1], joyKeyNames, 1);
+ keys_write(fn, "bind_joy2", currentConfig.JoyBinds[2], defaultConfig.JoyBinds[2], joyKeyNames, 1);
+ keys_write(fn, "bind_joy3", currentConfig.JoyBinds[3], defaultConfig.JoyBinds[3], joyKeyNames, 1);
+
fprintf(fn, NL);
if (fo != NULL)
}
-static void mystrip(char *str)
-{
- int i, len;
-
- len = strlen(str);
- for (i = 0; i < len; i++)
- if (str[i] != ' ') break;
- if (i > 0) memmove(str, str + i, len - i + 1);
- len = strlen(str);
- for (i = len - 1; i >= 0; i--)
- if (str[i] != ' ') break;
- str[i+1] = 0;
-}
-
-
int config_writelrom(const char *fname)
{
char line[128], *tmp, *optr = NULL;
int size;
FILE *f;
- if (strlen(currentConfig.lastRomFile) == 0) return 0;
+ if (strlen(lastRomFile) == 0) return 0;
f = fopen(fname, "r");
if (f != NULL)
fwrite(old_data, 1, optr - old_data, f);
free(old_data);
}
- fprintf(f, "LastUsedROM = %s" NL, currentConfig.lastRomFile);
+ fprintf(f, "LastUsedROM = %s" NL, lastRomFile);
fclose(f);
return 0;
}
+/* --------------------------------------------------------------------------*/
+
+int config_readlrom(const char *fname)
+{
+ char line[128], *tmp;
+ int i, len, ret = -1;
+ FILE *f;
+
+ f = fopen(fname, "r");
+ if (f == NULL) return -1;
+
+ // seek to the section needed
+ while (!feof(f))
+ {
+ tmp = fgets(line, sizeof(line), f);
+ if (tmp == NULL) break;
+
+ if (strncasecmp(line, "LastUsedROM", 11) != 0) continue;
+ len = strlen(line);
+ for (i = 0; i < len; i++)
+ if (line[i] == '#' || line[i] == '\r' || line[i] == '\n') { line[i] = 0; break; }
+ tmp = strchr(line, '=');
+ if (tmp == NULL) break;
+ tmp++;
+ mystrip(tmp);
+
+ len = sizeof(lastRomFile);
+ strncpy(lastRomFile, tmp, len);
+ lastRomFile[len-1] = 0;
+ ret = 0;
+ break;
+ }
+ fclose(f);
+ return ret;
+}
+
static int custom_read(menu_entry *me, const char *var, const char *val)
{
case MA_OPT_CONFIRM_STATES:
if (strcasecmp(var, "Confirm savestate") != 0) return 0;
if (strcasecmp(val, "OFF") == 0) {
- currentConfig.EmuOpt &= 5<<9;
+ currentConfig.EmuOpt &= ~(5<<9);
} else if (strcasecmp(val, "writes") == 0) {
- currentConfig.EmuOpt &= 5<<9;
- currentConfig.EmuOpt |= 1<<9;
+ currentConfig.EmuOpt &= ~(5<<9);
+ currentConfig.EmuOpt |= 1<<9;
} else if (strcasecmp(val, "loads") == 0) {
- currentConfig.EmuOpt &= 5<<9;
- currentConfig.EmuOpt |= 4<<9;
+ currentConfig.EmuOpt &= ~(5<<9);
+ currentConfig.EmuOpt |= 4<<9;
} else if (strcasecmp(val, "both") == 0) {
- currentConfig.EmuOpt &= 5<<9;
- currentConfig.EmuOpt |= 5<<9;
+ currentConfig.EmuOpt &= ~(5<<9);
+ currentConfig.EmuOpt |= 5<<9;
} else
return 0;
return 1;
return 1;
default:
- if (strcasecmp(var, "LastUsedROM") == 0) {
- tmpi = sizeof(currentConfig.lastRomFile);
- strncpy(currentConfig.lastRomFile, val, tmpi);
- currentConfig.lastRomFile[tmpi-1] = 0;
- return 1;
- }
lprintf("unhandled custom_read: %i\n", me->id);
return 0;
}
}
+static void keys_parse(const char *var, const char *val, int binds[32], const char *names[32])
+{
+ int t, i, keys_encountered = 0;
+ unsigned int player;
+
+ for (t = 0; t < 32; t++)
+ {
+ if (strcmp(names[t], var) == 0) break;
+ }
+ if (t == 32) {
+ lprintf("unhandled bind \"%s\"\n", var);
+ return;
+ }
+
+ if (!(keys_encountered & (1<<t))) {
+ binds[t] = 0;
+ keys_encountered |= 1<<t;
+ }
+ if (val[0] == 0)
+ return;
+ if (strncasecmp(val, "player", 6) == 0)
+ {
+ player = atoi(val + 6) - 1;
+ if (player > 1) goto fail;
+ for (i = 0; i < sizeof(me_ctrl_actions) / sizeof(me_ctrl_actions[0]); i++) {
+ if (strncasecmp(me_ctrl_actions[i].name, val + 8, strlen(val + 8)) == 0) {
+ binds[t] |= me_ctrl_actions[i].mask | (player<<16);
+ return;
+ }
+ }
+ }
+ for (i = 0; emuctrl_actions[i].name != NULL; i++) {
+ if (strncasecmp(emuctrl_actions[i].name, val, strlen(val)) == 0) {
+ binds[t] |= emuctrl_actions[i].mask;
+ return;
+ }
+ }
+
+fail:
+ lprintf("unhandled action \"%s\"\n", val);
+ return;
+
+}
+
+
+#define try_joy_parse(num) { \
+ if (strncasecmp(var, "bind_joy"#num " ", 10) == 0) { \
+ keys_parse(var + 10, val, currentConfig.JoyBinds[num], joyKeyNames); \
+ return; \
+ } \
+}
+
static void parse(const char *var, const char *val)
{
menu_entry *me;
int t, i, tlen, tmp, ret = 0;
+ if (strcasecmp(var, "LastUsedROM") == 0)
+ return; /* handled elsewhere */
+
+ // key binds
+ if (strncasecmp(var, "bind ", 5) == 0) {
+ keys_parse(var + 5, val, currentConfig.KeyBinds, keyNames);
+ return;
+ }
+ try_joy_parse(0)
+ try_joy_parse(1)
+ try_joy_parse(2)
+ try_joy_parse(3)
+
for (t = 0; t < sizeof(cfg_opts) / sizeof(cfg_opts[0]) && ret == 0; t++)
{
me = cfg_opts[t];
}
+int config_havesect(const char *fname, const char *section)
+{
+ FILE *f;
+ int ret;
+
+ f = fopen(fname, "r");
+ if (f == NULL) return 0;
+
+ ret = seek_sect(f, section);
+ fclose(f);
+ return ret;
+}
+
+
int config_readsect(const char *fname, const char *section)
{
char line[128], *var, *val, *tmp;
- FILE *f = fopen(fname, "r");
int len, i, ret;
+ FILE *f;
+ f = fopen(fname, "r");
if (f == NULL) return 0;
if (section != NULL)
val = &line[i+1];
mystrip(var);
mystrip(val);
- if (strlen(var) == 0 || strlen(val) == 0) {
+ if (strlen(var) == 0 || (strlen(val) == 0 && strncasecmp(var, "bind", 4) != 0)) {
lprintf("config_readsect: something's empty: \"%s\" = \"%s\"\n", var, val);
continue;
}
-#include <stdio.h>
-
int config_writesect(const char *fname, const char *section);
int config_writelrom(const char *fname);
int config_readsect(const char *fname, const char *section);
+int config_readlrom(const char *fname);
+int config_havesect(const char *fname, const char *section);
char noticeMsg[64];\r
int state_slot = 0;\r
int config_slot = 0, config_slot_current = 0;\r
+char lastRomFile[512];\r
\r
unsigned char *movie_data = NULL;\r
static int movie_size = 0;\r
}\r
\r
/* check if the name begins with BIOS name */\r
+/*\r
static int emu_isBios(const char *name)\r
{\r
int i;\r
if (strstr(name, biosfiles_jp[i]) != NULL) return 1;\r
return 0;\r
}\r
+*/\r
\r
-static unsigned char scd_id_header[0x100];\r
+static unsigned char id_header[0x100];\r
\r
/* checks if romFileName points to valid MegaCD image\r
* if so, checks for suitable BIOS */\r
}\r
\r
pm_seek(cd_f, (type == 1) ? 0x100 : 0x110, SEEK_SET);\r
- pm_read(scd_id_header, sizeof(scd_id_header), cd_f);\r
+ pm_read(id_header, sizeof(id_header), cd_f);\r
\r
/* it seems we have a CD image here. Try to detect region now.. */\r
pm_seek(cd_f, (type == 1) ? 0x100+0x10B : 0x110+0x10B, SEEK_SET);\r
char *emu_makeRomId(void)\r
{\r
static char id_string[3+0x11+0x11+0x30+16];\r
- unsigned char *id_header;\r
int pos;\r
\r
- if (Pico.rom == NULL) {\r
- id_string[0] = 0;\r
- return id_string;\r
- }\r
-\r
- if (PicoMCD & 1) {\r
- id_header = scd_id_header;\r
- strcpy(id_string, "CD|");\r
- } else {\r
- id_header = Pico.rom + 0x100;\r
- strcpy(id_string, "MD|");\r
- }\r
+ if (PicoMCD & 1)\r
+ strcpy(id_string, "CD|");\r
+ else strcpy(id_string, "MD|");\r
pos = 3;\r
\r
pos += extract_text(id_string + pos, id_header + 0x80, 0x0e, 1); // serial\r
pos += extract_text(id_string + pos, id_header + 0x50, 0x30, 1); // overseas name\r
id_string[pos] = 0;\r
\r
- printf("id_string: %s\n", id_string);\r
return id_string;\r
}\r
\r
}\r
\r
// load config for this ROM (do this before insert to get correct region)\r
+ if (!(PicoMCD&1))\r
+ memcpy(id_header, rom_data + 0x100, sizeof(id_header));\r
if (!cfg_loaded) {\r
ret = emu_ReadConfig(1, 1);\r
if (!ret) emu_ReadConfig(0, 1);\r
\r
menu_romload_end();\r
\r
- if (!emu_isBios(romFileName))\r
- {\r
- // emu_ReadConfig() might have messed currentConfig.lastRomFile\r
- strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1);\r
- currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0;\r
- }\r
-\r
if (PicoPatches) {\r
PicoPatchPrepare();\r
PicoPatchApply();\r
if (currentConfig.EmuOpt & 1)\r
emu_SaveLoadGame(1, 1);\r
\r
+ strncpy(lastRomFile, romFileName, sizeof(lastRomFile)-1);\r
+ lastRomFile[sizeof(lastRomFile)-1] = 0;\r
rom_loaded = 1;\r
return 1;\r
}\r
}\r
else\r
{\r
- if (!no_defaults)\r
- emu_setDefaultConfig();\r
+ char *sect = emu_makeRomId();\r
\r
// try new .cfg way\r
if (config_slot != 0)\r
sprintf(cfg, "game.%i.cfg", config_slot);\r
else strcpy(cfg, "game.cfg");\r
- ret = config_readsect(cfg, emu_makeRomId());\r
+\r
+ ret = -1;\r
+ if (config_havesect(cfg, sect)) {\r
+ emu_setDefaultConfig();\r
+ ret = config_readsect(cfg, sect);\r
+ }\r
\r
if (ret != 0)\r
{\r
f = fopen(cfg, "rb");\r
}\r
if (f) {\r
- int bread = fread(¤tConfig, 1, sizeof(currentConfig), f);\r
+ int bread;\r
+ fseek(f, 512, SEEK_SET); // skip unused lrom buffer\r
+ bread = fread(¤tConfig, 1, sizeof(currentConfig), f);\r
lprintf("emu_ReadConfig: %s %s\n", cfg, bread > 0 ? "(ok)" : "(failed)");\r
fclose(f);\r
ret = 0;\r
}\r
else\r
{\r
- lprintf("loaded cf from game sect\n");\r
+ lprintf("loaded cfg from sect \"%s\"\n", sect);\r
}\r
}\r
\r
sprintf(cfg, "game.%i.cfg", config_slot);\r
else strcpy(cfg, "game.cfg");\r
game_sect = emu_makeRomId();\r
+ lprintf("emu_WriteConfig: sect \"%s\"\n", game_sect);\r
}\r
\r
lprintf("emu_WriteConfig: %s ", cfg);\r
ret = config_writesect(cfg, game_sect);\r
+ if (write_lrom) config_writelrom(cfg);\r
#ifndef NO_SYNC\r
sync();\r
#endif\r
// For commercial use, separate licencing terms must be obtained.
typedef struct {
- char lastRomFile[512];
+ // char lastRomFile[512];
int EmuOpt; // LSb->MSb: use_sram, show_fps, enable_sound, gzip_saves,
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
// craigix_ram, confirm_save, show_cd_leds, confirm_load
extern int state_slot;
extern int config_slot, config_slot_current;
extern unsigned char *movie_data;
+extern char lastRomFile[512];
int emu_ReloadRom(void);
void emu_textOut16(int x, int y, const char *text);
char *emu_makeRomId(void);
+extern const char *keyNames[];
void emu_prepareDefaultConfig(void);
\r
char menuErrorMsg[64] = { 0, };\r
\r
+// PicoPad[] format: MXYZ SACB RLDU\r
+me_bind_action me_ctrl_actions[12] =\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
+\r
static unsigned char menu_font_data[10240];\r
static int menu_text_color = 0xffff; // default to white\r
static int menu_sel_color = -1; // disabled\r
-// (c) Copyright 2006,2007 notaz, All rights reserved.
+// (c) Copyright 2006-2008 notaz, All rights reserved.
void menu_init(void);
extern char menuErrorMsg[64];
-
typedef enum
{
MB_NONE = 1, /* no auto processing */
MA_OPT2_SQUIDGEHACK, /* gp2x */
MA_OPT2_STATUS_LINE, /* psp */
MA_OPT2_NO_FRAME_LIMIT, /* psp */
+ MA_OPT2_SVP_DYNAREC,
MA_OPT2_DONE,
MA_OPT3_SCALE, /* psp (all OPT3) */
MA_OPT3_HSCALE32,
char need_to_save;
} menu_entry;
+typedef struct
+{
+ char *name;
+ int mask;
+} me_bind_action;
+
+extern me_bind_action me_ctrl_actions[12];
+extern me_bind_action emuctrl_actions[]; // platform code
+
typedef void (me_draw_custom_f)(const menu_entry *entry, int x, int y, void *param);
void emu_prepareDefaultConfig(void)\r
{\r
memset(&defaultConfig, 0, sizeof(defaultConfig));\r
- defaultConfig.lastRomFile[0] = 0;\r
- defaultConfig.EmuOpt = 0x1f | 0x600; // | confirm_save, cd_leds\r
- defaultConfig.s_PicoOpt = 0x0f | 0xe00; // | use_940, cd_pcm, cd_cdda\r
+ defaultConfig.EmuOpt = 0x1d | 0x00700; // | <- ram_tmng, confirm_save, cd_leds\r
+ defaultConfig.s_PicoOpt = 0x0f | 0x20e00; // | <- use_940, cd_pcm, cd_cdda, svp drc\r
defaultConfig.s_PsndRate = 44100;\r
defaultConfig.s_PicoRegion = 0; // auto\r
defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP\r
\r
emu_prepareDefaultConfig();\r
emu_ReadConfig(0, 0);\r
+ config_readlrom(PicoConfigFile);\r
\r
gp2x_init();\r
if (currentConfig.EmuOpt&0x10) {\r
\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
return keys;
}
-typedef struct { char *name; int mask; } bind_action_t;
-
static void draw_key_config(const bind_action_t *opts, int opt_cnt, int player_idx, int sel)
{
int x, y, tl_y = 16+40, i;
}
-// PicoPad[] format: MXYZ SACB RLDU
-static bind_action_t ctrl_actions[] =
-{
- { "UP ", 0x001 },
- { "DOWN ", 0x002 },
- { "LEFT ", 0x004 },
- { "RIGHT ", 0x008 },
- { "A ", 0x040 },
- { "B ", 0x010 },
- { "C ", 0x020 },
- { "START ", 0x080 },
- { "MODE ", 0x800 },
- { "X ", 0x400 },
- { "Y ", 0x200 },
- { "Z ", 0x100 },
-};
-
// player2_flag, ?, ?, ?, ?, ?, ?, menu
// "NEXT SAVE SLOT", "PREV SAVE SLOT", "SWITCH RENDERER", "SAVE STATE",
// "LOAD STATE", "VOLUME UP", "VOLUME DOWN", "DONE"
-static bind_action_t emuctrl_actions[] =
+me_bind_action emuctrl_actions[] =
{
{ "Load State ", 1<<28 },
{ "Save State ", 1<<27 },
{ "Prev Save Slot ", 1<<25 },
{ "Next Save Slot ", 1<<24 },
{ "Switch Renderer", 1<<26 },
+ { NULL, 0 }
};
static void kc_sel_loop(void)
if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if (inp & BTN_CIRCLE) {
switch (menu_sel) {
- case 0: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 0); return;
- case 1: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 1); return;
+ case 0: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 0); return;
+ case 1: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 1); return;
case 2: key_config_loop(emuctrl_actions,
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]), -1); return;
case 3: if (!rom_loaded) emu_WriteConfig(0); return;