다마고치 선택 그림과 실제 외형 및 이름을 일치시킴
Paramix Studio / build (push) Canceled after 0s
Paramix Studio / pages (push) Canceled after 0s

This commit is contained in:
syskiller committed 2026-11-11 20:37:50 +09:00
1 parent 6ff604302e
commit fda254aa35
20 files changed
+193 -114

No files matched your search

+26 -1
View File
@@ -1166,6 +1166,31 @@ function charTable(dp) {
}
return [];
}
// Rebuild the current pet's native genes package from this ROM. The firmware
// caches palettes and eye sprites separately from the two character IDs.
// Native current-pet genes: nine names, two palettes, 54 five-layer frames and
// large/small eye sprites. Header-only ID changes retain the previous pet's look.
// Layout and checksum are checked against independent firmware-generated exports.
function characterGhost(rom,id,ctx=null,texts=null){
ctx=ctx||openRom(rom);texts=texts||textTablesOf(rom);const dp=ctx.files[0],table=i=>u32(dp,i*4)*2;
let rec=null;for(let o=table(11);o<table(12);o+=30)if(u16(dp,o)===id){rec=Array.from({length:15},(_,k)=>u16(dp,o+2*k));break;}
if(!rec)throw Error('Character definition is missing');
const chars=charTable(dp).filter(c=>c.id>1000&&c.id<9000),body=ctx.groups[chars.findIndex(c=>c.id===id)+1];
if(body===undefined)throw Error('Character sprites are missing');
const eye=ctx.entries[body+1],small=ctx.entries[body+4],align=n=>(n+3)&~3;
const out=new Uint8Array(0x1d34+align(eye.length)+align(small.length));
if(out.length>0x4000)throw Error('Character genes exceed the native slot');
w32(out,8,1);w16(out,12,4017);w16(out,14,id);out[16]=Math.min(15,rec[14]);
w16(out,0xfc,rec[3]);w16(out,0xfe,rec[5]);w16(out,0x100,rec[7]);w16(out,0x102,rec[8]);w16(out,0x10a,id);w32(out,0x10c,out.length);
for(let lang=0;lang<9;lang++){const t=texts.tabs[lang],index=rec[2]+1;if(!t||index>=t.n)throw Error('Native name table is missing');const start=t.offs[index]*2,end=index+1<t.n?t.offs[index+1]*2:t.b.length;let n=0;for(let i=start;i+1<end&&n<12;i+=2){const c=u16(t.b,i);if(c===0||c===0xf000)break;w16(out,18+26*lang+2*n++,c);}}
for(const[k,g]of[[0,body],[1,body+2]]){const e=ctx.entries[g],h=spriteHeader(e);out.set(e.subarray(h.palOffset,h.palOffset+32),0x140+32*k);}
const types=[0,1,15,16,17],map=[1,2,6,7,4,3,5,8,9,10,0];
for(let f=0;f<54;f++){const row=table(18)+4*(rec[1]*54+f),first=u16(dp,row),count=u16(dp,row+2);if(first===65535)continue;if(count>32)throw Error('Invalid character frame');
for(let j=0;j<count;j++){let pos=table(15)+u32(dp,table(16)+4*(first+j))*2,mask=u16(dp,pos);pos+=2;const v=[0,0,0,4096,0,64,0,0,0,0,0];for(let bit=0;bit<11;bit++)if(mask&(1<<bit)){v[map[bit]]=u16(dp,pos);pos+=2;}const ti=types.indexOf(v[10]);if(ti<0)continue;if(ti<3&&v[0])v[0]-=body;for(let k=0;k<11;k++)w16(out,0x600+(f*5+ti)*22+2*k,v[k]&65535);}
}
let at=0x1d34;for(const[k,e]of[[1,eye],[4,small]]){w32(out,0x110+8*k,at);w32(out,0x114+8*k,e.length);out.set(e,at);at+=align(e.length);}
let sum=0;for(let i=8;i<0x180;i+=4)sum=(sum+u32(out,i))>>>0;for(let i=0x600;i<out.length;i+=4)sum=(sum+u32(out,i))>>>0;w32(out,0,sum);w32(out,4,-sum>>>0);return out;
}
function fieldSets(ctx) {
const chars = charTable(ctx.files[0]).filter((c) => c.id > 1000 && c.id < 9000);
if (chars.length + 1 !== ctx.groups.length) return [];
@@ -1299,7 +1324,7 @@ function nativePetNames(out,edition,names,language){
return out;
}
root.ParamixCore = { koreanPetNames, paraLayers, faceFirst, facePoses, layersMove, EYE_V2, smaDetect, smaLoad, eyeFirst, eyeRelGet, shiftEyes, textClean, textGet, textApply, textTablesOf, TXT_ENC, DE_ENC, KO_CHARS, KO_ENC,
root.ParamixCore = { characterGhost, koreanPetNames, paraLayers, faceFirst, facePoses, layersMove, EYE_V2, smaDetect, smaLoad, eyeFirst, eyeRelGet, shiftEyes, textClean, textGet, textApply, textTablesOf, TXT_ENC, DE_ENC, KO_CHARS, KO_ENC,
fieldSets, charTable, FIELD_NAMES,
ASSET_BASE, EDITIONS, GROUP_PARTS, GROUP_SHEET_W, GROUP_SHEET_H,
arc2Parse, arc2Files, arc2Build, arc2Checksum, packSplit, packJoin, spriteHeader, spriteDecode, spriteEncode, spriteBlank, spriteTiny, spriteAlign, partOptions, launcherKeep, launcherChanges, isLauncher,