mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-01 06:45:05 +01:00
Improved RZX compatibility with the other emulator, fixed bug in rzx edit (file truncate)
This commit is contained in:
parent
0022e8f106
commit
f496d9f1b7
@ -1835,8 +1835,7 @@ int main(int argc,char *argv[])
|
||||
if ((ordenador.precision==0)||(jump_frames>0)) ordenador.interr=0;
|
||||
if (ordenador.recording_rzx)
|
||||
{
|
||||
if (ordenador.icount == 0xFFFF) ordenador.icount=0;
|
||||
else if (test_IFF1(&procesador)||(ordenador.icount>10)) {rzx_update(&ordenador.icount);ordenador.icount=0;}
|
||||
if (test_IFF1(&procesador)||(ordenador.icount>10)) {rzx_update(&ordenador.icount);ordenador.icount=0;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2019,9 +2019,7 @@ static int do_rzx(int which)
|
||||
ordenador.frames_count_rzx=1;
|
||||
retorno2 = load_rzx(0);
|
||||
if (retorno2) break; //Error or no file
|
||||
retorno2 = rzx_update(&ordenador.maxicount); //The first frame does not generate interrupt
|
||||
if (retorno2 == RZX_FINISHED) {printf("RZX: Playing finished at fisrt frame\n"); break;}
|
||||
//ordenador.cicles_counter=32; //to avoid the interrupt at first frame
|
||||
ordenador.maxicount = 0; //Force rzx_update and interrupt
|
||||
ordenador.playing_rzx = 1;
|
||||
retorno = -2; //Come back to the menu
|
||||
break;
|
||||
@ -2035,7 +2033,7 @@ static int do_rzx(int which)
|
||||
case 3: //Add Bookmark
|
||||
if (!ordenador.recording_rzx) break;
|
||||
rzx_update(&ordenador.icount);
|
||||
ordenador.icount=0xFFFF; //to avoid a new rzx_update
|
||||
ordenador.icount=0;
|
||||
save_z80("temp.z80",1);
|
||||
if (rzx_add_snapshot("temp.z80", RZX_COMPRESSED)==RZX_OK) {printf("RZX: Added snapshot\n");msgInfo("Added Bookmark", 3000, NULL);}
|
||||
else {printf("RZX: Impossible to add snapshot\n"); break;}
|
||||
@ -2044,7 +2042,11 @@ static int do_rzx(int which)
|
||||
break;
|
||||
case 4: //browser
|
||||
if (!ordenador.playing_rzx&&!ordenador.recording_rzx) break;
|
||||
if (ordenador.recording_rzx) rzx_update(&ordenador.icount); //Discard the records
|
||||
ordenador.icount = 0;
|
||||
rzx_reset(); //Reset internal library variables
|
||||
rzx_browser();
|
||||
if (ordenador.playing_rzx) ordenador.maxicount = 0; //Force rzx_update and interrupt
|
||||
retorno = -2;
|
||||
break;
|
||||
case 5: //edit
|
||||
|
@ -719,6 +719,9 @@ int rzx_edit(const char *filename)
|
||||
|
||||
void rzx_close(void)
|
||||
{
|
||||
long fpos;
|
||||
int fd;
|
||||
|
||||
switch(rzx.mode)
|
||||
{
|
||||
case RZX_PLAYBACK:
|
||||
@ -728,7 +731,14 @@ void rzx_close(void)
|
||||
break;
|
||||
case RZX_RECORD:
|
||||
/* is there an IRB to close? */
|
||||
if(rzx_status&RZX_IRB) rzx_close_irb();
|
||||
if(rzx_status&RZX_IRB) rzx_close_irb();
|
||||
if (rzxfile!=NULL)
|
||||
{
|
||||
fflush(rzxfile);
|
||||
fpos=ftell(rzxfile);
|
||||
fd=fileno(rzxfile);
|
||||
ftruncate(fd, fpos);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -757,6 +767,12 @@ void rzx_close(void)
|
||||
}
|
||||
}
|
||||
|
||||
void rzx_reset()
|
||||
{
|
||||
INmax=0;
|
||||
INcount=0;
|
||||
INold=0xFFFF;
|
||||
}
|
||||
|
||||
int rzx_update(rzx_u16 *icount)
|
||||
{
|
||||
|
@ -143,6 +143,7 @@ int rzx_add_comment(const char *text, const rzx_u32 flags);
|
||||
void rzx_set_file_position(unsigned int rzx_position);
|
||||
int rzx_extract_snapshot(unsigned int position, char *path, char *ext, int restore_position);
|
||||
int rzx_edit(const char *filename);
|
||||
void rzx_reset(void);
|
||||
|
||||
#ifdef RZX_DEBUG
|
||||
extern rzx_u16 INcount;
|
||||
|
Loading…
Reference in New Issue
Block a user