다마고치 선택 그림과 실제 외형 및 이름을 일치시킴
This commit is contained in:
1 parent
6ff604302e
commit
fda254aa35
20 files changed
+193
-114
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+18
-27
@@ -1442,32 +1442,22 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
|
||||
}
|
||||
/* the pet's own file (pages of the save with the character in the header): character there too */
|
||||
static u32 ko_names(void);
|
||||
static u32 tama_files(u32 old, u32 nw){
|
||||
u32 n=0;
|
||||
for(u32 a=g_cfg.user_start; a+PAGE<=g_cfg.user_end && a<SET_A; a+=PAGE){
|
||||
#ifdef FELD_TAMA_ANY
|
||||
/* 1.7.2 test25 (GitHub: after Breed the change was confirmed but the Tama stayed): the file of a bred Tama was
|
||||
* not found. Now: a small number at +8 (not only 1) and the character at +0x0C or +0x0E */
|
||||
{ u32 g=rd32(a+8u); if(g==0u || g>255u || (rd16(a+14u)!=old && rd16(a+12u)!=old)) continue; }
|
||||
#else
|
||||
if(rd32(a+8u)!=1u || rd16(a+14u)!=old) continue;
|
||||
#endif
|
||||
flash_read(a, g_page, PAGE);
|
||||
u32 before=0;for(u32 z=8;z<0x180;z+=4)before+=*(u32*)(g_page+z);
|
||||
#ifdef FELD_TAMA_ANY
|
||||
if((g_page[14]|(g_page[15]<<8))==old)
|
||||
#endif
|
||||
{ g_page[14]=(u8)nw; g_page[15]=(u8)(nw>>8); }
|
||||
if((g_page[12]|(g_page[13]<<8))==old){ g_page[12]=(u8)nw; g_page[13]=(u8)(nw>>8); }
|
||||
if((g_page[0x10A]|(g_page[0x10B]<<8))==old){ g_page[0x10A]=(u8)nw; g_page[0x10B]=(u8)(nw>>8); }
|
||||
if(rd32(a)+rd32(a+4u)==0u){
|
||||
int k=cat_find(nw);u32 names=ko_names();if(k>=0&&names){for(u32 j=0;j<26;j++)g_page[96u+j]=fl(names+26u*(u32)k+j)[0];g_page[0xfcu]=fl(g_cfg.cat_off+8u+28u*(u32)k+6u)[0];g_page[0xfdu]=0;}
|
||||
u32 sum=rd32(a)-before;for(u32 z=8;z<0x180;z+=4)sum+=*(u32*)(g_page+z);*(u32*)g_page=sum;*(u32*)(g_page+4u)=0u-sum;
|
||||
}
|
||||
flash_prog4k(a, g_page); n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
|
||||
static u32 tama_files(u32 old,u32 nw){
|
||||
int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0;
|
||||
u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0;
|
||||
u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu);
|
||||
if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0;
|
||||
for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){
|
||||
if(rd32(a+8u)!=1u||rd16(a+12u)!=4017u||rd32(a)+rd32(a+4u)!=0u)continue;
|
||||
u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue;
|
||||
// The first native genes slot is the current pet. Never alter later friend slots.
|
||||
if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0;
|
||||
for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;flash_prog4k(a+off,g_page);}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31545045u?a+8u:0;}
|
||||
static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
|
||||
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}}
|
||||
@@ -1500,10 +1490,11 @@ static void chr_pick(void){
|
||||
#ifdef FELD_TAMA_ANY
|
||||
/* without the Tama's file the game keeps showing the old Tama: say so instead of "changed" (files first, the
|
||||
* settings block in RAM stays untouched then) */
|
||||
if(old && old!=nw && !tama_files(old, nw)){ message("TAMA NICHT GEFUNDEN","NICHTS GE\304NDERT",""); return; }
|
||||
if(!tama_files(old, nw)){ message("TAMA NICHT GEFUNDEN","NICHTS GE\304NDERT",""); return; }
|
||||
#endif
|
||||
g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8);
|
||||
g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));
|
||||
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|31u);
|
||||
#ifdef FELD_TAMA_ANY
|
||||
#else
|
||||
if(old && old!=nw) tama_files(old, nw);
|
||||
|
||||
+18
-27
@@ -1441,32 +1441,22 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
|
||||
}
|
||||
/* the pet's own file (pages of the save with the character in the header): character there too */
|
||||
static u32 ko_names(void);
|
||||
static u32 tama_files(u32 old, u32 nw){
|
||||
u32 n=0;
|
||||
for(u32 a=g_cfg.user_start; a+PAGE<=g_cfg.user_end && a<SET_A; a+=PAGE){
|
||||
#ifdef FELD_TAMA_ANY
|
||||
/* 1.7.2 test25 (GitHub: after Breed the change was confirmed but the Tama stayed): the file of a bred Tama was
|
||||
* not found. Now: a small number at +8 (not only 1) and the character at +0x0C or +0x0E */
|
||||
{ u32 g=rd32(a+8u); if(g==0u || g>255u || (rd16(a+14u)!=old && rd16(a+12u)!=old)) continue; }
|
||||
#else
|
||||
if(rd32(a+8u)!=1u || rd16(a+14u)!=old) continue;
|
||||
#endif
|
||||
flash_read(a, g_page, PAGE);
|
||||
u32 before=0;for(u32 z=8;z<0x180;z+=4)before+=*(u32*)(g_page+z);
|
||||
#ifdef FELD_TAMA_ANY
|
||||
if((g_page[14]|(g_page[15]<<8))==old)
|
||||
#endif
|
||||
{ g_page[14]=(u8)nw; g_page[15]=(u8)(nw>>8); }
|
||||
if((g_page[12]|(g_page[13]<<8))==old){ g_page[12]=(u8)nw; g_page[13]=(u8)(nw>>8); }
|
||||
if((g_page[0x10A]|(g_page[0x10B]<<8))==old){ g_page[0x10A]=(u8)nw; g_page[0x10B]=(u8)(nw>>8); }
|
||||
if(rd32(a)+rd32(a+4u)==0u){
|
||||
int k=cat_find(nw);u32 names=ko_names();if(k>=0&&names){for(u32 j=0;j<26;j++)g_page[226u+j]=fl(names+26u*(u32)k+j)[0];g_page[0xfcu]=fl(g_cfg.cat_off+8u+28u*(u32)k+6u)[0];g_page[0xfdu]=0;}
|
||||
u32 sum=rd32(a)-before;for(u32 z=8;z<0x180;z+=4)sum+=*(u32*)(g_page+z);*(u32*)g_page=sum;*(u32*)(g_page+4u)=0u-sum;
|
||||
}
|
||||
flash_prog4k(a, g_page); n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
|
||||
static u32 tama_files(u32 old,u32 nw){
|
||||
int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0;
|
||||
u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0;
|
||||
u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu);
|
||||
if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0;
|
||||
for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){
|
||||
if(rd32(a+8u)!=1u||rd16(a+12u)!=4017u||rd32(a)+rd32(a+4u)!=0u)continue;
|
||||
u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue;
|
||||
// The first native genes slot is the current pet. Never alter later friend slots.
|
||||
if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0;
|
||||
for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;flash_prog4k(a+off,g_page);}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31545045u?a+8u:0;}
|
||||
static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
|
||||
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}}
|
||||
@@ -1499,10 +1489,11 @@ static void chr_pick(void){
|
||||
#ifdef FELD_TAMA_ANY
|
||||
/* without the Tama's file the game keeps showing the old Tama: say so instead of "changed" (files first, the
|
||||
* settings block in RAM stays untouched then) */
|
||||
if(old && old!=nw && !tama_files(old, nw)){ message("TAMA NOT FOUND","NOTHING CHANGED",""); return; }
|
||||
if(!tama_files(old, nw)){ message("TAMA NOT FOUND","NOTHING CHANGED",""); return; }
|
||||
#endif
|
||||
g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8);
|
||||
g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));
|
||||
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|31u);
|
||||
#ifdef FELD_TAMA_ANY
|
||||
#else
|
||||
if(old && old!=nw) tama_files(old, nw);
|
||||
|
||||
+18
-27
@@ -1467,32 +1467,22 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
|
||||
}
|
||||
/* the pet's own file (pages of the save with the character in the header): character there too */
|
||||
static u32 ko_names(void);
|
||||
static u32 tama_files(u32 old, u32 nw){
|
||||
u32 n=0;
|
||||
for(u32 a=g_cfg.user_start; a+PAGE<=g_cfg.user_end && a<SET_A; a+=PAGE){
|
||||
#ifdef FELD_TAMA_ANY
|
||||
/* 1.7.2 test25 (GitHub: after Breed the change was confirmed but the Tama stayed): the file of a bred Tama was
|
||||
* not found. Now: a small number at +8 (not only 1) and the character at +0x0C or +0x0E */
|
||||
{ u32 g=rd32(a+8u); if(g==0u || g>255u || (rd16(a+14u)!=old && rd16(a+12u)!=old)) continue; }
|
||||
#else
|
||||
if(rd32(a+8u)!=1u || rd16(a+14u)!=old) continue;
|
||||
#endif
|
||||
flash_read(a, g_page, PAGE);
|
||||
u32 before=0;for(u32 z=8;z<0x180;z+=4)before+=*(u32*)(g_page+z);
|
||||
#ifdef FELD_TAMA_ANY
|
||||
if((g_page[14]|(g_page[15]<<8))==old)
|
||||
#endif
|
||||
{ g_page[14]=(u8)nw; g_page[15]=(u8)(nw>>8); }
|
||||
if((g_page[12]|(g_page[13]<<8))==old){ g_page[12]=(u8)nw; g_page[13]=(u8)(nw>>8); }
|
||||
if((g_page[0x10A]|(g_page[0x10B]<<8))==old){ g_page[0x10A]=(u8)nw; g_page[0x10B]=(u8)(nw>>8); }
|
||||
if(rd32(a)+rd32(a+4u)==0u){
|
||||
int k=cat_find(nw);u32 names=ko_names();if(k>=0&&names){for(u32 j=0;j<26;j++)g_page[226u+j]=fl(names+26u*(u32)k+j)[0];g_page[0xfcu]=fl(g_cfg.cat_off+8u+28u*(u32)k+6u)[0];g_page[0xfdu]=0;}
|
||||
u32 sum=rd32(a)-before;for(u32 z=8;z<0x180;z+=4)sum+=*(u32*)(g_page+z);*(u32*)g_page=sum;*(u32*)(g_page+4u)=0u-sum;
|
||||
}
|
||||
flash_prog4k(a, g_page); n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
|
||||
static u32 tama_files(u32 old,u32 nw){
|
||||
int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0;
|
||||
u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0;
|
||||
u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu);
|
||||
if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0;
|
||||
for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){
|
||||
if(rd32(a+8u)!=1u||rd16(a+12u)!=4017u||rd32(a)+rd32(a+4u)!=0u)continue;
|
||||
u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue;
|
||||
// The first native genes slot is the current pet. Never alter later friend slots.
|
||||
if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0;
|
||||
for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;flash_prog4k(a+off,g_page);}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31464f4bu?a+8u+13u*rd32(a+4u):0;}
|
||||
static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
|
||||
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}}
|
||||
@@ -1525,10 +1515,11 @@ static void chr_pick(void){
|
||||
#ifdef FELD_TAMA_ANY
|
||||
/* without the Tama's file the game keeps showing the old Tama: say so instead of "changed" (files first, the
|
||||
* settings block in RAM stays untouched then) */
|
||||
if(old && old!=nw && !tama_files(old, nw)){ message("\200\235\200\270\200\214\201\222 \200\342\200\363","\200\300\200\212\201\245\201\211 \200\335\200\337\200\330\200\234\200\235",""); return; }
|
||||
if(!tama_files(old, nw)){ message("\200\235\200\270\200\214\201\222 \200\342\200\363","\200\300\200\212\201\245\201\211 \200\335\200\337\200\330\200\234\200\235",""); return; }
|
||||
#endif
|
||||
g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8);
|
||||
g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));
|
||||
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|31u);
|
||||
#ifdef FELD_TAMA_ANY
|
||||
#else
|
||||
if(old && old!=nw) tama_files(old, nw);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/* Exercise the actual A+C flash writer against every catalog character. */
|
||||
static void verify_character_genes(void){
|
||||
u8 *before=malloc(0x1000000);memcpy(before,host_flash,0x1000000);
|
||||
u32 old=t_id(),slot=0,names=ko_names(),tab=names+30u*g_cfg.cat_n,count=0;
|
||||
for(u32 a=g_cfg.user_start;a+0x4000<=g_cfg.user_end&&a+0x4000<=SET_A;a+=PAGE)
|
||||
if(rd32(a+8)==1&&rd16(a+12)==4017&&rd32(a)+rd32(a+4)==0&&rd32(a+0x118)==0x1d34){slot=a;break;}
|
||||
assert(slot);assert(ghost_rd32(tab)==0x314b5047u);
|
||||
for(u32 k=0;k<g_cfg.cat_n;k++){
|
||||
u32 rel=ghost_rd32(tab+8+4*k);if(!rel)continue;
|
||||
u32 src=g_cfg.cat_off+rel,id=rd16(g_cfg.cat_off+8+28*k),len=ghost_rd32(src+0x10c);
|
||||
memcpy(host_flash,before,0x1000000);assert(tama_files(old,id)==1);
|
||||
assert(!memcmp(host_flash+slot,host_flash+src,len));
|
||||
for(u32 j=len;j<0x4000;j++)assert(host_flash[slot+j]==255);
|
||||
assert(!memcmp(host_flash,before,slot));assert(!memcmp(host_flash+slot+0x4000,before+slot+0x4000,0x1000000-slot-0x4000));
|
||||
assert(tama_files(id,id)==1);assert(!memcmp(host_flash+slot,host_flash+src,len));count++;
|
||||
}
|
||||
assert(count>=60);memcpy(host_flash,before,0x1000000);free(before);
|
||||
printf("PASS: %u native character packages, all nine names, palettes, eye sprites, composite frames, same-ID repair and unchanged friends\n",count);
|
||||
}
|
||||
@@ -17,12 +17,13 @@ static void fields(void){field_menu(0,0);}
|
||||
static void persist(void){set_write("OK");}
|
||||
static u32 quantity_result,quantity_owned;
|
||||
static void quantity(void){quantity_result=count_add(5001,quantity_owned);}
|
||||
#include "qa-character-genes.h"
|
||||
int main(int argc,char **argv){
|
||||
if(argc!=4)return 2;
|
||||
host_flash=malloc(0x1000000);FILE *f=fopen(argv[1],"rb");if(!f)return 3;
|
||||
if(fread(host_flash,1,0x1000000,f)!=0x1000000)return 4;fclose(f);
|
||||
u32 offset=(u32)strtoul(argv[2],0,0);memcpy((void*)&g_cfg,host_flash+offset+0x140,sizeof g_cfg);
|
||||
proof_root=argv[3];for(u32 i=0;i<PAGE;i++)g_ff[i]=255;assert(set_load()==0);g_cur=0;g_act=0;g_napp=0;
|
||||
proof_root=argv[3];for(u32 i=0;i<PAGE;i++)g_ff[i]=255;assert(set_load()==0);g_cur=0;g_act=0;g_napp=0;verify_character_genes();
|
||||
proof("main",main_menu,"nnnc");proof("character",chr_pick,"nbcc");
|
||||
proof("character-scroll",chr_pick,"nnnnnnnnnnnnnbcc");
|
||||
proof("item",cat_pick,"nnbnncc");proof("points",points_menu,"c");proof("fields",fields,"nc");
|
||||
@@ -49,7 +50,7 @@ int main(int argc,char **argv){
|
||||
// B applies the character currently pictured, not the originally opened row.
|
||||
chr_build(t_stage()>=3u&&t_stage()<=5u?t_stage():5u);u32 expected=rd16(g_cfg.cat_off+8u+28u*g_chr[1]);
|
||||
proof("character-confirm",chr_pick,"bnnb");expected=rd16(g_cfg.cat_off+8u+28u*g_chr[2]);assert(t_id()==expected);
|
||||
int checked=0;for(u32 a=g_cfg.user_start;a+PAGE<=g_cfg.user_end&&a<SET_A;a+=PAGE){if(rd16(a+0x10a)==expected && rd32(a)+rd32(a+4u)==0u){int ci=cat_find(expected);assert(ci>=0);assert(!memcmp(fl(a+96u),fl(ko_names()+26u*(u32)ci),26));assert(!memcmp(fl(a+226u),flash_snapshot+a+226u,26));checked++;}}assert(checked>0);
|
||||
int checked=0;for(u32 a=g_cfg.user_start;a+PAGE<=g_cfg.user_end&&a<SET_A;a+=PAGE){if(rd16(a+0x10a)==expected && rd32(a)+rd32(a+4u)==0u){int ci=cat_find(expected);assert(ci>=0);u32 tab=ko_names()+30u*g_cfg.cat_n,src=g_cfg.cat_off+ghost_rd32(tab+8u+4u*(u32)ci);assert(!memcmp(fl(a+96u),fl(ko_names()+26u*(u32)ci),26));assert(!memcmp(fl(a+18u),fl(src+18u),9u*26u));checked++;}}assert(checked>0);
|
||||
memcpy(host_flash,flash_snapshot,0x1000000);memcpy(g_set,snapshot,PAGE);free(flash_snapshot);
|
||||
proof("persist",persist,"b");memset(g_set,0,PAGE);assert(set_load()==0);assert(list_id(0)==item);assert(count_get(0)==7);
|
||||
printf("PASS: text lists, picture dial selection and bounds, unchanged flash on cancellation, B commits pictured character, quantity 1..15, additive batch inventory\n");free(host_flash);return 0;
|
||||
|
||||
@@ -17,12 +17,13 @@ static void fields(void){field_menu(0,0);}
|
||||
static void persist(void){set_write("OK");}
|
||||
static u32 quantity_result,quantity_owned;
|
||||
static void quantity(void){quantity_result=count_add(5001,quantity_owned);}
|
||||
#include "qa-character-genes.h"
|
||||
int main(int argc,char **argv){
|
||||
if(argc!=4)return 2;
|
||||
host_flash=malloc(0x1000000);FILE *f=fopen(argv[1],"rb");if(!f)return 3;
|
||||
if(fread(host_flash,1,0x1000000,f)!=0x1000000)return 4;fclose(f);
|
||||
u32 offset=(u32)strtoul(argv[2],0,0);memcpy((void*)&g_cfg,host_flash+offset+0x140,sizeof g_cfg);
|
||||
proof_root=argv[3];for(u32 i=0;i<PAGE;i++)g_ff[i]=255;assert(set_load()==0);g_cur=0;g_act=0;g_napp=0;
|
||||
proof_root=argv[3];for(u32 i=0;i<PAGE;i++)g_ff[i]=255;assert(set_load()==0);g_cur=0;g_act=0;g_napp=0;verify_character_genes();
|
||||
proof("main",main_menu,"nnnc");proof("character",chr_pick,"nbcc");
|
||||
proof("character-scroll",chr_pick,"nnnnnnnnnnnnnbcc");
|
||||
proof("item",cat_pick,"nnbnncc");proof("points",points_menu,"c");proof("fields",fields,"nc");
|
||||
|
||||
@@ -17,12 +17,13 @@ static void fields(void){field_menu(0,0);}
|
||||
static void persist(void){set_write("OK");}
|
||||
static u32 quantity_result,quantity_owned;
|
||||
static void quantity(void){quantity_result=count_add(5001,quantity_owned);}
|
||||
#include "qa-character-genes.h"
|
||||
int main(int argc,char **argv){
|
||||
if(argc!=4)return 2;
|
||||
host_flash=malloc(0x1000000);FILE *f=fopen(argv[1],"rb");if(!f)return 3;
|
||||
if(fread(host_flash,1,0x1000000,f)!=0x1000000)return 4;fclose(f);
|
||||
u32 offset=(u32)strtoul(argv[2],0,0);memcpy((void*)&g_cfg,host_flash+offset+0x140,sizeof g_cfg);
|
||||
proof_root=argv[3];for(u32 i=0;i<PAGE;i++)g_ff[i]=255;assert(set_load()==0);g_cur=0;g_act=0;g_napp=0;
|
||||
proof_root=argv[3];for(u32 i=0;i<PAGE;i++)g_ff[i]=255;assert(set_load()==0);g_cur=0;g_act=0;g_napp=0;verify_character_genes();
|
||||
proof("main",main_menu,"nnnc");proof("character",chr_pick,"nbcc");
|
||||
proof("character-scroll",chr_pick,"nnnnnnnnnnnnnbcc");
|
||||
proof("item",cat_pick,"nnbnncc");proof("points",points_menu,"c");proof("fields",fields,"nc");
|
||||
|
||||
Reference in new issue
Block a user