From 1d83a75fe5729e44c07e3d5b7383fb523c81659a Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Sun, 27 Jan 2013 20:22:13 +0000 Subject: [PATCH] Fixed bug when entering file selection during file loading, inverted audio channels --- src/gui_sdl.c | 11 +++-------- src/menus.c | 14 ++++++-------- src/spk_ay.c | 2 +- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/gui_sdl.c b/src/gui_sdl.c index ff8cdcf..a739688 100644 --- a/src/gui_sdl.c +++ b/src/gui_sdl.c @@ -227,13 +227,6 @@ static void insert_tape() { unsigned char char_id[11]; int retorno, retval; - - // Maybe should go after the first control?? - if(ordenador.tap_file!=NULL) - rewind_tape(ordenador.tap_file,1); - - ordenador.tape_current_bit=0; - ordenador.tape_current_mode=TAP_TRASH; const char *filename = menu_select_file(load_path_taps, ordenador.current_tap, 1); @@ -250,6 +243,8 @@ static void insert_tape() if (!(ext_matches(filename, ".tap")|ext_matches(filename, ".TAP")|ext_matches(filename, ".tzx")| ext_matches(filename, ".TZX"))) {free((void *)filename); return;} + ordenador.tape_current_bit=0; + ordenador.tape_current_mode=TAP_TRASH; if(ordenador.tap_file!=NULL) { fclose(ordenador.tap_file); @@ -426,7 +421,7 @@ static int manage_tape(int which) ordenador.tape_current_mode=TAP_TRASH; rewind_tape(ordenador.tap_file,1); } - msgInfo("Tape rewinded",3000,NULL); + msgInfo("Tape rewound",3000,NULL); retorno=-1; break; case 5: //Create diff --git a/src/menus.c b/src/menus.c index 656d6fc..a97a8c6 100644 --- a/src/menus.c +++ b/src/menus.c @@ -632,7 +632,7 @@ void taps_menu() { fin=0; break; case SDLK_1: - ordenador.pause=1; + //ordenador.pause=1; select_tapfile(); break; case SDLK_2: @@ -642,7 +642,7 @@ void taps_menu() { ordenador.tape_current_mode=TAP_TRASH; rewind_tape(ordenador.tap_file,1); } - sprintf(ordenador.osd_text,"Tape rewinded"); + sprintf(ordenador.osd_text,"Tape rewound"); ordenador.osd_time=50; break; case SDLK_3: @@ -681,12 +681,6 @@ void select_tapfile() { clean_screen(); - if(ordenador.tap_file!=NULL) - rewind_tape(ordenador.tap_file,1); - - ordenador.tape_current_bit=0; - ordenador.tape_current_mode=TAP_TRASH; - print_string(videomem,"Choose the TAPE file to load",-1,32,13,0,ancho); filename=select_file(load_path_taps,FILETYPE_TAP_TZX); @@ -696,6 +690,9 @@ void select_tapfile() { return; } + ordenador.tape_current_bit=0; + ordenador.tape_current_mode=TAP_TRASH; + if(ordenador.tap_file!=NULL) { fclose(ordenador.tap_file); } @@ -703,6 +700,7 @@ void select_tapfile() { if (!strncmp(filename,"smb:",4)) ordenador.tap_file=fopen(filename,"r"); //tinysmb does not work with r+ else ordenador.tap_file=fopen(filename,"r+"); // read and write ordenador.tape_write = 0; // by default, can't record + if(ordenador.tap_file==NULL) retorno=-1; else diff --git a/src/spk_ay.c b/src/spk_ay.c index 88106db..5eab8fc 100644 --- a/src/spk_ay.c +++ b/src/spk_ay.c @@ -372,7 +372,7 @@ inline void play_sound (unsigned int tstados) { lvalue = beeper*ordenador.volume; } - *ordenador.current_buffer = (lvalue<<16)|(rvalue); + *ordenador.current_buffer = (rvalue<<16)|(lvalue); ordenador.current_buffer++; ordenador.sound_cuantity++;