return 1;\r
}\r
\r
+int emu_record_tape(const char *ext)\r
+{\r
+ int ret;\r
+\r
+ fname_ext(static_buff, sizeof(static_buff), "tape"PATH_SEP, ext, rom_fname_loaded);\r
+ ret = PicoRecordTape(static_buff);\r
+ if (ret != 0) {\r
+ menu_update_msg("recording tape failed");\r
+ return 0;\r
+ }\r
+ return 1;\r
+}\r
+\r
// <base dir><end>\r
void emu_make_path(char *buff, const char *end, int size)\r
{\r
mkdir_path(path, pos, "mds");\r
mkdir_path(path, pos, "srm");\r
mkdir_path(path, pos, "brm");\r
+ mkdir_path(path, pos, "tape");\r
mkdir_path(path, pos, "cfg");\r
\r
pprof_init();\r
bp[(w - i) + g_menuscreen_pp * u] = menu_text_color;
}
-static int menu_load_sc3000_tape(void)
+static menu_entry e_menu_main[];
+
+static int tape_record_bit;
+static const char *tape_record_exts[] = { ".wav", ".bit" };
+
+static const char *mgn_loadtape(int id, int *offs)
{
- static const char *rom_exts[] = { "bit", "wav", NULL };
- const char *ret_name;
+ return "";
+}
- ret_name = menu_loop_romsel_d(rom_fname_loaded,
- sizeof(rom_fname_loaded), rom_exts, NULL, menu_draw_prep);
- if (ret_name == NULL)
+static int mh_loadtape(int id, int keys)
+{
+ if (keys & (PBTN_LEFT|PBTN_RIGHT)) { // multi choice
+ int x = me_id2offset(e_menu_main, MA_MAIN_SAVE_TAPE);
+ e_menu_main[x].enabled = !e_menu_main[x].enabled;
return 0;
+ }
+ if (keys & PBTN_MOK) {
+ static const char *rom_exts[] = { "bit", "wav", NULL };
+ const char *ret_name;
+
+ ret_name = menu_loop_romsel_d(rom_fname_loaded,
+ sizeof(rom_fname_loaded), rom_exts, NULL, menu_draw_prep);
+ if (ret_name == NULL)
+ return 0;
- return emu_play_tape(ret_name);
+ return emu_play_tape(ret_name);
+ }
+ return 1;
}
-static menu_entry e_menu_main[];
+static const char *mgn_savetape(int id, int *offs)
+{
+ return tape_record_exts[!!tape_record_bit];
+}
+
+static int mh_savetape(int id, int keys)
+{
+ if (keys & (PBTN_LEFT|PBTN_RIGHT)) { // multi choice
+ tape_record_bit = !tape_record_bit;
+ return 0;
+ }
+ if (keys & PBTN_MOK) {
+ return emu_record_tape(tape_record_exts[!!tape_record_bit]);
+ }
+ return 1;
+}
static int main_menu_handler(int id, int keys)
{
return 1;
}
break;
- case MA_MAIN_LOAD_TAPE:
- if (PicoIn.AHW & PAHW_SC)
- return menu_load_sc3000_tape();
- break;
case MA_MAIN_CREDITS:
draw_menu_message(credits, draw_frame_credits);
in_menu_wait(PBTN_MOK|PBTN_MBACK, NULL, 70);
mee_handler_id("Reset game", MA_MAIN_RESET_GAME, main_menu_handler),
mee_handler_id("Change CD", MA_MAIN_CHANGE_CD, main_menu_handler),
mee_cust_s_h ("Storyware page", MA_MAIN_PICO_PAGE, 0,mh_picopage, mgn_picopage, NULL),
- mee_handler_id("Load tape", MA_MAIN_LOAD_TAPE, main_menu_handler),
+ mee_cust_s_h ("Load tape", MA_MAIN_LOAD_TAPE, 0,mh_loadtape, mgn_loadtape, NULL),
+ mee_cust_s_h ("Save tape", MA_MAIN_SAVE_TAPE, 0,mh_savetape, mgn_savetape, NULL),
mee_handler_id("Patches / GameGenie",MA_MAIN_PATCHES, main_menu_handler),
mee_handler_id("Load new game", MA_MAIN_LOAD_ROM, main_menu_handler),
mee_handler ("Change options", menu_loop_options),
me_enable(e_menu_main, MA_MAIN_RESET_GAME, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_CHANGE_CD, PicoIn.AHW & PAHW_MCD);
me_enable(e_menu_main, MA_MAIN_LOAD_TAPE, PicoIn.AHW & PAHW_SC);
+ me_enable(e_menu_main, MA_MAIN_SAVE_TAPE, 0);
me_enable(e_menu_main, MA_MAIN_PICO_PAGE, PicoIn.AHW & PAHW_PICO);
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
me_enable(e_menu_main, MA_OPT_SAVECFG_GAME, PicoGameLoaded);