다마고치 변경할 때 본체 색상도 선택하도록 추가
Paramix Studio / build (push) Canceled after 0s
Paramix Studio / pages (push) Canceled after 0s

This commit is contained in:
syskiller committed 2026-11-11 21:34:16 +09:00
1 parent fda254aa35
commit 63fe0c8d41
35 files changed
+421 -188

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+19 -1
View File
@@ -1,4 +1,23 @@
{
"ORIGINAL": "ORIGINAL",
"RED": "ROT",
"PINK": "ROSA",
"PURPLE": "VIOLETT",
"BLUE": "BLAU",
"SKY BLUE": "HIMMELBLAU",
"MINT": "MINT",
"GREEN": "GRÜN",
"YELLOW": "GELB",
"ORANGE": "ORANGE",
"LIGHT PINK": "HELLROSA",
"LAVENDER": "LAVENDEL",
"LIGHT BLUE": "HELLBLAU",
"LIGHT GREEN": "HELLGRÜN",
"CREAM": "CREME",
"WHITE": "WEISS",
"GRAY": "GRAU",
"WHEEL COLOR A TAMA": "RAD FARBE A TAMA",
"WHEEL TAMA A COLOR": "RAD TAMA A FARBE",
"LAND": "LAND",
"WATER": "WASSER",
"SKY": "HIMMEL",
@@ -101,7 +120,6 @@
"NO CHARACTERS": "KEINE TAMAGOTCHIS",
"TAMA: ": "TAMA: ",
"A STAGE B OK C BACK": "A ALTER B OK C ZUR.",
"WHEEL: PREV/NEXT": "RAD: ZURÜCK/WEITER",
"B APPLY C LIST": "B WÄHLEN C LISTE",
"TAMA NOT FOUND": "TAMA NICHT GEFUNDEN",
"TAMA CHANGED": "TAMA GEÄNDERT",
+15 -1
View File
@@ -1,6 +1,6 @@
/* ITOSM Korean menu subset of Galmuri9, quiple, SIL OFL 1.1.
* See third-party/Galmuri-OFL.txt. Generated by scripts/build-menu-ko.cjs. */
#define KO_GLYPHS 179
#define KO_GLYPHS 193
static const unsigned char ko_font[KO_GLYPHS][13]={
{0,0,0,0,0,64,0,0,0,0,0,0,0}, /* · */
{249,2,64,144,36,17,132,66,19,4,1,0,0}, /* 가 */
@@ -27,6 +27,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{119,4,65,16,0,255,128,7,241,4,127,0,0}, /* 끔 */
{129,32,72,26,4,253,0,68,1,0,127,0,0}, /* 난 */
{129,32,72,26,4,253,0,7,241,4,127,0,0}, /* 남 */
{64,16,4,1,0,127,2,0,131,254,0,0,0}, /* 노 */
{64,16,4,1,252,0,63,226,32,136,34,0,0}, /* 뉴 */
{64,16,7,240,0,255,128,4,1,0,127,0,0}, /* 는 */
{64,31,192,3,254,0,31,193,241,128,127,0,0}, /* 늘 */
@@ -42,10 +43,13 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{249,32,72,18,4,249,8,66,19,244,1,0,0}, /* 되 */
{249,32,79,144,132,253,0,7,241,4,127,0,0}, /* 됨 */
{249,32,79,144,132,253,16,71,241,4,127,0,0}, /* 됩 */
{127,16,4,1,252,0,63,224,128,32,8,0,0}, /* 두 */
{249,32,72,19,228,1,63,66,16,132,33,0,0}, /* 뒤 */
{127,16,4,1,0,127,0,0,3,254,0,0,0}, /* 드 */
{127,16,7,240,0,255,128,7,240,4,1,0,0}, /* 득 */
{250,168,170,42,138,163,168,170,43,234,2,128,0}, /* 때 */
{249,2,64,147,228,129,160,72,19,228,1,0,0}, /* 라 */
{249,2,79,154,4,249,0,3,225,4,62,0,0}, /* 랑 */
{250,130,175,186,10,250,128,7,249,2,127,128,0}, /* 램 */
{249,2,111,146,6,249,0,3,225,4,62,0,0}, /* 량 */
{249,2,64,147,228,135,32,72,19,228,1,0,0}, /* 러 */
@@ -58,11 +62,13 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{127,7,198,1,252,255,128,7,241,4,127,0,0}, /* 름 */
{249,2,64,147,228,129,32,72,19,228,1,0,0}, /* 리 */
{249,2,79,146,4,249,0,7,240,4,1,0,0}, /* 릭 */
{249,2,79,146,4,249,0,7,241,4,127,0,0}, /* 림 */
{249,34,72,146,36,137,162,72,147,228,1,0,0}, /* 마 */
{250,162,168,170,58,138,162,168,171,234,2,128,0}, /* 메 */
{249,35,200,146,60,249,0,68,1,0,127,0,0}, /* 면 */
{127,16,71,240,32,255,128,7,240,4,1,0,0}, /* 목 */
{249,34,72,146,36,137,34,72,147,228,1,0,0}, /* 미 */
{249,34,72,146,36,249,0,68,1,0,127,0,0}, /* 민 */
{137,62,72,154,36,249,0,3,225,4,62,0,0}, /* 방 */
{138,162,168,171,234,139,162,168,171,234,2,128,0}, /* 배 */
{138,191,168,171,234,0,31,225,249,128,127,128,0}, /* 벨 */
@@ -75,10 +81,12 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{65,31,196,17,252,0,63,224,129,0,127,0,0}, /* 분 */
{65,31,196,19,254,8,31,193,241,128,127,0,0}, /* 불 */
{137,34,72,147,228,137,34,72,147,228,1,0,0}, /* 비 */
{169,62,106,147,228,0,31,193,241,128,127,0,0}, /* 빨 */
{33,8,66,16,132,81,148,72,146,36,1,0,0}, /* 사 */
{33,8,66,25,68,137,0,7,240,4,1,0,0}, /* 삭 */
{33,8,66,25,68,137,0,3,225,4,62,0,0}, /* 상 */
{34,136,162,40,138,83,148,168,170,42,2,128,0}, /* 새 */
{34,136,162,57,74,138,128,7,248,2,0,128,0}, /* 색 */
{33,8,66,16,156,81,20,72,146,36,1,0,0}, /* 서 */
{33,8,66,113,68,137,0,68,1,0,127,0,0}, /* 선 */
{33,9,197,18,36,0,31,193,241,128,127,0,0}, /* 설 */
@@ -98,12 +106,14 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{113,34,72,154,36,113,0,132,249,20,114,0,0}, /* 않 */
{113,34,104,145,196,0,31,193,241,128,127,0,0}, /* 알 */
{113,34,72,154,36,113,0,2,33,84,136,128,0}, /* 았 */
{113,34,104,146,38,113,0,3,225,4,62,0,0}, /* 양 */
{113,34,72,146,60,137,34,72,145,196,1,0,0}, /* 어 */
{113,35,200,145,196,0,16,71,241,4,127,0,0}, /* 업 */
{113,35,200,145,196,0,20,135,33,84,120,128,0}, /* 없 */
{113,34,72,242,36,113,0,2,33,84,136,128,0}, /* 었 */
{114,162,168,170,58,138,162,168,169,202,2,128,0}, /* 에 */
{113,35,200,146,60,113,0,7,240,4,1,0,0}, /* 역 */
{113,35,200,146,60,113,0,68,1,0,127,0,0}, /* 연 */
{113,35,200,145,220,1,31,193,241,128,127,0,0}, /* 열 */
{114,162,168,234,42,138,163,168,169,202,2,128,0}, /* 예 */
{62,16,68,17,4,62,2,0,131,254,0,0,0}, /* 오 */
@@ -138,6 +148,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{250,136,162,40,186,82,148,168,170,42,2,128,0}, /* 제 */
{127,2,1,64,136,65,2,0,131,254,0,0,0}, /* 조 */
{127,5,6,48,32,255,128,4,1,0,127,0,0}, /* 존 */
{127,2,1,65,140,0,63,224,128,32,8,0,0}, /* 주 */
{127,5,6,48,0,255,130,3,225,4,62,0,0}, /* 중 */
{249,8,66,16,132,81,20,72,146,36,1,0,0}, /* 지 */
{249,8,66,17,68,137,0,7,241,4,127,0,0}, /* 짐 */
@@ -159,6 +170,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{242,160,175,106,10,242,128,7,249,2,127,128,0}, /* 템 */
{127,31,132,1,252,8,63,227,225,4,62,0,0}, /* 통 */
{127,16,7,241,0,127,0,0,3,254,0,0,0}, /* 트 */
{253,18,68,145,36,73,146,68,147,244,1,0,0}, /* 파 */
{250,148,165,41,74,83,148,165,43,234,2,128,0}, /* 패 */
{249,21,197,17,92,249,0,68,1,0,127,0,0}, /* 편 */
{127,8,130,32,136,127,2,0,131,254,0,0,0}, /* 포 */
@@ -175,9 +187,11 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{34,190,167,58,42,114,128,3,241,2,63,0,0}, /* 행 */
{33,62,199,18,44,113,0,68,1,0,127,0,0}, /* 현 */
{33,62,199,18,44,113,0,3,225,4,62,0,0}, /* 형 */
{8,63,228,16,248,8,63,227,225,4,62,0,0}, /* 홍 */
{33,63,64,17,196,137,156,66,19,244,1,0,0}, /* 화 */
{33,63,68,152,196,33,63,64,1,252,1,0,0}, /* 확 */
{33,63,68,152,196,33,63,64,1,0,127,0,0}, /* 환 */
{33,63,68,152,196,33,63,67,225,4,62,0,0}, /* 황 */
{33,63,64,17,196,137,28,66,19,244,1,0,0}, /* 회 */
{8,63,227,225,4,62,0,15,248,32,8,0,0}, /* 후 */
{33,63,68,147,244,32,31,193,241,128,127,0,0}, /* 휠 */
+14
View File
@@ -25,6 +25,7 @@
"끔",
"난",
"남",
"노",
"뉴",
"는",
"늘",
@@ -40,10 +41,13 @@
"되",
"됨",
"됩",
"두",
"뒤",
"드",
"득",
"때",
"라",
"랑",
"램",
"량",
"러",
@@ -56,11 +60,13 @@
"름",
"리",
"릭",
"림",
"마",
"메",
"면",
"목",
"미",
"민",
"방",
"배",
"벨",
@@ -73,10 +79,12 @@
"분",
"불",
"비",
"빨",
"사",
"삭",
"상",
"새",
"색",
"서",
"선",
"설",
@@ -96,12 +104,14 @@
"않",
"알",
"았",
"양",
"어",
"업",
"없",
"었",
"에",
"역",
"연",
"열",
"예",
"오",
@@ -136,6 +146,7 @@
"제",
"조",
"존",
"주",
"중",
"지",
"짐",
@@ -157,6 +168,7 @@
"템",
"통",
"트",
"파",
"패",
"편",
"포",
@@ -173,9 +185,11 @@
"행",
"현",
"형",
"홍",
"화",
"확",
"환",
"황",
"회",
"후",
"휠"
+26 -6
View File
@@ -1441,11 +1441,14 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
return 0;
}
/* the pet's own file (pages of the save with the character in the header): character there too */
static int g_chr_color;
static u32 ko_colors(void);
static u32 ko_names(void);
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 pal=ko_colors();if(g_chr_color>=0&&!pal)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){
@@ -1453,14 +1456,30 @@ static u32 tama_files(u32 old,u32 nw){
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);}
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;if(off==0&&g_chr_color>=0){
u32 before=0;for(u32 q=8;q<0x180;q+=4)before+=*(u32*)(g_page+q);
g_page[16]=(u8)g_chr_color;for(u32 q=0;q<16;q++){u8 v=fl(pal+16u*(u32)g_chr_color+q)[0];g_page[0x140+q]=v;g_page[0x160+q]=v;}
u32 sum=ghost_rd32(src)-before;for(u32 q=8;q<0x180;q+=4)sum+=*(u32*)(g_page+q);*(u32*)g_page=sum;*(u32*)(g_page+4)=0u-sum;
}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);}}
static u32 ko_colors(void){u32 a=ko_names()+34u*g_cfg.cat_n+8u;return ko_le32(a)==0x314b5043u?a+4u:0;}
static const char *ko_color_name(void){static const char *const names[]={"ORIGINAL","ROT","ROSA","VIOLETT","BLAU","HIMMELBLAU","MINT","GR\334N","GELB","ORANGE","HELLROSA","LAVENDEL","HELLBLAU","HELLGR\334N","CREME","WEISS","GRAU"};return names[g_chr_color+1];}
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;u32 mask=at+2u*w*h,pal=ko_colors();int colored=g_chr_color>=0&&pal&&ko_le32(mask)==0x314b534du;
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++){u32 n=y*w+x;const volatile u8 *p=fl(at+2u*n);u32 c=p[0]|((u32)p[1]<<8);if(c==0xf81fu)continue;
if(colored){u32 index=(fl(mask+4u+(n>>1))[0]>>((n&1u)*4u))&15u;if(index<8u){p=fl(pal+16u*(u32)g_chr_color+2u*index);c=p[0]|((u32)p[1]<<8);}}
rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);
}
}
static void chr_pick(void){
static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u;
u32 sel=0, top=0;
@@ -1478,12 +1497,13 @@ static void chr_pick(void){
if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; }
if(c==K_BACK) return;
if(c==K_OK){
u32 nw=0,st=0,old=t_id();int accepted=0,back=0;
u32 nw=0,st=0,old=t_id();int accepted=0,back=0,colorMode=0;
g_chr_color=g_set[g_cfg.tama_off+0x19u]&31u;if(g_chr_color>15)g_chr_color=-1;
while(!accepted&&!back){
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(93,stage_name(st),GREY,1);ctext(105,"RAD: ZUR\334CK/WEITER",GREY,1);ctext(117,"B W\304HLEN C LISTE",GREY,1);show();wait_release();
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
ctext(93,ko_color_name(),GREY,1);ctext(105,colorMode?"RAD FARBE A TAMA":"RAD TAMA A FARBE",GREY,1);ctext(117,"B W\304HLEN C LISTE",GREY,1);show();wait_release();
for(;;){int key=input();if(key==K_A){colorMode=!colorMode;break;}if(key==1){if(colorMode){g_chr_color+=g_step;if(g_chr_color>15)g_chr_color=-1;if(g_chr_color< -1)g_chr_color=15;break;}int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
}
if(!accepted)break;
u32 to=g_cfg.tama_off;
@@ -1494,7 +1514,7 @@ static void chr_pick(void){
#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);
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|(g_chr_color<0?31u:(u32)g_chr_color));
#ifdef FELD_TAMA_ANY
#else
if(old && old!=nw) tama_files(old, nw);
+26 -6
View File
@@ -1440,11 +1440,14 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
return 0;
}
/* the pet's own file (pages of the save with the character in the header): character there too */
static int g_chr_color;
static u32 ko_colors(void);
static u32 ko_names(void);
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 pal=ko_colors();if(g_chr_color>=0&&!pal)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){
@@ -1452,14 +1455,30 @@ static u32 tama_files(u32 old,u32 nw){
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);}
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;if(off==0&&g_chr_color>=0){
u32 before=0;for(u32 q=8;q<0x180;q+=4)before+=*(u32*)(g_page+q);
g_page[16]=(u8)g_chr_color;for(u32 q=0;q<16;q++){u8 v=fl(pal+16u*(u32)g_chr_color+q)[0];g_page[0x140+q]=v;g_page[0x160+q]=v;}
u32 sum=ghost_rd32(src)-before;for(u32 q=8;q<0x180;q+=4)sum+=*(u32*)(g_page+q);*(u32*)g_page=sum;*(u32*)(g_page+4)=0u-sum;
}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);}}
static u32 ko_colors(void){u32 a=ko_names()+34u*g_cfg.cat_n+8u;return ko_le32(a)==0x314b5043u?a+4u:0;}
static const char *ko_color_name(void){static const char *const names[]={"ORIGINAL","RED","PINK","PURPLE","BLUE","SKY BLUE","MINT","GREEN","YELLOW","ORANGE","LIGHT PINK","LAVENDER","LIGHT BLUE","LIGHT GREEN","CREAM","WHITE","GRAY"};return names[g_chr_color+1];}
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;u32 mask=at+2u*w*h,pal=ko_colors();int colored=g_chr_color>=0&&pal&&ko_le32(mask)==0x314b534du;
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++){u32 n=y*w+x;const volatile u8 *p=fl(at+2u*n);u32 c=p[0]|((u32)p[1]<<8);if(c==0xf81fu)continue;
if(colored){u32 index=(fl(mask+4u+(n>>1))[0]>>((n&1u)*4u))&15u;if(index<8u){p=fl(pal+16u*(u32)g_chr_color+2u*index);c=p[0]|((u32)p[1]<<8);}}
rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);
}
}
static void chr_pick(void){
static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u;
u32 sel=0, top=0;
@@ -1477,12 +1496,13 @@ static void chr_pick(void){
if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; }
if(c==K_BACK) return;
if(c==K_OK){
u32 nw=0,st=0,old=t_id();int accepted=0,back=0;
u32 nw=0,st=0,old=t_id();int accepted=0,back=0,colorMode=0;
g_chr_color=g_set[g_cfg.tama_off+0x19u]&31u;if(g_chr_color>15)g_chr_color=-1;
while(!accepted&&!back){
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(93,stage_name(st),GREY,1);ctext(105,"WHEEL: PREV/NEXT",GREY,1);ctext(117,"B APPLY C LIST",GREY,1);show();wait_release();
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
ctext(93,ko_color_name(),GREY,1);ctext(105,colorMode?"WHEEL COLOR A TAMA":"WHEEL TAMA A COLOR",GREY,1);ctext(117,"B APPLY C LIST",GREY,1);show();wait_release();
for(;;){int key=input();if(key==K_A){colorMode=!colorMode;break;}if(key==1){if(colorMode){g_chr_color+=g_step;if(g_chr_color>15)g_chr_color=-1;if(g_chr_color< -1)g_chr_color=15;break;}int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
}
if(!accepted)break;
u32 to=g_cfg.tama_off;
@@ -1493,7 +1513,7 @@ static void chr_pick(void){
#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);
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|(g_chr_color<0?31u:(u32)g_chr_color));
#ifdef FELD_TAMA_ANY
#else
if(old && old!=nw) tama_files(old, nw);
+152 -132
View File
@@ -213,12 +213,12 @@ static void utoa_(u32 v, char *s){ char t[12]; int n=0; do{ t[n++]=(char)('0'+v%
static u16 fcol(u32 i){ return (u16)(i<4u ? g_cfg.field_col[i] : g_cfg.field_col2[i-4u]); }
static const char *ko_field(const char *s){
{const char *a="LAND";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\360\201\211";}
{const char *a="WATER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\325\201\210";}
{const char *a="SKY";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\245\200\233";}
{const char *a="FOREST";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\327";}
{const char *a="TROPICAL";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\234\200\261\201\244\201\224";}
{const char *a="GLACIER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\220\200\257\200\365\200\322";}
{const char *a="LAND";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\372\201\224";}
{const char *a="WATER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\335\201\223";}
{const char *a="SKY";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\261\200\234";}
{const char *a="FOREST";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\337";}
{const char *a="TROPICAL";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\247\200\265\201\260\201\237";}
{const char *a="GLACIER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\220\200\263\200\377\200\332";}
return s;}
static const char *fname(u32 i){ return ko_field(i<4u ? (const char*)g_cfg.field_name[i] : (const char*)g_cfg.field_name2[i-4u]); }
static u32 fid(u32 i){ return i<4u ? g_cfg.field_id[i] : g_cfg.field_id2[i-4u]; }
@@ -456,7 +456,7 @@ static int stash(u32 fi){
if(on==PAGE){ u32 x=pool_take(fi); if(x==0xFFFFu || nd>=DPG_MAX) return 11;
flash_prog4k(pool_addr(x),g_out); g_hdr.dpg[nd++]=(u16)x; on=0; } }
by+=n;
progress("\201\200\200\376 \201\210", ++done, tot*2u);
progress("\201\212\201\210 \201\223", ++done, tot*2u);
}
if(on){ u32 x=pool_take(fi); if(x==0xFFFFu || nd>=DPG_MAX) return 11;
for(u32 k=on;k<PAGE;k++) g_out[k]=0xFF; flash_prog4k(pool_addr(x),g_out); g_hdr.dpg[nd++]=(u16)x; }
@@ -468,7 +468,7 @@ static int stash(u32 fi){
if(lz_unpack(g_cmp, n, g_page)) return 12;
if(!flash_same(a, g_page, PAGE)) return 13;
off+=n;
progress("\201\256\200\366 \201\210", tot+i+1u, tot*2u);
progress("\201\273\201\200 \201\223", tot+i+1u, tot*2u);
}
g_hdr.magic=SLOT_MAGIC; g_hdr.field=fi+1u; g_hdr.npages=np; g_hdr.bytes=by; g_hdr.sum=sum;
g_hdr.res[0]=POOL_MAGIC; g_hdr.res[1]=nd; g_hdr.res[2]=PEND_MAGIC;
@@ -504,7 +504,7 @@ static int restore(u32 fi, int fresh){
} else if(set!=(int)pass) continue;
if(want){ if(!flash_same(a,g_page,PAGE)) flash_prog4k(a,g_page); if(!flash_same(a,g_page,PAGE)) return 22; }
else if(!page_ff(a)){ erase_page(a); if(!page_ff(a)) return 23; }
if(!pass && !(++done & 7u)) progress("\200\307\200\256\200\350\200\232 \201\210", done, tot);
if(!pass && !(++done & 7u)) progress("\200\315\200\262\200\362\200\233 \201\223", done, tot);
}
if(!fresh && ix2!=np) return 24;
}
@@ -522,24 +522,24 @@ static void leave(void){
}
static void error_screen(int code){
rect(0,0,128,128,BG);
ctext(30,"\200\350\200\264",RED,2);
char s[12]="\201\225\200\251 00"; s[5]=(char)('0'+code/10); s[6]=(char)('0'+code%10);
ctext(30,"\200\362\200\270",RED,2);
char s[12]="\201\240\200\253 00"; s[5]=(char)('0'+code/10); s[6]=(char)('0'+code%10);
ctext(56,s,WHITE,1);
if(code==10||code==11) ctext(68,"\201\200\200\376 \200\354\200\255 \201\216\200\215",WHITE,1); /* the field stays as it is */
ctext(84,"B/C \200\243\200\334\200\201\200\222",GREY,1);
if(code==10||code==11) ctext(68,"\201\212\201\210 \200\366\200\261 \201\231\200\215",WHITE,1); /* the field stays as it is */
ctext(84,"B/C \200\244\200\344\200\201\200\222",GREY,1);
show(); wait_release();
for(;;){ int k=input(); if(k==K_OK||k==K_BACK) leave(); }
}
static void message(const char *l1, const char *l2, const char *l3){
rect(0,0,128,128,BG);
ctext(34,l1,WHITE,1); ctext(48,l2,WHITE,1); ctext(62,l3,WHITE,1);
ctext(100,"C \200\250\200\261",GREY,1);
ctext(100,"C \200\252\200\265",GREY,1);
show(); wait_release();
for(;;){ int k=input(); if(k==K_OK||k==K_BACK) return; }
}
static void done_screen(const char *what, u16 col){
rect(0,0,128,128,BG);
ctext(40,"\200\352\200\263",WHITE,2);
ctext(40,"\200\364\200\267",WHITE,2);
ctext(66,what,col,1);
show();
delay_loop(6000000u);
@@ -556,7 +556,7 @@ static void app_detect(void){
g_app = m==0x43584D50u ? 2u : m==0x37584D50u ? 4u : m==0x38584D50u ? 5u : 3u;
for(u32 i=0x140u;i<0x400u;i+=4u) if(rd32(off+i)==0x434D4450u){ g_app=1u; break; }
}
static const char *const g_appname[6]={"","DOOM","TAMAEMU","\201\241\200\261\200\217\200\254","T7EMU","T18EMU"};
static const char *const g_appname[6]={"","DOOM","TAMAEMU","\201\255\200\265\200\217\200\260","T7EMU","T18EMU"};
static void start_app(void){
rect(0,0,128,128,0); show();
#ifdef HOST
@@ -600,12 +600,12 @@ static void apps_detect(void){
#ifndef NO_LSET
/* start device (1.6.8): sound and display time, the Paradise's own settings screens are gone */
if(g_cfg.flags & 16u){
const char *d="\200\317\201\204"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0;
const char *d="\200\327\201\216"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0;
g_appsrc[g_napp++]=0; g_sx=g_napp;
}
#endif
if((g_cfg.flags & 16u) && g_cfg.version>=7u && g_cfg.dl_src>=0x10000000u && g_cfg.dl_src<0x11000000u){
const char *d="\200\235\200\355\200\261\200\251"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0;
const char *d="\200\236\200\367\200\265\200\253"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0;
g_appsrc[g_napp++]=g_cfg.dl_src; g_dl=g_napp;
}
}
@@ -734,7 +734,7 @@ static void act_mark(u32 j){
}
/* Live save to slot g_act, then slot tgt (has) or a fresh start on field fld into the live area. */
static void field_switch2(u32 tgt, int has, u32 fld){
rect(0,0,128,128,BG); ctext(8,"\200\375\200\331 \200\222\200\235\200\266\200\321\200\353",WHITE,1); ctext(20,"\201\202\200\356\200\362 \200\357\201\211\201\245\200\321\200\353",GREY,1); show();
rect(0,0,128,128,BG); ctext(8,"\201\207\200\341 \200\222\200\236\200\272\200\331\200\365",WHITE,1); ctext(20,"\201\214\200\370\200\374 \200\371\201\224\201\261\200\331\200\365",GREY,1); show();
int e=stash((u32)g_act);
if(e){ erase_page(slot_base((u32)g_act)); error_screen(e); }
e=restore(has ? tgt : fld,!has);
@@ -749,12 +749,12 @@ static void field_switch2(u32 tgt, int has, u32 fld){
static void field_switch(u32 tgt, int has){ field_switch2(tgt, has, tgt); }
static int field_confirm(u32 tgt, int has){
rect(0,0,128,128,BG);
ctext(14,"\201\202\201\257 \200\237\200\313",WHITE,1);
ctext(14,"\201\214\201\274 \200\240\200\322",WHITE,1);
ctext(30,fname(tgt),fcol(tgt),2);
ctext(54, has ? "\200\301\200\216\201\246 \201\200\200\376\200\362" : "\200\365 \201\211\200\345\200\344\200\315", WHITE,1);
ctext(66, has ? "\200\307\200\256\200\351\200\234\200\235" : "\200\314\200\261 \200\331\200\374\201\251\200\234\200\235", WHITE,1);
ctext(92,"B \200\347",WHITE,1);
ctext(106,"C \200\334\200\234\200\353",GREY,1);
ctext(54, has ? "\200\307\200\216\201\262 \201\212\201\210\200\374" : "\200\377 \201\224\200\356\200\355\200\325", WHITE,1);
ctext(66, has ? "\200\315\200\262\200\363\200\235\200\236" : "\200\323\200\265 \200\341\201\206\201\265\200\235\200\236", WHITE,1);
ctext(92,"B \200\361",WHITE,1);
ctext(106,"C \200\344\200\235\200\365",GREY,1);
show();
return yes_no();
}
@@ -764,7 +764,7 @@ static int launch_mode(void){ return (g_cfg.flags & F_LAUNCH) != 0u; }
* The time is kept in the Paradise's settings block at IDLE_OFF (0 = 2 minutes, else index + 1). */
#define IDLE_OFF 0xF07u
static const u32 g_idle_tab[5]={30000u,60000u,120000u,300000u,0u};
static const char *const g_idle_nm[5]={"30 S","1\200\306","2\200\306","5\200\306","\200\225\201\211 \200\335\200\363"};
static const char *const g_idle_nm[5]={"30 S","1\200\314","2\200\314","5\200\314","\200\225\201\224 \200\345\200\375"};
static u32 g_idle_t, g_idle_ms;
#ifdef BAT_SHOW
#ifdef HOST
@@ -776,9 +776,9 @@ static void bat_text(char *s){ const char *t="2.84V 80%"; int i=0; while((s[i]=t
static void lset_menu(void);
#ifdef FELD_CLEAN
static int clean_mode(void);
#define SX_TEXT (clean_mode() ? "\200\331\200\213\200\200\201\255\200\272" : "\200\323\200\266\200\200\201\255\200\272")
#define SX_TEXT (clean_mode() ? "\200\341\200\213\200\200\201\272\200\277" : "\200\333\200\272\200\200\201\272\200\277")
#else
#define SX_TEXT "\200\323\200\266\200\200\201\255\200\272"
#define SX_TEXT "\200\333\200\272\200\200\201\272\200\277"
#endif
#if defined(FELD_PW) && !defined(HOST)
/* test23 (switch FELD_PW): the display dark, the menu waited for a key in a tight loop at the full clock and used
@@ -841,7 +841,7 @@ static void apps_menu(int top){
for(;;){
rect(0,0,128,128,BG);
int y0 = n>=4u ? 1 : 12;
if(n<4u) ctext(2, launch_mode() ? "PARAMIX" : "\201\241\200\261\200\217\200\254",WHITE,1);
if(n<4u) ctext(2, launch_mode() ? "PARAMIX" : "\201\255\200\265\200\217\200\260",WHITE,1);
if(n>8u){ if(sel<first) first=sel; if(sel>=first+8u) first=sel-7u; } else first=0;
for(u32 i=first;i<n && i<first+(n>8u?8u:n);i++){
int sx = g_sx && i+1u==g_sx;
@@ -850,13 +850,13 @@ static void apps_menu(int top){
int dy = n>7u ? 14 : 16, y=2+(int)(i-first)*dy;
if(i==sel){ rect(1,y,127,y+dy-1,c); rect(2,y+1,126,y+dy-2,BG); }
text(5,y+(dy-8)/2+1,g_appnm[i],c,1);
const char *st = sx ? "\200\346\200\222" : "\200\331\200\374";
const char *st = sx ? "\200\360\200\222" : "\200\341\201\206";
text(123-text_w(st,1),y+(dy-8)/2+1,st,GREY,1);
} else big_entry(y0+(int)i*29, i==sel, g_appnm[i], g_dl && i+1u==g_dl ? "PC \200\222\200\262" : sx ? SX_TEXT : "\200\331\200\374", c, GREY);
} else big_entry(y0+(int)i*29, i==sel, g_appnm[i], g_dl && i+1u==g_dl ? "PC \200\222\200\266" : sx ? SX_TEXT : "\200\341\201\206", c, GREY);
}
#ifdef BAT_SHOW
/* test17: the start device's home screen shows the battery bottom right */
if(top && launch_mode()){ char bt[12]; bat_text(bt); text(5,117,"B \200\331\200\374",GREY,1); if(n<=8u) text(123-text_w(bt,1),119,bt,GREY,1);
if(top && launch_mode()){ char bt[12]; bat_text(bt); text(5,117,"B \200\341\201\206",GREY,1); if(n<=8u) text(123-text_w(bt,1),119,bt,GREY,1);
#ifdef FELD_AUTODBG
if(g_adbg[2]){ static const char hx[]="0123456789ABCDEF"; char d[8]; u32 mm=g_adbg[0];
d[0]= mm==MB_L ? 'L' : mm==MB_M ? 'M' : mm==MB_R ? 'R' : mm ? '?' : '0'; d[1]=hx[(g_adbg[1]>>8)&15u]; d[2]=g_adbg[2]==2u ? 'B' : '-'; d[3]= g_adbg[3]==MB_S ? 'S' : g_adbg[3] ? '?' : '0'; d[4]=0;
@@ -865,7 +865,7 @@ static void apps_menu(int top){
}
else
#endif
ctext(117, top && launch_mode() ? "B \200\331\200\374" : "B \201\256\200\366 C \200\250\200\261",GREY,1);
ctext(117, top && launch_mode() ? "B \200\341\201\206" : "B \201\273\201\200 C \200\252\200\265",GREY,1);
if(n>8u){ char sc[8]; u32 a=sel+1u; int k=0; if(a>=10u) sc[k++]=(char)('0'+a/10u); sc[k++]=(char)('0'+a%10u); sc[k++]='/'; if(n>=10u) sc[k++]=(char)('0'+n/10u); sc[k++]=(char)('0'+n%10u); sc[k]=0; text(123-text_w(sc,1),119,sc,GREY,1); }
show(); wait_release();
for(;;){
@@ -888,10 +888,10 @@ static void field_menu(int with_app, int top){
for(;;){
rect(0,0,128,128,BG);
int y0 = n>=4u ? 1 : 12;
if(n<4u) ctext(2, top ? "PARAMIX" : "\201\211\200\345", WHITE,1);
if(n<4u) ctext(2, top ? "PARAMIX" : "\201\224\200\356", WHITE,1);
for(u32 i=0;i<n;i++){
const char *nm = i<nf ? fname(i) : g_napp>1u ? "\201\241\200\261\200\217\200\254" : g_appnm[0];
const char *st = i>=nf ? (g_napp>1u ? "\200\316\201\230" : "\200\331\200\374") : ((int)i==g_cur) ? "\200\311\200\354 \201\210" : has[i] ? "\201\200\200\376\200\246" : "\200\314\200\261";
const char *nm = i<nf ? fname(i) : g_napp>1u ? "\201\255\200\265\200\217\200\260" : g_appnm[0];
const char *st = i>=nf ? (g_napp>1u ? "\200\326\201\243" : "\200\341\201\206") : ((int)i==g_cur) ? "\200\320\200\366 \201\223" : has[i] ? "\201\212\201\210\200\247" : "\200\323\200\265";
u16 c = i<nf ? fcol(i) : ORANGE, stc = (i<nf && (int)i==g_cur) ? WHITE : GREY;
if(n>4u){ /* six fields: compact rows */
int y=2+(int)i*16;
@@ -900,7 +900,7 @@ static void field_menu(int with_app, int top){
text(123-text_w(st,1),y+4,st,stc,1);
} else big_entry(y0+(int)i*29, i==sel, nm, st, c, stc);
}
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1);
ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1);
show(); wait_release();
for(;;){
int k=input();
@@ -929,13 +929,13 @@ static int set_load(void){
}
static int set_check_msg(void){
int e=set_load();
if(e==1){ message("\201\200\200\376 \200\241\200\365\201\231\200\201","\200\324\200\313\200\245\200\343\200\330\200\234\200\235","\200\300\200\212\201\245\201\211 \200\335\200\337\200\330\200\234\200\235"); return 1; }
if(e==2){ message("\201\200\200\376 \200\241\200\365\201\231 \200\342\200\363","\201\206\200\221 \201\242\200\257\200\365\201\246 \200\250","\200\235\200\331 \200\331\200\242\201\245\200\321\200\353"); return 1; }
if(e){ message("\201\200\200\376 \201\254\200\332\200\362","\200\336 \200\325 \200\342\200\330\200\234\200\235",""); return 1; }
if(e==1){ message("\201\212\201\210 \200\242\200\377\201\244\200\201","\200\334\200\322\200\246\200\354\200\340\200\235\200\236","\200\306\200\212\201\261\201\224 \200\345\200\347\200\340\200\235\200\236"); return 1; }
if(e==2){ message("\201\212\201\210 \200\242\200\377\201\244 \200\353\200\375","\201\220\200\221 \201\256\200\263\200\377\201\262 \200\252","\200\236\200\341 \200\341\200\243\201\261\200\331\200\365"); return 1; }
if(e){ message("\201\212\201\210 \201\270\200\342\200\374","\200\346 \200\335 \200\353\200\340\200\235\200\236",""); return 1; }
return 0;
}
static void set_write(const char *what){
rect(0,0,128,128,BG); ctext(40,"\201\200\200\376 \201\210",WHITE,1); ctext(54,"\201\202\200\356\200\362 \200\357\201\211\201\245\200\321\200\353",GREY,1); show();
rect(0,0,128,128,BG); ctext(40,"\201\212\201\210 \201\223",WHITE,1); ctext(54,"\201\214\200\370\200\374 \200\371\201\224\201\261\200\331\200\365",GREY,1); show();
stamp(g_set);
flash_prog4k(SET_A, g_set);
flash_prog4k(SET_B, g_set);
@@ -1000,7 +1000,7 @@ static void clock_menu(int must){
for(;;){
if(d>mdays(y,mo)) d=mdays(y,mo);
rect(0,0,128,128,BG);
ctext(4,"\200\331\200\213 \200\317\201\204",WHITE,1);
ctext(4,"\200\341\200\213 \200\327\201\216",WHITE,1);
char s[6];
utoa_(y,s); text(5,26,s,sel==0u?ORANGE:WHITE,2);
s[0]='-'; s[1]=0; text(52,26,s,GREY,2);
@@ -1010,9 +1010,9 @@ static void clock_menu(int must){
two(s,h); s[2]=0; text(34,52,s,sel==3u?ORANGE:WHITE,2);
s[0]=':'; s[1]=0; text(58,52,s,GREY,2);
two(s,mi); s[2]=0; text(70,52,s,sel==4u?ORANGE:WHITE,2);
ctext(84,"\201\262 \200\300\200\212",GREY,1);
ctext(96,"A \200\235\200\363 B \201\200\200\376",GREY,1);
if(!must) ctext(108,"C \200\250\200\261",GREY,1);
ctext(84,"\201\300 \200\306\200\212",GREY,1);
ctext(96,"A \200\236\200\375 B \201\212\201\210",GREY,1);
if(!must) ctext(108,"C \200\252\200\265",GREY,1);
show(); wait_release();
for(;;){
int k=input();
@@ -1029,7 +1029,7 @@ static void clock_menu(int must){
if(k==K_BACK && !must) return;
if(k==K_OK){
Clk c; u32 idle=clk_load(&c) ? c.idle : 0u;
rect(0,0,128,128,BG); ctext(54,"\201\200\200\376 \201\210",WHITE,1); show();
rect(0,0,128,128,BG); ctext(54,"\201\212\201\210 \201\223",WHITE,1); show();
clk_store((u32)para_days((int32_t)y,(int32_t)mo,(int32_t)d)*86400u+h*3600u+mi*60u, idle);
return;
}
@@ -1050,15 +1050,15 @@ static void lset_load(void){
static void lset_clean(void){
Clk k; u32 idl = clk_load(&k) && k.idle>=1u && k.idle<=5u ? k.idle-1u : 2u, idl0=idl, sel=0;
for(;;){
char tm[8]; u32 t=clk_now(); if(t) hhmm(t,tm); else { const char *n="\200\274\200\317\201\204"; int i=0; while((tm[i]=n[i])) i++; }
char tm[8]; u32 t=clk_now(); if(t) hhmm(t,tm); else { const char *n="\200\301\200\327\201\216"; int i=0; while((tm[i]=n[i])) i++; }
rect(0,0,128,128,BG);
ctext(2,"\200\317\201\204",WHITE,1);
big_entry(16, sel==0u, "\200\331\200\213", tm, ORANGE, WHITE);
big_entry(45, sel==1u, "\201\255\200\272", g_idle_nm[idl], ORANGE, WHITE);
text(9,84,"\201\255\200\272 \200\224\201\212",GREY,1);
text(9,94,"\200\371\200\260\200\365 \200\342\200\362 \200\253",GREY,1);
ctext(108,"B \200\300\200\212",GREY,1);
ctext(117,"C \201\200\200\376 \201\261 \200\250\200\261",GREY,1);
ctext(2,"\200\327\201\216",WHITE,1);
big_entry(16, sel==0u, "\200\341\200\213", tm, ORANGE, WHITE);
big_entry(45, sel==1u, "\201\272\200\277", g_idle_nm[idl], ORANGE, WHITE);
text(9,84,"\201\272\200\277 \200\224\201\225",GREY,1);
text(9,94,"\201\203\200\264\200\377 \200\353\200\374 \200\255",GREY,1);
ctext(108,"B \200\306\200\212",GREY,1);
ctext(117,"C \201\212\201\210 \201\277 \200\252\200\265",GREY,1);
show(); wait_release();
for(;;){
int c=input();
@@ -1066,7 +1066,7 @@ static void lset_clean(void){
if(c==K_OK){ if(sel==0u) clock_menu(0); else idl=(idl+1u)%5u; break; }
if(c==K_BACK){
if(idl!=idl0){
rect(0,0,128,128,BG); ctext(54,"\201\200\200\376 \201\210",WHITE,1); show();
rect(0,0,128,128,BG); ctext(54,"\201\212\201\210 \201\223",WHITE,1); show();
u32 t2=clk_now(); clk_store(t2, idl+1u);
g_idle_ms=g_idle_tab[idl];
}
@@ -1082,20 +1082,20 @@ static void lset_menu(void){
#endif
int e=set_load();
if(e==1 || e==2){ set_check_msg(); return; }
static const char *const snd_nm[4]={"\200\226","\200\374\200\211","\200\301\201\233","\201\226\200\211"};
static const char *const snd_nm[4]={"\200\226","\201\206\200\211","\200\307\201\246","\201\241\200\211"};
u32 snd=(g_set[SND_OFF]>>3)&3u, snd0=snd;
u32 idl=g_set[IDLE_OFF]; idl = idl>=1u && idl<=5u ? idl-1u : 2u; u32 idl0=idl;
u32 sel=0;
for(;;){
rect(0,0,128,128,BG);
ctext(2,"\200\317\201\204",WHITE,1);
big_entry(16, sel==0u, "\200\323\200\266", snd_nm[snd], ORANGE, WHITE);
big_entry(45, sel==1u, "\201\255\200\272", g_idle_nm[idl], ORANGE, WHITE);
text(9,74,"\200\323\200\266: \200\303\201\236 \201\201\200\354",GREY,1);
text(9,84,"\201\255\200\272: \200\365 \200\271\200\231\200\344\200\315",GREY,1);
text(9,94,"\200\371\200\260 \200\342\200\361\200\272 \200\224\201\212",GREY,1);
ctext(108,"B \200\300\200\212",GREY,1);
ctext(117,"C \201\200\200\376 \201\261 \200\250\200\261",GREY,1);
ctext(2,"\200\327\201\216",WHITE,1);
big_entry(16, sel==0u, "\200\333\200\272", snd_nm[snd], ORANGE, WHITE);
big_entry(45, sel==1u, "\201\272\200\277", g_idle_nm[idl], ORANGE, WHITE);
text(9,74,"\200\333\200\272: \200\311\201\252 \201\213\200\366",GREY,1);
text(9,84,"\201\272\200\277: \200\377 \200\276\200\232\200\355\200\325",GREY,1);
text(9,94,"\201\203\200\264 \200\353\200\373\200\277 \200\224\201\225",GREY,1);
ctext(108,"B \200\306\200\212",GREY,1);
ctext(117,"C \201\212\201\210 \201\277 \200\252\200\265",GREY,1);
show(); wait_release();
for(;;){
int k=input();
@@ -1105,7 +1105,7 @@ static void lset_menu(void){
if(snd!=snd0 || idl!=idl0){
g_set[SND_OFF]=(u8)((g_set[SND_OFF]&~0x18u)|(snd<<3));
g_set[IDLE_OFF]=(u8)(idl+1u);
rect(0,0,128,128,BG); ctext(40,"\201\200\200\376 \201\210",WHITE,1); ctext(54,"\201\202\200\356\200\362 \200\357\201\211\201\245\200\321\200\353",GREY,1); show();
rect(0,0,128,128,BG); ctext(40,"\201\212\201\210 \201\223",WHITE,1); ctext(54,"\201\214\200\370\200\374 \200\371\201\224\201\261\200\331\200\365",GREY,1); show();
stamp(g_set);
flash_prog4k(SET_A, g_set);
flash_prog4k(SET_B, g_set);
@@ -1196,7 +1196,7 @@ static u32 pic_sum(u32 n){ u32 s=0; for(u32 i=0;i<n;i++) s+=g_pic[i]; s&=0xFFFFu
#define EXT_MAGIC 0x54584550u /* "PEXT": per item address, length, sum, first word of the picture */
static void draw_item_pic(u32 id, int cx, int cy, int box){
int k=cat_find(id);
if(!g_cfg.pack_off){ pic_code(cy,"\200\365\200\274\201\211 \200\342\200\363"); return; }
if(!g_cfg.pack_off){ pic_code(cy,"\200\377\200\301\201\224 \200\353\200\375"); return; }
if(k<0){ pic_code(cy,"P1"); return; }
u32 co=g_cfg.cat_off+8u+28u*(u32)k, pic=rd16(co+4u), want=rd16(co+6u);
u32 xo=g_cfg.cat_off+8u+28u*g_cfg.cat_n, e, end=0;
@@ -1272,7 +1272,7 @@ static void draw_item_pic(u32 id, int cx, int cy, int box){
}
}
}
static const char *group_name(u32 id){ switch(id/1000u){ case 5: return "\200\332\200\311"; case 6: return "\200\202\200\332"; case 7: return "\200\376\200\227\200\203"; case 8: return "\200\354\201\240"; default: return "\200\222\201\227"; } }
static const char *group_name(u32 id){ switch(id/1000u){ case 5: return "\200\342\200\320"; case 6: return "\200\202\200\342"; case 7: return "\201\210\200\227\200\203"; case 8: return "\200\366\201\254"; default: return "\200\222\201\242"; } }
/* Draw a list: title, 10 rows from y=12, footer. */
static void ko_surface(void){rect(0,0,128,128,RGB(0,169,209));for(int y=19;y<113;y++)for(int x=0;x<128;x++)if(((x+y)&7)<2)rect(x,y,x+1,y+1,RGB(0,157,199));rect(0,0,128,19,RGB(18,58,112));rect(0,113,128,128,RGB(18,58,112));}
@@ -1307,7 +1307,7 @@ static void bag_build(void){ g_bagn=0; u32 n=list_len(); for(u32 i=0;i<n;i++) if
#define BAG_SHOWN(i) 1
#endif
static int bag_row(u32 i, char *name, char *right, u16 *col){
if(i==0){ const char *s="+ \200\334\200\365\201\232 \201\220\200\201"; int k=0; while(s[k]){ name[k]=s[k]; k++; } name[k]=0; *col=GOLD; return 0; }
if(i==0){ const char *s="+ \200\344\200\377\201\245 \201\233\200\201"; int k=0; while(s[k]){ name[k]=s[k]; k++; } name[k]=0; *col=GOLD; return 0; }
u32 slot=g_bag[i-1]; const char *s=item_name(list_id(slot)); int k=0; while(s[k] && k<22){ name[k]=s[k]; k++; } name[k]=0;
right[0]='x'; utoa_(count_get(slot), right+1);
return 0;
@@ -1330,8 +1330,8 @@ static u32 count_choose(u32 id,u32 v,u32 lo,u32 hi,int adding){
for(;;){
rect(0,0,128,128,BG);ko_title(item_name(id),2);draw_item_pic(id,64,54,60);
char num[8];utoa_(v,num);
text(20,87,adding?"\201\220\200\201":"\200\325\200\255",WHITE,1);text(65,85,num,GOLD,2);text(103,87,"\200\206",WHITE,1);
ctext(105,"\201\262 \200\325\200\255 \201\206\201\203",GREY,1);ctext(117,"B \201\256\200\366 C \200\273\200\262",GREY,1);show();wait_release();
text(20,87,adding?"\201\233\200\201":"\200\335\200\261",WHITE,1);text(65,85,num,GOLD,2);text(103,87,"\200\206",WHITE,1);
ctext(105,"\201\300 \200\335\200\261 \201\220\201\215",GREY,1);ctext(117,"B \201\273\201\200 C \200\300\200\266",GREY,1);show();wait_release();
for(;;){int k=input();
if(k==1){int nv=(int)v+g_step;if(nv<(int)lo)nv=(int)lo;if(nv>(int)hi)nv=(int)hi;v=(u32)nv;break;}
if(k==K_A){if(v<hi)v++;break;}
@@ -1345,18 +1345,18 @@ static u32 count_edit(u32 id,u32 v,u32 lo){return count_choose(id,v,lo,15u,0);}
static u32 count_edit(u32 id,u32 v){u32 n=count_choose(id,v,1u,15u,0);return n==16u?0u:n;}
#endif
static u32 count_add(u32 id,u32 owned){
if(owned>=15u){message("\201\217\200\237 15\200\206 \200\301\200\357","\200\240 \201\220\200\201\201\247 \200\325 \200\342\200\330\200\234\200\235","");return 16u;}
if(owned>=15u){message("\201\232\200\240 15\200\206 \200\307\200\371","\200\241 \201\233\200\201\201\263 \200\335 \200\353\200\340\200\235\200\236","");return 16u;}
u32 n=count_choose(id,1u,1u,15u-owned,1);return n==16u?16u:owned+n;
}
static int g_dirty;
static void cat_pick(void){
cat_build();
if(!g_catn){ message("\200\334\200\365\201\232 \200\273\200\262 \200\342\200\363","\201\253\200\377 ROM\200\344",""); return; }
if(!g_catn){ message("\200\344\200\377\201\245 \200\300\200\266 \200\353\200\375","\201\267\201\211 ROM\200\355",""); return; }
u32 sel=0, top=0;
for(;;){
if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u;
char t[64]; const char *g=group_name(g_cat[sel]); int k=0; const char *a="\201\220\200\201: "; while(a[k]){ t[k]=a[k]; k++; } int j=0; while(g[j]){ t[k++]=g[j++]; } t[k]=0;
list_draw(t, g_catn, sel, top, cat_row, "A \200\306\200\264 B \200\316\201\230 C \200\250\200\261");
char t[64]; const char *g=group_name(g_cat[sel]); int k=0; const char *a="\201\233\200\201: "; while(a[k]){ t[k]=a[k]; k++; } int j=0; while(g[j]){ t[k++]=g[j++]; } t[k]=0;
list_draw(t, g_catn, sel, top, cat_row, "A \200\314\200\270 B \200\326\201\243 C \200\252\200\265");
wait_release();
for(;;){
int c=input();
@@ -1366,7 +1366,7 @@ static void cat_pick(void){
if(c==K_OK){
u32 id=g_cat[sel], n=list_len(), slot=n;
for(u32 i=0;i<n;i++) if(list_id(i)==id){ slot=i; break; }
if(slot>=640u){ message("\200\201\200\275\200\365 \200\201\200\252 \201\214","",""); return; }
if(slot>=640u){ message("\200\201\200\303\200\377 \200\201\200\254 \201\227","",""); return; }
#ifdef BAG_DEL
u32 v=count_add(id, slot<n ? count_get(slot) : 0u);
if(v<16u){ list_set(slot,id); count_set(slot,v); g_dirty=1; return; }
@@ -1387,7 +1387,7 @@ static void items_menu(void){
bag_build();
u32 n=g_bagn+1u; if(sel>=n) sel=n-1u;
if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u;
list_draw("\200\334\200\365\201\232", n, sel, top, bag_row, "B \201\236\201\213 C \200\250\200\261");
list_draw("\200\344\200\377\201\245", n, sel, top, bag_row, "B \201\252\201\226 C \200\252\200\265");
wait_release();
for(;;){
int c=input();
@@ -1404,9 +1404,9 @@ static void items_menu(void){
}
if(c==K_BACK){
if(!g_dirty) return;
rect(0,0,128,128,BG); ctext(34,"\200\300\200\212\200\362 \201\200\200\376\201\247\200\223\200\353?",WHITE,1); ctext(60,"\200\303\201\215\200\201 \200\377\200\331\200\374\200\247\200\234\200\235",GREY,1);
ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\234\200\353",GREY,1); show();
if(yes_no()) set_write("\200\334\200\365\201\232 \201\200\200\376 \200\352\200\263");
rect(0,0,128,128,BG); ctext(34,"\200\306\200\212\200\374 \201\212\201\210\201\263\200\223\200\365?",WHITE,1); ctext(60,"\200\311\201\230\200\201 \201\211\200\341\201\206\200\250\200\235\200\236",GREY,1);
ctext(92,"B \200\361",WHITE,1); ctext(106,"C \200\344\200\235\200\365",GREY,1); show();
if(yes_no()) set_write("\200\344\200\377\201\245 \201\212\201\210 \200\364\200\267");
return;
}
}
@@ -1419,15 +1419,15 @@ static void points_menu(void){
int pos=0;
for(;;){
rect(0,0,128,128,BG);
ctext(10,"\200\235\200\270\201\237\200\366\201\234",GOLD,1);
ctext(10,"\200\236\200\275\201\253\201\200\201\247",GOLD,1);
for(int i=0;i<5;i++){
int x=14+i*21; char s[2]={(char)('0'+dg[i]),0};
if(i==pos) rect(x-2,40,x+17,68,RGB(205,225,169));
text(x,43,s,i==pos?GOLD:WHITE,3);
}
ctext(80,"\201\262 \200\326\200\373 \200\300\200\212",GREY,1);
ctext(92,"B \200\235\200\363 A \200\365\201\202",GREY,1);
ctext(106,"C \201\221\200\323",GREY,1);
ctext(80,"\201\300 \200\336\201\205 \200\306\200\212",GREY,1);
ctext(92,"B \200\236\200\375 A \200\377\201\214",GREY,1);
ctext(106,"C \201\234\200\333",GREY,1);
show(); wait_release();
for(;;){
int k=input();
@@ -1438,10 +1438,10 @@ static void points_menu(void){
if(pos<4){ pos++; break; }
u32 nv=0; for(int i=0;i<5;i++) nv=nv*10u+dg[i];
if(nv==money_get()) return;
rect(0,0,128,128,BG); ctext(24,"\201\237\200\366\201\234 \200\317\201\204\200\204",WHITE,1);
char s[8]; utoa_(nv,s); ctext(44,s,GOLD,2); ctext(70,"\200\303\201\215\200\201 \200\377\200\331\200\374\200\247\200\234\200\235",GREY,1);
ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\234\200\353",GREY,1); show();
if(yes_no()){ money_put(nv); set_write("\201\237\200\366\201\234 \201\200\200\376 \200\352\200\263"); }
rect(0,0,128,128,BG); ctext(24,"\201\253\201\200\201\247 \200\327\201\216\200\204",WHITE,1);
char s[8]; utoa_(nv,s); ctext(44,s,GOLD,2); ctext(70,"\200\311\201\230\200\201 \201\211\200\341\201\206\200\250\200\235\200\236",GREY,1);
ctext(92,"B \200\361",WHITE,1); ctext(106,"C \200\344\200\235\200\365",GREY,1); show();
if(yes_no()){ money_put(nv); set_write("\201\253\201\200\201\247 \201\212\201\210 \200\364\200\267"); }
return;
}
}
@@ -1454,7 +1454,7 @@ static int tama_ok(void){ return (g_cfg.flags & F_TAMA) && g_cfg.version>=6u &&
static u32 lv_get(void){ return g_set[g_cfg.level_off] & 15u; }
static u32 t_id(void){ u32 o=g_cfg.tama_off+4u; return g_set[o]|(g_set[o+1]<<8); }
static u32 t_stage(void){ return (g_set[g_cfg.tama_off+0x18u]>>2)&7u; }
static const char *stage_name(u32 st){ switch(st){ case 1: return "\200\336"; case 2: return "\200\334\200\222"; case 3: return "\200\357\200\334\200\222"; case 4: return "\200\320\200\376\200\222"; case 5: return "\200\320\201\215"; default: return "?"; } }
static const char *stage_name(u32 st){ switch(st){ case 1: return "\200\346"; case 2: return "\200\344\200\222"; case 3: return "\200\371\200\344\200\222"; case 4: return "\200\330\201\210\200\222"; case 5: return "\200\330\201\230"; default: return "?"; } }
static u16 g_chr[256]; static u32 g_chrn;
static void chr_build(u32 st){ g_chrn=0; for(u32 k=0;k<g_cfg.cat_n && g_chrn<256u;k++){ u32 o=g_cfg.cat_off+8u+28u*k; if(fl(o+2)[0]==2u && fl(o+6)[0]==st) g_chr[g_chrn++]=(u16)k; } }
static void chr_name(u32 k, char *out){const char *n=item_name(rd16(g_cfg.cat_off+8u+28u*k));int i=0;while(n[i]&&i<60){out[i]=n[i];i++;}out[i]=0;}
@@ -1466,11 +1466,14 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
return 0;
}
/* the pet's own file (pages of the save with the character in the header): character there too */
static int g_chr_color;
static u32 ko_colors(void);
static u32 ko_names(void);
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 pal=ko_colors();if(g_chr_color>=0&&!pal)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){
@@ -1478,24 +1481,40 @@ static u32 tama_files(u32 old,u32 nw){
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);}
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;if(off==0&&g_chr_color>=0){
u32 before=0;for(u32 q=8;q<0x180;q+=4)before+=*(u32*)(g_page+q);
g_page[16]=(u8)g_chr_color;for(u32 q=0;q<16;q++){u8 v=fl(pal+16u*(u32)g_chr_color+q)[0];g_page[0x140+q]=v;g_page[0x160+q]=v;}
u32 sum=ghost_rd32(src)-before;for(u32 q=8;q<0x180;q+=4)sum+=*(u32*)(g_page+q);*(u32*)g_page=sum;*(u32*)(g_page+4)=0u-sum;
}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);}}
static u32 ko_colors(void){u32 a=ko_names()+34u*g_cfg.cat_n+8u;return ko_le32(a)==0x314b5043u?a+4u:0;}
static const char *ko_color_name(void){static const char *const names[]={"\200\222\200\311\200\324","\200\317\200\205","\200\314\201\271","\200\307\200\256","\201\250\200\257","\201\261\200\234\200\324","\200\302\201\247","\201\231\200\266","\200\231\200\257","\201\222\201\275","\200\357\200\314\201\271","\200\357\200\307\200\256","\200\357\201\261\200\234","\200\357\200\251","\201\241\200\274","\201\261\200\350","\201\276\200\324"};return names[g_chr_color+1];}
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;u32 mask=at+2u*w*h,pal=ko_colors();int colored=g_chr_color>=0&&pal&&ko_le32(mask)==0x314b534du;
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++){u32 n=y*w+x;const volatile u8 *p=fl(at+2u*n);u32 c=p[0]|((u32)p[1]<<8);if(c==0xf81fu)continue;
if(colored){u32 index=(fl(mask+4u+(n>>1))[0]>>((n&1u)*4u))&15u;if(index<8u){p=fl(pal+16u*(u32)g_chr_color+2u*index);c=p[0]|((u32)p[1]<<8);}}
rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);
}
}
static void chr_pick(void){
static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u;
u32 sel=0, top=0;
chr_build(st_list[si]);
for(;;){
if(!g_chrn){ message("\201\223\200\267\201\231 \200\342\200\363","\201\253\200\377 ROM\200\344",""); return; }
if(!g_chrn){ message("\201\236\200\273\201\244 \200\353\200\375","\201\267\201\211 ROM\200\355",""); return; }
if(sel>=g_chrn) sel=g_chrn-1u;
if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u;
char t[64]; const char *a="\200\235\200\270: "; int k=0; while(a[k]){ t[k]=a[k]; k++; } const char *b=stage_name(st_list[si]); int j=0; while(b[j]) t[k++]=b[j++]; t[k]=0;
list_draw(t, g_chrn, sel, top, chr_row, "A \200\236\200\213 B \200\316\201\230 C \200\250\200\261");
char t[64]; const char *a="\200\236\200\275: "; int k=0; while(a[k]){ t[k]=a[k]; k++; } const char *b=stage_name(st_list[si]); int j=0; while(b[j]) t[k++]=b[j++]; t[k]=0;
list_draw(t, g_chrn, sel, top, chr_row, "A \200\237\200\213 B \200\326\201\243 C \200\252\200\265");
wait_release();
for(;;){
int c=input();
@@ -1503,28 +1522,29 @@ static void chr_pick(void){
if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; }
if(c==K_BACK) return;
if(c==K_OK){
u32 nw=0,st=0,old=t_id();int accepted=0,back=0;
u32 nw=0,st=0,old=t_id();int accepted=0,back=0,colorMode=0;
g_chr_color=g_set[g_cfg.tama_off+0x19u]&31u;if(g_chr_color>15)g_chr_color=-1;
while(!accepted&&!back){
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(93,stage_name(st),GREY,1);ctext(105,"\201\262 \200\365\201\202 \200\235\200\363",GREY,1);ctext(117,"B \200\300\200\212 C \200\273\200\262",GREY,1);show();wait_release();
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
ctext(93,ko_color_name(),GREY,1);ctext(105,colorMode?"\201\300 \200\324\200\322 A \200\377\200\245":"\201\300 \200\377\200\245 A \200\324\200\322",GREY,1);ctext(117,"B \200\306\200\212 C \200\300\200\266",GREY,1);show();wait_release();
for(;;){int key=input();if(key==K_A){colorMode=!colorMode;break;}if(key==1){if(colorMode){g_chr_color+=g_step;if(g_chr_color>15)g_chr_color=-1;if(g_chr_color< -1)g_chr_color=15;break;}int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
}
if(!accepted)break;
u32 to=g_cfg.tama_off;
#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(!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\236\200\275\200\214\201\235 \200\353\200\375","\200\306\200\212\201\261\201\224 \200\345\200\347\200\340\200\235\200\236",""); 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);
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|(g_chr_color<0?31u:(u32)g_chr_color));
#ifdef FELD_TAMA_ANY
#else
if(old && old!=nw) tama_files(old, nw);
#endif
set_write("\200\235\200\270\200\214\201\222 \200\300\200\212\200\246");
set_write("\200\236\200\275\200\214\201\235 \200\306\200\212\200\247");
return;
}
}
@@ -1533,9 +1553,9 @@ static void chr_pick(void){
static void level_edit(void){
u32 v=lv_get(), old=v;
for(;;){
rect(0,0,128,128,BG); ctext(10,"\201\252\200\320 \200\257\200\277",GOLD,1);
rect(0,0,128,128,BG); ctext(10,"\201\266\200\330 \200\263\200\305",GOLD,1);
char s[4]; utoa_(v,s); ctext(40,s,WHITE,4);
ctext(80,"\201\262 \200\257\200\277 \200\300\200\212",GREY,1); ctext(94,"B \201\256\200\366 C \200\250\200\261",GREY,1); show(); wait_release();
ctext(80,"\201\300 \200\263\200\305 \200\306\200\212",GREY,1); ctext(94,"B \201\273\201\200 C \200\252\200\265",GREY,1); show(); wait_release();
for(;;){
int k=input();
if(k==1){ int nv=(int)v+(g_step>0?1:-1); if(nv<0) nv=0; if(nv>10) nv=10; v=(u32)nv; break; }
@@ -1546,33 +1566,33 @@ static void level_edit(void){
u32 o=g_cfg.level_off, b=g_set[o];
/* up: the game celebrates the new level itself; down: nothing to celebrate */
g_set[o]=(u8)(v>old ? ((b&0xF0u)|v) : ((v<<4)|v));
set_write("\200\257\200\277 \201\200\200\376 \200\352\200\263");
set_write("\200\263\200\305 \201\212\201\210 \200\364\200\267");
return;
}
}
}
}
static void care_full(void){
rect(0,0,128,128,BG); ctext(24,"\200\243\200\304 \201\260\200\302",WHITE,1); ctext(40,"\200\276\200\305\200\265\200\200\201\252\200\302\200\200\200\210\200\205",GOLD,1);
ctext(70,"\200\303\201\215\200\201 \200\377\200\331\200\374\200\247\200\234\200\235",GREY,1); ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\234\200\353",GREY,1); show();
rect(0,0,128,128,BG); ctext(24,"\200\244\200\312 \201\276\200\310",WHITE,1); ctext(40,"\200\304\200\313\200\271\200\200\201\266\200\310\200\200\200\210\200\205",GOLD,1);
ctext(70,"\200\311\201\230\200\201 \201\211\200\341\201\206\200\250\200\235\200\236",GREY,1); ctext(92,"B \200\361",WHITE,1); ctext(106,"C \200\344\200\235\200\365",GREY,1); show();
if(!yes_no()) return;
u32 to=g_cfg.tama_off;
g_set[to+0x1Cu]=6u; g_set[to+0x1Du]=20u; g_set[to+0x10u]=0u;
set_write("\200\243\200\304 \201\260\200\302 \200\352\200\263");
set_write("\200\244\200\312 \201\276\200\310 \200\364\200\267");
}
static void big_entry(int y, int sel, const char *name, const char *st, u16 c, u16 stc);
static void tama_menu(void){
if(set_check_msg()) return;
u32 sel=0;
for(;;){
rect(0,0,128,128,BG); ctext(2,"\200\235\200\270\200\214\201\222",WHITE,1);
rect(0,0,128,128,BG); ctext(2,"\200\236\200\275\200\214\201\235",WHITE,1);
char st[64], nm[64]; nm[0]=0;
utoa_(lv_get(),st); big_entry(12,sel==0,"\200\257\200\277",st,GOLD,GREY);
utoa_(lv_get(),st); big_entry(12,sel==0,"\200\263\200\305",st,GOLD,GREY);
{ u32 id=t_id(); int k=cat_find(id); if(k>=0 && fl(g_cfg.cat_off+8u+28u*(u32)k+2u)[0]==2u) chr_name((u32)k,nm); else utoa_(id,nm); }
big_entry(41,sel==1,"\200\300\200\212",nm,PINK,GREY);
{ u32 to=g_cfg.tama_off; char *p=st; const char *a="\200\276\200\305\200\265 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Cu],p); while(*p) p++; a=" \201\252\200\302 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Du],p); while(*p) p++; if(g_set[to+0x10u]){ a=" \200\334\201\243"; while(*a) *p++=*a++; } *p=0; }
big_entry(70,sel==2,"\200\243\200\304",st,ORANGE,GREY);
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1);
big_entry(41,sel==1,"\200\306\200\212",nm,PINK,GREY);
{ u32 to=g_cfg.tama_off; char *p=st; const char *a="\200\304\200\313\200\271 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Cu],p); while(*p) p++; a=" \201\266\200\310 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Du],p); while(*p) p++; if(g_set[to+0x10u]){ a=" \200\344\201\257"; while(*a) *p++=*a++; } *p=0; }
big_entry(70,sel==2,"\200\244\200\312",st,ORANGE,GREY);
ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1);
show(); wait_release();
for(;;){
int k=input();
@@ -1614,9 +1634,9 @@ static void saves_scan(void){
static u32 field_pick(void){ /* field for a new game, 0xFF = back */
u32 nf=nfields(), sel=0;
for(;;){
rect(0,0,128,128,BG); ctext(2,"\200\331\200\374\201\247 \201\211\200\345",WHITE,1);
rect(0,0,128,128,BG); ctext(2,"\200\341\201\206\201\263 \201\224\200\356",WHITE,1);
for(u32 i=0;i<nf;i++){ int y=14+(int)i*16; if(i==sel){ rect(1,y,127,y+15,fcol(i)); rect(2,y+1,126,y+14,BG); } text(5,y+4,fname(i),fcol(i),1); }
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1); show(); wait_release();
ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1); show(); wait_release();
for(;;){ int k=input();
if(k==1){ sel=(u32)((int)sel+(g_step>0?1:-1)+(int)nf)%nf; break; }
if(k==K_A){ sel=(sel+1u)%nf; break; }
@@ -1630,24 +1650,24 @@ static void saves_menu(int with_app, int top){
u32 na = with_app ? (g_napp>1u ? 1u : g_napp) : 0u, n=ns+na, sel = na ? ns : (u32)g_act;
for(;;){
rect(0,0,128,128,BG);
if(n<=4u) ctext(2, top ? "PARAMIX" : "\201\200\200\376 \200\273\200\262", WHITE,1);
if(n<=4u) ctext(2, top ? "PARAMIX" : "\201\212\201\210 \200\300\200\266", WHITE,1);
for(u32 i=0;i<n;i++){
char nm[12], st[48]; u16 c=ORANGE, stc=GREY;
if(i<ns){
const char *a="\201\200\200\376 "; int k=0; while(a[k]){ nm[k]=a[k]; k++; } nm[k++]=(char)('1'+i); nm[k]=0;
const char *a="\201\212\201\210 "; int k=0; while(a[k]){ nm[k]=a[k]; k++; } nm[k++]=(char)('1'+i); nm[k]=0;
int f=g_sfld[i]; char *p=st;
if((int)i!=g_act && !slot_valid(i)){ const char *e="\200\310\200\340 \200\372\200\363"; while(*e) *p++=*e++; c=GREY; }
if((int)i!=g_act && !slot_valid(i)){ const char *e="\200\316\200\351 \201\204\200\375"; while(*e) *p++=*e++; c=GREY; }
else if(n>4u && g_snm[i][0]){ for(int q=0;g_snm[i][q];q++) *p++=g_snm[i][q]; if(f>=0) c=fcol((u32)f); } /* compact: the Tama, field by colour */
else { const char *e=f>=0 ? fname((u32)f) : "?"; while(*e) *p++=*e++; if(g_snm[i][0]){ *p++=' '; for(int q=0;g_snm[i][q];q++) *p++=g_snm[i][q]; } if(f>=0) c=fcol((u32)f); }
*p=0; if((int)i==g_act) stc=WHITE;
} else { const char *e=g_napp>1u ? "\201\241\200\261\200\217\200\254" : g_appnm[0]; int k=0; while(e[k] && k<11){ nm[k]=e[k]; k++; } nm[k]=0; e=g_napp>1u?"\200\316\201\230":"\200\331\200\374"; int q=0; while(e[q]){ st[q]=e[q]; q++; } st[q]=0; }
} else { const char *e=g_napp>1u ? "\201\255\200\265\200\217\200\260" : g_appnm[0]; int k=0; while(e[k] && k<11){ nm[k]=e[k]; k++; } nm[k]=0; e=g_napp>1u?"\200\326\201\243":"\200\341\201\206"; int q=0; while(e[q]){ st[q]=e[q]; q++; } st[q]=0; }
if(n>4u){
int y=2+(int)i*16;
if(i==sel){ rect(1,y,127,y+15,c); rect(2,y+1,126,y+14,BG); }
text(5,y+4,nm,c,1); int w=text_w(st,1); int x=123-w; if(x<48) x=48; textn(x,y+4,st,(124-x)/6,stc,1);
} else big_entry((n<4u?12:1)+(int)i*29, i==sel, nm, st, c, stc);
}
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1);
ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1);
show(); wait_release();
for(;;){
int k=input();
@@ -1658,14 +1678,14 @@ static void saves_menu(int with_app, int top){
if(sel>=ns){ if(g_napp>1u) apps_menu(0); else start_app_i(0); break; }
if((int)sel==g_act){ if(top) leave(); return; }
int has=slot_valid(sel); u32 fld;
if(has){ fld=(u32)g_sfld[sel]; if(g_sfld[sel]<0){ message("\201\200\200\376","\200\367\200\222 \200\333\201\235",""); break; } }
if(has){ fld=(u32)g_sfld[sel]; if(g_sfld[sel]<0){ message("\201\212\201\210","\201\201\200\222 \200\343\201\251",""); break; } }
else { fld=field_pick(); if(fld==0xFFu) break; }
rect(0,0,128,128,BG);
char t[8]="\201\200\200\376 "; t[5]=(char)('1'+sel); t[6]=0;
ctext(14, has ? "\200\307\200\256\200\350\200\222" : "\200\314 \200\211\200\370 \201\211\200\345", WHITE,1); ctext(28,t,WHITE,2);
char t[8]="\201\212\201\210 "; t[5]=(char)('1'+sel); t[6]=0;
ctext(14, has ? "\200\315\200\262\200\362\200\222" : "\200\323 \200\211\201\202 \201\224\200\356", WHITE,1); ctext(28,t,WHITE,2);
ctext(52,fname(fld),fcol(fld),1); if(has && g_snm[sel][0]) ctext(64,g_snm[sel],GREY,1);
ctext(80,"\200\222\201\207 \201\200\200\376 \200\357\201\211",GREY,1);
ctext(96,"B \200\347",WHITE,1); ctext(108,"C \200\334\200\234\200\353",GREY,1); show();
ctext(80,"\200\222\201\221 \201\212\201\210 \200\371\201\224",GREY,1);
ctext(96,"B \200\361",WHITE,1); ctext(108,"C \200\344\200\235\200\365",GREY,1); show();
if(yes_no()) field_switch2(sel, has, fld);
break;
}
@@ -1685,15 +1705,15 @@ static void main_menu(void){
for(;;){
set_load();
ko_surface();
ctext(4,"\201\222\201\234 \200\271\200\231",RGB(255,255,255),1);
ctext(4,"\201\235\201\247 \200\276\200\232",RGB(255,255,255),1);
for(u32 i=0;i<n;i++){
const char *label;
switch(kinds[i]){case 0:label="\201\211\200\345\200\215 \201\200\200\376";break;case 1:label="\200\334\200\365\201\232";break;case 2:label="\200\235\200\270\201\237\200\366\201\234";break;case 4:label="\200\235\200\270\200\214\201\222";break;default:label="\201\241\200\261\200\217\200\254";}
switch(kinds[i]){case 0:label="\201\224\200\356\200\215 \201\212\201\210";break;case 1:label="\200\344\200\377\201\245";break;case 2:label="\200\236\200\275\201\253\201\200\201\247";break;case 4:label="\200\236\200\275\200\214\201\235";break;default:label="\201\255\200\265\200\217\200\260";}
int y=24+(int)i*17;
ko_row(y-2,i==sel);
text(14,y,label,WHITE,1);
}
ctext(117,"A \200\365\200\244 B \200\316\201\230 C \200\250\200\261",RGB(255,255,255),1);
ctext(117,"A \200\377\200\245 B \200\326\201\243 C \200\252\200\265",RGB(255,255,255),1);
show(); wait_release();
for(;;){
int k=input();
@@ -1751,18 +1771,18 @@ static void run(void){
/* the game itself moved the Tama to this field (1.6.8): an older save of the field is still stored */
if(fields && !saves_mode() && slot_valid((u32)g_cur) && rd32(slot_base((u32)g_cur)+28u)!=PEND_MAGIC){
rect(0,0,128,128,BG);
ctext(10,"\200\235\200\270\200\214\201\222 \200\365\200\244 \201\211\200\345",WHITE,1); ctext(22,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(34,"\200\211\200\370\200\344\200\315 \200\365\200\244\201\250",WHITE,1);
ctext(52,"\200\365\201\202 \201\211\200\345\200\364",GREY,1); ctext(64,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(76,"\201\200\200\376\200\365 \200\230\200\334 \200\372\200\363",GREY,1);
ctext(96,"B \200\312\201\205",WHITE,1); ctext(108,"C \200\357\201\211",GREY,1);
ctext(10,"\200\236\200\275\200\214\201\235 \200\377\200\245 \201\224\200\356",WHITE,1); ctext(22,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(34,"\200\211\201\202\200\355\200\325 \200\377\200\245\201\264",WHITE,1);
ctext(52,"\200\377\201\214 \201\224\200\356\200\376",GREY,1); ctext(64,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(76,"\201\212\201\210\200\377 \200\230\200\344 \201\204\200\375",GREY,1);
ctext(96,"B \200\321\201\217",WHITE,1); ctext(108,"C \200\371\201\224",GREY,1);
show();
if(yes_no()) erase_page(slot_base((u32)g_cur));
}
/* interrupted switch? */
else if(fields && slot_valid((u32)g_act) && (!saves_mode() || rd32(slot_base((u32)g_act)+28u)==PEND_MAGIC)){
rect(0,0,128,128,BG);
ctext(14,"\201\202\201\257 \200\374\200\341\200\365",RED,1); ctext(26,"\201\210\200\236\200\245\200\343\200\330\200\234\200\235",RED,1);
ctext(48,"\201\200\200\376\200\362 \200\302\200\356\201\247\200\223\200\353",WHITE,1); ctext(60,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(72,"?",WHITE,1);
ctext(96,"B \200\347",WHITE,1); ctext(108,"C \200\334\200\234\200\353",GREY,1);
ctext(14,"\201\214\201\274 \201\206\200\352\200\377",RED,1); ctext(26,"\201\223\200\237\200\246\200\354\200\340\200\235\200\236",RED,1);
ctext(48,"\201\212\201\210\200\374 \200\310\200\370\201\263\200\223\200\365",WHITE,1); ctext(60,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(72,"?",WHITE,1);
ctext(96,"B \200\361",WHITE,1); ctext(108,"C \200\344\200\235\200\365",GREY,1);
show();
if(!yes_no()) leave();
rect(0,0,128,128,BG); show();
@@ -1774,7 +1794,7 @@ static void run(void){
#ifdef FELD_CLEAN
if(clean_mode() && !clk_now() && CLK_ASK()) clock_menu(1); /* new batteries: the time first */
#endif
while(!g_napp) message("\201\241\200\261\200\217\200\254 \200\342\200\363","\201\253\200\377 ROM\200\344","");
while(!g_napp) message("\201\255\200\265\200\217\200\260 \200\353\200\375","\201\267\201\211 ROM\200\355","");
apps_menu(1);
}
if(g_cfg.flags & (F_BAG|F_TAMA)) main_menu();
+10 -3
View File
@@ -4,7 +4,7 @@ static void verify_character_genes(void){
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);
assert(slot);assert(ghost_rd32(tab)==0x314b5047u);g_chr_color=-1;
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);
@@ -12,8 +12,15 @@ static void verify_character_genes(void){
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(tama_files(id,id)==1);assert(!memcmp(host_flash+slot,host_flash+src,len));
for(int color=0;color<16;color++){
memcpy(host_flash+slot,before+slot,0x4000);g_chr_color=color;assert(tama_files(old,id)==1);assert(host_flash[slot+16]==color);
assert(!memcmp(host_flash+slot+0x140,fl(ko_colors()+color*16),16));assert(!memcmp(host_flash+slot+0x160,fl(ko_colors()+color*16),16));
assert(!memcmp(host_flash+slot+0x150,fl(src+0x150),16));assert(!memcmp(host_flash+slot+0x170,fl(src+0x170),16));assert(!memcmp(host_flash+slot+0x600,fl(src+0x600),len-0x600));
u32 sum=0;for(u32 j=8;j<0x180;j+=4)sum+=rd32(slot+j);for(u32 j=0x600;j<len;j+=4)sum+=rd32(slot+j);assert(rd32(slot)==sum&&rd32(slot+4)==0u-sum);
}
assert(!memcmp(host_flash,before,slot));assert(!memcmp(host_flash+slot+0x4000,before+slot+0x4000,0x1000000-slot-0x4000));g_chr_color=-1;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);
printf("PASS: %u characters with original and 16 native colors, checksums, all nine names, eye sprites, composite frames, same-ID repair and unchanged friends\n",count);
}
+4
View File
@@ -47,6 +47,10 @@ int main(int argc,char **argv){
// list and reopening must keep the item selected in the picture screen.
char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc");
proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000));
// Color mode changes the preview and writes the selected native palette.
proof("color-cancel",chr_pick,"banncc");assert(!memcmp(snapshot,g_set,PAGE));assert(!memcmp(flash_snapshot,host_flash,0x1000000));
proof("color-select",chr_pick,"bannnnnnnnb");assert((g_set[g_cfg.tama_off+0x19]&31)==7);
memcpy(host_flash,flash_snapshot,0x1000000);memcpy(g_set,snapshot,PAGE);
// 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);
+4
View File
@@ -47,6 +47,10 @@ int main(int argc,char **argv){
// list and reopening must keep the item selected in the picture screen.
char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc");
proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000));
// Color mode changes the preview and writes the selected native palette.
proof("color-cancel",chr_pick,"banncc");assert(!memcmp(snapshot,g_set,PAGE));assert(!memcmp(flash_snapshot,host_flash,0x1000000));
proof("color-select",chr_pick,"bannnnnnnnb");assert((g_set[g_cfg.tama_off+0x19]&31)==7);
memcpy(host_flash,flash_snapshot,0x1000000);memcpy(g_set,snapshot,PAGE);
// 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);
+4
View File
@@ -47,6 +47,10 @@ int main(int argc,char **argv){
// list and reopening must keep the item selected in the picture screen.
char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc");
proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000));
// Color mode changes the preview and writes the selected native palette.
proof("color-cancel",chr_pick,"banncc");assert(!memcmp(snapshot,g_set,PAGE));assert(!memcmp(flash_snapshot,host_flash,0x1000000));
proof("color-select",chr_pick,"bannnnnnnnb");assert((g_set[g_cfg.tama_off+0x19]&31)==7);
memcpy(host_flash,flash_snapshot,0x1000000);memcpy(g_set,snapshot,PAGE);
// 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);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB