다마고치 연구소 한국어판 소스 공개
This commit is contained in:
commit
db23855630
661 files changed
+503597
No files matched your search
@@ -0,0 +1,57 @@
|
||||
// Applied to the generated Korean variant only. Core input and write logic stay intact.
|
||||
module.exports=function(s,enc){
|
||||
const start=s.indexOf('static void main_menu(void){'), end=s.indexOf('\nstatic void run(void)',start);
|
||||
let menu=s.slice(start,end);
|
||||
const a=menu.indexOf(' rect(0,0,128,128,BG);'),b=menu.indexOf(' show(); wait_release();',a);
|
||||
menu=menu.slice(0,a)+` rect(0,0,128,128,BG);
|
||||
ctext(3,"${enc('다마고치 편집')}",WHITE,1);
|
||||
for(u32 i=0;i<n;i++){
|
||||
int x=9+(int)(i%3u)*39,y=21+(int)(i/3u)*39;
|
||||
u16 col=i==sel?GOLD:GREY;
|
||||
rect(x-3,y-3,x+34,y+34,col);rect(x-1,y-1,x+32,y+32,BG);
|
||||
/* Compact pixel icons: planet, bag, points, Tama and programs. */
|
||||
if(kinds[i]==0){rect(x+7,y+3,x+24,y+27,RGB(60,180,235));rect(x+2,y+9,x+29,y+21,RGB(60,180,235));rect(x+7,y+10,x+18,y+15,RGB(110,220,100));rect(x+16,y+17,x+24,y+22,RGB(110,220,100));}
|
||||
else if(kinds[i]==1){rect(x+6,y+10,x+26,y+27,PINK);rect(x+10,y+4,x+22,y+14,PINK);rect(x+13,y+7,x+19,y+11,BG);}
|
||||
else if(kinds[i]==2){rect(x+7,y+4,x+25,y+27,GOLD);rect(x+3,y+9,x+29,y+22,GOLD);text(x+12,y+11,"P",BG,1);}
|
||||
else if(kinds[i]==4){rect(x+5,y+9,x+27,y+25,RGB(120,220,120));rect(x+7,y+3,x+11,y+12,RGB(120,220,120));rect(x+21,y+3,x+25,y+12,RGB(120,220,120));rect(x+10,y+14,x+13,y+17,BG);rect(x+20,y+14,x+23,y+17,BG);rect(x+14,y+21,x+20,y+23,BG);}
|
||||
else {rect(x+3,y+6,x+29,y+25,ORANGE);text(x+9,y+11,"AB",BG,1);}
|
||||
}
|
||||
const char *label;
|
||||
switch(kinds[sel]){case 0:label="${enc('지역과 저장')}";break;case 1:label="${enc('아이템')}";break;case 2:label="${enc('다마포인트')}";break;case 4:label="${enc('다마고치')}";break;default:label="${enc('프로그램')}";}
|
||||
ctext(102,label,WHITE,1);ctext(117,"${enc('A 이동 B 선택 C 뒤로')}",GREY,1);
|
||||
`+menu.slice(b);
|
||||
s=s.slice(0,start)+menu+s.slice(end);
|
||||
// Original Paradise uses a light menu surface and a colored selection frame.
|
||||
s=s.replace(/#define BG\s+[^\n]+/,'#define BG RGB(246,247,221)');
|
||||
s=s.replace(/#define WHITE\s+[^\n]+/,'#define WHITE RGB(33,48,72)');
|
||||
s=s.replace(/#define GREY\s+[^\n]+/,'#define GREY RGB(75,96,108)');
|
||||
s=s.replace(/#define GOLD\s+[^\n]+/,'#define GOLD RGB(157,95,8)').replace(/#define ORANGE\s+[^\n]+/,'#define ORANGE RGB(160,80,12)').replace(/#define PINK\s+[^\n]+/,'#define PINK RGB(176,45,100)');
|
||||
// Korean native names are also stored as the firmware's u16 glyph codes after the font.
|
||||
const pos=s.indexOf('static void chr_pick(void){');
|
||||
const helpers=`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 void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=rd32(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++){u32 c=rd16(g_cfg.cat_off+o+2u*(y*32u+x));if(c!=0xf81fu)rect(32+x*2,27+y*2,34+x*2,29+y*2,(u16)c);}}
|
||||
`;
|
||||
s=s.slice(0,pos)+helpers+s.slice(pos);
|
||||
s=s.replace(/ list_draw\(t, g_chrn, sel, top, chr_row, [^\n]+/,` rect(0,0,128,128,BG);ctext(3,t,WHITE,1);ko_portrait(g_chr[sel]);char name[24];chr_name(g_chr[sel],name);ctext(98,name,WHITE,1);ctext(117,"${enc('A 단계 B 선택 C 뒤로')}",GREY,1);show();`);
|
||||
s=s.replace('static char g_nm[24];','static char g_nm[64];');
|
||||
s=s.replace('u32 n=fl(o+3)[0]; if(n>20u) n=20u;', 'u32 n=fl(o+3)[0]; if(n==255u){u32 a=g_cfg.cat_off+rd32(o+8);u32 i=0;while(i<60u&&fl(a+i)[0]){g_nm[i]=(char)fl(a+i)[0];i++;}g_nm[i]=0;return g_nm;} if(n>20u) n=20u;');
|
||||
s=s.replace(/static void chr_name\(u32 k, char \*out\)\{[^\n]+/, '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;}');
|
||||
s=s.replace(/\b(nm|name|st|t)\[24\]/g,'$1[64]');
|
||||
// Wrap by glyph boundaries rather than splitting a two-byte Korean character.
|
||||
const split=s.indexOf('static const char *item_name');
|
||||
s=s.slice(0,split)+`static void ko_title(const char *s,int y){int n=0,w=0;while(s[n]){int z=ko_pair(s+n)?2:1,px=z==2?10:6;if(w+px>116)break;w+=px;n+=z;}textn((128-w)/2,y,s,n,WHITE,1);if(s[n])ctext(y+11,s+n,WHITE,1);}\n`+s.slice(split);
|
||||
s=s.replace('if(L<=20) ctext(4,nm,WHITE,1); else { textn(4,2,nm,20,WHITE,1); textn(4,11,nm+20,20,WHITE,1); }','ko_title(nm,2);');
|
||||
s=s.replace('ctext(98,name,WHITE,1);','ko_title(name,94);');
|
||||
s=s.replace(/ list_draw\(t, g_catn, sel, top, cat_row, [^\n]+/,` rect(0,0,128,128,BG);ctext(3,t,WHITE,1);draw_item_pic(g_cat[sel],64,54,64);ko_title(item_name(g_cat[sel]),94);ctext(117,"${enc('A 분류 B 선택 C 뒤로')}",GREY,1);show();`);
|
||||
s=s.replace('static u32 tama_files(u32 old, u32 nw){','static u32 ko_names(void);\nstatic u32 tama_files(u32 old, u32 nw){');
|
||||
s=s.replace(' flash_read(a, g_page, PAGE);\n#ifdef FELD_TAMA_ANY',' flash_read(a, g_page, PAGE);\n u32 before=0;for(u32 z=8;z<0x180;z+=4)before+=*(u32*)(g_page+z);\n#ifdef FELD_TAMA_ANY');
|
||||
s=s.replace(' flash_prog4k(a, g_page); n++;',` if(rd32(a)+rd32(a+4u)==0u){
|
||||
int k=cat_find(nw);u32 names=ko_names();if(k>=0&&names){for(u32 j=0;j<26;j++)g_page[226u+j]=fl(names+26u*(u32)k+j)[0];g_page[0xfcu]=fl(g_cfg.cat_off+8u+28u*(u32)k+6u)[0];g_page[0xfdu]=0;}
|
||||
u32 sum=rd32(a)-before;for(u32 z=8;z<0x180;z+=4)sum+=*(u32*)(g_page+z);*(u32*)g_page=sum;*(u32*)(g_page+4u)=0u-sum;
|
||||
}
|
||||
flash_prog4k(a, g_page); n++;`);
|
||||
s=s.replace('RGB(60,60,110)','RGB(205,225,169)').replace('RGB(40,40,70)','BG');
|
||||
s=s.replace('if(k>=0 && fl(g_cfg.cat_off+8u+28u*(u32)k+2u)[0]==2u){ char t[64]; chr_name((u32)k,t); t[15]=0;', 'if(k>=0 && fl(g_cfg.cat_off+8u+28u*(u32)k+2u)[0]==2u){ char t[64]; chr_name((u32)k,t); int z=0;while(t[z]&&z+(ko_pair(t+z)?2:1)<=14)z+=ko_pair(t+z)?2:1;t[z]=0;');
|
||||
// Keep the current item on a picture screen before confirming a change.
|
||||
return s;
|
||||
};
|
||||
Reference in new issue
Block a user