다마고치 선택 그림과 실제 외형 및 이름을 일치시킴
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

+35
View File
@@ -0,0 +1,35 @@
/* Supply a private ROM and optionally independent native-firmware oracle exports. */
const fs=require('fs'),path=require('path'),assert=require('assert/strict');
const C=require('../src/core.js'),S=require('../src/saves.js'),F=require('../src/feld.js');
const rom=new Uint8Array(fs.readFileSync(process.argv[2])),original=rom.slice(),ctx=C.openRom(rom);
const chars=F.characters(rom),save={pages:S.paraFromImage(rom,ctx.editionId),edition:ctx.editionId};
const dv=b=>new DataView(b.buffer,b.byteOffset,b.byteLength),u16=(b,a)=>dv(b).getUint16(a,true),u32=(b,a)=>dv(b).getUint32(a,true);
const old=S.paraPet(save,ctx.editionId).id;
const slot=[...save.pages].sort((a,b)=>a[0]-b[0]).find(([a,b])=>u32(b,8)===1&&u16(b,12)===4017&&u16(b,0x10a)===old&&u32(b,0x118)===0x1d34)[0];
let compared=0;
for(const c of chars){
const ghost=C.characterGhost(rom,c.id,ctx),out=S.paraPetSet(save,ctx.editionId,{id:c.id,stage:c.stage,ghost});
assert.equal(S.paraPet(out,ctx.editionId).id,c.id);assert.equal(S.paraPet(out,ctx.editionId).stage,c.stage);
const stored=new Uint8Array(0x4000);for(let i=0;i<0x4000;i+=4096)stored.set(out.pages.get(slot+i),i);
assert.deepEqual(stored.subarray(0,ghost.length),ghost);assert(stored.subarray(ghost.length).every(v=>v===255));
for(const[a,b]of save.pages)if(!(a>=slot&&a<slot+0x4000)&&a!==0xefe000&&a!==0xeff000)assert.deepEqual(out.pages.get(a),b,'Unrelated save changed: '+a.toString(16));
// Applying the same character repairs stale palettes and eye/composite data too.
assert.deepEqual(S.paraPetSet(out,ctx.editionId,{id:c.id,stage:c.stage,ghost}).pages,out.pages);
if(process.argv[3]){const native=fs.readFileSync(path.join(process.argv[3],c.id+'.ghost'));assert.deepEqual(Buffer.from(ghost),native,'Native firmware mismatch: '+c.id);compared++;}
}
// Another pet with the same ID is not the current pet's appearance cache.
const friends=new Map(save.pages),friend=slot+0x4000;
for(let i=0;i<0x4000;i+=4096)friends.set(friend+i,save.pages.get(slot+i).slice());
const gem=chars.find(c=>c.id===4062),ghost=C.characterGhost(rom,gem.id,ctx);
const changed=S.paraPetSet({...save,pages:friends},ctx.editionId,{id:gem.id,stage:gem.stage,ghost});
for(let i=0;i<0x4000;i+=4096)assert.deepEqual(changed.pages.get(friend+i),friends.get(friend+i),'Friend data changed');
assert.throws(()=>S.paraPetSet(save,ctx.editionId,{id:gem.id}),/appearance/);
const def=C.charTable(ctx.files[0]).find(c=>c.id===gem.id);
for(const[lang,name,index]of[['ko','한글이',8],['en','GEM TEST',1],['de','BÄRCHEN',3]]){
const edited=C.textApply(rom,new Map([[def.name,name]]),lang),g=C.characterGhost(edited,gem.id),enc=lang==='ko'?{...C.TXT_ENC,...C.KO_ENC}:lang==='de'?C.DE_ENC:C.TXT_ENC;
for(let i=0;i<name.length;i++)assert.equal(u16(g,18+26*index+2*i),enc[name[i]],lang+' native name');
const editedLanguages=lang==='en'?[1,2,3,4,5,6]:[index];
for(let i=0;i<9;i++)if(!editedLanguages.includes(i))assert.deepEqual(g.subarray(18+26*i,44+26*i),ghost.subarray(18+26*i,44+26*i),'Other native name changed');
}
assert.deepEqual(rom,original);
console.log(JSON.stringify({passed:true,characters:chars.length,nativeFirmwareComparisons:compared,allNativeNames:true,friendsPreserved:true,sameCharacterRepair:true,deviceWritten:false}));
+9 -1
View File
@@ -50,6 +50,14 @@ const root=require('path').resolve(__dirname,'..');
assert.equal(F.itemCatalog(german.rom,'de').find(x=>x.id===5001).name,'MILCH');
fs.writeFileSync(process.argv[3]+'.de.bin',german.rom);
await w.__loadRom(file(german.rom));language('en');const back=await w.__composeRom();assert(back&&!back.same);const backInfo=F.feldFind(back.rom,F.embedded().stub);assert(Buffer.from(back.rom.subarray(backInfo.off,backInfo.off+0x8000)).includes(Buffer.from('ITOSM_EN_MENU_V1')));
for(const lang of ['ko','en','de']){
await w.__loadRom(file(rom));language(lang);d.getElementById('btnPetRom').click();
const select=d.getElementById('petChar');select.value='4062:5';d.getElementById('btnPetSave').click();
const C=w.ParamixCore,S=w.ParamixSaves,state=w.__state,expected=C.characterGhost(state.ctx.rom,4062);
assert.equal(S.paraPet({pages:S.paraFromImage(state.ctx.rom,state.ctx.editionId)},state.ctx.editionId).id,4062);
assert.deepEqual(Buffer.from(state.ctx.rom.subarray(0xdee000,0xdee000+expected.length)),Buffer.from(expected),'Browser did not apply complete appearance: '+lang);
d.getElementById('btnPetSave').click();assert.deepEqual(Buffer.from(state.ctx.rom.subarray(0xdee000,0xdee000+expected.length)),Buffer.from(expected),'Same-character repair failed: '+lang);
}
assert.deepEqual(errors,[]);w.close();
console.log('PASS: KO/EN/DE ROM builds, EN-DE-EN menu rebuilds, German item names, late API response and source preservation; no device write');
console.log('PASS: KO/EN/DE ROM builds, menu rebuilds, native character appearance and same-ID repair through the browser save button, German names, late API response and source preservation; no device write');
})().catch(e=>{console.error(e);process.exit(1);});