Refine product copy and native Korean menu with lossless character previews
Paramix Studio / build (push) Canceled after 0s
Paramix Studio / pages (push) Canceled after 0s

This commit is contained in:
syskiller committed 2026-11-10 23:07:24 +09:00
1 parent 5e3303cba8
commit dbe2c1f41f
30 files changed
+342 -282

No files matched your search

+4 -5
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 180
#define KO_GLYPHS 179
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}, /* 가 */
@@ -29,6 +29,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{129,32,72,26,4,253,0,7,241,4,127,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}, /* 늘 */
{129,32,72,18,4,129,32,72,19,228,1,0,0}, /* 니 */
{249,32,72,18,4,129,160,72,19,228,1,0,0}, /* 다 */
{249,32,72,26,4,249,0,68,1,0,127,0,0}, /* 단 */
@@ -45,7 +46,6 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{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}, /* 때 */
{250,130,175,186,10,250,128,164,1,0,127,128,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}, /* 러 */
@@ -89,7 +89,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{8,5,6,48,32,255,128,4,1,0,127,0,0}, /* 손 */
{8,5,2,33,4,0,63,224,128,32,8,0,0}, /* 수 */
{8,5,6,48,0,255,130,0,128,80,99,0,0}, /* 숫 */
{8,2,1,64,136,65,0,0,3,254,0,0,0}, /* 스 */
{8,5,6,48,0,255,130,7,240,136,127,0,0}, /* 숲 */
{8,5,6,48,0,255,144,71,241,4,127,0,0}, /* 습 */
{33,8,66,16,132,81,20,72,146,36,1,0,0}, /* 시 */
{33,8,66,17,68,137,0,7,240,4,1,0,0}, /* 식 */
@@ -112,9 +112,9 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{62,16,68,17,4,62,8,130,35,254,0,0,0}, /* 요 */
{62,16,67,224,136,255,128,3,225,4,62,0,0}, /* 용 */
{62,16,67,224,0,255,130,4,129,0,127,0,0}, /* 운 */
{113,34,72,145,196,1,63,66,16,156,33,0,0}, /* 워 */
{113,34,71,19,244,39,8,68,1,0,127,0,0}, /* 원 */
{62,16,68,16,248,0,63,226,32,136,34,0,0}, /* 유 */
{62,16,67,224,0,255,136,135,240,4,1,0,0}, /* 육 */
{62,16,68,17,4,62,0,0,3,254,0,0,0}, /* 으 */
{62,16,67,227,254,0,31,193,241,128,127,0,0}, /* 을 */
{62,16,67,224,0,255,128,7,241,4,127,0,0}, /* 음 */
@@ -149,7 +149,6 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{8,31,192,128,80,99,0,15,248,32,8,0,0}, /* 추 */
{33,62,69,18,36,1,63,66,16,132,33,0,0}, /* 취 */
{113,0,79,144,132,33,20,69,18,36,1,0,0}, /* 치 */
{249,2,64,147,228,17,132,66,19,4,1,0,0}, /* 카 */
{250,130,160,171,234,19,132,162,43,10,2,128,0}, /* 캐 */
{249,2,79,240,68,225,31,193,241,128,127,0,0}, /* 컬 */
{127,0,64,17,252,1,2,64,131,254,0,0,0}, /* 코 */
+7 -8
View File
@@ -27,6 +27,7 @@
"남",
"뉴",
"는",
"늘",
"니",
"다",
"단",
@@ -43,7 +44,6 @@
"드",
"득",
"때",
"랜",
"램",
"량",
"러",
@@ -87,7 +87,7 @@
"손",
"수",
"숫",
"스",
"숲",
"습",
"시",
"식",
@@ -110,9 +110,9 @@
"요",
"용",
"운",
"워",
"원",
"유",
"육",
"으",
"을",
"음",
@@ -147,7 +147,6 @@
"추",
"취",
"치",
"카",
"캐",
"컬",
"코",
@@ -319,10 +318,10 @@
"NO PROGRAMS": "프로그램 없음"
},
"fields": {
"LAND": "랜드",
"WATER": "워터",
"SKY": "스카이",
"FOREST": "포레스트",
"LAND": "육지",
"WATER": "수중",
"SKY": "하늘",
"FOREST": "숲",
"TROPICAL": "트로피컬",
"GLACIER": "글레이셔"
}
+119 -114
View File
@@ -203,7 +203,7 @@ static void ctext(int y,const char *s,u16 c,int sc){ text((128-text_w(s,sc))/2,y
static void show(void){ hw_push(g_fb,128,0,0,128,128); }
static void utoa_(u32 v, char *s){ char t[12]; int n=0; do{ t[n++]=(char)('0'+v%10u); v/=10u; }while(v); for(int i=0;i<n;i++) s[i]=t[n-1-i]; s[n]=0; }
#define BG RGB(246,247,221)
#define BG RGB(248,252,255)
#define WHITE RGB(33,48,72)
#define GREY RGB(75,96,108)
#define RED RGB(255,80,80)
@@ -213,11 +213,11 @@ 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\253\200\250";}
{const char *a="WATER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\356\201\232";}
{const char *a="SKY";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\327\201\223\200\365";}
{const char *a="FOREST";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\240\200\257\200\327\201\235";}
{const char *a="TROPICAL";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\235\200\261\201\245\201\225";}
{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";}
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]); }
@@ -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\257\200\366 \201\210", tot+i+1u, tot*2u);
progress("\201\256\200\366 \201\210", 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;
@@ -523,17 +523,17 @@ 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\226\200\250 00"; s[5]=(char)('0'+code/10); s[6]=(char)('0'+code%10);
char s[12]="\201\225\200\251 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\242\200\334\200\201\200\222",GREY,1);
ctext(84,"B/C \200\243\200\334\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\247\200\261",GREY,1);
ctext(100,"C \200\250\200\261",GREY,1);
show(); wait_release();
for(;;){ int k=input(); if(k==K_OK||k==K_BACK) return; }
}
@@ -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\242\200\261\200\217\200\254","T7EMU","T18EMU"};
static const char *const g_appname[6]={"","DOOM","TAMAEMU","\201\241\200\261\200\217\200\254","T7EMU","T18EMU"};
static void start_app(void){
rect(0,0,128,128,0); show();
#ifdef HOST
@@ -605,7 +605,7 @@ static void apps_detect(void){
}
#endif
if((g_cfg.flags & 16u) && g_cfg.version>=7u && g_cfg.dl_src>=0x10000000u && g_cfg.dl_src<0x11000000u){
const char *d="\200\234\200\355\200\261\200\250"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0;
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;
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\234\200\266\200\321\200\353",WHITE,1); ctext(20,"\201\202\200\357\200\362 \200\360\201\211\201\246\200\321\200\353",GREY,1); show();
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();
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\260 \200\236\200\313",WHITE,1);
ctext(14,"\201\202\201\257 \200\237\200\313",WHITE,1);
ctext(30,fname(tgt),fcol(tgt),2);
ctext(54, has ? "\200\301\200\216\201\247 \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\233\200\234" : "\200\314\200\261 \200\331\200\374\201\252\200\233\200\234", WHITE,1);
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\233\200\353",GREY,1);
ctext(106,"C \200\334\200\234\200\353",GREY,1);
show();
return yes_no();
}
@@ -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\256\200\272" : "\200\323\200\266\200\200\201\256\200\272")
#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")
#else
#define SX_TEXT "\200\323\200\266\200\200\201\256\200\272"
#define SX_TEXT "\200\323\200\266\200\200\201\255\200\272"
#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\242\200\261\200\217\200\254",WHITE,1);
if(n<4u) ctext(2, launch_mode() ? "PARAMIX" : "\201\241\200\261\200\217\200\254",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;
@@ -865,7 +865,7 @@ static void apps_menu(int top){
}
else
#endif
ctext(117, top && launch_mode() ? "B \200\331\200\374" : "B \201\257\200\366 C \200\247\200\261",GREY,1);
ctext(117, top && launch_mode() ? "B \200\331\200\374" : "B \201\256\200\366 C \200\250\200\261",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(;;){
@@ -890,8 +890,8 @@ static void field_menu(int with_app, int top){
int y0 = n>=4u ? 1 : 12;
if(n<4u) ctext(2, top ? "PARAMIX" : "\201\211\200\345", WHITE,1);
for(u32 i=0;i<n;i++){
const char *nm = i<nf ? fname(i) : g_napp>1u ? "\201\242\200\261\200\217\200\254" : g_appnm[0];
const char *st = i>=nf ? (g_napp>1u ? "\200\316\201\231" : "\200\331\200\374") : ((int)i==g_cur) ? "\200\311\200\354 \201\210" : has[i] ? "\201\200\200\376\200\245" : "\200\314\200\261";
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";
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\257\200\366 C \200\247\200\261",GREY,1);
ctext(117,"B \201\256\200\366 C \200\250\200\261",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\240\200\365\201\232\200\201","\200\324\200\313\200\244\200\343\200\330\200\233\200\234","\200\300\200\212\201\246\201\211 \200\335\200\337\200\330\200\233\200\234"); return 1; }
if(e==2){ message("\201\200\200\376 \200\240\200\365\201\232 \200\342\200\363","\201\206\200\221 \201\243\200\257\200\365\201\247 \200\247","\200\234\200\331 \200\331\200\241\201\246\200\321\200\353"); return 1; }
if(e){ message("\201\200\200\376 \201\255\200\332\200\362","\200\336 \200\325 \200\342\200\330\200\233\200\234",""); return 1; }
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; }
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\357\200\362 \200\360\201\211\201\246\200\321\200\353",GREY,1); show();
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();
stamp(g_set);
flash_prog4k(SET_A, g_set);
flash_prog4k(SET_B, g_set);
@@ -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\263 \200\300\200\212",GREY,1);
ctext(96,"A \200\234\200\363 B \201\200\200\376",GREY,1);
if(!must) ctext(108,"C \200\247\200\261",GREY,1);
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);
show(); wait_release();
for(;;){
int k=input();
@@ -1054,11 +1054,11 @@ static void lset_clean(void){
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\256\200\272", g_idle_nm[idl], ORANGE, WHITE);
text(9,84,"\201\256\200\272 \200\224\201\212",GREY,1);
text(9,94,"\200\371\200\260\200\365 \200\342\200\362 \200\252",GREY,1);
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\262 \200\247\200\261",GREY,1);
ctext(117,"C \201\200\200\376 \201\261 \200\250\200\261",GREY,1);
show(); wait_release();
for(;;){
int c=input();
@@ -1082,7 +1082,7 @@ 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\234","\201\227\200\211"};
static const char *const snd_nm[4]={"\200\226","\200\374\200\211","\200\301\201\233","\201\226\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;
@@ -1090,12 +1090,12 @@ static void lset_menu(void){
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\256\200\272", g_idle_nm[idl], ORANGE, WHITE);
text(9,74,"\200\323\200\266: \200\303\201\237 \201\201\200\354",GREY,1);
text(9,84,"\201\256\200\272: \200\365 \200\271\200\231\200\344\200\315",GREY,1);
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\262 \200\247\200\261",GREY,1);
ctext(117,"C \201\200\200\376 \201\261 \200\250\200\261",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\357\200\362 \200\360\201\211\201\246\200\321\200\353",GREY,1); show();
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();
stamp(g_set);
flash_prog4k(SET_A, g_set);
flash_prog4k(SET_B, g_set);
@@ -1272,24 +1272,26 @@ 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\241"; default: return "\200\222\201\230"; } }
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"; } }
/* 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));}
static void ko_row(int y,int selected){rect(5,y+2,123,y+14,RGB(18,96,136));rect(3,y+3,125,y+11,RGB(255,255,255));rect(5,y+1,123,y+13,RGB(255,255,255));rect(7,y,121,y+14,RGB(255,255,255));if(selected)for(int x=0;x<5;x++)rect(5+x,y+3+x,6+x,y+11-x,RGB(224,80,152));}
static void list_draw(const char *title, u32 n, u32 sel, u32 top, int (*row)(u32 i, char *name, char *right, u16 *col), const char *foot){
rect(0,0,128,128,BG);
ctext(2,title,WHITE,1);
for(u32 r=0;r<8u && top+r<n;r++){
u32 i=top+r; int y=16+(int)r*12;
ko_surface();
ctext(4,title,RGB(255,255,255),1);
for(u32 r=0;r<6u && top+r<n;r++){
u32 i=top+r; int y=23+(int)r*15;
char nm[64], rt[8]; u16 c=WHITE; nm[0]=0; rt[0]=0;
row(i,nm,rt,&c);
if(i==sel) rect(0,y-1,128,y+10,RGB(205,225,169));
ko_row(y-2,i==sel);
int rw=text_w(rt,1);
int maxc = (122-rw)/6;
textn(3,y,nm,maxc,c,1);
text(125-rw,y,rt,GREY,1);
int maxc = (111-rw)/6;
textn(13,y,nm,maxc,c,1);
text(120-rw,y,rt,GREY,1);
}
if(n>8u){ int h=96*8/(int)n; if(h<6) h=6; int y=16+(int)(96-h)*(int)top/(int)(n-8u); rect(126,y,128,y+h,GREY); }
ctext(118,foot,GREY,1);
if(n>6u){ int h=90*6/(int)n; if(h<6) h=6; int y=21+(int)(90-h)*(int)top/(int)(n-6u); rect(126,y,128,y+h,GREY); }
ctext(117,foot,RGB(255,255,255),1);
show();
}
@@ -1305,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\233 \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\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; }
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;
@@ -1329,7 +1331,7 @@ static u32 count_choose(u32 id,u32 v,u32 lo,u32 hi,int adding){
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\263 \200\325\200\255 \201\206\201\203",GREY,1);ctext(117,"B \201\257\200\366 C \200\273\200\262",GREY,1);show();wait_release();
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();
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;}
@@ -1343,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\236 15\200\206 \200\301\200\360","\200\237 \201\220\200\201\201\250 \200\325 \200\342\200\330\200\233\200\234","");return 16u;}
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;}
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\233 \200\273\200\262 \200\342\200\363","\201\254\200\377 ROM\200\344",""); return; }
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; }
u32 sel=0, top=0;
for(;;){
if(sel<top) top=sel; if(sel>=top+8u) top=sel-7u;
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\231 C \200\247\200\261");
list_draw(t, g_catn, sel, top, cat_row, "A \200\306\200\264 B \200\316\201\230 C \200\250\200\261");
wait_release();
for(;;){
int c=input();
@@ -1364,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\251 \201\214","",""); return; }
if(slot>=640u){ message("\200\201\200\275\200\365 \200\201\200\252 \201\214","",""); 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; }
@@ -1384,8 +1386,8 @@ static void items_menu(void){
for(;;){
bag_build();
u32 n=g_bagn+1u; if(sel>=n) sel=n-1u;
if(sel<top) top=sel; if(sel>=top+8u) top=sel-7u;
list_draw("\200\334\200\365\201\233", n, sel, top, bag_row, "B \201\237\201\213 C \200\247\200\261");
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");
wait_release();
for(;;){
int c=input();
@@ -1402,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\250\200\223\200\353?",WHITE,1); ctext(60,"\200\303\201\215\200\201 \200\377\200\331\200\374\200\246\200\233\200\234",GREY,1);
ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\233\200\353",GREY,1); show();
if(yes_no()) set_write("\200\334\200\365\201\233 \201\200\200\376 \200\352\200\263");
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");
return;
}
}
@@ -1417,14 +1419,14 @@ static void points_menu(void){
int pos=0;
for(;;){
rect(0,0,128,128,BG);
ctext(10,"\200\234\200\270\201\240\200\366\201\235",GOLD,1);
ctext(10,"\200\235\200\270\201\237\200\366\201\234",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(60,60,110));
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\263 \200\326\200\373 \200\300\200\212",GREY,1);
ctext(92,"B \200\234\200\363 A \200\365\201\202",GREY,1);
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);
show(); wait_release();
for(;;){
@@ -1436,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\240\200\366\201\235 \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\246\200\233\200\234",GREY,1);
ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\233\200\353",GREY,1); show();
if(yes_no()){ money_put(nv); set_write("\201\240\200\366\201\235 \201\200\200\376 \200\352\200\263"); }
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"); }
return;
}
}
@@ -1452,14 +1454,14 @@ 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\360\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\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 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;}
static int chr_row(u32 i, char *name, char *right, u16 *col){
u32 k=g_chr[i], o=g_cfg.cat_off+8u+28u*k; chr_name(k,name);
u32 f=fl(o+7)[0]; const char *fn=""; if(f && f-1u<nfields()){ fn=fname(f-1u); *col=WHITE; }
int q=0; while(fn[q] && q<4){ right[q]=fn[q]; q++; } right[q]=0;
int q=0; while(fn[q] && q<0){ right[q]=fn[q]; q++; } right[q]=0;
if(rd16(o)==t_id()) *col=GOLD;
return 0;
}
@@ -1493,17 +1495,17 @@ static u32 tama_files(u32 old, u32 nw){
}
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;for(u32 y=0;y<32;y++)for(u32 x=0;x<32;x++){const volatile u8 *p=fl(g_cfg.cat_off+o+2u*(y*32u+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(32+x*2,27+y*2,34+x*2,29+y*2,(u16)c);}}
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 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\224\200\267\201\232 \200\342\200\363","\201\254\200\377 ROM\200\344",""); return; }
if(!g_chrn){ message("\201\223\200\267\201\231 \200\342\200\363","\201\253\200\377 ROM\200\344",""); return; }
if(sel>=g_chrn) sel=g_chrn-1u;
if(sel<top) top=sel; if(sel>=top+8u) top=sel-7u;
char t[64]; const char *a="\200\234\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\235\200\213 B \200\316\201\231 C \200\247\200\261");
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");
wait_release();
for(;;){
int c=input();
@@ -1511,16 +1513,19 @@ 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 kk=g_chr[sel], o=g_cfg.cat_off+8u+28u*kk, nw=rd16(o), st=fl(o+6)[0], old=t_id();
char nm[64]; chr_name(kk,nm);
rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(95,stage_name(st),GREY,1);ctext(117,"B \200\300\200\212 C \200\273\200\262",GREY,1);show();
if(!yes_no()) break;
u32 nw=0,st=0,old=t_id();int accepted=0,back=0;
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;}}
}
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(old && old!=nw && !tama_files(old, nw)){ message("\200\234\200\270\200\214\201\222 \200\342\200\363","\200\300\200\212\201\246\201\211 \200\335\200\337\200\330\200\233\200\234",""); return; }
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; }
#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));
@@ -1528,7 +1533,7 @@ static void chr_pick(void){
#else
if(old && old!=nw) tama_files(old, nw);
#endif
set_write("\200\234\200\270\200\214\201\222 \200\300\200\212\200\245");
set_write("\200\235\200\270\200\214\201\222 \200\300\200\212\200\246");
return;
}
}
@@ -1537,9 +1542,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\253\200\320 \200\257\200\277",GOLD,1);
rect(0,0,128,128,BG); ctext(10,"\201\252\200\320 \200\257\200\277",GOLD,1);
char s[4]; utoa_(v,s); ctext(40,s,WHITE,4);
ctext(80,"\201\263 \200\257\200\277 \200\300\200\212",GREY,1); ctext(94,"B \201\257\200\366 C \200\247\200\261",GREY,1); show(); wait_release();
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();
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; }
@@ -1557,26 +1562,26 @@ static void level_edit(void){
}
}
static void care_full(void){
rect(0,0,128,128,BG); ctext(24,"\200\242\200\304 \201\261\200\302",WHITE,1); ctext(40,"\200\276\200\305\200\265\200\200\201\253\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\246\200\233\200\234",GREY,1); ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\233\200\353",GREY,1); show();
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();
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\242\200\304 \201\261\200\302 \200\352\200\263");
set_write("\200\243\200\304 \201\260\200\302 \200\352\200\263");
}
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\234\200\270\200\214\201\222",WHITE,1);
rect(0,0,128,128,BG); ctext(2,"\200\235\200\270\200\214\201\222",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);
{ 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\253\200\302 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Du],p); while(*p) p++; if(g_set[to+0x10u]){ a=" \200\334\201\244"; while(*a) *p++=*a++; } *p=0; }
big_entry(70,sel==2,"\200\242\200\304",st,ORANGE,GREY);
ctext(117,"B \201\257\200\366 C \200\247\200\261",GREY,1);
{ 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);
show(); wait_release();
for(;;){
int k=input();
@@ -1618,9 +1623,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\250 \201\211\200\345",WHITE,1);
rect(0,0,128,128,BG); ctext(2,"\200\331\200\374\201\247 \201\211\200\345",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\257\200\366 C \200\247\200\261",GREY,1); show(); wait_release();
ctext(117,"B \201\256\200\366 C \200\250\200\261",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; }
@@ -1644,14 +1649,14 @@ static void saves_menu(int with_app, int top){
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\242\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\231":"\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\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; }
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\257\200\366 C \200\247\200\261",GREY,1);
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1);
show(); wait_release();
for(;;){
int k=input();
@@ -1662,14 +1667,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\236",""); break; } }
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; } }
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);
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\360\201\211",GREY,1);
ctext(96,"B \200\347",WHITE,1); ctext(108,"C \200\334\200\233\200\353",GREY,1); show();
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();
if(yes_no()) field_switch2(sel, has, fld);
break;
}
@@ -1688,16 +1693,16 @@ static void main_menu(void){
u32 sel = g_napp ? n-1u : 0u;
for(;;){
set_load();
rect(0,0,128,128,BG);
ctext(3,"\200\234\200\270\200\214\201\222 \201\237\201\213",WHITE,1);
ko_surface();
ctext(4,"\201\222\201\234 \200\271\200\231",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\233";break;case 2:label="\200\234\200\270\201\240\200\366\201\235";break;case 4:label="\200\234\200\270\200\214\201\222";break;default:label="\201\242\200\261\200\217\200\254";}
int y=22+(int)i*18;
if(i==sel){rect(5,y-3,123,y+13,GOLD);rect(7,y-1,121,y+11,RGB(205,225,169));}
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";}
int y=24+(int)i*17;
ko_row(y-2,i==sel);
text(14,y,label,WHITE,1);
}
ctext(117,"A \200\365\200\243 B \200\316\201\231 C \200\247\200\261",GREY,1);
ctext(117,"A \200\365\200\244 B \200\316\201\230 C \200\250\200\261",RGB(255,255,255),1);
show(); wait_release();
for(;;){
int k=input();
@@ -1755,18 +1760,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\234\200\270\200\214\201\222 \200\365\200\243 \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\243\201\251",WHITE,1);
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\360\201\211",GREY,1);
ctext(96,"B \200\312\201\205",WHITE,1); ctext(108,"C \200\357\201\211",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\260 \200\374\200\341\200\365",RED,1); ctext(26,"\201\210\200\235\200\244\200\343\200\330\200\233\200\234",RED,1);
ctext(48,"\201\200\200\376\200\362 \200\302\200\357\201\250\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\233\200\353",GREY,1);
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);
show();
if(!yes_no()) leave();
rect(0,0,128,128,BG); show();
@@ -1778,7 +1783,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\242\200\261\200\217\200\254 \200\342\200\363","\201\254\200\377 ROM\200\344","");
while(!g_napp) message("\201\241\200\261\200\217\200\254 \200\342\200\363","\201\253\200\377 ROM\200\344","");
apps_menu(1);
}
if(g_cfg.flags & (F_BAG|F_TAMA)) main_menu();
+11 -2
View File
@@ -40,7 +40,16 @@ int main(int argc,char **argv){
proof("insert",cat_pick,"bnnnb");assert(g_dirty);assert(list_len()==1);assert(count_get(0)==4);
u32 item=list_id(0);g_dirty=0;proof("append",cat_pick,"bnnb");assert(g_dirty);assert(list_id(0)==item);assert(list_len()==1);assert(count_get(0)==7);
// Cancelling character preview returns to the list without writing any save.
memcpy(snapshot,g_set,PAGE);proof("character-cancel",chr_pick,"nbcc");assert(!memcmp(snapshot,g_set,PAGE));
memcpy(snapshot,g_set,PAGE);u8 *flash_snapshot=malloc(0x1000000);memcpy(flash_snapshot,host_flash,0x1000000);
proof("character-dial",chr_pick,"bnnpppnncc");assert(!memcmp(snapshot,g_set,PAGE));assert(!memcmp(flash_snapshot,host_flash,0x1000000));
// Moving from the last row cannot read beyond the catalog. Returning to the
// 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));
// 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);
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 confirmation, quantity 1..15, additive batch inventory, capacity and cancellation\n");free(host_flash);return 0;
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;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB