Refine product copy and native Korean menu with lossless character previews
This commit is contained in:
1 parent
5e3303cba8
commit
dbe2c1f41f
30 files changed
+342
-282
No files matched your search
@@ -7,7 +7,7 @@ const dom=new JSDOM(html,{url:'https://tama.itosm.co.kr',runScripts:'dangerously
|
||||
const w=dom.window,d=w.document;
|
||||
assert.deepEqual(errors,[]);
|
||||
assert.equal(d.documentElement.lang,'ko');
|
||||
assert.match(d.body.textContent,/다마고치 파라다이스를 더 다양하게/);
|
||||
assert.match(d.body.textContent,/다마고치 파라다이스 편집 도구/);
|
||||
for(const el of d.querySelectorAll('[data-t]'))assert.ok(el.textContent.trim(),'Empty translation '+el.dataset.t);
|
||||
assert.ok(d.getElementById('menuKo').checked);
|
||||
d.querySelector('[data-lang="en"]').click();assert.ok(!d.getElementById('menuKo').checked);
|
||||
|
||||
+14
-1
@@ -38,7 +38,20 @@ async function main(){
|
||||
const glyphCount=globalThis.ParamixKoreanMenu.fixed.length+C.KO_CHARS.length;
|
||||
assert.equal(u32(image,font+4),glyphCount);
|
||||
const names=font+8+13*glyphCount;let portraits=0;
|
||||
for(let i=0;i<n;i++)if(u32(image,names+26*n+4*i))portraits++;
|
||||
const nativeFont=C.spriteDecode(ctx.entries[15]).subs;
|
||||
for(const [i,ch]of [...globalThis.ParamixKoreanMenu.fixed,...C.KO_CHARS].entries()){
|
||||
if(ch==='·')continue;const glyph=nativeFont[C.KO_ENC[ch]-1];
|
||||
for(let y=0;y<10;y++)for(let x=0;x<10;x++){const bit=y*10+x;assert.equal(!!(image[font+8+i*13+(bit>>3)]&(128>>(bit&7))),!!glyph.data[((y+3)*16+x+3)*4+3],`Native font changed: ${ch} ${x},${y}`);}
|
||||
}
|
||||
const all=defs.filter(c=>c.id>1000&&c.id<9000);
|
||||
for(let i=0;i<n;i++){
|
||||
const off=u32(image,names+26*n+4*i);if(!off)continue;portraits++;
|
||||
const at=cat+off;assert.equal(u32(image,at),0x3154504b);const w=image[at+4],h=image[at+6];assert.equal(w,64);assert.equal(h,64);
|
||||
const id=image[cat+8+28*i]|image[cat+9+28*i]<<8,g=ctx.groups[all.findIndex(c=>c.id===id)+1],pose=C.faceFirst(ctx.files[0],g,g+1,g+2);
|
||||
const body=C.spriteDecode(ctx.entries[g]).subs[pose.bs],pixels=body.data.slice();
|
||||
for(const [j,v]of [[1,pose.eye],[2,pose.mouth]]){if(!v)continue;const p=C.spriteDecode(ctx.entries[g+j]).subs[v.sub],dx=(w-p.w)/2+v.dx,dy=(h-p.h)/2+v.dy;for(let y=0;y<p.h;y++)for(let x=0;x<p.w;x++){const sx=x+dx,sy=y+dy,k=(y*p.w+x)*4;if(sx>=0&&sy>=0&&sx<w&&sy<h&&p.data[k+3])pixels.set(p.data.subarray(k,k+4),(sy*w+sx)*4);}}
|
||||
for(let p=0;p<w*h;p++){const k=4*p,expected=pixels[k+3]?((pixels[k]>>3)<<11)|((pixels[k+1]>>2)<<5)|(pixels[k+2]>>3):0xf81f;assert.equal(image[at+8+2*p]|image[at+9+2*p]<<8,expected,`Portrait pixel changed: ${id} ${p}`);}
|
||||
}
|
||||
assert(portraits>=60,'Character pictures missing: '+portraits);
|
||||
const stripped=F.feldStrip(image,emb,E);assert(stripped.subarray(cat,cat+4096).every(b=>b===255));
|
||||
assert.deepEqual(stripped.subarray(0xD49000),out.subarray(0xD49000),'Menu removal changed device saves');
|
||||
|
||||
Reference in new issue
Block a user