diff --git a/src/computer.c b/src/computer.c index 0338dcd..d1897c4 100644 --- a/src/computer.c +++ b/src/computer.c @@ -118,6 +118,7 @@ void computer_init () { //Called only on start-up ordenador.tape_readed = 0; ordenador.pause = 1; // tape stop ordenador.tape_fast_load = 1; // fast load by default + ordenador.rewind_on_reset = 1; //Rewound on reset by default ordenador.tape_current_mode = TAP_TRASH; ordenador.tap_file = NULL; @@ -1654,11 +1655,14 @@ void ResetComputer () { microdrive_reset(); - ordenador.pause = 1; + if (ordenador.rewind_on_reset) + { + ordenador.pause = 1; if (ordenador.tap_file != NULL) { ordenador.tape_current_mode = TAP_TRASH; rewind_tape (ordenador.tap_file,1); } + } ordenador.precision=ordenador.precision_old; //in case the machine is reset during loading } diff --git a/src/computer.h b/src/computer.h index 30273a1..a28971d 100644 --- a/src/computer.h +++ b/src/computer.h @@ -174,6 +174,7 @@ struct computer { unsigned int tape_pause_at_end; FILE *tap_file; unsigned char tape_fast_load; // 0 normal load; 1 fast load + unsigned char rewind_on_reset; unsigned char current_tap[2049]; unsigned char last_selected_file[2049]; unsigned char last_selected_poke_file[2049]; diff --git a/src/emulator.c b/src/emulator.c index 9dd3278..7f56d8e 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -710,6 +710,7 @@ int save_config(struct computer *object, char *filename) { fprintf(fconfig,"volume=%c%c",65+(object->volume),10); fprintf(fconfig,"bw=%c%c",48+object->bw,10); fprintf(fconfig,"tap_fast=%c%c",48+object->tape_fast_load,10); + fprintf(fconfig,"rewind_on_reset=%c%c",48+object->rewind_on_reset,10); fprintf(fconfig,"joypad1=%c%c",48+object->joypad_as_joystick[0],10); fprintf(fconfig,"joypad2=%c%c",48+object->joypad_as_joystick[1],10); fprintf(fconfig,"rumble1=%c%c",48+object->rumble[0],10); @@ -886,7 +887,8 @@ int load_config(struct computer *object, char *filename) { FILE *fconfig; unsigned char volume=255,mode128k=255,issue=255,ntsc=255, joystick1=255,joystick2=255,ay_emul=255,mdr_active=255, dblscan=255,framerate =255, screen =255, text=255, precision=255, bw=255, tap_fast=255, audio_mode=255, - joypad1=255, joypad2=255, rumble1=255, rumble2=255, joy_n=255, key_n=255, port=255, autoconf=255, turbo=225, vk_auto=255, vk_rumble=255; + joypad1=255, joypad2=255, rumble1=255, rumble2=255, joy_n=255, key_n=255, port=255, autoconf=255, turbo=225, vk_auto=255, vk_rumble=255, + rewind_on_reset=255; if (filename) strcpy(config_path,filename); else return -2; @@ -984,6 +986,10 @@ int load_config(struct computer *object, char *filename) { tap_fast=(line[9]-'0'); continue; } + if (!strncmp(line,"rewind_on_reset=",16)) { + rewind_on_reset=(line[16]-'0'); + continue; + } if (!strncmp(line,"joypad1=",8)) { joypad1=line[8]-'0'; continue; @@ -1078,6 +1084,9 @@ int load_config(struct computer *object, char *filename) { if (tap_fast<2) { object->tape_fast_load=tap_fast; } + if (rewind_on_reset<2) { + object->rewind_on_reset=rewind_on_reset; + } if (joypad1<2) { object->joypad_as_joystick[0]=joypad1; } diff --git a/src/gui_sdl.c b/src/gui_sdl.c index 324a47b..ff8cdcf 100644 --- a/src/gui_sdl.c +++ b/src/gui_sdl.c @@ -84,8 +84,10 @@ static const char *emulation_messages[] = { /*05*/ "^|on|off", /*06*/ "Turbo mode", /*07*/ "^|off|auto|fast|ultrafast", - /*08*/ "Precision", + /*08*/ "Rewind tape on reset", /*09*/ "^|on|off", + /*10*/ "Precision", + /*11*/ "^|on|off", NULL }; @@ -497,36 +499,40 @@ static void set_machine_model(int which) } } -static void emulation_settings(void) +static int emulation_settings(void) { - unsigned int submenus[5],submenus_old[5]; - int opt, i; + unsigned int submenus[6],submenus_old[6]; + int opt, i, retorno; unsigned char old_mode, old_videosystem; + retorno=-1; //exit to the previous menue + memset(submenus, 0, sizeof(submenus)); submenus[0] = get_machine_model(); submenus[1] = jump_frames; submenus[2] = !ordenador.tape_fast_load; submenus[3] = ordenador.turbo; - submenus[4] = !ordenador.precision; + submenus[4] = !ordenador.rewind_on_reset; + submenus[5] = !ordenador.precision; - for (i=0; i<5; i++) submenus_old[i] = submenus[i]; + for (i=0; i<6; i++) submenus_old[i] = submenus[i]; old_mode=ordenador.mode128k; old_videosystem = ordenador.videosystem; opt = menu_select_title("Emulation settings menu", emulation_messages, submenus); if (opt < 0) - return; + return retorno; if (submenus[0]!=submenus_old[0]) set_machine_model(submenus[0]); - if ((old_mode!=ordenador.mode128k)||(old_videosystem!=ordenador.videosystem)) ResetComputer(); + if ((old_mode!=ordenador.mode128k)||(old_videosystem!=ordenador.videosystem)) {ResetComputer(); retorno=-2;} jump_frames = submenus[1]; ordenador.tape_fast_load = !submenus[2]; ordenador.turbo = submenus[3]; + ordenador.rewind_on_reset = !submenus[4]; curr_frames=0; if (submenus[3] != submenus_old[3]) @@ -560,9 +566,9 @@ static void emulation_settings(void) } } - if (submenus[4] != submenus_old[4]) + if (submenus[5] != submenus_old[5]) { - ordenador.precision = !submenus[4]; + ordenador.precision = !submenus[5]; ordenador.precision_old=ordenador.precision; if (ordenador.turbo_state!=4) //Tape is not loading with turbo mode if (ordenador.precision) @@ -577,6 +583,8 @@ static void emulation_settings(void) } } + + return retorno; } unsigned int get_value_filter (unsigned int value) @@ -1829,7 +1837,7 @@ void main_menu() input_options(submenus[2]); break; case 7: - emulation_settings(); + if (emulation_settings()==-2) retorno=-1; break; case 8: screen_settings();