mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-28 11:04:15 +01:00
Added RZX browser screen preview
This commit is contained in:
parent
adfc358ec1
commit
8e988a0240
@ -517,6 +517,11 @@ void print_font(SDL_Surface *screen, int r, int g, int b,
|
|||||||
SDL_FreeSurface(font_surf);
|
SDL_FreeSurface(font_surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int extract_screen_rzx (char *screen, FILE * fichero)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int extract_screen(char* screen, const char* name)
|
int extract_screen(char* screen, const char* name)
|
||||||
{
|
{
|
||||||
FILE *fichero;
|
FILE *fichero;
|
||||||
@ -573,6 +578,21 @@ int extract_screen(char* screen, const char* name)
|
|||||||
return retorno;
|
return retorno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((ext_matches(name, ".rzx")||ext_matches(name, ".RZX")))
|
||||||
|
{
|
||||||
|
sprintf(filename,"%s/%s",load_path_rzx, name);
|
||||||
|
fichero=fopen(filename,"rb");
|
||||||
|
if (!fichero) //Try in the tmp zip directory
|
||||||
|
{
|
||||||
|
sprintf(filename,"%s/%s",path_tmp, name);
|
||||||
|
fichero=fopen(filename,"rb");
|
||||||
|
if (!fichero) return -1;
|
||||||
|
}
|
||||||
|
retorno = extract_screen_rzx(screen, fichero);
|
||||||
|
fclose(fichero);
|
||||||
|
return retorno;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,12 +607,40 @@ void draw_scr_file(int x,int y, const char *selected_file, int which)
|
|||||||
char name[MAX_PATH_LENGTH];
|
char name[MAX_PATH_LENGTH];
|
||||||
char filename[MAX_PATH_LENGTH];
|
char filename[MAX_PATH_LENGTH];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
char block_n[5];
|
||||||
|
char ext[4];
|
||||||
|
unsigned int rzx_position, block_n_int;
|
||||||
|
|
||||||
if (selected_file==NULL) // Aborted
|
if (selected_file==NULL) // Aborted
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strcpy(name,selected_file);
|
strcpy(name,selected_file);
|
||||||
|
|
||||||
|
if (strstr(name, "Frames:")&&(which==0)) //RZX Browser item
|
||||||
|
{
|
||||||
|
if (name[0]==']') strncpy(block_n, name+1,4);
|
||||||
|
else strncpy(block_n, name,4);
|
||||||
|
|
||||||
|
block_n[4]=0;
|
||||||
|
|
||||||
|
block_n_int=atoi(block_n);
|
||||||
|
|
||||||
|
if (block_n_int >(MAX_RZX_BROWSER_ITEM-1)) return;
|
||||||
|
|
||||||
|
rzx_position=rzx_browser_list[block_n_int].position;
|
||||||
|
|
||||||
|
if (extract_snapshot(rzx_position, load_path_snaps, ext)) return; //error
|
||||||
|
|
||||||
|
strcpy(name, "rzxtemp.");
|
||||||
|
strcat(name, ext);
|
||||||
|
|
||||||
|
if (extract_screen(screen, name)) return; //error
|
||||||
|
|
||||||
|
sprintf(filename, "%s/%s", load_path_snaps, name);
|
||||||
|
unlink(filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((ext_matches(name, ".zip")||ext_matches(name, ".ZIP")))
|
if ((ext_matches(name, ".zip")||ext_matches(name, ".ZIP")))
|
||||||
{
|
{
|
||||||
//remove the zip extension
|
//remove the zip extension
|
||||||
@ -634,7 +682,7 @@ void draw_scr_file(int x,int y, const char *selected_file, int which)
|
|||||||
fclose(fichero);
|
fclose(fichero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p_translt = ordenador.translate;
|
p_translt = ordenador.translate;
|
||||||
p_translt2 = ordenador.translate2;
|
p_translt2 = ordenador.translate2;
|
||||||
|
@ -281,15 +281,16 @@ void set_rzxfile_position(unsigned int rzx_position)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int extract_snapshot(int position)
|
int extract_snapshot(unsigned int position, char *path, char *ext)
|
||||||
{
|
{
|
||||||
int done=0;
|
int done=0, ret=0;
|
||||||
long old_position, fpos;
|
int old_position, fpos;
|
||||||
FILE *snapfile;
|
FILE *snapfile;
|
||||||
|
|
||||||
old_position=ftell(rzxfile);
|
old_position=ftell(rzxfile);
|
||||||
|
|
||||||
fseek(rzxfile,position,SEEK_SET);
|
fseek(rzxfile,position,SEEK_SET);
|
||||||
|
fread(block.buff,5,1,rzxfile);
|
||||||
fread(block.buff,12,1,rzxfile);
|
fread(block.buff,12,1,rzxfile);
|
||||||
strcpy(rzx_snap.filename,"");
|
strcpy(rzx_snap.filename,"");
|
||||||
rzx_snap.options=0x00;
|
rzx_snap.options=0x00;
|
||||||
@ -301,8 +302,10 @@ old_position=ftell(rzxfile);
|
|||||||
fpos=ftell(rzxfile);
|
fpos=ftell(rzxfile);
|
||||||
rzx_popen(fpos,"rb");
|
rzx_popen(fpos,"rb");
|
||||||
#endif
|
#endif
|
||||||
strcpy(rzx_snap.filename,"rzxtemp.");
|
strcpy(rzx_snap.filename, path);
|
||||||
|
strcat(rzx_snap.filename,"/rzxtemp.");
|
||||||
strcat(rzx_snap.filename,&block.buff[4]);
|
strcat(rzx_snap.filename,&block.buff[4]);
|
||||||
|
strcpy(ext, &block.buff[4]);
|
||||||
#ifndef RZX_BIG_ENDIAN
|
#ifndef RZX_BIG_ENDIAN
|
||||||
rzx_snap.length=*((rzx_u32*)&block.buff[8]);
|
rzx_snap.length=*((rzx_u32*)&block.buff[8]);
|
||||||
#else
|
#else
|
||||||
@ -311,7 +314,7 @@ old_position=ftell(rzxfile);
|
|||||||
/* extract to tempfile */
|
/* extract to tempfile */
|
||||||
snapfile=fopen(rzx_snap.filename,"wb");
|
snapfile=fopen(rzx_snap.filename,"wb");
|
||||||
/* if you can't, skip to next block */
|
/* if you can't, skip to next block */
|
||||||
if(snapfile==NULL) return -1;
|
if(snapfile==NULL) {fseek(rzxfile,old_position,SEEK_SET); return -1;}
|
||||||
/* ok */
|
/* ok */
|
||||||
//rzx_snap.options|=RZX_REMOVE;
|
//rzx_snap.options|=RZX_REMOVE;
|
||||||
fpos=rzx_snap.length;
|
fpos=rzx_snap.length;
|
||||||
@ -333,9 +336,10 @@ old_position=ftell(rzxfile);
|
|||||||
fclose(snapfile);
|
fclose(snapfile);
|
||||||
done=0;
|
done=0;
|
||||||
}
|
}
|
||||||
|
else ret=-1;
|
||||||
|
|
||||||
fseek(rzxfile,old_position,SEEK_SET);
|
fseek(rzxfile,old_position,SEEK_SET);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rzx_close_irb()
|
void rzx_close_irb()
|
||||||
|
@ -139,6 +139,7 @@ int rzx_add_snapshot(const char *filename, const rzx_u32 flags);
|
|||||||
int rzx_add_comment(const char *text, const rzx_u32 flags);
|
int rzx_add_comment(const char *text, const rzx_u32 flags);
|
||||||
|
|
||||||
void set_rzxfile_position(unsigned int rzx_position);
|
void set_rzxfile_position(unsigned int rzx_position);
|
||||||
|
int extract_snapshot(unsigned int position, char *path, char *ext);
|
||||||
|
|
||||||
#ifdef RZX_DEBUG
|
#ifdef RZX_DEBUG
|
||||||
extern rzx_u16 INcount;
|
extern rzx_u16 INcount;
|
||||||
|
Loading…
Reference in New Issue
Block a user