Option to disable tape rewind on reset, machine model change returns immediately to emulation

This commit is contained in:
fabio.olimpieri 2013-01-27 14:04:18 +00:00
parent d1412faf6e
commit f3dc41a8dd
4 changed files with 35 additions and 13 deletions

View File

@ -118,6 +118,7 @@ void computer_init () { //Called only on start-up
ordenador.tape_readed = 0; ordenador.tape_readed = 0;
ordenador.pause = 1; // tape stop ordenador.pause = 1; // tape stop
ordenador.tape_fast_load = 1; // fast load by default 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.tape_current_mode = TAP_TRASH;
ordenador.tap_file = NULL; ordenador.tap_file = NULL;
@ -1654,11 +1655,14 @@ void ResetComputer () {
microdrive_reset(); microdrive_reset();
if (ordenador.rewind_on_reset)
{
ordenador.pause = 1; ordenador.pause = 1;
if (ordenador.tap_file != NULL) { if (ordenador.tap_file != NULL) {
ordenador.tape_current_mode = TAP_TRASH; ordenador.tape_current_mode = TAP_TRASH;
rewind_tape (ordenador.tap_file,1); rewind_tape (ordenador.tap_file,1);
} }
}
ordenador.precision=ordenador.precision_old; //in case the machine is reset during loading ordenador.precision=ordenador.precision_old; //in case the machine is reset during loading
} }

View File

@ -174,6 +174,7 @@ struct computer {
unsigned int tape_pause_at_end; unsigned int tape_pause_at_end;
FILE *tap_file; FILE *tap_file;
unsigned char tape_fast_load; // 0 normal load; 1 fast load unsigned char tape_fast_load; // 0 normal load; 1 fast load
unsigned char rewind_on_reset;
unsigned char current_tap[2049]; unsigned char current_tap[2049];
unsigned char last_selected_file[2049]; unsigned char last_selected_file[2049];
unsigned char last_selected_poke_file[2049]; unsigned char last_selected_poke_file[2049];

View File

@ -710,6 +710,7 @@ int save_config(struct computer *object, char *filename) {
fprintf(fconfig,"volume=%c%c",65+(object->volume),10); fprintf(fconfig,"volume=%c%c",65+(object->volume),10);
fprintf(fconfig,"bw=%c%c",48+object->bw,10); fprintf(fconfig,"bw=%c%c",48+object->bw,10);
fprintf(fconfig,"tap_fast=%c%c",48+object->tape_fast_load,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,"joypad1=%c%c",48+object->joypad_as_joystick[0],10);
fprintf(fconfig,"joypad2=%c%c",48+object->joypad_as_joystick[1],10); fprintf(fconfig,"joypad2=%c%c",48+object->joypad_as_joystick[1],10);
fprintf(fconfig,"rumble1=%c%c",48+object->rumble[0],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; FILE *fconfig;
unsigned char volume=255,mode128k=255,issue=255,ntsc=255, joystick1=255,joystick2=255,ay_emul=255,mdr_active=255, 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, 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); if (filename) strcpy(config_path,filename);
else return -2; else return -2;
@ -984,6 +986,10 @@ int load_config(struct computer *object, char *filename) {
tap_fast=(line[9]-'0'); tap_fast=(line[9]-'0');
continue; continue;
} }
if (!strncmp(line,"rewind_on_reset=",16)) {
rewind_on_reset=(line[16]-'0');
continue;
}
if (!strncmp(line,"joypad1=",8)) { if (!strncmp(line,"joypad1=",8)) {
joypad1=line[8]-'0'; joypad1=line[8]-'0';
continue; continue;
@ -1078,6 +1084,9 @@ int load_config(struct computer *object, char *filename) {
if (tap_fast<2) { if (tap_fast<2) {
object->tape_fast_load=tap_fast; object->tape_fast_load=tap_fast;
} }
if (rewind_on_reset<2) {
object->rewind_on_reset=rewind_on_reset;
}
if (joypad1<2) { if (joypad1<2) {
object->joypad_as_joystick[0]=joypad1; object->joypad_as_joystick[0]=joypad1;
} }

View File

@ -84,8 +84,10 @@ static const char *emulation_messages[] = {
/*05*/ "^|on|off", /*05*/ "^|on|off",
/*06*/ "Turbo mode", /*06*/ "Turbo mode",
/*07*/ "^|off|auto|fast|ultrafast", /*07*/ "^|off|auto|fast|ultrafast",
/*08*/ "Precision", /*08*/ "Rewind tape on reset",
/*09*/ "^|on|off", /*09*/ "^|on|off",
/*10*/ "Precision",
/*11*/ "^|on|off",
NULL 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]; unsigned int submenus[6],submenus_old[6];
int opt, i; int opt, i, retorno;
unsigned char old_mode, old_videosystem; unsigned char old_mode, old_videosystem;
retorno=-1; //exit to the previous menue
memset(submenus, 0, sizeof(submenus)); memset(submenus, 0, sizeof(submenus));
submenus[0] = get_machine_model(); submenus[0] = get_machine_model();
submenus[1] = jump_frames; submenus[1] = jump_frames;
submenus[2] = !ordenador.tape_fast_load; submenus[2] = !ordenador.tape_fast_load;
submenus[3] = ordenador.turbo; 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_mode=ordenador.mode128k;
old_videosystem = ordenador.videosystem; old_videosystem = ordenador.videosystem;
opt = menu_select_title("Emulation settings menu", opt = menu_select_title("Emulation settings menu",
emulation_messages, submenus); emulation_messages, submenus);
if (opt < 0) if (opt < 0)
return; return retorno;
if (submenus[0]!=submenus_old[0]) set_machine_model(submenus[0]); 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]; jump_frames = submenus[1];
ordenador.tape_fast_load = !submenus[2]; ordenador.tape_fast_load = !submenus[2];
ordenador.turbo = submenus[3]; ordenador.turbo = submenus[3];
ordenador.rewind_on_reset = !submenus[4];
curr_frames=0; curr_frames=0;
if (submenus[3] != submenus_old[3]) 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; ordenador.precision_old=ordenador.precision;
if (ordenador.turbo_state!=4) //Tape is not loading with turbo mode if (ordenador.turbo_state!=4) //Tape is not loading with turbo mode
if (ordenador.precision) if (ordenador.precision)
@ -577,6 +583,8 @@ static void emulation_settings(void)
} }
} }
return retorno;
} }
unsigned int get_value_filter (unsigned int value) unsigned int get_value_filter (unsigned int value)
@ -1829,7 +1837,7 @@ void main_menu()
input_options(submenus[2]); input_options(submenus[2]);
break; break;
case 7: case 7:
emulation_settings(); if (emulation_settings()==-2) retorno=-1;
break; break;
case 8: case 8:
screen_settings(); screen_settings();