mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-28 11:04:15 +01:00
Editorial changes in parse_poke
This commit is contained in:
parent
4426bfde5f
commit
d8367e488f
@ -1137,45 +1137,45 @@ void do_poke_sdl() {
|
||||
|
||||
int parse_poke (const char *filename)
|
||||
{
|
||||
static unsigned char old_poke[MAX_TRAINER][MAX_POKE]; //Max 19 Pokes per trainer and max 50 trainer
|
||||
FILE* fpoke;
|
||||
unsigned char title[128], flag, newfile, restore, old_mport1;
|
||||
int bank, address, value, original_value, ritorno,y,k, trainer, poke;
|
||||
SDL_Rect src, banner;
|
||||
static unsigned char old_poke[MAX_TRAINER][MAX_POKE]; //Max 19 Pokes per trainer and max 50 trainer
|
||||
FILE* fpoke;
|
||||
unsigned char title[128], flag, newfile, restore, old_mport1;
|
||||
int bank, address, value, original_value, ritorno,y,k, trainer, poke;
|
||||
SDL_Rect src, banner;
|
||||
|
||||
src.x=0;
|
||||
src.y=30/RATIO;
|
||||
src.w=FULL_DISPLAY_X;
|
||||
src.h=FULL_DISPLAY_Y-60/RATIO;
|
||||
src.x=0;
|
||||
src.y=30/RATIO;
|
||||
src.w=FULL_DISPLAY_X;
|
||||
src.h=FULL_DISPLAY_Y-60/RATIO;
|
||||
|
||||
banner.x=0;
|
||||
banner.y=30/RATIO;
|
||||
banner.w=FULL_DISPLAY_X;
|
||||
banner.h=20/RATIO;
|
||||
banner.x=0;
|
||||
banner.y=30/RATIO;
|
||||
banner.w=FULL_DISPLAY_X;
|
||||
banner.h=20/RATIO;
|
||||
|
||||
y=60/RATIO;
|
||||
y=60/RATIO;
|
||||
|
||||
if (strcmp(ordenador.last_selected_poke_file,filename)) newfile=1; else newfile=0;
|
||||
if (strcmp(ordenador.last_selected_poke_file,filename)) newfile=1; else newfile=0;
|
||||
|
||||
trainer=0;
|
||||
trainer=0;
|
||||
|
||||
fpoke = fopen(filename,"r");
|
||||
fpoke = fopen(filename,"r");
|
||||
|
||||
if (fpoke==NULL)
|
||||
{
|
||||
if (fpoke==NULL)
|
||||
{
|
||||
msgInfo("Can not access the file",3000,NULL);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
clean_screen();
|
||||
clean_screen();
|
||||
|
||||
SDL_FillRect(screen, &src, SDL_MapRGB(screen->format, 0xff, 0xff, 0xff));
|
||||
SDL_FillRect(screen, &src, SDL_MapRGB(screen->format, 0xff, 0xff, 0xff));
|
||||
|
||||
print_font(screen, 0x0, 0x0, 0x0,0, 30/RATIO, "Press 1 to deselect, 2 to select", 16);
|
||||
print_font(screen, 0x0, 0x0, 0x0,0, 30/RATIO, "Press 1 to deselect, 2 to select", 16);
|
||||
|
||||
ritorno=0;
|
||||
do
|
||||
{
|
||||
ritorno=0;
|
||||
do
|
||||
{
|
||||
if (trainer==MAX_TRAINER) {ritorno=2;break;}
|
||||
|
||||
poke=1;
|
||||
@ -1225,7 +1225,7 @@ do
|
||||
fscanf(fpoke, "%1s %d %d %d %d", &flag, &bank, &address, &value, &original_value);
|
||||
if (((flag!='M')&&(flag!='Z'))||(bank>8)||(bank<0)||(address>0xFFFF)||(address<0x4000)||(value>256)||(value<0)||(original_value>255)||(original_value<0)) {ritorno=1;break;}
|
||||
if (feof(fpoke)) {ritorno=1;break;}
|
||||
if ((!(bank&0x8))&&((ordenador.mode128k==1)||(ordenador.mode128k==2)||(ordenador.mode128k==4))) //+3?
|
||||
if ((!(bank&0x8))&&(ordenador.mode128k)) //128k,+2,+3,SP
|
||||
{
|
||||
old_mport1 = ordenador.mport1;
|
||||
ordenador.mport1 = (unsigned char) (bank&0x7);
|
||||
@ -1237,7 +1237,7 @@ do
|
||||
{if (original_value) old_poke[trainer][poke]=(unsigned char) original_value; else old_poke[trainer][poke]= Z80free_Rd_fake ((word) address);}
|
||||
if (restore) value = (int) old_poke[trainer][poke];
|
||||
}
|
||||
|
||||
//if ((value == 256) && (k & KEY_SELECT)) {value = choice_value(); Z80free_Wr_fake ((word)address, (unsigned char) value);} TODO
|
||||
if (((value < 256) && (k & KEY_SELECT))||(restore)) Z80free_Wr_fake ((word)address, (unsigned char) value);
|
||||
ordenador.mport1 = old_mport1;
|
||||
set_memory_pointers (); // set the pointers
|
||||
@ -1250,10 +1250,10 @@ do
|
||||
{if (original_value) old_poke[trainer][poke]=(unsigned char) original_value; else old_poke[trainer][poke]= Z80free_Rd_fake ((word) address);}
|
||||
if (restore) value = (int) old_poke[trainer][poke];
|
||||
}
|
||||
//if ((value == 256) && (k & KEY_SELECT)) {value = choice_value(); Z80free_Wr_fake ((word)address, (unsigned char) value);} TODO
|
||||
if (((value < 256) && (k & KEY_SELECT))||(restore)) Z80free_Wr_fake ((word)address, (unsigned char) value);
|
||||
}
|
||||
poke++;
|
||||
|
||||
}
|
||||
while (flag!='Z');
|
||||
|
||||
@ -1261,17 +1261,17 @@ do
|
||||
|
||||
if (!fgets(title,128,fpoke)) {ritorno=1;break;} //line feed reading
|
||||
|
||||
}
|
||||
while (ritorno==0);
|
||||
}
|
||||
while (ritorno==0);
|
||||
|
||||
k=0;
|
||||
k=0;
|
||||
|
||||
while (!(k & KEY_ESCAPE)&&(ritorno==0))
|
||||
{k = menu_wait_key_press();}
|
||||
while (!(k & KEY_ESCAPE)&&(ritorno==0))
|
||||
{k = menu_wait_key_press();}
|
||||
|
||||
fclose(fpoke);
|
||||
if (ritorno==0) strcpy(ordenador.last_selected_poke_file,filename);
|
||||
return (ritorno);
|
||||
fclose(fpoke);
|
||||
if (ritorno==0) strcpy(ordenador.last_selected_poke_file,filename);
|
||||
return (ritorno);
|
||||
}
|
||||
|
||||
void load_poke_file()
|
||||
|
Loading…
Reference in New Issue
Block a user