int pico_inp_mode = 0;\r
int engineState = PGS_Menu;\r
\r
+/* tmp buff to reduce stack usage for plats with small stack */\r
+static char static_buff[512];\r
/* TODO: len checking */\r
-char rom_fname_reload[512] = { 0, };\r
-char rom_fname_loaded[512] = { 0, };\r
+char rom_fname_reload[512];\r
+char rom_fname_loaded[512];\r
int rom_loaded = 0;\r
int reset_timing = 0;\r
static unsigned int notice_msg_time; /* when started showing */\r
\r
static int find_bios(int region, char **bios_file)\r
{\r
- static char bios_path[1024];\r
int i, count;\r
const char * const *files;\r
FILE *f = NULL;\r
\r
for (i = 0; i < count; i++)\r
{\r
- emu_make_path(bios_path, files[i], sizeof(bios_path) - 4);\r
- strcat(bios_path, ".bin");\r
- f = fopen(bios_path, "rb");\r
+ emu_make_path(static_buff, files[i], sizeof(static_buff) - 4);\r
+ strcat(static_buff, ".bin");\r
+ f = fopen(static_buff, "rb");\r
if (f) break;\r
\r
- bios_path[strlen(bios_path) - 4] = 0;\r
- strcat(bios_path, ".zip");\r
- f = fopen(bios_path, "rb");\r
+ static_buff[strlen(static_buff) - 4] = 0;\r
+ strcat(static_buff, ".zip");\r
+ f = fopen(static_buff, "rb");\r
if (f) break;\r
}\r
\r
if (f) {\r
- lprintf("using bios: %s\n", bios_path);\r
+ lprintf("using bios: %s\n", static_buff);\r
fclose(f);\r
- if (bios_file) *bios_file = bios_path;\r
+ if (bios_file)\r
+ *bios_file = static_buff;\r
return 1;\r
} else {\r
- sprintf(bios_path, "no %s BIOS files found, read docs",\r
+ sprintf(static_buff, "no %s BIOS files found, read docs",\r
region != 4 ? (region == 8 ? "EU" : "JAP") : "USA");\r
- me_update_msg(bios_path);\r
+ me_update_msg(static_buff);\r
return 0;\r
}\r
}\r
}\r
\r
menu_romload_prepare(used_rom_name); // also CD load\r
+ used_rom_name = NULL; // uses static_buff\r
\r
ret = PicoCartLoad(rom, &rom_data, &rom_size, (PicoAHW & PAHW_SMS) ? 1 : 0);\r
pm_close(rom);\r
if (!ret) emu_read_config(0, 0);\r
}\r
\r
- if (PicoCartInsert(rom_data, rom_size)) {\r
+ emu_make_path(static_buff, "carthw.cfg", sizeof(static_buff));\r
+ if (PicoCartInsert(rom_data, rom_size, static_buff)) {\r
me_update_msg("Failed to load ROM.");\r
goto fail;\r
}\r
if (ext) strcat(dst, ext);\r
}\r
\r
+// <base dir><end>\r
void emu_make_path(char *buff, const char *end, int size)\r
{\r
int pos, end_len;\r
\r
char *emu_get_save_fname(int load, int is_sram, int slot)\r
{\r
- static char saveFname[512];\r
+ char *saveFname = static_buff;\r
char ext[16];\r
\r
if (is_sram)\r
pframes_done++; frames_done++;\r
diff_lim += target_frametime;\r
\r
- if (!(currentConfig.EmuOpt & EOPT_NO_FRMLIMIT)) {\r
+ if (!(currentConfig.EmuOpt & (EOPT_NO_FRMLIMIT|EOPT_EXT_FRMLIMIT))) {\r
timestamp = get_ticks();\r
diff = timestamp - timestamp_base;\r
if (!reset_timing && diff < diff_lim) // we are too fast\r
PicoFrame();\r
\r
/* frame limiter */\r
- if (!reset_timing && !(currentConfig.EmuOpt & EOPT_NO_FRMLIMIT))\r
+ if (!reset_timing && !(currentConfig.EmuOpt & (EOPT_NO_FRMLIMIT|EOPT_EXT_FRMLIMIT)))\r
{\r
timestamp = get_ticks();\r
diff = timestamp - timestamp_base;\r