Share A+C menu design and picture controls in English and Korean
This commit is contained in:
1 parent
e220d59741
commit
c0e835a94d
20 files changed
+1984
-19
No files matched your search
+2
-2
@@ -295,7 +295,7 @@ Object.assign(T.en, {
|
||||
"sixLoginToast": "Log in to use six-region expansion.",
|
||||
"sixLoginSave": "Log in again to save the six-region ROM.",
|
||||
"nameLanguageLocked": "Save or reset your name edits before editing another language.",
|
||||
"menuLanguageHint": "Menu language: English. Select 한국어 to save a Korean menu.",
|
||||
"menuLanguageHint": "To use a Korean A+C menu, select 한국어 as the website language before saving your new ROM.",
|
||||
"languageFeatureTitle": "Korean and English menus",
|
||||
"languageFeature": "Select 한국어 or EN to change the editor and the A+C menu built into your new ROM.",
|
||||
"startTitle": "Tamagotchi Paradise Firmware Editor",
|
||||
@@ -1059,7 +1059,7 @@ T.ko = {
|
||||
"sixLoginToast": "여섯 지역 통합은 로그인 후 이용하세요.",
|
||||
"sixLoginSave": "여섯 지역 확장 결과를 저장하려면 다시 로그인하세요.",
|
||||
"nameLanguageLocked": "수정한 이름을 저장하거나 초기화한 뒤 다른 언어를 편집하세요.",
|
||||
"menuLanguageHint": "메뉴 언어: 한국어. EN을 선택하면 영어 메뉴로 저장됩니다.",
|
||||
"menuLanguageHint": "영어 A+C 메뉴를 적용하려면 홈페이지 언어를 EN으로 바꾼 뒤 새 ROM을 저장하세요.",
|
||||
"languageFeatureTitle": "한국어·영어 메뉴",
|
||||
"languageFeature": "한국어·EN 선택에 따라 편집 화면과 새로 만드는 A+C 메뉴의 언어가 바뀝니다."
|
||||
};
|
||||
|
||||
+22
-13
@@ -577,7 +577,7 @@ function charCatalog(d, P, language='en', pictures=false) {
|
||||
if (c.id < 1001 || c.id > 4999 || c.stage < 2 || c.stage > 5) continue;
|
||||
const nm = (language==='ko' ? C.textGet(d,c.name,'ko') : tt >= 0 ? zeichenkette(d,tt,c.name) : '') || ('NO. ' + c.id);
|
||||
const fi = P.names.indexOf(TYPE_NAMES[c.field]);
|
||||
out.push({ id: c.id, fixed: 2, pic: 0, sum: (c.stage & 255) | ((fi + 1) << 8), at: null, nativeName:C.textGet(d,c.name,'ko'), thumbnail:language==='ko'&&pictures?portrait(C,ctx,ctx.groups[all.findIndex(v=>v.id===c.id)+1]):null, name: nm.replace(/\s+/g, ' ') });
|
||||
out.push({ id: c.id, fixed: 2, pic: 0, sum: (c.stage & 255) | ((fi + 1) << 8), at: null, nativeName:C.textGet(d,c.name,language), thumbnail:pictures?portrait(C,ctx,ctx.groups[all.findIndex(v=>v.id===c.id)+1]):null, name: nm.replace(/\s+/g, ' ') });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -620,18 +620,20 @@ function nativeMenuFont(rom){
|
||||
}
|
||||
return font;
|
||||
}
|
||||
function catalogBlob(cat, korean=false, rom=null) {
|
||||
function catalogBlob(cat, korean=false, rom=null, englishPictures=false) {
|
||||
const x = 8 + 28 * cat.length;
|
||||
const font=korean ? nativeMenuFont(rom) : new Uint8Array(0);
|
||||
const font=korean ? nativeMenuFont(rom) : new Uint8Array(englishPictures?8:0);
|
||||
if(englishPictures){w32(font,0,0x31545045);}
|
||||
const encoded=cat.map(c=>korean?globalThis.ParamixKoreanMenu.encode(c.name||('항목 '+c.id),60):c.name.slice(0,20));
|
||||
const base=x+4+12*cat.length+font.length, tails=korean?26*cat.length+4*cat.length+cat.reduce((n,c)=>n+(c.thumbnail?.length||0),0)+encoded.reduce((n,c)=>n+c.length+1,0):0;
|
||||
const base=x+4+12*cat.length+font.length, tails=korean||englishPictures?26*cat.length+4*cat.length+cat.reduce((n,c)=>n+(c.thumbnail?.length||0),0)+(korean?encoded.reduce((n,c)=>n+c.length+1,0):0):0;
|
||||
const b = new Uint8Array(base+tails);
|
||||
const nameOffsets=[];
|
||||
if(korean){let pos=base+30*cat.length;cat.forEach((c,i)=>{
|
||||
if(korean||englishPictures){let pos=base+30*cat.length;cat.forEach((c,i)=>{
|
||||
[...(c.nativeName||c.name)].slice(0,12).forEach((ch,j)=>w16(b,base+i*26+j*2,globalThis.ParamixCore.TXT_ENC[ch]??globalThis.ParamixCore.KO_ENC[ch]??0));
|
||||
if(c.thumbnail){w32(b,base+26*cat.length+i*4,pos);b.set(c.thumbnail,pos);pos+=c.thumbnail.length;}
|
||||
});encoded.forEach(n=>{nameOffsets.push(pos);for(const c of n)b[pos++]=c.charCodeAt(0);b[pos++]=0;});}
|
||||
if(korean)b.set(font,x+4+12*cat.length);
|
||||
});if(korean)encoded.forEach(n=>{nameOffsets.push(pos);for(const c of n)b[pos++]=c.charCodeAt(0);b[pos++]=0;});
|
||||
if(englishPictures)w32(font,4,pos);}
|
||||
if(korean||englishPictures)b.set(font,x+4+12*cat.length);
|
||||
w32(b, x, EXT_MAGIC);
|
||||
cat.forEach((c, i) => { const o = x + 4 + 12 * i; if (c.at) { w32(b, o, c.at.addr); w16(b, o + 4, c.at.len); w16(b, o + 6, c.at.sum); w32(b, o + 8, c.at.head); } });
|
||||
w32(b, 0, CAT_MAGIC); w32(b, 4, cat.length);
|
||||
@@ -663,6 +665,11 @@ function feldStrip(rom, emb, E) {
|
||||
// The Korean catalog is separate from executable code and from save slots.
|
||||
if(f.catOff>=0x111000 && f.catN<2000 && u32(out,f.catOff)===CAT_MAGIC){
|
||||
const font=f.catOff+12+40*f.catN, count=u32(out,font+4);
|
||||
if(u32(out,font)===0x31545045){
|
||||
const end=f.catOff+count;
|
||||
if(end<font+8+30*f.catN || end>out.length)throw Error('Invalid English portrait catalog size');
|
||||
out.fill(255,f.catOff,page(end));
|
||||
}
|
||||
if(u32(out,font)===0x31464f4b && count<=4096){
|
||||
let end=font+8+13*count;
|
||||
if(f.catN){
|
||||
@@ -727,16 +734,17 @@ function feldApply(rom, opts, saved, emb, E) {
|
||||
const stubOff = prev || kind ? STUB_OFF : freeStubOff(out);
|
||||
if (!prev && !isFF(out, stubOff, 0x1000)) throw new Error('no room for the launcher');
|
||||
const korean=containsKoMark(emb.feld);
|
||||
const englishPictures=!korean && containsBytes(emb.feld,'ITOSM_EN_MENU_V1');
|
||||
const catList = bag ? itemCatalog(out,korean?'ko':'en') : [];
|
||||
if (tama) { const pack = catList.pack; catList.push(...charCatalog(out, P,korean?'ko':'en',korean)); catList.sort((a, b) => a.id - b.id); catList.pack = pack; }
|
||||
const cat = bag || tama || korean ? catalogBlob(catList,korean,out) : new Uint8Array(0);
|
||||
const fsz = page(emb.feld.length), catalogSize=page(cat.length), csz=korean?0:catalogSize;
|
||||
if (tama) { const pack = catList.pack; catList.push(...charCatalog(out, P,korean?'ko':'en',korean||englishPictures)); catList.sort((a, b) => a.id - b.id); catList.pack = pack; }
|
||||
const cat = bag || tama || korean ? catalogBlob(catList,korean,out,englishPictures) : new Uint8Array(0);
|
||||
const fsz = page(emb.feld.length), catalogSize=page(cat.length), csz=korean||englishPictures?0:catalogSize;
|
||||
let separateCat=0;
|
||||
if(korean){
|
||||
if(korean||englishPictures){
|
||||
const ceiling=Math.min(P.idPage-0x1000,opts.appsLow||P.idPage-0x1000);
|
||||
const floor=page(assetEnd(out));
|
||||
for(let a=(ceiling-catalogSize)&~0xFFF;a>=floor;a-=4096)if(isFF(out,a,catalogSize)){separateCat=a;break;}
|
||||
if(!separateCat)throw Error('한글 이름과 그림을 넣을 공간이 부족합니다.');
|
||||
if(!separateCat)throw Error(korean?'한글 이름과 그림을 넣을 공간이 부족합니다.':'Not enough room for names and pictures');
|
||||
}
|
||||
const doom = kind === 1;
|
||||
let prog = doom ? doomCodeEnd(out) : stubOff + 0x1000;
|
||||
@@ -957,7 +965,8 @@ function cleanApply(rom, opts, emb) {
|
||||
|
||||
const FELD_B64 = '__FELD_B64__', FELD_STUB_B64 = '__FELD_STUB_B64__', FELDC_B64 = '__FELDC_B64__';
|
||||
const FELD_KO_B64 = '__FELD_KO_B64__', FELDC_KO_B64 = '__FELDC_KO_B64__';
|
||||
function containsKoMark(b){const m='ITOSM_KO_MENU_V1';return b.some((_,i)=>i+m.length<b.length && [...m].every((c,j)=>b[i+j]===c.charCodeAt(0)));}
|
||||
function containsBytes(b,m){return b.some((_,i)=>i+m.length<b.length && [...m].every((c,j)=>b[i+j]===c.charCodeAt(0)));}
|
||||
function containsKoMark(b){return containsBytes(b,'ITOSM_KO_MENU_V1');}
|
||||
function koreanMenu(rom) {
|
||||
if (FELD_STUB_B64.startsWith('__')) return false;
|
||||
const f = feldFind(rom, b64(FELD_STUB_B64));
|
||||
|
||||
+1
-1
@@ -750,6 +750,6 @@ sixChooseSource 아래 여섯 지역 옵션을 켜고 추가 원본을 선택하
|
||||
sixLoginToast 여섯 지역 통합은 로그인 후 이용하세요.
|
||||
sixLoginSave 여섯 지역 확장 결과를 저장하려면 다시 로그인하세요.
|
||||
nameLanguageLocked 수정한 이름을 저장하거나 초기화한 뒤 다른 언어를 편집하세요.
|
||||
menuLanguageHint 메뉴 언어: 한국어. EN을 선택하면 영어 메뉴로 저장됩니다.
|
||||
menuLanguageHint 영어 A+C 메뉴를 적용하려면 홈페이지 언어를 EN으로 바꾼 뒤 새 ROM을 저장하세요.
|
||||
languageFeatureTitle 한국어·영어 메뉴
|
||||
languageFeature 한국어·EN 선택에 따라 편집 화면과 새로 만드는 A+C 메뉴의 언어가 바뀝니다.
|
||||
|
Reference in new issue
Block a user