다마고치 변경할 때 본체 색상도 선택하도록 추가
Paramix Studio / build (push) Canceled after 0s
Paramix Studio / pages (push) Canceled after 0s

This commit is contained in:
syskiller committed 2026-11-11 21:34:16 +09:00
1 parent fda254aa35
commit 63fe0c8d41
35 files changed
+421 -188

No files matched your search

+4
View File
@@ -23,6 +23,8 @@ mameise의 Paramix Studio 1.7.4를 바탕으로 한국어 편집 기능과 본
- 여섯 지역 통합에는 트로피컬/글레이셔 원본과 랜드/워터/스카이 중 하나의 원본이 필요합니다. 이 두 원본은 현재 확보하지 못했으므로 실제 여섯 지역 결과 ROM 및 실기 동작은 검증하지 못했습니다. 해당 기능은 공개된 upstream 알고리즘을 사용합니다. - 여섯 지역 통합에는 트로피컬/글레이셔 원본과 랜드/워터/스카이 중 하나의 원본이 필요합니다. 이 두 원본은 현재 확보하지 못했으므로 실제 여섯 지역 결과 ROM 및 실기 동작은 검증하지 못했습니다. 해당 기능은 공개된 upstream 알고리즘을 사용합니다.
- GPL 원본/수정 소스는 계속 공개합니다. 회원 제한은 이 웹 서비스의 기능 접근 제한이며 공개 소스를 별도로 빌드하는 것까지 차단하는 방식은 아닙니다. - GPL 원본/수정 소스는 계속 공개합니다. 회원 제한은 이 웹 서비스의 기능 접근 제한이며 공개 소스를 별도로 빌드하는 것까지 차단하는 방식은 아닙니다.
A+C 다마고치 그림 화면에서 A 버튼으로 색상 조절을 선택하고 다이얼로 기본색이나 본체의 16색을 고릅니다. 홈페이지 저장 관리에도 같은 색상 선택과 미리보기를 넣었습니다. 색상만 수정하면 기존 눈 모양을 유지합니다. 제이드 포레스트 90개 항목의 16색 조합 1,440개를 에뮬레이터가 실행한 본체 펌웨어의 결과와 대조했습니다. 다른 기종과 실물 기기 검증은 별도입니다.
## 빌드 ## 빌드
Node.js로 `node scripts/localize-web.cjs`와 `node scripts/build-menu-ko.cjs`를 실행합니다. Node.js로 `node scripts/localize-web.cjs`와 `node scripts/build-menu-ko.cjs`를 실행합니다.
@@ -54,6 +56,8 @@ gcc -w -fsanitize=address,undefined -g preview-ko.c -o preview-ko
./preview-ko qa ./preview-ko qa
``` ```
개인 ROM으로 `node test/character-color-test.cjs 원본.bin`을 실행하면 색상별 미리보기와 저장 자료를 검사합니다. 독립적으로 추출한 본체 펌웨어 결과 폴더를 마지막 인자로 지정하면 각 색상의 전체 외형 자료도 대조합니다.
## 저작권 ## 저작권
원본 및 수정 프로그램: GPL-3.0-or-later. LICENSE와 NOTICE.md를 함께 제공합니다. 원본 및 수정 프로그램: GPL-3.0-or-later. LICENSE와 NOTICE.md를 함께 제공합니다.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+19 -1
View File
@@ -1,4 +1,23 @@
{ {
"ORIGINAL": "ORIGINAL",
"RED": "ROT",
"PINK": "ROSA",
"PURPLE": "VIOLETT",
"BLUE": "BLAU",
"SKY BLUE": "HIMMELBLAU",
"MINT": "MINT",
"GREEN": "GRÜN",
"YELLOW": "GELB",
"ORANGE": "ORANGE",
"LIGHT PINK": "HELLROSA",
"LAVENDER": "LAVENDEL",
"LIGHT BLUE": "HELLBLAU",
"LIGHT GREEN": "HELLGRÜN",
"CREAM": "CREME",
"WHITE": "WEISS",
"GRAY": "GRAU",
"WHEEL COLOR A TAMA": "RAD FARBE A TAMA",
"WHEEL TAMA A COLOR": "RAD TAMA A FARBE",
"LAND": "LAND", "LAND": "LAND",
"WATER": "WASSER", "WATER": "WASSER",
"SKY": "HIMMEL", "SKY": "HIMMEL",
@@ -101,7 +120,6 @@
"NO CHARACTERS": "KEINE TAMAGOTCHIS", "NO CHARACTERS": "KEINE TAMAGOTCHIS",
"TAMA: ": "TAMA: ", "TAMA: ": "TAMA: ",
"A STAGE B OK C BACK": "A ALTER B OK C ZUR.", "A STAGE B OK C BACK": "A ALTER B OK C ZUR.",
"WHEEL: PREV/NEXT": "RAD: ZURÜCK/WEITER",
"B APPLY C LIST": "B WÄHLEN C LISTE", "B APPLY C LIST": "B WÄHLEN C LISTE",
"TAMA NOT FOUND": "TAMA NICHT GEFUNDEN", "TAMA NOT FOUND": "TAMA NICHT GEFUNDEN",
"TAMA CHANGED": "TAMA GEÄNDERT", "TAMA CHANGED": "TAMA GEÄNDERT",
+15 -1
View File
@@ -1,6 +1,6 @@
/* ITOSM Korean menu subset of Galmuri9, quiple, SIL OFL 1.1. /* ITOSM Korean menu subset of Galmuri9, quiple, SIL OFL 1.1.
* See third-party/Galmuri-OFL.txt. Generated by scripts/build-menu-ko.cjs. */ * See third-party/Galmuri-OFL.txt. Generated by scripts/build-menu-ko.cjs. */
#define KO_GLYPHS 179 #define KO_GLYPHS 193
static const unsigned char ko_font[KO_GLYPHS][13]={ static const unsigned char ko_font[KO_GLYPHS][13]={
{0,0,0,0,0,64,0,0,0,0,0,0,0}, /* · */ {0,0,0,0,0,64,0,0,0,0,0,0,0}, /* · */
{249,2,64,144,36,17,132,66,19,4,1,0,0}, /* 가 */ {249,2,64,144,36,17,132,66,19,4,1,0,0}, /* 가 */
@@ -27,6 +27,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{119,4,65,16,0,255,128,7,241,4,127,0,0}, /* 끔 */ {119,4,65,16,0,255,128,7,241,4,127,0,0}, /* 끔 */
{129,32,72,26,4,253,0,68,1,0,127,0,0}, /* 난 */ {129,32,72,26,4,253,0,68,1,0,127,0,0}, /* 난 */
{129,32,72,26,4,253,0,7,241,4,127,0,0}, /* 남 */ {129,32,72,26,4,253,0,7,241,4,127,0,0}, /* 남 */
{64,16,4,1,0,127,2,0,131,254,0,0,0}, /* 노 */
{64,16,4,1,252,0,63,226,32,136,34,0,0}, /* 뉴 */ {64,16,4,1,252,0,63,226,32,136,34,0,0}, /* 뉴 */
{64,16,7,240,0,255,128,4,1,0,127,0,0}, /* 는 */ {64,16,7,240,0,255,128,4,1,0,127,0,0}, /* 는 */
{64,31,192,3,254,0,31,193,241,128,127,0,0}, /* 늘 */ {64,31,192,3,254,0,31,193,241,128,127,0,0}, /* 늘 */
@@ -42,10 +43,13 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{249,32,72,18,4,249,8,66,19,244,1,0,0}, /* 되 */ {249,32,72,18,4,249,8,66,19,244,1,0,0}, /* 되 */
{249,32,79,144,132,253,0,7,241,4,127,0,0}, /* 됨 */ {249,32,79,144,132,253,0,7,241,4,127,0,0}, /* 됨 */
{249,32,79,144,132,253,16,71,241,4,127,0,0}, /* 됩 */ {249,32,79,144,132,253,16,71,241,4,127,0,0}, /* 됩 */
{127,16,4,1,252,0,63,224,128,32,8,0,0}, /* 두 */
{249,32,72,19,228,1,63,66,16,132,33,0,0}, /* 뒤 */ {249,32,72,19,228,1,63,66,16,132,33,0,0}, /* 뒤 */
{127,16,4,1,0,127,0,0,3,254,0,0,0}, /* 드 */ {127,16,4,1,0,127,0,0,3,254,0,0,0}, /* 드 */
{127,16,7,240,0,255,128,7,240,4,1,0,0}, /* 득 */ {127,16,7,240,0,255,128,7,240,4,1,0,0}, /* 득 */
{250,168,170,42,138,163,168,170,43,234,2,128,0}, /* 때 */ {250,168,170,42,138,163,168,170,43,234,2,128,0}, /* 때 */
{249,2,64,147,228,129,160,72,19,228,1,0,0}, /* 라 */
{249,2,79,154,4,249,0,3,225,4,62,0,0}, /* 랑 */
{250,130,175,186,10,250,128,7,249,2,127,128,0}, /* 램 */ {250,130,175,186,10,250,128,7,249,2,127,128,0}, /* 램 */
{249,2,111,146,6,249,0,3,225,4,62,0,0}, /* 량 */ {249,2,111,146,6,249,0,3,225,4,62,0,0}, /* 량 */
{249,2,64,147,228,135,32,72,19,228,1,0,0}, /* 러 */ {249,2,64,147,228,135,32,72,19,228,1,0,0}, /* 러 */
@@ -58,11 +62,13 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{127,7,198,1,252,255,128,7,241,4,127,0,0}, /* 름 */ {127,7,198,1,252,255,128,7,241,4,127,0,0}, /* 름 */
{249,2,64,147,228,129,32,72,19,228,1,0,0}, /* 리 */ {249,2,64,147,228,129,32,72,19,228,1,0,0}, /* 리 */
{249,2,79,146,4,249,0,7,240,4,1,0,0}, /* 릭 */ {249,2,79,146,4,249,0,7,240,4,1,0,0}, /* 릭 */
{249,2,79,146,4,249,0,7,241,4,127,0,0}, /* 림 */
{249,34,72,146,36,137,162,72,147,228,1,0,0}, /* 마 */ {249,34,72,146,36,137,162,72,147,228,1,0,0}, /* 마 */
{250,162,168,170,58,138,162,168,171,234,2,128,0}, /* 메 */ {250,162,168,170,58,138,162,168,171,234,2,128,0}, /* 메 */
{249,35,200,146,60,249,0,68,1,0,127,0,0}, /* 면 */ {249,35,200,146,60,249,0,68,1,0,127,0,0}, /* 면 */
{127,16,71,240,32,255,128,7,240,4,1,0,0}, /* 목 */ {127,16,71,240,32,255,128,7,240,4,1,0,0}, /* 목 */
{249,34,72,146,36,137,34,72,147,228,1,0,0}, /* 미 */ {249,34,72,146,36,137,34,72,147,228,1,0,0}, /* 미 */
{249,34,72,146,36,249,0,68,1,0,127,0,0}, /* 민 */
{137,62,72,154,36,249,0,3,225,4,62,0,0}, /* 방 */ {137,62,72,154,36,249,0,3,225,4,62,0,0}, /* 방 */
{138,162,168,171,234,139,162,168,171,234,2,128,0}, /* 배 */ {138,162,168,171,234,139,162,168,171,234,2,128,0}, /* 배 */
{138,191,168,171,234,0,31,225,249,128,127,128,0}, /* 벨 */ {138,191,168,171,234,0,31,225,249,128,127,128,0}, /* 벨 */
@@ -75,10 +81,12 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{65,31,196,17,252,0,63,224,129,0,127,0,0}, /* 분 */ {65,31,196,17,252,0,63,224,129,0,127,0,0}, /* 분 */
{65,31,196,19,254,8,31,193,241,128,127,0,0}, /* 불 */ {65,31,196,19,254,8,31,193,241,128,127,0,0}, /* 불 */
{137,34,72,147,228,137,34,72,147,228,1,0,0}, /* 비 */ {137,34,72,147,228,137,34,72,147,228,1,0,0}, /* 비 */
{169,62,106,147,228,0,31,193,241,128,127,0,0}, /* 빨 */
{33,8,66,16,132,81,148,72,146,36,1,0,0}, /* 사 */ {33,8,66,16,132,81,148,72,146,36,1,0,0}, /* 사 */
{33,8,66,25,68,137,0,7,240,4,1,0,0}, /* 삭 */ {33,8,66,25,68,137,0,7,240,4,1,0,0}, /* 삭 */
{33,8,66,25,68,137,0,3,225,4,62,0,0}, /* 상 */ {33,8,66,25,68,137,0,3,225,4,62,0,0}, /* 상 */
{34,136,162,40,138,83,148,168,170,42,2,128,0}, /* 새 */ {34,136,162,40,138,83,148,168,170,42,2,128,0}, /* 새 */
{34,136,162,57,74,138,128,7,248,2,0,128,0}, /* 색 */
{33,8,66,16,156,81,20,72,146,36,1,0,0}, /* 서 */ {33,8,66,16,156,81,20,72,146,36,1,0,0}, /* 서 */
{33,8,66,113,68,137,0,68,1,0,127,0,0}, /* 선 */ {33,8,66,113,68,137,0,68,1,0,127,0,0}, /* 선 */
{33,9,197,18,36,0,31,193,241,128,127,0,0}, /* 설 */ {33,9,197,18,36,0,31,193,241,128,127,0,0}, /* 설 */
@@ -98,12 +106,14 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{113,34,72,154,36,113,0,132,249,20,114,0,0}, /* 않 */ {113,34,72,154,36,113,0,132,249,20,114,0,0}, /* 않 */
{113,34,104,145,196,0,31,193,241,128,127,0,0}, /* 알 */ {113,34,104,145,196,0,31,193,241,128,127,0,0}, /* 알 */
{113,34,72,154,36,113,0,2,33,84,136,128,0}, /* 았 */ {113,34,72,154,36,113,0,2,33,84,136,128,0}, /* 았 */
{113,34,104,146,38,113,0,3,225,4,62,0,0}, /* 양 */
{113,34,72,146,60,137,34,72,145,196,1,0,0}, /* 어 */ {113,34,72,146,60,137,34,72,145,196,1,0,0}, /* 어 */
{113,35,200,145,196,0,16,71,241,4,127,0,0}, /* 업 */ {113,35,200,145,196,0,16,71,241,4,127,0,0}, /* 업 */
{113,35,200,145,196,0,20,135,33,84,120,128,0}, /* 없 */ {113,35,200,145,196,0,20,135,33,84,120,128,0}, /* 없 */
{113,34,72,242,36,113,0,2,33,84,136,128,0}, /* 었 */ {113,34,72,242,36,113,0,2,33,84,136,128,0}, /* 었 */
{114,162,168,170,58,138,162,168,169,202,2,128,0}, /* 에 */ {114,162,168,170,58,138,162,168,169,202,2,128,0}, /* 에 */
{113,35,200,146,60,113,0,7,240,4,1,0,0}, /* 역 */ {113,35,200,146,60,113,0,7,240,4,1,0,0}, /* 역 */
{113,35,200,146,60,113,0,68,1,0,127,0,0}, /* 연 */
{113,35,200,145,220,1,31,193,241,128,127,0,0}, /* 열 */ {113,35,200,145,220,1,31,193,241,128,127,0,0}, /* 열 */
{114,162,168,234,42,138,163,168,169,202,2,128,0}, /* 예 */ {114,162,168,234,42,138,163,168,169,202,2,128,0}, /* 예 */
{62,16,68,17,4,62,2,0,131,254,0,0,0}, /* 오 */ {62,16,68,17,4,62,2,0,131,254,0,0,0}, /* 오 */
@@ -138,6 +148,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{250,136,162,40,186,82,148,168,170,42,2,128,0}, /* 제 */ {250,136,162,40,186,82,148,168,170,42,2,128,0}, /* 제 */
{127,2,1,64,136,65,2,0,131,254,0,0,0}, /* 조 */ {127,2,1,64,136,65,2,0,131,254,0,0,0}, /* 조 */
{127,5,6,48,32,255,128,4,1,0,127,0,0}, /* 존 */ {127,5,6,48,32,255,128,4,1,0,127,0,0}, /* 존 */
{127,2,1,65,140,0,63,224,128,32,8,0,0}, /* 주 */
{127,5,6,48,0,255,130,3,225,4,62,0,0}, /* 중 */ {127,5,6,48,0,255,130,3,225,4,62,0,0}, /* 중 */
{249,8,66,16,132,81,20,72,146,36,1,0,0}, /* 지 */ {249,8,66,16,132,81,20,72,146,36,1,0,0}, /* 지 */
{249,8,66,17,68,137,0,7,241,4,127,0,0}, /* 짐 */ {249,8,66,17,68,137,0,7,241,4,127,0,0}, /* 짐 */
@@ -159,6 +170,7 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{242,160,175,106,10,242,128,7,249,2,127,128,0}, /* 템 */ {242,160,175,106,10,242,128,7,249,2,127,128,0}, /* 템 */
{127,31,132,1,252,8,63,227,225,4,62,0,0}, /* 통 */ {127,31,132,1,252,8,63,227,225,4,62,0,0}, /* 통 */
{127,16,7,241,0,127,0,0,3,254,0,0,0}, /* 트 */ {127,16,7,241,0,127,0,0,3,254,0,0,0}, /* 트 */
{253,18,68,145,36,73,146,68,147,244,1,0,0}, /* 파 */
{250,148,165,41,74,83,148,165,43,234,2,128,0}, /* 패 */ {250,148,165,41,74,83,148,165,43,234,2,128,0}, /* 패 */
{249,21,197,17,92,249,0,68,1,0,127,0,0}, /* 편 */ {249,21,197,17,92,249,0,68,1,0,127,0,0}, /* 편 */
{127,8,130,32,136,127,2,0,131,254,0,0,0}, /* 포 */ {127,8,130,32,136,127,2,0,131,254,0,0,0}, /* 포 */
@@ -175,9 +187,11 @@ static const unsigned char ko_font[KO_GLYPHS][13]={
{34,190,167,58,42,114,128,3,241,2,63,0,0}, /* 행 */ {34,190,167,58,42,114,128,3,241,2,63,0,0}, /* 행 */
{33,62,199,18,44,113,0,68,1,0,127,0,0}, /* 현 */ {33,62,199,18,44,113,0,68,1,0,127,0,0}, /* 현 */
{33,62,199,18,44,113,0,3,225,4,62,0,0}, /* 형 */ {33,62,199,18,44,113,0,3,225,4,62,0,0}, /* 형 */
{8,63,228,16,248,8,63,227,225,4,62,0,0}, /* 홍 */
{33,63,64,17,196,137,156,66,19,244,1,0,0}, /* 화 */ {33,63,64,17,196,137,156,66,19,244,1,0,0}, /* 화 */
{33,63,68,152,196,33,63,64,1,252,1,0,0}, /* 확 */ {33,63,68,152,196,33,63,64,1,252,1,0,0}, /* 확 */
{33,63,68,152,196,33,63,64,1,0,127,0,0}, /* 환 */ {33,63,68,152,196,33,63,64,1,0,127,0,0}, /* 환 */
{33,63,68,152,196,33,63,67,225,4,62,0,0}, /* 황 */
{33,63,64,17,196,137,28,66,19,244,1,0,0}, /* 회 */ {33,63,64,17,196,137,28,66,19,244,1,0,0}, /* 회 */
{8,63,227,225,4,62,0,15,248,32,8,0,0}, /* 후 */ {8,63,227,225,4,62,0,15,248,32,8,0,0}, /* 후 */
{33,63,68,147,244,32,31,193,241,128,127,0,0}, /* 휠 */ {33,63,68,147,244,32,31,193,241,128,127,0,0}, /* 휠 */
+14
View File
@@ -25,6 +25,7 @@
"끔", "끔",
"난", "난",
"남", "남",
"노",
"뉴", "뉴",
"는", "는",
"늘", "늘",
@@ -40,10 +41,13 @@
"되", "되",
"됨", "됨",
"됩", "됩",
"두",
"뒤", "뒤",
"드", "드",
"득", "득",
"때", "때",
"라",
"랑",
"램", "램",
"량", "량",
"러", "러",
@@ -56,11 +60,13 @@
"름", "름",
"리", "리",
"릭", "릭",
"림",
"마", "마",
"메", "메",
"면", "면",
"목", "목",
"미", "미",
"민",
"방", "방",
"배", "배",
"벨", "벨",
@@ -73,10 +79,12 @@
"분", "분",
"불", "불",
"비", "비",
"빨",
"사", "사",
"삭", "삭",
"상", "상",
"새", "새",
"색",
"서", "서",
"선", "선",
"설", "설",
@@ -96,12 +104,14 @@
"않", "않",
"알", "알",
"았", "았",
"양",
"어", "어",
"업", "업",
"없", "없",
"었", "었",
"에", "에",
"역", "역",
"연",
"열", "열",
"예", "예",
"오", "오",
@@ -136,6 +146,7 @@
"제", "제",
"조", "조",
"존", "존",
"주",
"중", "중",
"지", "지",
"짐", "짐",
@@ -157,6 +168,7 @@
"템", "템",
"통", "통",
"트", "트",
"파",
"패", "패",
"편", "편",
"포", "포",
@@ -173,9 +185,11 @@
"행", "행",
"현", "현",
"형", "형",
"홍",
"화", "화",
"확", "확",
"환", "환",
"황",
"회", "회",
"후", "후",
"휠" "휠"
+26 -6
View File
@@ -1441,11 +1441,14 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
return 0; return 0;
} }
/* the pet's own file (pages of the save with the character in the header): character there too */ /* the pet's own file (pages of the save with the character in the header): character there too */
static int g_chr_color;
static u32 ko_colors(void);
static u32 ko_names(void); static u32 ko_names(void);
static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);} static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
static u32 tama_files(u32 old,u32 nw){ static u32 tama_files(u32 old,u32 nw){
int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0; int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0;
u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0; u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0;
u32 pal=ko_colors();if(g_chr_color>=0&&!pal)return 0;
u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu); u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu);
if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0; if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0;
for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){ for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){
@@ -1453,14 +1456,30 @@ static u32 tama_files(u32 old,u32 nw){
u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue; u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue;
// The first native genes slot is the current pet. Never alter later friend slots. // The first native genes slot is the current pet. Never alter later friend slots.
if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0; if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0;
for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;flash_prog4k(a+off,g_page);} for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;if(off==0&&g_chr_color>=0){
u32 before=0;for(u32 q=8;q<0x180;q+=4)before+=*(u32*)(g_page+q);
g_page[16]=(u8)g_chr_color;for(u32 q=0;q<16;q++){u8 v=fl(pal+16u*(u32)g_chr_color+q)[0];g_page[0x140+q]=v;g_page[0x160+q]=v;}
u32 sum=ghost_rd32(src)-before;for(u32 q=8;q<0x180;q+=4)sum+=*(u32*)(g_page+q);*(u32*)g_page=sum;*(u32*)(g_page+4)=0u-sum;
}flash_prog4k(a+off,g_page);}
return 1; return 1;
} }
return 0; return 0;
} }
static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31545045u?a+8u:0;} static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31545045u?a+8u:0;}
static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);} static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}} static u32 ko_colors(void){u32 a=ko_names()+34u*g_cfg.cat_n+8u;return ko_le32(a)==0x314b5043u?a+4u:0;}
static const char *ko_color_name(void){static const char *const names[]={"ORIGINAL","ROT","ROSA","VIOLETT","BLAU","HIMMELBLAU","MINT","GR\334N","GELB","ORANGE","HELLROSA","LAVENDEL","HELLBLAU","HELLGR\334N","CREME","WEISS","GRAU"};return names[g_chr_color+1];}
static void ko_portrait(u32 k){
u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;
u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}
if(!w||!h||w>64||h>64)return;u32 mask=at+2u*w*h,pal=ko_colors();int colored=g_chr_color>=0&&pal&&ko_le32(mask)==0x314b534du;
int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;
for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){u32 n=y*w+x;const volatile u8 *p=fl(at+2u*n);u32 c=p[0]|((u32)p[1]<<8);if(c==0xf81fu)continue;
if(colored){u32 index=(fl(mask+4u+(n>>1))[0]>>((n&1u)*4u))&15u;if(index<8u){p=fl(pal+16u*(u32)g_chr_color+2u*index);c=p[0]|((u32)p[1]<<8);}}
rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);
}
}
static void chr_pick(void){ static void chr_pick(void){
static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u; static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u;
u32 sel=0, top=0; u32 sel=0, top=0;
@@ -1478,12 +1497,13 @@ static void chr_pick(void){
if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; } if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; }
if(c==K_BACK) return; if(c==K_BACK) return;
if(c==K_OK){ if(c==K_OK){
u32 nw=0,st=0,old=t_id();int accepted=0,back=0; u32 nw=0,st=0,old=t_id();int accepted=0,back=0,colorMode=0;
g_chr_color=g_set[g_cfg.tama_off+0x19u]&31u;if(g_chr_color>15)g_chr_color=-1;
while(!accepted&&!back){ while(!accepted&&!back){
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0]; u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk); char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(93,stage_name(st),GREY,1);ctext(105,"RAD: ZUR\334CK/WEITER",GREY,1);ctext(117,"B W\304HLEN C LISTE",GREY,1);show();wait_release(); ctext(93,ko_color_name(),GREY,1);ctext(105,colorMode?"RAD FARBE A TAMA":"RAD TAMA A FARBE",GREY,1);ctext(117,"B W\304HLEN C LISTE",GREY,1);show();wait_release();
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}} for(;;){int key=input();if(key==K_A){colorMode=!colorMode;break;}if(key==1){if(colorMode){g_chr_color+=g_step;if(g_chr_color>15)g_chr_color=-1;if(g_chr_color< -1)g_chr_color=15;break;}int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
} }
if(!accepted)break; if(!accepted)break;
u32 to=g_cfg.tama_off; u32 to=g_cfg.tama_off;
@@ -1494,7 +1514,7 @@ static void chr_pick(void){
#endif #endif
g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8); g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8);
g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2)); g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|31u); g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|(g_chr_color<0?31u:(u32)g_chr_color));
#ifdef FELD_TAMA_ANY #ifdef FELD_TAMA_ANY
#else #else
if(old && old!=nw) tama_files(old, nw); if(old && old!=nw) tama_files(old, nw);
+26 -6
View File
@@ -1440,11 +1440,14 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
return 0; return 0;
} }
/* the pet's own file (pages of the save with the character in the header): character there too */ /* the pet's own file (pages of the save with the character in the header): character there too */
static int g_chr_color;
static u32 ko_colors(void);
static u32 ko_names(void); static u32 ko_names(void);
static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);} static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
static u32 tama_files(u32 old,u32 nw){ static u32 tama_files(u32 old,u32 nw){
int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0; int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0;
u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0; u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0;
u32 pal=ko_colors();if(g_chr_color>=0&&!pal)return 0;
u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu); u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu);
if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0; if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0;
for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){ for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){
@@ -1452,14 +1455,30 @@ static u32 tama_files(u32 old,u32 nw){
u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue; u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue;
// The first native genes slot is the current pet. Never alter later friend slots. // The first native genes slot is the current pet. Never alter later friend slots.
if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0; if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0;
for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;flash_prog4k(a+off,g_page);} for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;if(off==0&&g_chr_color>=0){
u32 before=0;for(u32 q=8;q<0x180;q+=4)before+=*(u32*)(g_page+q);
g_page[16]=(u8)g_chr_color;for(u32 q=0;q<16;q++){u8 v=fl(pal+16u*(u32)g_chr_color+q)[0];g_page[0x140+q]=v;g_page[0x160+q]=v;}
u32 sum=ghost_rd32(src)-before;for(u32 q=8;q<0x180;q+=4)sum+=*(u32*)(g_page+q);*(u32*)g_page=sum;*(u32*)(g_page+4)=0u-sum;
}flash_prog4k(a+off,g_page);}
return 1; return 1;
} }
return 0; return 0;
} }
static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31545045u?a+8u:0;} static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31545045u?a+8u:0;}
static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);} static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}} static u32 ko_colors(void){u32 a=ko_names()+34u*g_cfg.cat_n+8u;return ko_le32(a)==0x314b5043u?a+4u:0;}
static const char *ko_color_name(void){static const char *const names[]={"ORIGINAL","RED","PINK","PURPLE","BLUE","SKY BLUE","MINT","GREEN","YELLOW","ORANGE","LIGHT PINK","LAVENDER","LIGHT BLUE","LIGHT GREEN","CREAM","WHITE","GRAY"};return names[g_chr_color+1];}
static void ko_portrait(u32 k){
u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;
u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}
if(!w||!h||w>64||h>64)return;u32 mask=at+2u*w*h,pal=ko_colors();int colored=g_chr_color>=0&&pal&&ko_le32(mask)==0x314b534du;
int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;
for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){u32 n=y*w+x;const volatile u8 *p=fl(at+2u*n);u32 c=p[0]|((u32)p[1]<<8);if(c==0xf81fu)continue;
if(colored){u32 index=(fl(mask+4u+(n>>1))[0]>>((n&1u)*4u))&15u;if(index<8u){p=fl(pal+16u*(u32)g_chr_color+2u*index);c=p[0]|((u32)p[1]<<8);}}
rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);
}
}
static void chr_pick(void){ static void chr_pick(void){
static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u; static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u;
u32 sel=0, top=0; u32 sel=0, top=0;
@@ -1477,12 +1496,13 @@ static void chr_pick(void){
if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; } if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; }
if(c==K_BACK) return; if(c==K_BACK) return;
if(c==K_OK){ if(c==K_OK){
u32 nw=0,st=0,old=t_id();int accepted=0,back=0; u32 nw=0,st=0,old=t_id();int accepted=0,back=0,colorMode=0;
g_chr_color=g_set[g_cfg.tama_off+0x19u]&31u;if(g_chr_color>15)g_chr_color=-1;
while(!accepted&&!back){ while(!accepted&&!back){
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0]; u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk); char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(93,stage_name(st),GREY,1);ctext(105,"WHEEL: PREV/NEXT",GREY,1);ctext(117,"B APPLY C LIST",GREY,1);show();wait_release(); ctext(93,ko_color_name(),GREY,1);ctext(105,colorMode?"WHEEL COLOR A TAMA":"WHEEL TAMA A COLOR",GREY,1);ctext(117,"B APPLY C LIST",GREY,1);show();wait_release();
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}} for(;;){int key=input();if(key==K_A){colorMode=!colorMode;break;}if(key==1){if(colorMode){g_chr_color+=g_step;if(g_chr_color>15)g_chr_color=-1;if(g_chr_color< -1)g_chr_color=15;break;}int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
} }
if(!accepted)break; if(!accepted)break;
u32 to=g_cfg.tama_off; u32 to=g_cfg.tama_off;
@@ -1493,7 +1513,7 @@ static void chr_pick(void){
#endif #endif
g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8); g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8);
g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2)); g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|31u); g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|(g_chr_color<0?31u:(u32)g_chr_color));
#ifdef FELD_TAMA_ANY #ifdef FELD_TAMA_ANY
#else #else
if(old && old!=nw) tama_files(old, nw); if(old && old!=nw) tama_files(old, nw);
+152 -132
View File
@@ -213,12 +213,12 @@ static void utoa_(u32 v, char *s){ char t[12]; int n=0; do{ t[n++]=(char)('0'+v%
static u16 fcol(u32 i){ return (u16)(i<4u ? g_cfg.field_col[i] : g_cfg.field_col2[i-4u]); } static u16 fcol(u32 i){ return (u16)(i<4u ? g_cfg.field_col[i] : g_cfg.field_col2[i-4u]); }
static const char *ko_field(const char *s){ static const char *ko_field(const char *s){
{const char *a="LAND";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\360\201\211";} {const char *a="LAND";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\372\201\224";}
{const char *a="WATER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\325\201\210";} {const char *a="WATER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\335\201\223";}
{const char *a="SKY";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\245\200\233";} {const char *a="SKY";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\261\200\234";}
{const char *a="FOREST";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\327";} {const char *a="FOREST";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\337";}
{const char *a="TROPICAL";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\234\200\261\201\244\201\224";} {const char *a="TROPICAL";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\201\247\200\265\201\260\201\237";}
{const char *a="GLACIER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\220\200\257\200\365\200\322";} {const char *a="GLACIER";int i=0;while(a[i]&&s[i]&&a[i]==s[i])i++;if(!a[i]&&!s[i])return "\200\220\200\263\200\377\200\332";}
return s;} return s;}
static const char *fname(u32 i){ return ko_field(i<4u ? (const char*)g_cfg.field_name[i] : (const char*)g_cfg.field_name2[i-4u]); } static const char *fname(u32 i){ return ko_field(i<4u ? (const char*)g_cfg.field_name[i] : (const char*)g_cfg.field_name2[i-4u]); }
static u32 fid(u32 i){ return i<4u ? g_cfg.field_id[i] : g_cfg.field_id2[i-4u]; } static u32 fid(u32 i){ return i<4u ? g_cfg.field_id[i] : g_cfg.field_id2[i-4u]; }
@@ -456,7 +456,7 @@ static int stash(u32 fi){
if(on==PAGE){ u32 x=pool_take(fi); if(x==0xFFFFu || nd>=DPG_MAX) return 11; if(on==PAGE){ u32 x=pool_take(fi); if(x==0xFFFFu || nd>=DPG_MAX) return 11;
flash_prog4k(pool_addr(x),g_out); g_hdr.dpg[nd++]=(u16)x; on=0; } } flash_prog4k(pool_addr(x),g_out); g_hdr.dpg[nd++]=(u16)x; on=0; } }
by+=n; by+=n;
progress("\201\200\200\376 \201\210", ++done, tot*2u); progress("\201\212\201\210 \201\223", ++done, tot*2u);
} }
if(on){ u32 x=pool_take(fi); if(x==0xFFFFu || nd>=DPG_MAX) return 11; if(on){ u32 x=pool_take(fi); if(x==0xFFFFu || nd>=DPG_MAX) return 11;
for(u32 k=on;k<PAGE;k++) g_out[k]=0xFF; flash_prog4k(pool_addr(x),g_out); g_hdr.dpg[nd++]=(u16)x; } for(u32 k=on;k<PAGE;k++) g_out[k]=0xFF; flash_prog4k(pool_addr(x),g_out); g_hdr.dpg[nd++]=(u16)x; }
@@ -468,7 +468,7 @@ static int stash(u32 fi){
if(lz_unpack(g_cmp, n, g_page)) return 12; if(lz_unpack(g_cmp, n, g_page)) return 12;
if(!flash_same(a, g_page, PAGE)) return 13; if(!flash_same(a, g_page, PAGE)) return 13;
off+=n; off+=n;
progress("\201\256\200\366 \201\210", tot+i+1u, tot*2u); progress("\201\273\201\200 \201\223", tot+i+1u, tot*2u);
} }
g_hdr.magic=SLOT_MAGIC; g_hdr.field=fi+1u; g_hdr.npages=np; g_hdr.bytes=by; g_hdr.sum=sum; g_hdr.magic=SLOT_MAGIC; g_hdr.field=fi+1u; g_hdr.npages=np; g_hdr.bytes=by; g_hdr.sum=sum;
g_hdr.res[0]=POOL_MAGIC; g_hdr.res[1]=nd; g_hdr.res[2]=PEND_MAGIC; g_hdr.res[0]=POOL_MAGIC; g_hdr.res[1]=nd; g_hdr.res[2]=PEND_MAGIC;
@@ -504,7 +504,7 @@ static int restore(u32 fi, int fresh){
} else if(set!=(int)pass) continue; } else if(set!=(int)pass) continue;
if(want){ if(!flash_same(a,g_page,PAGE)) flash_prog4k(a,g_page); if(!flash_same(a,g_page,PAGE)) return 22; } if(want){ if(!flash_same(a,g_page,PAGE)) flash_prog4k(a,g_page); if(!flash_same(a,g_page,PAGE)) return 22; }
else if(!page_ff(a)){ erase_page(a); if(!page_ff(a)) return 23; } else if(!page_ff(a)){ erase_page(a); if(!page_ff(a)) return 23; }
if(!pass && !(++done & 7u)) progress("\200\307\200\256\200\350\200\232 \201\210", done, tot); if(!pass && !(++done & 7u)) progress("\200\315\200\262\200\362\200\233 \201\223", done, tot);
} }
if(!fresh && ix2!=np) return 24; if(!fresh && ix2!=np) return 24;
} }
@@ -522,24 +522,24 @@ static void leave(void){
} }
static void error_screen(int code){ static void error_screen(int code){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(30,"\200\350\200\264",RED,2); ctext(30,"\200\362\200\270",RED,2);
char s[12]="\201\225\200\251 00"; s[5]=(char)('0'+code/10); s[6]=(char)('0'+code%10); char s[12]="\201\240\200\253 00"; s[5]=(char)('0'+code/10); s[6]=(char)('0'+code%10);
ctext(56,s,WHITE,1); ctext(56,s,WHITE,1);
if(code==10||code==11) ctext(68,"\201\200\200\376 \200\354\200\255 \201\216\200\215",WHITE,1); /* the field stays as it is */ if(code==10||code==11) ctext(68,"\201\212\201\210 \200\366\200\261 \201\231\200\215",WHITE,1); /* the field stays as it is */
ctext(84,"B/C \200\243\200\334\200\201\200\222",GREY,1); ctext(84,"B/C \200\244\200\344\200\201\200\222",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ int k=input(); if(k==K_OK||k==K_BACK) leave(); } for(;;){ int k=input(); if(k==K_OK||k==K_BACK) leave(); }
} }
static void message(const char *l1, const char *l2, const char *l3){ static void message(const char *l1, const char *l2, const char *l3){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(34,l1,WHITE,1); ctext(48,l2,WHITE,1); ctext(62,l3,WHITE,1); ctext(34,l1,WHITE,1); ctext(48,l2,WHITE,1); ctext(62,l3,WHITE,1);
ctext(100,"C \200\250\200\261",GREY,1); ctext(100,"C \200\252\200\265",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ int k=input(); if(k==K_OK||k==K_BACK) return; } for(;;){ int k=input(); if(k==K_OK||k==K_BACK) return; }
} }
static void done_screen(const char *what, u16 col){ static void done_screen(const char *what, u16 col){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(40,"\200\352\200\263",WHITE,2); ctext(40,"\200\364\200\267",WHITE,2);
ctext(66,what,col,1); ctext(66,what,col,1);
show(); show();
delay_loop(6000000u); delay_loop(6000000u);
@@ -556,7 +556,7 @@ static void app_detect(void){
g_app = m==0x43584D50u ? 2u : m==0x37584D50u ? 4u : m==0x38584D50u ? 5u : 3u; g_app = m==0x43584D50u ? 2u : m==0x37584D50u ? 4u : m==0x38584D50u ? 5u : 3u;
for(u32 i=0x140u;i<0x400u;i+=4u) if(rd32(off+i)==0x434D4450u){ g_app=1u; break; } for(u32 i=0x140u;i<0x400u;i+=4u) if(rd32(off+i)==0x434D4450u){ g_app=1u; break; }
} }
static const char *const g_appname[6]={"","DOOM","TAMAEMU","\201\241\200\261\200\217\200\254","T7EMU","T18EMU"}; static const char *const g_appname[6]={"","DOOM","TAMAEMU","\201\255\200\265\200\217\200\260","T7EMU","T18EMU"};
static void start_app(void){ static void start_app(void){
rect(0,0,128,128,0); show(); rect(0,0,128,128,0); show();
#ifdef HOST #ifdef HOST
@@ -600,12 +600,12 @@ static void apps_detect(void){
#ifndef NO_LSET #ifndef NO_LSET
/* start device (1.6.8): sound and display time, the Paradise's own settings screens are gone */ /* start device (1.6.8): sound and display time, the Paradise's own settings screens are gone */
if(g_cfg.flags & 16u){ if(g_cfg.flags & 16u){
const char *d="\200\317\201\204"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0; const char *d="\200\327\201\216"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0;
g_appsrc[g_napp++]=0; g_sx=g_napp; g_appsrc[g_napp++]=0; g_sx=g_napp;
} }
#endif #endif
if((g_cfg.flags & 16u) && g_cfg.version>=7u && g_cfg.dl_src>=0x10000000u && g_cfg.dl_src<0x11000000u){ if((g_cfg.flags & 16u) && g_cfg.version>=7u && g_cfg.dl_src>=0x10000000u && g_cfg.dl_src<0x11000000u){
const char *d="\200\235\200\355\200\261\200\251"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0; const char *d="\200\236\200\367\200\265\200\253"; int k=0; while(d[k]){ g_appnm[g_napp][k]=d[k]; k++; } g_appnm[g_napp][k]=0;
g_appsrc[g_napp++]=g_cfg.dl_src; g_dl=g_napp; g_appsrc[g_napp++]=g_cfg.dl_src; g_dl=g_napp;
} }
} }
@@ -734,7 +734,7 @@ static void act_mark(u32 j){
} }
/* Live save to slot g_act, then slot tgt (has) or a fresh start on field fld into the live area. */ /* Live save to slot g_act, then slot tgt (has) or a fresh start on field fld into the live area. */
static void field_switch2(u32 tgt, int has, u32 fld){ static void field_switch2(u32 tgt, int has, u32 fld){
rect(0,0,128,128,BG); ctext(8,"\200\375\200\331 \200\222\200\235\200\266\200\321\200\353",WHITE,1); ctext(20,"\201\202\200\356\200\362 \200\357\201\211\201\245\200\321\200\353",GREY,1); show(); rect(0,0,128,128,BG); ctext(8,"\201\207\200\341 \200\222\200\236\200\272\200\331\200\365",WHITE,1); ctext(20,"\201\214\200\370\200\374 \200\371\201\224\201\261\200\331\200\365",GREY,1); show();
int e=stash((u32)g_act); int e=stash((u32)g_act);
if(e){ erase_page(slot_base((u32)g_act)); error_screen(e); } if(e){ erase_page(slot_base((u32)g_act)); error_screen(e); }
e=restore(has ? tgt : fld,!has); e=restore(has ? tgt : fld,!has);
@@ -749,12 +749,12 @@ static void field_switch2(u32 tgt, int has, u32 fld){
static void field_switch(u32 tgt, int has){ field_switch2(tgt, has, tgt); } static void field_switch(u32 tgt, int has){ field_switch2(tgt, has, tgt); }
static int field_confirm(u32 tgt, int has){ static int field_confirm(u32 tgt, int has){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(14,"\201\202\201\257 \200\237\200\313",WHITE,1); ctext(14,"\201\214\201\274 \200\240\200\322",WHITE,1);
ctext(30,fname(tgt),fcol(tgt),2); ctext(30,fname(tgt),fcol(tgt),2);
ctext(54, has ? "\200\301\200\216\201\246 \201\200\200\376\200\362" : "\200\365 \201\211\200\345\200\344\200\315", WHITE,1); ctext(54, has ? "\200\307\200\216\201\262 \201\212\201\210\200\374" : "\200\377 \201\224\200\356\200\355\200\325", WHITE,1);
ctext(66, has ? "\200\307\200\256\200\351\200\234\200\235" : "\200\314\200\261 \200\331\200\374\201\251\200\234\200\235", WHITE,1); ctext(66, has ? "\200\315\200\262\200\363\200\235\200\236" : "\200\323\200\265 \200\341\201\206\201\265\200\235\200\236", WHITE,1);
ctext(92,"B \200\347",WHITE,1); ctext(92,"B \200\361",WHITE,1);
ctext(106,"C \200\334\200\234\200\353",GREY,1); ctext(106,"C \200\344\200\235\200\365",GREY,1);
show(); show();
return yes_no(); return yes_no();
} }
@@ -764,7 +764,7 @@ static int launch_mode(void){ return (g_cfg.flags & F_LAUNCH) != 0u; }
* The time is kept in the Paradise's settings block at IDLE_OFF (0 = 2 minutes, else index + 1). */ * The time is kept in the Paradise's settings block at IDLE_OFF (0 = 2 minutes, else index + 1). */
#define IDLE_OFF 0xF07u #define IDLE_OFF 0xF07u
static const u32 g_idle_tab[5]={30000u,60000u,120000u,300000u,0u}; static const u32 g_idle_tab[5]={30000u,60000u,120000u,300000u,0u};
static const char *const g_idle_nm[5]={"30 S","1\200\306","2\200\306","5\200\306","\200\225\201\211 \200\335\200\363"}; static const char *const g_idle_nm[5]={"30 S","1\200\314","2\200\314","5\200\314","\200\225\201\224 \200\345\200\375"};
static u32 g_idle_t, g_idle_ms; static u32 g_idle_t, g_idle_ms;
#ifdef BAT_SHOW #ifdef BAT_SHOW
#ifdef HOST #ifdef HOST
@@ -776,9 +776,9 @@ static void bat_text(char *s){ const char *t="2.84V 80%"; int i=0; while((s[i]=t
static void lset_menu(void); static void lset_menu(void);
#ifdef FELD_CLEAN #ifdef FELD_CLEAN
static int clean_mode(void); static int clean_mode(void);
#define SX_TEXT (clean_mode() ? "\200\331\200\213\200\200\201\255\200\272" : "\200\323\200\266\200\200\201\255\200\272") #define SX_TEXT (clean_mode() ? "\200\341\200\213\200\200\201\272\200\277" : "\200\333\200\272\200\200\201\272\200\277")
#else #else
#define SX_TEXT "\200\323\200\266\200\200\201\255\200\272" #define SX_TEXT "\200\333\200\272\200\200\201\272\200\277"
#endif #endif
#if defined(FELD_PW) && !defined(HOST) #if defined(FELD_PW) && !defined(HOST)
/* test23 (switch FELD_PW): the display dark, the menu waited for a key in a tight loop at the full clock and used /* test23 (switch FELD_PW): the display dark, the menu waited for a key in a tight loop at the full clock and used
@@ -841,7 +841,7 @@ static void apps_menu(int top){
for(;;){ for(;;){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
int y0 = n>=4u ? 1 : 12; int y0 = n>=4u ? 1 : 12;
if(n<4u) ctext(2, launch_mode() ? "PARAMIX" : "\201\241\200\261\200\217\200\254",WHITE,1); if(n<4u) ctext(2, launch_mode() ? "PARAMIX" : "\201\255\200\265\200\217\200\260",WHITE,1);
if(n>8u){ if(sel<first) first=sel; if(sel>=first+8u) first=sel-7u; } else first=0; if(n>8u){ if(sel<first) first=sel; if(sel>=first+8u) first=sel-7u; } else first=0;
for(u32 i=first;i<n && i<first+(n>8u?8u:n);i++){ for(u32 i=first;i<n && i<first+(n>8u?8u:n);i++){
int sx = g_sx && i+1u==g_sx; int sx = g_sx && i+1u==g_sx;
@@ -850,13 +850,13 @@ static void apps_menu(int top){
int dy = n>7u ? 14 : 16, y=2+(int)(i-first)*dy; int dy = n>7u ? 14 : 16, y=2+(int)(i-first)*dy;
if(i==sel){ rect(1,y,127,y+dy-1,c); rect(2,y+1,126,y+dy-2,BG); } if(i==sel){ rect(1,y,127,y+dy-1,c); rect(2,y+1,126,y+dy-2,BG); }
text(5,y+(dy-8)/2+1,g_appnm[i],c,1); text(5,y+(dy-8)/2+1,g_appnm[i],c,1);
const char *st = sx ? "\200\346\200\222" : "\200\331\200\374"; const char *st = sx ? "\200\360\200\222" : "\200\341\201\206";
text(123-text_w(st,1),y+(dy-8)/2+1,st,GREY,1); text(123-text_w(st,1),y+(dy-8)/2+1,st,GREY,1);
} else big_entry(y0+(int)i*29, i==sel, g_appnm[i], g_dl && i+1u==g_dl ? "PC \200\222\200\262" : sx ? SX_TEXT : "\200\331\200\374", c, GREY); } else big_entry(y0+(int)i*29, i==sel, g_appnm[i], g_dl && i+1u==g_dl ? "PC \200\222\200\266" : sx ? SX_TEXT : "\200\341\201\206", c, GREY);
} }
#ifdef BAT_SHOW #ifdef BAT_SHOW
/* test17: the start device's home screen shows the battery bottom right */ /* test17: the start device's home screen shows the battery bottom right */
if(top && launch_mode()){ char bt[12]; bat_text(bt); text(5,117,"B \200\331\200\374",GREY,1); if(n<=8u) text(123-text_w(bt,1),119,bt,GREY,1); if(top && launch_mode()){ char bt[12]; bat_text(bt); text(5,117,"B \200\341\201\206",GREY,1); if(n<=8u) text(123-text_w(bt,1),119,bt,GREY,1);
#ifdef FELD_AUTODBG #ifdef FELD_AUTODBG
if(g_adbg[2]){ static const char hx[]="0123456789ABCDEF"; char d[8]; u32 mm=g_adbg[0]; if(g_adbg[2]){ static const char hx[]="0123456789ABCDEF"; char d[8]; u32 mm=g_adbg[0];
d[0]= mm==MB_L ? 'L' : mm==MB_M ? 'M' : mm==MB_R ? 'R' : mm ? '?' : '0'; d[1]=hx[(g_adbg[1]>>8)&15u]; d[2]=g_adbg[2]==2u ? 'B' : '-'; d[3]= g_adbg[3]==MB_S ? 'S' : g_adbg[3] ? '?' : '0'; d[4]=0; d[0]= mm==MB_L ? 'L' : mm==MB_M ? 'M' : mm==MB_R ? 'R' : mm ? '?' : '0'; d[1]=hx[(g_adbg[1]>>8)&15u]; d[2]=g_adbg[2]==2u ? 'B' : '-'; d[3]= g_adbg[3]==MB_S ? 'S' : g_adbg[3] ? '?' : '0'; d[4]=0;
@@ -865,7 +865,7 @@ static void apps_menu(int top){
} }
else else
#endif #endif
ctext(117, top && launch_mode() ? "B \200\331\200\374" : "B \201\256\200\366 C \200\250\200\261",GREY,1); ctext(117, top && launch_mode() ? "B \200\341\201\206" : "B \201\273\201\200 C \200\252\200\265",GREY,1);
if(n>8u){ char sc[8]; u32 a=sel+1u; int k=0; if(a>=10u) sc[k++]=(char)('0'+a/10u); sc[k++]=(char)('0'+a%10u); sc[k++]='/'; if(n>=10u) sc[k++]=(char)('0'+n/10u); sc[k++]=(char)('0'+n%10u); sc[k]=0; text(123-text_w(sc,1),119,sc,GREY,1); } if(n>8u){ char sc[8]; u32 a=sel+1u; int k=0; if(a>=10u) sc[k++]=(char)('0'+a/10u); sc[k++]=(char)('0'+a%10u); sc[k++]='/'; if(n>=10u) sc[k++]=(char)('0'+n/10u); sc[k++]=(char)('0'+n%10u); sc[k]=0; text(123-text_w(sc,1),119,sc,GREY,1); }
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
@@ -888,10 +888,10 @@ static void field_menu(int with_app, int top){
for(;;){ for(;;){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
int y0 = n>=4u ? 1 : 12; int y0 = n>=4u ? 1 : 12;
if(n<4u) ctext(2, top ? "PARAMIX" : "\201\211\200\345", WHITE,1); if(n<4u) ctext(2, top ? "PARAMIX" : "\201\224\200\356", WHITE,1);
for(u32 i=0;i<n;i++){ for(u32 i=0;i<n;i++){
const char *nm = i<nf ? fname(i) : g_napp>1u ? "\201\241\200\261\200\217\200\254" : g_appnm[0]; const char *nm = i<nf ? fname(i) : g_napp>1u ? "\201\255\200\265\200\217\200\260" : g_appnm[0];
const char *st = i>=nf ? (g_napp>1u ? "\200\316\201\230" : "\200\331\200\374") : ((int)i==g_cur) ? "\200\311\200\354 \201\210" : has[i] ? "\201\200\200\376\200\246" : "\200\314\200\261"; const char *st = i>=nf ? (g_napp>1u ? "\200\326\201\243" : "\200\341\201\206") : ((int)i==g_cur) ? "\200\320\200\366 \201\223" : has[i] ? "\201\212\201\210\200\247" : "\200\323\200\265";
u16 c = i<nf ? fcol(i) : ORANGE, stc = (i<nf && (int)i==g_cur) ? WHITE : GREY; u16 c = i<nf ? fcol(i) : ORANGE, stc = (i<nf && (int)i==g_cur) ? WHITE : GREY;
if(n>4u){ /* six fields: compact rows */ if(n>4u){ /* six fields: compact rows */
int y=2+(int)i*16; int y=2+(int)i*16;
@@ -900,7 +900,7 @@ static void field_menu(int with_app, int top){
text(123-text_w(st,1),y+4,st,stc,1); text(123-text_w(st,1),y+4,st,stc,1);
} else big_entry(y0+(int)i*29, i==sel, nm, st, c, stc); } else big_entry(y0+(int)i*29, i==sel, nm, st, c, stc);
} }
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1); ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
@@ -929,13 +929,13 @@ static int set_load(void){
} }
static int set_check_msg(void){ static int set_check_msg(void){
int e=set_load(); int e=set_load();
if(e==1){ message("\201\200\200\376 \200\241\200\365\201\231\200\201","\200\324\200\313\200\245\200\343\200\330\200\234\200\235","\200\300\200\212\201\245\201\211 \200\335\200\337\200\330\200\234\200\235"); return 1; } if(e==1){ message("\201\212\201\210 \200\242\200\377\201\244\200\201","\200\334\200\322\200\246\200\354\200\340\200\235\200\236","\200\306\200\212\201\261\201\224 \200\345\200\347\200\340\200\235\200\236"); return 1; }
if(e==2){ message("\201\200\200\376 \200\241\200\365\201\231 \200\342\200\363","\201\206\200\221 \201\242\200\257\200\365\201\246 \200\250","\200\235\200\331 \200\331\200\242\201\245\200\321\200\353"); return 1; } if(e==2){ message("\201\212\201\210 \200\242\200\377\201\244 \200\353\200\375","\201\220\200\221 \201\256\200\263\200\377\201\262 \200\252","\200\236\200\341 \200\341\200\243\201\261\200\331\200\365"); return 1; }
if(e){ message("\201\200\200\376 \201\254\200\332\200\362","\200\336 \200\325 \200\342\200\330\200\234\200\235",""); return 1; } if(e){ message("\201\212\201\210 \201\270\200\342\200\374","\200\346 \200\335 \200\353\200\340\200\235\200\236",""); return 1; }
return 0; return 0;
} }
static void set_write(const char *what){ static void set_write(const char *what){
rect(0,0,128,128,BG); ctext(40,"\201\200\200\376 \201\210",WHITE,1); ctext(54,"\201\202\200\356\200\362 \200\357\201\211\201\245\200\321\200\353",GREY,1); show(); rect(0,0,128,128,BG); ctext(40,"\201\212\201\210 \201\223",WHITE,1); ctext(54,"\201\214\200\370\200\374 \200\371\201\224\201\261\200\331\200\365",GREY,1); show();
stamp(g_set); stamp(g_set);
flash_prog4k(SET_A, g_set); flash_prog4k(SET_A, g_set);
flash_prog4k(SET_B, g_set); flash_prog4k(SET_B, g_set);
@@ -1000,7 +1000,7 @@ static void clock_menu(int must){
for(;;){ for(;;){
if(d>mdays(y,mo)) d=mdays(y,mo); if(d>mdays(y,mo)) d=mdays(y,mo);
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(4,"\200\331\200\213 \200\317\201\204",WHITE,1); ctext(4,"\200\341\200\213 \200\327\201\216",WHITE,1);
char s[6]; char s[6];
utoa_(y,s); text(5,26,s,sel==0u?ORANGE:WHITE,2); utoa_(y,s); text(5,26,s,sel==0u?ORANGE:WHITE,2);
s[0]='-'; s[1]=0; text(52,26,s,GREY,2); s[0]='-'; s[1]=0; text(52,26,s,GREY,2);
@@ -1010,9 +1010,9 @@ static void clock_menu(int must){
two(s,h); s[2]=0; text(34,52,s,sel==3u?ORANGE:WHITE,2); two(s,h); s[2]=0; text(34,52,s,sel==3u?ORANGE:WHITE,2);
s[0]=':'; s[1]=0; text(58,52,s,GREY,2); s[0]=':'; s[1]=0; text(58,52,s,GREY,2);
two(s,mi); s[2]=0; text(70,52,s,sel==4u?ORANGE:WHITE,2); two(s,mi); s[2]=0; text(70,52,s,sel==4u?ORANGE:WHITE,2);
ctext(84,"\201\262 \200\300\200\212",GREY,1); ctext(84,"\201\300 \200\306\200\212",GREY,1);
ctext(96,"A \200\235\200\363 B \201\200\200\376",GREY,1); ctext(96,"A \200\236\200\375 B \201\212\201\210",GREY,1);
if(!must) ctext(108,"C \200\250\200\261",GREY,1); if(!must) ctext(108,"C \200\252\200\265",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
@@ -1029,7 +1029,7 @@ static void clock_menu(int must){
if(k==K_BACK && !must) return; if(k==K_BACK && !must) return;
if(k==K_OK){ if(k==K_OK){
Clk c; u32 idle=clk_load(&c) ? c.idle : 0u; Clk c; u32 idle=clk_load(&c) ? c.idle : 0u;
rect(0,0,128,128,BG); ctext(54,"\201\200\200\376 \201\210",WHITE,1); show(); rect(0,0,128,128,BG); ctext(54,"\201\212\201\210 \201\223",WHITE,1); show();
clk_store((u32)para_days((int32_t)y,(int32_t)mo,(int32_t)d)*86400u+h*3600u+mi*60u, idle); clk_store((u32)para_days((int32_t)y,(int32_t)mo,(int32_t)d)*86400u+h*3600u+mi*60u, idle);
return; return;
} }
@@ -1050,15 +1050,15 @@ static void lset_load(void){
static void lset_clean(void){ static void lset_clean(void){
Clk k; u32 idl = clk_load(&k) && k.idle>=1u && k.idle<=5u ? k.idle-1u : 2u, idl0=idl, sel=0; Clk k; u32 idl = clk_load(&k) && k.idle>=1u && k.idle<=5u ? k.idle-1u : 2u, idl0=idl, sel=0;
for(;;){ for(;;){
char tm[8]; u32 t=clk_now(); if(t) hhmm(t,tm); else { const char *n="\200\274\200\317\201\204"; int i=0; while((tm[i]=n[i])) i++; } char tm[8]; u32 t=clk_now(); if(t) hhmm(t,tm); else { const char *n="\200\301\200\327\201\216"; int i=0; while((tm[i]=n[i])) i++; }
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(2,"\200\317\201\204",WHITE,1); ctext(2,"\200\327\201\216",WHITE,1);
big_entry(16, sel==0u, "\200\331\200\213", tm, ORANGE, WHITE); big_entry(16, sel==0u, "\200\341\200\213", tm, ORANGE, WHITE);
big_entry(45, sel==1u, "\201\255\200\272", g_idle_nm[idl], ORANGE, WHITE); big_entry(45, sel==1u, "\201\272\200\277", g_idle_nm[idl], ORANGE, WHITE);
text(9,84,"\201\255\200\272 \200\224\201\212",GREY,1); text(9,84,"\201\272\200\277 \200\224\201\225",GREY,1);
text(9,94,"\200\371\200\260\200\365 \200\342\200\362 \200\253",GREY,1); text(9,94,"\201\203\200\264\200\377 \200\353\200\374 \200\255",GREY,1);
ctext(108,"B \200\300\200\212",GREY,1); ctext(108,"B \200\306\200\212",GREY,1);
ctext(117,"C \201\200\200\376 \201\261 \200\250\200\261",GREY,1); ctext(117,"C \201\212\201\210 \201\277 \200\252\200\265",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int c=input(); int c=input();
@@ -1066,7 +1066,7 @@ static void lset_clean(void){
if(c==K_OK){ if(sel==0u) clock_menu(0); else idl=(idl+1u)%5u; break; } if(c==K_OK){ if(sel==0u) clock_menu(0); else idl=(idl+1u)%5u; break; }
if(c==K_BACK){ if(c==K_BACK){
if(idl!=idl0){ if(idl!=idl0){
rect(0,0,128,128,BG); ctext(54,"\201\200\200\376 \201\210",WHITE,1); show(); rect(0,0,128,128,BG); ctext(54,"\201\212\201\210 \201\223",WHITE,1); show();
u32 t2=clk_now(); clk_store(t2, idl+1u); u32 t2=clk_now(); clk_store(t2, idl+1u);
g_idle_ms=g_idle_tab[idl]; g_idle_ms=g_idle_tab[idl];
} }
@@ -1082,20 +1082,20 @@ static void lset_menu(void){
#endif #endif
int e=set_load(); int e=set_load();
if(e==1 || e==2){ set_check_msg(); return; } if(e==1 || e==2){ set_check_msg(); return; }
static const char *const snd_nm[4]={"\200\226","\200\374\200\211","\200\301\201\233","\201\226\200\211"}; static const char *const snd_nm[4]={"\200\226","\201\206\200\211","\200\307\201\246","\201\241\200\211"};
u32 snd=(g_set[SND_OFF]>>3)&3u, snd0=snd; u32 snd=(g_set[SND_OFF]>>3)&3u, snd0=snd;
u32 idl=g_set[IDLE_OFF]; idl = idl>=1u && idl<=5u ? idl-1u : 2u; u32 idl0=idl; u32 idl=g_set[IDLE_OFF]; idl = idl>=1u && idl<=5u ? idl-1u : 2u; u32 idl0=idl;
u32 sel=0; u32 sel=0;
for(;;){ for(;;){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(2,"\200\317\201\204",WHITE,1); ctext(2,"\200\327\201\216",WHITE,1);
big_entry(16, sel==0u, "\200\323\200\266", snd_nm[snd], ORANGE, WHITE); big_entry(16, sel==0u, "\200\333\200\272", snd_nm[snd], ORANGE, WHITE);
big_entry(45, sel==1u, "\201\255\200\272", g_idle_nm[idl], ORANGE, WHITE); big_entry(45, sel==1u, "\201\272\200\277", g_idle_nm[idl], ORANGE, WHITE);
text(9,74,"\200\323\200\266: \200\303\201\236 \201\201\200\354",GREY,1); text(9,74,"\200\333\200\272: \200\311\201\252 \201\213\200\366",GREY,1);
text(9,84,"\201\255\200\272: \200\365 \200\271\200\231\200\344\200\315",GREY,1); text(9,84,"\201\272\200\277: \200\377 \200\276\200\232\200\355\200\325",GREY,1);
text(9,94,"\200\371\200\260 \200\342\200\361\200\272 \200\224\201\212",GREY,1); text(9,94,"\201\203\200\264 \200\353\200\373\200\277 \200\224\201\225",GREY,1);
ctext(108,"B \200\300\200\212",GREY,1); ctext(108,"B \200\306\200\212",GREY,1);
ctext(117,"C \201\200\200\376 \201\261 \200\250\200\261",GREY,1); ctext(117,"C \201\212\201\210 \201\277 \200\252\200\265",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
@@ -1105,7 +1105,7 @@ static void lset_menu(void){
if(snd!=snd0 || idl!=idl0){ if(snd!=snd0 || idl!=idl0){
g_set[SND_OFF]=(u8)((g_set[SND_OFF]&~0x18u)|(snd<<3)); g_set[SND_OFF]=(u8)((g_set[SND_OFF]&~0x18u)|(snd<<3));
g_set[IDLE_OFF]=(u8)(idl+1u); g_set[IDLE_OFF]=(u8)(idl+1u);
rect(0,0,128,128,BG); ctext(40,"\201\200\200\376 \201\210",WHITE,1); ctext(54,"\201\202\200\356\200\362 \200\357\201\211\201\245\200\321\200\353",GREY,1); show(); rect(0,0,128,128,BG); ctext(40,"\201\212\201\210 \201\223",WHITE,1); ctext(54,"\201\214\200\370\200\374 \200\371\201\224\201\261\200\331\200\365",GREY,1); show();
stamp(g_set); stamp(g_set);
flash_prog4k(SET_A, g_set); flash_prog4k(SET_A, g_set);
flash_prog4k(SET_B, g_set); flash_prog4k(SET_B, g_set);
@@ -1196,7 +1196,7 @@ static u32 pic_sum(u32 n){ u32 s=0; for(u32 i=0;i<n;i++) s+=g_pic[i]; s&=0xFFFFu
#define EXT_MAGIC 0x54584550u /* "PEXT": per item address, length, sum, first word of the picture */ #define EXT_MAGIC 0x54584550u /* "PEXT": per item address, length, sum, first word of the picture */
static void draw_item_pic(u32 id, int cx, int cy, int box){ static void draw_item_pic(u32 id, int cx, int cy, int box){
int k=cat_find(id); int k=cat_find(id);
if(!g_cfg.pack_off){ pic_code(cy,"\200\365\200\274\201\211 \200\342\200\363"); return; } if(!g_cfg.pack_off){ pic_code(cy,"\200\377\200\301\201\224 \200\353\200\375"); return; }
if(k<0){ pic_code(cy,"P1"); return; } if(k<0){ pic_code(cy,"P1"); return; }
u32 co=g_cfg.cat_off+8u+28u*(u32)k, pic=rd16(co+4u), want=rd16(co+6u); u32 co=g_cfg.cat_off+8u+28u*(u32)k, pic=rd16(co+4u), want=rd16(co+6u);
u32 xo=g_cfg.cat_off+8u+28u*g_cfg.cat_n, e, end=0; u32 xo=g_cfg.cat_off+8u+28u*g_cfg.cat_n, e, end=0;
@@ -1272,7 +1272,7 @@ static void draw_item_pic(u32 id, int cx, int cy, int box){
} }
} }
} }
static const char *group_name(u32 id){ switch(id/1000u){ case 5: return "\200\332\200\311"; case 6: return "\200\202\200\332"; case 7: return "\200\376\200\227\200\203"; case 8: return "\200\354\201\240"; default: return "\200\222\201\227"; } } static const char *group_name(u32 id){ switch(id/1000u){ case 5: return "\200\342\200\320"; case 6: return "\200\202\200\342"; case 7: return "\201\210\200\227\200\203"; case 8: return "\200\366\201\254"; default: return "\200\222\201\242"; } }
/* Draw a list: title, 10 rows from y=12, footer. */ /* Draw a list: title, 10 rows from y=12, footer. */
static void ko_surface(void){rect(0,0,128,128,RGB(0,169,209));for(int y=19;y<113;y++)for(int x=0;x<128;x++)if(((x+y)&7)<2)rect(x,y,x+1,y+1,RGB(0,157,199));rect(0,0,128,19,RGB(18,58,112));rect(0,113,128,128,RGB(18,58,112));} static void ko_surface(void){rect(0,0,128,128,RGB(0,169,209));for(int y=19;y<113;y++)for(int x=0;x<128;x++)if(((x+y)&7)<2)rect(x,y,x+1,y+1,RGB(0,157,199));rect(0,0,128,19,RGB(18,58,112));rect(0,113,128,128,RGB(18,58,112));}
@@ -1307,7 +1307,7 @@ static void bag_build(void){ g_bagn=0; u32 n=list_len(); for(u32 i=0;i<n;i++) if
#define BAG_SHOWN(i) 1 #define BAG_SHOWN(i) 1
#endif #endif
static int bag_row(u32 i, char *name, char *right, u16 *col){ static int bag_row(u32 i, char *name, char *right, u16 *col){
if(i==0){ const char *s="+ \200\334\200\365\201\232 \201\220\200\201"; int k=0; while(s[k]){ name[k]=s[k]; k++; } name[k]=0; *col=GOLD; return 0; } if(i==0){ const char *s="+ \200\344\200\377\201\245 \201\233\200\201"; int k=0; while(s[k]){ name[k]=s[k]; k++; } name[k]=0; *col=GOLD; return 0; }
u32 slot=g_bag[i-1]; const char *s=item_name(list_id(slot)); int k=0; while(s[k] && k<22){ name[k]=s[k]; k++; } name[k]=0; u32 slot=g_bag[i-1]; const char *s=item_name(list_id(slot)); int k=0; while(s[k] && k<22){ name[k]=s[k]; k++; } name[k]=0;
right[0]='x'; utoa_(count_get(slot), right+1); right[0]='x'; utoa_(count_get(slot), right+1);
return 0; return 0;
@@ -1330,8 +1330,8 @@ static u32 count_choose(u32 id,u32 v,u32 lo,u32 hi,int adding){
for(;;){ for(;;){
rect(0,0,128,128,BG);ko_title(item_name(id),2);draw_item_pic(id,64,54,60); rect(0,0,128,128,BG);ko_title(item_name(id),2);draw_item_pic(id,64,54,60);
char num[8];utoa_(v,num); char num[8];utoa_(v,num);
text(20,87,adding?"\201\220\200\201":"\200\325\200\255",WHITE,1);text(65,85,num,GOLD,2);text(103,87,"\200\206",WHITE,1); text(20,87,adding?"\201\233\200\201":"\200\335\200\261",WHITE,1);text(65,85,num,GOLD,2);text(103,87,"\200\206",WHITE,1);
ctext(105,"\201\262 \200\325\200\255 \201\206\201\203",GREY,1);ctext(117,"B \201\256\200\366 C \200\273\200\262",GREY,1);show();wait_release(); ctext(105,"\201\300 \200\335\200\261 \201\220\201\215",GREY,1);ctext(117,"B \201\273\201\200 C \200\300\200\266",GREY,1);show();wait_release();
for(;;){int k=input(); for(;;){int k=input();
if(k==1){int nv=(int)v+g_step;if(nv<(int)lo)nv=(int)lo;if(nv>(int)hi)nv=(int)hi;v=(u32)nv;break;} if(k==1){int nv=(int)v+g_step;if(nv<(int)lo)nv=(int)lo;if(nv>(int)hi)nv=(int)hi;v=(u32)nv;break;}
if(k==K_A){if(v<hi)v++;break;} if(k==K_A){if(v<hi)v++;break;}
@@ -1345,18 +1345,18 @@ static u32 count_edit(u32 id,u32 v,u32 lo){return count_choose(id,v,lo,15u,0);}
static u32 count_edit(u32 id,u32 v){u32 n=count_choose(id,v,1u,15u,0);return n==16u?0u:n;} static u32 count_edit(u32 id,u32 v){u32 n=count_choose(id,v,1u,15u,0);return n==16u?0u:n;}
#endif #endif
static u32 count_add(u32 id,u32 owned){ static u32 count_add(u32 id,u32 owned){
if(owned>=15u){message("\201\217\200\237 15\200\206 \200\301\200\357","\200\240 \201\220\200\201\201\247 \200\325 \200\342\200\330\200\234\200\235","");return 16u;} if(owned>=15u){message("\201\232\200\240 15\200\206 \200\307\200\371","\200\241 \201\233\200\201\201\263 \200\335 \200\353\200\340\200\235\200\236","");return 16u;}
u32 n=count_choose(id,1u,1u,15u-owned,1);return n==16u?16u:owned+n; u32 n=count_choose(id,1u,1u,15u-owned,1);return n==16u?16u:owned+n;
} }
static int g_dirty; static int g_dirty;
static void cat_pick(void){ static void cat_pick(void){
cat_build(); cat_build();
if(!g_catn){ message("\200\334\200\365\201\232 \200\273\200\262 \200\342\200\363","\201\253\200\377 ROM\200\344",""); return; } if(!g_catn){ message("\200\344\200\377\201\245 \200\300\200\266 \200\353\200\375","\201\267\201\211 ROM\200\355",""); return; }
u32 sel=0, top=0; u32 sel=0, top=0;
for(;;){ for(;;){
if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u; if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u;
char t[64]; const char *g=group_name(g_cat[sel]); int k=0; const char *a="\201\220\200\201: "; while(a[k]){ t[k]=a[k]; k++; } int j=0; while(g[j]){ t[k++]=g[j++]; } t[k]=0; char t[64]; const char *g=group_name(g_cat[sel]); int k=0; const char *a="\201\233\200\201: "; while(a[k]){ t[k]=a[k]; k++; } int j=0; while(g[j]){ t[k++]=g[j++]; } t[k]=0;
list_draw(t, g_catn, sel, top, cat_row, "A \200\306\200\264 B \200\316\201\230 C \200\250\200\261"); list_draw(t, g_catn, sel, top, cat_row, "A \200\314\200\270 B \200\326\201\243 C \200\252\200\265");
wait_release(); wait_release();
for(;;){ for(;;){
int c=input(); int c=input();
@@ -1366,7 +1366,7 @@ static void cat_pick(void){
if(c==K_OK){ if(c==K_OK){
u32 id=g_cat[sel], n=list_len(), slot=n; u32 id=g_cat[sel], n=list_len(), slot=n;
for(u32 i=0;i<n;i++) if(list_id(i)==id){ slot=i; break; } for(u32 i=0;i<n;i++) if(list_id(i)==id){ slot=i; break; }
if(slot>=640u){ message("\200\201\200\275\200\365 \200\201\200\252 \201\214","",""); return; } if(slot>=640u){ message("\200\201\200\303\200\377 \200\201\200\254 \201\227","",""); return; }
#ifdef BAG_DEL #ifdef BAG_DEL
u32 v=count_add(id, slot<n ? count_get(slot) : 0u); u32 v=count_add(id, slot<n ? count_get(slot) : 0u);
if(v<16u){ list_set(slot,id); count_set(slot,v); g_dirty=1; return; } if(v<16u){ list_set(slot,id); count_set(slot,v); g_dirty=1; return; }
@@ -1387,7 +1387,7 @@ static void items_menu(void){
bag_build(); bag_build();
u32 n=g_bagn+1u; if(sel>=n) sel=n-1u; u32 n=g_bagn+1u; if(sel>=n) sel=n-1u;
if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u; if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u;
list_draw("\200\334\200\365\201\232", n, sel, top, bag_row, "B \201\236\201\213 C \200\250\200\261"); list_draw("\200\344\200\377\201\245", n, sel, top, bag_row, "B \201\252\201\226 C \200\252\200\265");
wait_release(); wait_release();
for(;;){ for(;;){
int c=input(); int c=input();
@@ -1404,9 +1404,9 @@ static void items_menu(void){
} }
if(c==K_BACK){ if(c==K_BACK){
if(!g_dirty) return; if(!g_dirty) return;
rect(0,0,128,128,BG); ctext(34,"\200\300\200\212\200\362 \201\200\200\376\201\247\200\223\200\353?",WHITE,1); ctext(60,"\200\303\201\215\200\201 \200\377\200\331\200\374\200\247\200\234\200\235",GREY,1); rect(0,0,128,128,BG); ctext(34,"\200\306\200\212\200\374 \201\212\201\210\201\263\200\223\200\365?",WHITE,1); ctext(60,"\200\311\201\230\200\201 \201\211\200\341\201\206\200\250\200\235\200\236",GREY,1);
ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\234\200\353",GREY,1); show(); ctext(92,"B \200\361",WHITE,1); ctext(106,"C \200\344\200\235\200\365",GREY,1); show();
if(yes_no()) set_write("\200\334\200\365\201\232 \201\200\200\376 \200\352\200\263"); if(yes_no()) set_write("\200\344\200\377\201\245 \201\212\201\210 \200\364\200\267");
return; return;
} }
} }
@@ -1419,15 +1419,15 @@ static void points_menu(void){
int pos=0; int pos=0;
for(;;){ for(;;){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(10,"\200\235\200\270\201\237\200\366\201\234",GOLD,1); ctext(10,"\200\236\200\275\201\253\201\200\201\247",GOLD,1);
for(int i=0;i<5;i++){ for(int i=0;i<5;i++){
int x=14+i*21; char s[2]={(char)('0'+dg[i]),0}; int x=14+i*21; char s[2]={(char)('0'+dg[i]),0};
if(i==pos) rect(x-2,40,x+17,68,RGB(205,225,169)); if(i==pos) rect(x-2,40,x+17,68,RGB(205,225,169));
text(x,43,s,i==pos?GOLD:WHITE,3); text(x,43,s,i==pos?GOLD:WHITE,3);
} }
ctext(80,"\201\262 \200\326\200\373 \200\300\200\212",GREY,1); ctext(80,"\201\300 \200\336\201\205 \200\306\200\212",GREY,1);
ctext(92,"B \200\235\200\363 A \200\365\201\202",GREY,1); ctext(92,"B \200\236\200\375 A \200\377\201\214",GREY,1);
ctext(106,"C \201\221\200\323",GREY,1); ctext(106,"C \201\234\200\333",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
@@ -1438,10 +1438,10 @@ static void points_menu(void){
if(pos<4){ pos++; break; } if(pos<4){ pos++; break; }
u32 nv=0; for(int i=0;i<5;i++) nv=nv*10u+dg[i]; u32 nv=0; for(int i=0;i<5;i++) nv=nv*10u+dg[i];
if(nv==money_get()) return; if(nv==money_get()) return;
rect(0,0,128,128,BG); ctext(24,"\201\237\200\366\201\234 \200\317\201\204\200\204",WHITE,1); rect(0,0,128,128,BG); ctext(24,"\201\253\201\200\201\247 \200\327\201\216\200\204",WHITE,1);
char s[8]; utoa_(nv,s); ctext(44,s,GOLD,2); ctext(70,"\200\303\201\215\200\201 \200\377\200\331\200\374\200\247\200\234\200\235",GREY,1); char s[8]; utoa_(nv,s); ctext(44,s,GOLD,2); ctext(70,"\200\311\201\230\200\201 \201\211\200\341\201\206\200\250\200\235\200\236",GREY,1);
ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\234\200\353",GREY,1); show(); ctext(92,"B \200\361",WHITE,1); ctext(106,"C \200\344\200\235\200\365",GREY,1); show();
if(yes_no()){ money_put(nv); set_write("\201\237\200\366\201\234 \201\200\200\376 \200\352\200\263"); } if(yes_no()){ money_put(nv); set_write("\201\253\201\200\201\247 \201\212\201\210 \200\364\200\267"); }
return; return;
} }
} }
@@ -1454,7 +1454,7 @@ static int tama_ok(void){ return (g_cfg.flags & F_TAMA) && g_cfg.version>=6u &&
static u32 lv_get(void){ return g_set[g_cfg.level_off] & 15u; } static u32 lv_get(void){ return g_set[g_cfg.level_off] & 15u; }
static u32 t_id(void){ u32 o=g_cfg.tama_off+4u; return g_set[o]|(g_set[o+1]<<8); } static u32 t_id(void){ u32 o=g_cfg.tama_off+4u; return g_set[o]|(g_set[o+1]<<8); }
static u32 t_stage(void){ return (g_set[g_cfg.tama_off+0x18u]>>2)&7u; } static u32 t_stage(void){ return (g_set[g_cfg.tama_off+0x18u]>>2)&7u; }
static const char *stage_name(u32 st){ switch(st){ case 1: return "\200\336"; case 2: return "\200\334\200\222"; case 3: return "\200\357\200\334\200\222"; case 4: return "\200\320\200\376\200\222"; case 5: return "\200\320\201\215"; default: return "?"; } } static const char *stage_name(u32 st){ switch(st){ case 1: return "\200\346"; case 2: return "\200\344\200\222"; case 3: return "\200\371\200\344\200\222"; case 4: return "\200\330\201\210\200\222"; case 5: return "\200\330\201\230"; default: return "?"; } }
static u16 g_chr[256]; static u32 g_chrn; static u16 g_chr[256]; static u32 g_chrn;
static void chr_build(u32 st){ g_chrn=0; for(u32 k=0;k<g_cfg.cat_n && g_chrn<256u;k++){ u32 o=g_cfg.cat_off+8u+28u*k; if(fl(o+2)[0]==2u && fl(o+6)[0]==st) g_chr[g_chrn++]=(u16)k; } } static void chr_build(u32 st){ g_chrn=0; for(u32 k=0;k<g_cfg.cat_n && g_chrn<256u;k++){ u32 o=g_cfg.cat_off+8u+28u*k; if(fl(o+2)[0]==2u && fl(o+6)[0]==st) g_chr[g_chrn++]=(u16)k; } }
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;} 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;}
@@ -1466,11 +1466,14 @@ static int chr_row(u32 i, char *name, char *right, u16 *col){
return 0; return 0;
} }
/* the pet's own file (pages of the save with the character in the header): character there too */ /* the pet's own file (pages of the save with the character in the header): character there too */
static int g_chr_color;
static u32 ko_colors(void);
static u32 ko_names(void); static u32 ko_names(void);
static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);} static u32 ghost_rd32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
static u32 tama_files(u32 old,u32 nw){ static u32 tama_files(u32 old,u32 nw){
int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0; int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0;
u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0; u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0;
u32 pal=ko_colors();if(g_chr_color>=0&&!pal)return 0;
u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu); u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu);
if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0; if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0;
for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){ for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){
@@ -1478,24 +1481,40 @@ static u32 tama_files(u32 old,u32 nw){
u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue; u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue;
// The first native genes slot is the current pet. Never alter later friend slots. // The first native genes slot is the current pet. Never alter later friend slots.
if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0; if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0;
for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;flash_prog4k(a+off,g_page);} for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;if(off==0&&g_chr_color>=0){
u32 before=0;for(u32 q=8;q<0x180;q+=4)before+=*(u32*)(g_page+q);
g_page[16]=(u8)g_chr_color;for(u32 q=0;q<16;q++){u8 v=fl(pal+16u*(u32)g_chr_color+q)[0];g_page[0x140+q]=v;g_page[0x160+q]=v;}
u32 sum=ghost_rd32(src)-before;for(u32 q=8;q<0x180;q+=4)sum+=*(u32*)(g_page+q);*(u32*)g_page=sum;*(u32*)(g_page+4)=0u-sum;
}flash_prog4k(a+off,g_page);}
return 1; return 1;
} }
return 0; return 0;
} }
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 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 u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);} static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}} static u32 ko_colors(void){u32 a=ko_names()+34u*g_cfg.cat_n+8u;return ko_le32(a)==0x314b5043u?a+4u:0;}
static const char *ko_color_name(void){static const char *const names[]={"\200\222\200\311\200\324","\200\317\200\205","\200\314\201\271","\200\307\200\256","\201\250\200\257","\201\261\200\234\200\324","\200\302\201\247","\201\231\200\266","\200\231\200\257","\201\222\201\275","\200\357\200\314\201\271","\200\357\200\307\200\256","\200\357\201\261\200\234","\200\357\200\251","\201\241\200\274","\201\261\200\350","\201\276\200\324"};return names[g_chr_color+1];}
static void ko_portrait(u32 k){
u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;
u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}
if(!w||!h||w>64||h>64)return;u32 mask=at+2u*w*h,pal=ko_colors();int colored=g_chr_color>=0&&pal&&ko_le32(mask)==0x314b534du;
int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;
for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){u32 n=y*w+x;const volatile u8 *p=fl(at+2u*n);u32 c=p[0]|((u32)p[1]<<8);if(c==0xf81fu)continue;
if(colored){u32 index=(fl(mask+4u+(n>>1))[0]>>((n&1u)*4u))&15u;if(index<8u){p=fl(pal+16u*(u32)g_chr_color+2u*index);c=p[0]|((u32)p[1]<<8);}}
rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);
}
}
static void chr_pick(void){ static void chr_pick(void){
static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u; static const u8 st_list[3]={3,4,5}; u32 si=t_stage()>=3u && t_stage()<=5u ? t_stage()-3u : 2u;
u32 sel=0, top=0; u32 sel=0, top=0;
chr_build(st_list[si]); chr_build(st_list[si]);
for(;;){ for(;;){
if(!g_chrn){ message("\201\223\200\267\201\231 \200\342\200\363","\201\253\200\377 ROM\200\344",""); return; } if(!g_chrn){ message("\201\236\200\273\201\244 \200\353\200\375","\201\267\201\211 ROM\200\355",""); return; }
if(sel>=g_chrn) sel=g_chrn-1u; if(sel>=g_chrn) sel=g_chrn-1u;
if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u; if(sel<top) top=sel; if(sel>=top+6u) top=sel-5u;
char t[64]; const char *a="\200\235\200\270: "; int k=0; while(a[k]){ t[k]=a[k]; k++; } const char *b=stage_name(st_list[si]); int j=0; while(b[j]) t[k++]=b[j++]; t[k]=0; char t[64]; const char *a="\200\236\200\275: "; int k=0; while(a[k]){ t[k]=a[k]; k++; } const char *b=stage_name(st_list[si]); int j=0; while(b[j]) t[k++]=b[j++]; t[k]=0;
list_draw(t, g_chrn, sel, top, chr_row, "A \200\236\200\213 B \200\316\201\230 C \200\250\200\261"); list_draw(t, g_chrn, sel, top, chr_row, "A \200\237\200\213 B \200\326\201\243 C \200\252\200\265");
wait_release(); wait_release();
for(;;){ for(;;){
int c=input(); int c=input();
@@ -1503,28 +1522,29 @@ static void chr_pick(void){
if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; } if(c==K_A){ si=(si+1u)%3u; chr_build(st_list[si]); sel=0; top=0; break; }
if(c==K_BACK) return; if(c==K_BACK) return;
if(c==K_OK){ if(c==K_OK){
u32 nw=0,st=0,old=t_id();int accepted=0,back=0; u32 nw=0,st=0,old=t_id();int accepted=0,back=0,colorMode=0;
g_chr_color=g_set[g_cfg.tama_off+0x19u]&31u;if(g_chr_color>15)g_chr_color=-1;
while(!accepted&&!back){ while(!accepted&&!back){
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0]; u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk); char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(93,stage_name(st),GREY,1);ctext(105,"\201\262 \200\365\201\202 \200\235\200\363",GREY,1);ctext(117,"B \200\300\200\212 C \200\273\200\262",GREY,1);show();wait_release(); ctext(93,ko_color_name(),GREY,1);ctext(105,colorMode?"\201\300 \200\324\200\322 A \200\377\200\245":"\201\300 \200\377\200\245 A \200\324\200\322",GREY,1);ctext(117,"B \200\306\200\212 C \200\300\200\266",GREY,1);show();wait_release();
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}} for(;;){int key=input();if(key==K_A){colorMode=!colorMode;break;}if(key==1){if(colorMode){g_chr_color+=g_step;if(g_chr_color>15)g_chr_color=-1;if(g_chr_color< -1)g_chr_color=15;break;}int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
} }
if(!accepted)break; if(!accepted)break;
u32 to=g_cfg.tama_off; u32 to=g_cfg.tama_off;
#ifdef FELD_TAMA_ANY #ifdef FELD_TAMA_ANY
/* without the Tama's file the game keeps showing the old Tama: say so instead of "changed" (files first, the /* without the Tama's file the game keeps showing the old Tama: say so instead of "changed" (files first, the
* settings block in RAM stays untouched then) */ * settings block in RAM stays untouched then) */
if(!tama_files(old, nw)){ message("\200\235\200\270\200\214\201\222 \200\342\200\363","\200\300\200\212\201\245\201\211 \200\335\200\337\200\330\200\234\200\235",""); return; } if(!tama_files(old, nw)){ message("\200\236\200\275\200\214\201\235 \200\353\200\375","\200\306\200\212\201\261\201\224 \200\345\200\347\200\340\200\235\200\236",""); return; }
#endif #endif
g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8); g_set[to+4]=(u8)nw; g_set[to+5]=(u8)(nw>>8); g_set[to+6]=(u8)nw; g_set[to+7]=(u8)(nw>>8);
g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2)); g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));
g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|31u); g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|(g_chr_color<0?31u:(u32)g_chr_color));
#ifdef FELD_TAMA_ANY #ifdef FELD_TAMA_ANY
#else #else
if(old && old!=nw) tama_files(old, nw); if(old && old!=nw) tama_files(old, nw);
#endif #endif
set_write("\200\235\200\270\200\214\201\222 \200\300\200\212\200\246"); set_write("\200\236\200\275\200\214\201\235 \200\306\200\212\200\247");
return; return;
} }
} }
@@ -1533,9 +1553,9 @@ static void chr_pick(void){
static void level_edit(void){ static void level_edit(void){
u32 v=lv_get(), old=v; u32 v=lv_get(), old=v;
for(;;){ for(;;){
rect(0,0,128,128,BG); ctext(10,"\201\252\200\320 \200\257\200\277",GOLD,1); rect(0,0,128,128,BG); ctext(10,"\201\266\200\330 \200\263\200\305",GOLD,1);
char s[4]; utoa_(v,s); ctext(40,s,WHITE,4); char s[4]; utoa_(v,s); ctext(40,s,WHITE,4);
ctext(80,"\201\262 \200\257\200\277 \200\300\200\212",GREY,1); ctext(94,"B \201\256\200\366 C \200\250\200\261",GREY,1); show(); wait_release(); ctext(80,"\201\300 \200\263\200\305 \200\306\200\212",GREY,1); ctext(94,"B \201\273\201\200 C \200\252\200\265",GREY,1); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
if(k==1){ int nv=(int)v+(g_step>0?1:-1); if(nv<0) nv=0; if(nv>10) nv=10; v=(u32)nv; break; } if(k==1){ int nv=(int)v+(g_step>0?1:-1); if(nv<0) nv=0; if(nv>10) nv=10; v=(u32)nv; break; }
@@ -1546,33 +1566,33 @@ static void level_edit(void){
u32 o=g_cfg.level_off, b=g_set[o]; u32 o=g_cfg.level_off, b=g_set[o];
/* up: the game celebrates the new level itself; down: nothing to celebrate */ /* up: the game celebrates the new level itself; down: nothing to celebrate */
g_set[o]=(u8)(v>old ? ((b&0xF0u)|v) : ((v<<4)|v)); g_set[o]=(u8)(v>old ? ((b&0xF0u)|v) : ((v<<4)|v));
set_write("\200\257\200\277 \201\200\200\376 \200\352\200\263"); set_write("\200\263\200\305 \201\212\201\210 \200\364\200\267");
return; return;
} }
} }
} }
} }
static void care_full(void){ static void care_full(void){
rect(0,0,128,128,BG); ctext(24,"\200\243\200\304 \201\260\200\302",WHITE,1); ctext(40,"\200\276\200\305\200\265\200\200\201\252\200\302\200\200\200\210\200\205",GOLD,1); rect(0,0,128,128,BG); ctext(24,"\200\244\200\312 \201\276\200\310",WHITE,1); ctext(40,"\200\304\200\313\200\271\200\200\201\266\200\310\200\200\200\210\200\205",GOLD,1);
ctext(70,"\200\303\201\215\200\201 \200\377\200\331\200\374\200\247\200\234\200\235",GREY,1); ctext(92,"B \200\347",WHITE,1); ctext(106,"C \200\334\200\234\200\353",GREY,1); show(); ctext(70,"\200\311\201\230\200\201 \201\211\200\341\201\206\200\250\200\235\200\236",GREY,1); ctext(92,"B \200\361",WHITE,1); ctext(106,"C \200\344\200\235\200\365",GREY,1); show();
if(!yes_no()) return; if(!yes_no()) return;
u32 to=g_cfg.tama_off; u32 to=g_cfg.tama_off;
g_set[to+0x1Cu]=6u; g_set[to+0x1Du]=20u; g_set[to+0x10u]=0u; g_set[to+0x1Cu]=6u; g_set[to+0x1Du]=20u; g_set[to+0x10u]=0u;
set_write("\200\243\200\304 \201\260\200\302 \200\352\200\263"); set_write("\200\244\200\312 \201\276\200\310 \200\364\200\267");
} }
static void big_entry(int y, int sel, const char *name, const char *st, u16 c, u16 stc); static void big_entry(int y, int sel, const char *name, const char *st, u16 c, u16 stc);
static void tama_menu(void){ static void tama_menu(void){
if(set_check_msg()) return; if(set_check_msg()) return;
u32 sel=0; u32 sel=0;
for(;;){ for(;;){
rect(0,0,128,128,BG); ctext(2,"\200\235\200\270\200\214\201\222",WHITE,1); rect(0,0,128,128,BG); ctext(2,"\200\236\200\275\200\214\201\235",WHITE,1);
char st[64], nm[64]; nm[0]=0; char st[64], nm[64]; nm[0]=0;
utoa_(lv_get(),st); big_entry(12,sel==0,"\200\257\200\277",st,GOLD,GREY); utoa_(lv_get(),st); big_entry(12,sel==0,"\200\263\200\305",st,GOLD,GREY);
{ u32 id=t_id(); int k=cat_find(id); if(k>=0 && fl(g_cfg.cat_off+8u+28u*(u32)k+2u)[0]==2u) chr_name((u32)k,nm); else utoa_(id,nm); } { u32 id=t_id(); int k=cat_find(id); if(k>=0 && fl(g_cfg.cat_off+8u+28u*(u32)k+2u)[0]==2u) chr_name((u32)k,nm); else utoa_(id,nm); }
big_entry(41,sel==1,"\200\300\200\212",nm,PINK,GREY); big_entry(41,sel==1,"\200\306\200\212",nm,PINK,GREY);
{ u32 to=g_cfg.tama_off; char *p=st; const char *a="\200\276\200\305\200\265 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Cu],p); while(*p) p++; a=" \201\252\200\302 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Du],p); while(*p) p++; if(g_set[to+0x10u]){ a=" \200\334\201\243"; while(*a) *p++=*a++; } *p=0; } { u32 to=g_cfg.tama_off; char *p=st; const char *a="\200\304\200\313\200\271 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Cu],p); while(*p) p++; a=" \201\266\200\310 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Du],p); while(*p) p++; if(g_set[to+0x10u]){ a=" \200\344\201\257"; while(*a) *p++=*a++; } *p=0; }
big_entry(70,sel==2,"\200\243\200\304",st,ORANGE,GREY); big_entry(70,sel==2,"\200\244\200\312",st,ORANGE,GREY);
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1); ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
@@ -1614,9 +1634,9 @@ static void saves_scan(void){
static u32 field_pick(void){ /* field for a new game, 0xFF = back */ static u32 field_pick(void){ /* field for a new game, 0xFF = back */
u32 nf=nfields(), sel=0; u32 nf=nfields(), sel=0;
for(;;){ for(;;){
rect(0,0,128,128,BG); ctext(2,"\200\331\200\374\201\247 \201\211\200\345",WHITE,1); rect(0,0,128,128,BG); ctext(2,"\200\341\201\206\201\263 \201\224\200\356",WHITE,1);
for(u32 i=0;i<nf;i++){ int y=14+(int)i*16; if(i==sel){ rect(1,y,127,y+15,fcol(i)); rect(2,y+1,126,y+14,BG); } text(5,y+4,fname(i),fcol(i),1); } for(u32 i=0;i<nf;i++){ int y=14+(int)i*16; if(i==sel){ rect(1,y,127,y+15,fcol(i)); rect(2,y+1,126,y+14,BG); } text(5,y+4,fname(i),fcol(i),1); }
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1); show(); wait_release(); ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1); show(); wait_release();
for(;;){ int k=input(); for(;;){ int k=input();
if(k==1){ sel=(u32)((int)sel+(g_step>0?1:-1)+(int)nf)%nf; break; } if(k==1){ sel=(u32)((int)sel+(g_step>0?1:-1)+(int)nf)%nf; break; }
if(k==K_A){ sel=(sel+1u)%nf; break; } if(k==K_A){ sel=(sel+1u)%nf; break; }
@@ -1630,24 +1650,24 @@ static void saves_menu(int with_app, int top){
u32 na = with_app ? (g_napp>1u ? 1u : g_napp) : 0u, n=ns+na, sel = na ? ns : (u32)g_act; u32 na = with_app ? (g_napp>1u ? 1u : g_napp) : 0u, n=ns+na, sel = na ? ns : (u32)g_act;
for(;;){ for(;;){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
if(n<=4u) ctext(2, top ? "PARAMIX" : "\201\200\200\376 \200\273\200\262", WHITE,1); if(n<=4u) ctext(2, top ? "PARAMIX" : "\201\212\201\210 \200\300\200\266", WHITE,1);
for(u32 i=0;i<n;i++){ for(u32 i=0;i<n;i++){
char nm[12], st[48]; u16 c=ORANGE, stc=GREY; char nm[12], st[48]; u16 c=ORANGE, stc=GREY;
if(i<ns){ if(i<ns){
const char *a="\201\200\200\376 "; int k=0; while(a[k]){ nm[k]=a[k]; k++; } nm[k++]=(char)('1'+i); nm[k]=0; const char *a="\201\212\201\210 "; int k=0; while(a[k]){ nm[k]=a[k]; k++; } nm[k++]=(char)('1'+i); nm[k]=0;
int f=g_sfld[i]; char *p=st; int f=g_sfld[i]; char *p=st;
if((int)i!=g_act && !slot_valid(i)){ const char *e="\200\310\200\340 \200\372\200\363"; while(*e) *p++=*e++; c=GREY; } if((int)i!=g_act && !slot_valid(i)){ const char *e="\200\316\200\351 \201\204\200\375"; while(*e) *p++=*e++; c=GREY; }
else if(n>4u && g_snm[i][0]){ for(int q=0;g_snm[i][q];q++) *p++=g_snm[i][q]; if(f>=0) c=fcol((u32)f); } /* compact: the Tama, field by colour */ else if(n>4u && g_snm[i][0]){ for(int q=0;g_snm[i][q];q++) *p++=g_snm[i][q]; if(f>=0) c=fcol((u32)f); } /* compact: the Tama, field by colour */
else { const char *e=f>=0 ? fname((u32)f) : "?"; while(*e) *p++=*e++; if(g_snm[i][0]){ *p++=' '; for(int q=0;g_snm[i][q];q++) *p++=g_snm[i][q]; } if(f>=0) c=fcol((u32)f); } else { const char *e=f>=0 ? fname((u32)f) : "?"; while(*e) *p++=*e++; if(g_snm[i][0]){ *p++=' '; for(int q=0;g_snm[i][q];q++) *p++=g_snm[i][q]; } if(f>=0) c=fcol((u32)f); }
*p=0; if((int)i==g_act) stc=WHITE; *p=0; if((int)i==g_act) stc=WHITE;
} else { const char *e=g_napp>1u ? "\201\241\200\261\200\217\200\254" : g_appnm[0]; int k=0; while(e[k] && k<11){ nm[k]=e[k]; k++; } nm[k]=0; e=g_napp>1u?"\200\316\201\230":"\200\331\200\374"; int q=0; while(e[q]){ st[q]=e[q]; q++; } st[q]=0; } } else { const char *e=g_napp>1u ? "\201\255\200\265\200\217\200\260" : g_appnm[0]; int k=0; while(e[k] && k<11){ nm[k]=e[k]; k++; } nm[k]=0; e=g_napp>1u?"\200\326\201\243":"\200\341\201\206"; int q=0; while(e[q]){ st[q]=e[q]; q++; } st[q]=0; }
if(n>4u){ if(n>4u){
int y=2+(int)i*16; int y=2+(int)i*16;
if(i==sel){ rect(1,y,127,y+15,c); rect(2,y+1,126,y+14,BG); } if(i==sel){ rect(1,y,127,y+15,c); rect(2,y+1,126,y+14,BG); }
text(5,y+4,nm,c,1); int w=text_w(st,1); int x=123-w; if(x<48) x=48; textn(x,y+4,st,(124-x)/6,stc,1); text(5,y+4,nm,c,1); int w=text_w(st,1); int x=123-w; if(x<48) x=48; textn(x,y+4,st,(124-x)/6,stc,1);
} else big_entry((n<4u?12:1)+(int)i*29, i==sel, nm, st, c, stc); } else big_entry((n<4u?12:1)+(int)i*29, i==sel, nm, st, c, stc);
} }
ctext(117,"B \201\256\200\366 C \200\250\200\261",GREY,1); ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
@@ -1658,14 +1678,14 @@ static void saves_menu(int with_app, int top){
if(sel>=ns){ if(g_napp>1u) apps_menu(0); else start_app_i(0); break; } if(sel>=ns){ if(g_napp>1u) apps_menu(0); else start_app_i(0); break; }
if((int)sel==g_act){ if(top) leave(); return; } if((int)sel==g_act){ if(top) leave(); return; }
int has=slot_valid(sel); u32 fld; int has=slot_valid(sel); u32 fld;
if(has){ fld=(u32)g_sfld[sel]; if(g_sfld[sel]<0){ message("\201\200\200\376","\200\367\200\222 \200\333\201\235",""); break; } } if(has){ fld=(u32)g_sfld[sel]; if(g_sfld[sel]<0){ message("\201\212\201\210","\201\201\200\222 \200\343\201\251",""); break; } }
else { fld=field_pick(); if(fld==0xFFu) break; } else { fld=field_pick(); if(fld==0xFFu) break; }
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
char t[8]="\201\200\200\376 "; t[5]=(char)('1'+sel); t[6]=0; char t[8]="\201\212\201\210 "; t[5]=(char)('1'+sel); t[6]=0;
ctext(14, has ? "\200\307\200\256\200\350\200\222" : "\200\314 \200\211\200\370 \201\211\200\345", WHITE,1); ctext(28,t,WHITE,2); ctext(14, has ? "\200\315\200\262\200\362\200\222" : "\200\323 \200\211\201\202 \201\224\200\356", WHITE,1); ctext(28,t,WHITE,2);
ctext(52,fname(fld),fcol(fld),1); if(has && g_snm[sel][0]) ctext(64,g_snm[sel],GREY,1); ctext(52,fname(fld),fcol(fld),1); if(has && g_snm[sel][0]) ctext(64,g_snm[sel],GREY,1);
ctext(80,"\200\222\201\207 \201\200\200\376 \200\357\201\211",GREY,1); ctext(80,"\200\222\201\221 \201\212\201\210 \200\371\201\224",GREY,1);
ctext(96,"B \200\347",WHITE,1); ctext(108,"C \200\334\200\234\200\353",GREY,1); show(); ctext(96,"B \200\361",WHITE,1); ctext(108,"C \200\344\200\235\200\365",GREY,1); show();
if(yes_no()) field_switch2(sel, has, fld); if(yes_no()) field_switch2(sel, has, fld);
break; break;
} }
@@ -1685,15 +1705,15 @@ static void main_menu(void){
for(;;){ for(;;){
set_load(); set_load();
ko_surface(); ko_surface();
ctext(4,"\201\222\201\234 \200\271\200\231",RGB(255,255,255),1); ctext(4,"\201\235\201\247 \200\276\200\232",RGB(255,255,255),1);
for(u32 i=0;i<n;i++){ for(u32 i=0;i<n;i++){
const char *label; const char *label;
switch(kinds[i]){case 0:label="\201\211\200\345\200\215 \201\200\200\376";break;case 1:label="\200\334\200\365\201\232";break;case 2:label="\200\235\200\270\201\237\200\366\201\234";break;case 4:label="\200\235\200\270\200\214\201\222";break;default:label="\201\241\200\261\200\217\200\254";} switch(kinds[i]){case 0:label="\201\224\200\356\200\215 \201\212\201\210";break;case 1:label="\200\344\200\377\201\245";break;case 2:label="\200\236\200\275\201\253\201\200\201\247";break;case 4:label="\200\236\200\275\200\214\201\235";break;default:label="\201\255\200\265\200\217\200\260";}
int y=24+(int)i*17; int y=24+(int)i*17;
ko_row(y-2,i==sel); ko_row(y-2,i==sel);
text(14,y,label,WHITE,1); text(14,y,label,WHITE,1);
} }
ctext(117,"A \200\365\200\244 B \200\316\201\230 C \200\250\200\261",RGB(255,255,255),1); ctext(117,"A \200\377\200\245 B \200\326\201\243 C \200\252\200\265",RGB(255,255,255),1);
show(); wait_release(); show(); wait_release();
for(;;){ for(;;){
int k=input(); int k=input();
@@ -1751,18 +1771,18 @@ static void run(void){
/* the game itself moved the Tama to this field (1.6.8): an older save of the field is still stored */ /* the game itself moved the Tama to this field (1.6.8): an older save of the field is still stored */
if(fields && !saves_mode() && slot_valid((u32)g_cur) && rd32(slot_base((u32)g_cur)+28u)!=PEND_MAGIC){ if(fields && !saves_mode() && slot_valid((u32)g_cur) && rd32(slot_base((u32)g_cur)+28u)!=PEND_MAGIC){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(10,"\200\235\200\270\200\214\201\222 \200\365\200\244 \201\211\200\345",WHITE,1); ctext(22,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(34,"\200\211\200\370\200\344\200\315 \200\365\200\244\201\250",WHITE,1); ctext(10,"\200\236\200\275\200\214\201\235 \200\377\200\245 \201\224\200\356",WHITE,1); ctext(22,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(34,"\200\211\201\202\200\355\200\325 \200\377\200\245\201\264",WHITE,1);
ctext(52,"\200\365\201\202 \201\211\200\345\200\364",GREY,1); ctext(64,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(76,"\201\200\200\376\200\365 \200\230\200\334 \200\372\200\363",GREY,1); ctext(52,"\200\377\201\214 \201\224\200\356\200\376",GREY,1); ctext(64,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(76,"\201\212\201\210\200\377 \200\230\200\344 \201\204\200\375",GREY,1);
ctext(96,"B \200\312\201\205",WHITE,1); ctext(108,"C \200\357\201\211",GREY,1); ctext(96,"B \200\321\201\217",WHITE,1); ctext(108,"C \200\371\201\224",GREY,1);
show(); show();
if(yes_no()) erase_page(slot_base((u32)g_cur)); if(yes_no()) erase_page(slot_base((u32)g_cur));
} }
/* interrupted switch? */ /* interrupted switch? */
else if(fields && slot_valid((u32)g_act) && (!saves_mode() || rd32(slot_base((u32)g_act)+28u)==PEND_MAGIC)){ else if(fields && slot_valid((u32)g_act) && (!saves_mode() || rd32(slot_base((u32)g_act)+28u)==PEND_MAGIC)){
rect(0,0,128,128,BG); rect(0,0,128,128,BG);
ctext(14,"\201\202\201\257 \200\374\200\341\200\365",RED,1); ctext(26,"\201\210\200\236\200\245\200\343\200\330\200\234\200\235",RED,1); ctext(14,"\201\214\201\274 \201\206\200\352\200\377",RED,1); ctext(26,"\201\223\200\237\200\246\200\354\200\340\200\235\200\236",RED,1);
ctext(48,"\201\200\200\376\200\362 \200\302\200\356\201\247\200\223\200\353",WHITE,1); ctext(60,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(72,"?",WHITE,1); ctext(48,"\201\212\201\210\200\374 \200\310\200\370\201\263\200\223\200\365",WHITE,1); ctext(60,fname((u32)g_cur),fcol((u32)g_cur),1); ctext(72,"?",WHITE,1);
ctext(96,"B \200\347",WHITE,1); ctext(108,"C \200\334\200\234\200\353",GREY,1); ctext(96,"B \200\361",WHITE,1); ctext(108,"C \200\344\200\235\200\365",GREY,1);
show(); show();
if(!yes_no()) leave(); if(!yes_no()) leave();
rect(0,0,128,128,BG); show(); rect(0,0,128,128,BG); show();
@@ -1774,7 +1794,7 @@ static void run(void){
#ifdef FELD_CLEAN #ifdef FELD_CLEAN
if(clean_mode() && !clk_now() && CLK_ASK()) clock_menu(1); /* new batteries: the time first */ if(clean_mode() && !clk_now() && CLK_ASK()) clock_menu(1); /* new batteries: the time first */
#endif #endif
while(!g_napp) message("\201\241\200\261\200\217\200\254 \200\342\200\363","\201\253\200\377 ROM\200\344",""); while(!g_napp) message("\201\255\200\265\200\217\200\260 \200\353\200\375","\201\267\201\211 ROM\200\355","");
apps_menu(1); apps_menu(1);
} }
if(g_cfg.flags & (F_BAG|F_TAMA)) main_menu(); if(g_cfg.flags & (F_BAG|F_TAMA)) main_menu();
+10 -3
View File
@@ -4,7 +4,7 @@ static void verify_character_genes(void){
u32 old=t_id(),slot=0,names=ko_names(),tab=names+30u*g_cfg.cat_n,count=0; u32 old=t_id(),slot=0,names=ko_names(),tab=names+30u*g_cfg.cat_n,count=0;
for(u32 a=g_cfg.user_start;a+0x4000<=g_cfg.user_end&&a+0x4000<=SET_A;a+=PAGE) for(u32 a=g_cfg.user_start;a+0x4000<=g_cfg.user_end&&a+0x4000<=SET_A;a+=PAGE)
if(rd32(a+8)==1&&rd16(a+12)==4017&&rd32(a)+rd32(a+4)==0&&rd32(a+0x118)==0x1d34){slot=a;break;} if(rd32(a+8)==1&&rd16(a+12)==4017&&rd32(a)+rd32(a+4)==0&&rd32(a+0x118)==0x1d34){slot=a;break;}
assert(slot);assert(ghost_rd32(tab)==0x314b5047u); assert(slot);assert(ghost_rd32(tab)==0x314b5047u);g_chr_color=-1;
for(u32 k=0;k<g_cfg.cat_n;k++){ for(u32 k=0;k<g_cfg.cat_n;k++){
u32 rel=ghost_rd32(tab+8+4*k);if(!rel)continue; u32 rel=ghost_rd32(tab+8+4*k);if(!rel)continue;
u32 src=g_cfg.cat_off+rel,id=rd16(g_cfg.cat_off+8+28*k),len=ghost_rd32(src+0x10c); u32 src=g_cfg.cat_off+rel,id=rd16(g_cfg.cat_off+8+28*k),len=ghost_rd32(src+0x10c);
@@ -12,8 +12,15 @@ static void verify_character_genes(void){
assert(!memcmp(host_flash+slot,host_flash+src,len)); assert(!memcmp(host_flash+slot,host_flash+src,len));
for(u32 j=len;j<0x4000;j++)assert(host_flash[slot+j]==255); for(u32 j=len;j<0x4000;j++)assert(host_flash[slot+j]==255);
assert(!memcmp(host_flash,before,slot));assert(!memcmp(host_flash+slot+0x4000,before+slot+0x4000,0x1000000-slot-0x4000)); assert(!memcmp(host_flash,before,slot));assert(!memcmp(host_flash+slot+0x4000,before+slot+0x4000,0x1000000-slot-0x4000));
assert(tama_files(id,id)==1);assert(!memcmp(host_flash+slot,host_flash+src,len));count++; assert(tama_files(id,id)==1);assert(!memcmp(host_flash+slot,host_flash+src,len));
for(int color=0;color<16;color++){
memcpy(host_flash+slot,before+slot,0x4000);g_chr_color=color;assert(tama_files(old,id)==1);assert(host_flash[slot+16]==color);
assert(!memcmp(host_flash+slot+0x140,fl(ko_colors()+color*16),16));assert(!memcmp(host_flash+slot+0x160,fl(ko_colors()+color*16),16));
assert(!memcmp(host_flash+slot+0x150,fl(src+0x150),16));assert(!memcmp(host_flash+slot+0x170,fl(src+0x170),16));assert(!memcmp(host_flash+slot+0x600,fl(src+0x600),len-0x600));
u32 sum=0;for(u32 j=8;j<0x180;j+=4)sum+=rd32(slot+j);for(u32 j=0x600;j<len;j+=4)sum+=rd32(slot+j);assert(rd32(slot)==sum&&rd32(slot+4)==0u-sum);
}
assert(!memcmp(host_flash,before,slot));assert(!memcmp(host_flash+slot+0x4000,before+slot+0x4000,0x1000000-slot-0x4000));g_chr_color=-1;count++;
} }
assert(count>=60);memcpy(host_flash,before,0x1000000);free(before); assert(count>=60);memcpy(host_flash,before,0x1000000);free(before);
printf("PASS: %u native character packages, all nine names, palettes, eye sprites, composite frames, same-ID repair and unchanged friends\n",count); printf("PASS: %u characters with original and 16 native colors, checksums, all nine names, eye sprites, composite frames, same-ID repair and unchanged friends\n",count);
} }
+4
View File
@@ -47,6 +47,10 @@ int main(int argc,char **argv){
// list and reopening must keep the item selected in the picture screen. // list and reopening must keep the item selected in the picture screen.
char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc"); char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc");
proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000)); proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000));
// Color mode changes the preview and writes the selected native palette.
proof("color-cancel",chr_pick,"banncc");assert(!memcmp(snapshot,g_set,PAGE));assert(!memcmp(flash_snapshot,host_flash,0x1000000));
proof("color-select",chr_pick,"bannnnnnnnb");assert((g_set[g_cfg.tama_off+0x19]&31)==7);
memcpy(host_flash,flash_snapshot,0x1000000);memcpy(g_set,snapshot,PAGE);
// B applies the character currently pictured, not the originally opened row. // B applies the character currently pictured, not the originally opened row.
chr_build(t_stage()>=3u&&t_stage()<=5u?t_stage():5u);u32 expected=rd16(g_cfg.cat_off+8u+28u*g_chr[1]); chr_build(t_stage()>=3u&&t_stage()<=5u?t_stage():5u);u32 expected=rd16(g_cfg.cat_off+8u+28u*g_chr[1]);
proof("character-confirm",chr_pick,"bnnb");expected=rd16(g_cfg.cat_off+8u+28u*g_chr[2]);assert(t_id()==expected); proof("character-confirm",chr_pick,"bnnb");expected=rd16(g_cfg.cat_off+8u+28u*g_chr[2]);assert(t_id()==expected);
+4
View File
@@ -47,6 +47,10 @@ int main(int argc,char **argv){
// list and reopening must keep the item selected in the picture screen. // list and reopening must keep the item selected in the picture screen.
char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc"); char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc");
proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000)); proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000));
// Color mode changes the preview and writes the selected native palette.
proof("color-cancel",chr_pick,"banncc");assert(!memcmp(snapshot,g_set,PAGE));assert(!memcmp(flash_snapshot,host_flash,0x1000000));
proof("color-select",chr_pick,"bannnnnnnnb");assert((g_set[g_cfg.tama_off+0x19]&31)==7);
memcpy(host_flash,flash_snapshot,0x1000000);memcpy(g_set,snapshot,PAGE);
// B applies the character currently pictured, not the originally opened row. // B applies the character currently pictured, not the originally opened row.
chr_build(t_stage()>=3u&&t_stage()<=5u?t_stage():5u);u32 expected=rd16(g_cfg.cat_off+8u+28u*g_chr[1]); chr_build(t_stage()>=3u&&t_stage()<=5u?t_stage():5u);u32 expected=rd16(g_cfg.cat_off+8u+28u*g_chr[1]);
proof("character-confirm",chr_pick,"bnnb");expected=rd16(g_cfg.cat_off+8u+28u*g_chr[2]);assert(t_id()==expected); proof("character-confirm",chr_pick,"bnnb");expected=rd16(g_cfg.cat_off+8u+28u*g_chr[2]);assert(t_id()==expected);
+4
View File
@@ -47,6 +47,10 @@ int main(int argc,char **argv){
// list and reopening must keep the item selected in the picture screen. // list and reopening must keep the item selected in the picture screen.
char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc"); char edge[300];edge[0]='b';memset(edge+1,'n',256);strcpy(edge+257,"cbc");
proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000)); proof("character-edge",chr_pick,edge);assert(!memcmp(flash_snapshot,host_flash,0x1000000));
// Color mode changes the preview and writes the selected native palette.
proof("color-cancel",chr_pick,"banncc");assert(!memcmp(snapshot,g_set,PAGE));assert(!memcmp(flash_snapshot,host_flash,0x1000000));
proof("color-select",chr_pick,"bannnnnnnnb");assert((g_set[g_cfg.tama_off+0x19]&31)==7);
memcpy(host_flash,flash_snapshot,0x1000000);memcpy(g_set,snapshot,PAGE);
// B applies the character currently pictured, not the originally opened row. // B applies the character currently pictured, not the originally opened row.
chr_build(t_stage()>=3u&&t_stage()<=5u?t_stage():5u);u32 expected=rd16(g_cfg.cat_off+8u+28u*g_chr[1]); chr_build(t_stage()>=3u&&t_stage()<=5u?t_stage():5u);u32 expected=rd16(g_cfg.cat_off+8u+28u*g_chr[1]);
proof("character-confirm",chr_pick,"bnnb");expected=rd16(g_cfg.cat_off+8u+28u*g_chr[2]);assert(t_id()==expected); proof("character-confirm",chr_pick,"bnnb");expected=rd16(g_cfg.cat_off+8u+28u*g_chr[2]);assert(t_id()==expected);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

+2 -2
View File
@@ -5,7 +5,7 @@
<style>body{max-width:850px;margin:40px auto;padding:0 24px;background:#edf5ef;color:#233a30;font:16px/1.8 'Malgun Gothic',system-ui,sans-serif}a{color:#146e56}h1{line-height:1.3}section{background:white;border:1px solid #c7d9cc;border-radius:16px;padding:24px;margin:20px 0}.tag{font-size:13px;color:#54705f}img{width:256px;max-width:100%;image-rendering:pixelated;border-radius:6px}.shots{display:flex;gap:16px;flex-wrap:wrap}strong{color:#214d3c}</style></head><body> <style>body{max-width:850px;margin:40px auto;padding:0 24px;background:#edf5ef;color:#233a30;font:16px/1.8 'Malgun Gothic',system-ui,sans-serif}a{color:#146e56}h1{line-height:1.3}section{background:white;border:1px solid #c7d9cc;border-radius:16px;padding:24px;margin:20px 0}.tag{font-size:13px;color:#54705f}img{width:256px;max-width:100%;image-rendering:pixelated;border-radius:6px}.shots{display:flex;gap:16px;flex-wrap:wrap}strong{color:#214d3c}</style></head><body>
<a href="/">← 편집 도구로 돌아가기</a><p class="tag">ITOSM · Paramix Studio 한국어판</p><h1>다마고치 연구소 사용 안내</h1> <a href="/">← 편집 도구로 돌아가기</a><p class="tag">ITOSM · Paramix Studio 한국어판</p><h1>다마고치 연구소 사용 안내</h1>
<section><h2>먼저 파일 열기</h2><p>이미 작업한 기기라면 현재 상태의 ROM과 저장 데이터를 먼저 읽어 보관하세요. 원본 ROM 또는 현재 읽은 16 MB 파일을 열면 캐릭터·저장·본체 메뉴 등의 탭이 나타납니다. 파일 열기·편집은 PC 브라우저 안에서 처리합니다.</p><p>기기 연결은 PC의 Chrome 또는 Edge에서 지원합니다. 장비는 서버가 아니라 사용 중인 PC에 연결하세요.</p></section> <section><h2>먼저 파일 열기</h2><p>이미 작업한 기기라면 현재 상태의 ROM과 저장 데이터를 먼저 읽어 보관하세요. 원본 ROM 또는 현재 읽은 16 MB 파일을 열면 캐릭터·저장·본체 메뉴 등의 탭이 나타납니다. 파일 열기·편집은 PC 브라우저 안에서 처리합니다.</p><p>기기 연결은 PC의 Chrome 또는 Edge에서 지원합니다. 장비는 서버가 아니라 사용 중인 PC에 연결하세요.</p></section>
<section><h2>ROM 읽기와 기록</h2><ol><li>USB-UART 어댑터를 PC와 본체에 연결합니다.</li><li>본체에서 다마 우주 → A → 통신 → 다운로드로 이동합니다.</li><li>홈페이지의 기기 → 연결을 누르고 어댑터를 선택합니다.</li><li>ROM 추출·백업 후 다운로드로 현재 상태를 보관합니다.</li></ol><p>본체의 다운로드 메뉴는 ROM 통신을 준비하는 메뉴입니다. PC에 파일을 저장하는 다운로드와 구분하세요.</p></section><section><h2>가상 방문</h2><p>ROM 읽기와 별개의 기능입니다. 홈페이지에서 기기 → 파라다이스 가상 방문을 열고 기종을 선택한 뒤 시작을 누릅니다. 어댑터를 선택하고 본체에서 다마 우주 → A → 통신 → 놀기 → B로 진행하세요. 가상 방문 중에는 ROM 작업용 연결 버튼을 누르지 않습니다.</p></section><section><h2>연결이 되지 않을 때</h2><p>어댑터와 배선을 확인하고 같은 장치를 사용하는 다른 탭이나 프로그램을 닫으세요. ROM을 기록하거나 검증하는 중에는 전원과 케이블을 유지하고 화면의 이어 쓰기 안내를 따르세요.</p><p>복구 기능이 설치된 기기에서는 C 버튼을 누른 채 RESET을 짧게 눌렀다 놓습니다. 복구 화면이 나타나면 C를 놓고 다시 연결하세요. A+C는 편집 메뉴를 여는 조합입니다. ROM 기록 중에는 RESET을 누르지 마세요.</p></section><section><h2>본체 A+C 메뉴(치트 메뉴)</h2><p><strong>메뉴 언어</strong> · 한국어 선택 시 한국어 · EN 선택 시 영어 · DE 선택 시 독일어. 새 ROM 저장 후 본체에 기록하면 적용됩니다.</p><p>영어 A+C 메뉴를 적용하려면 홈페이지 언어를 EN으로 바꾼 뒤 새 ROM을 저장하세요. 한국어 메뉴를 적용하려면 한국어를 선택하세요. 세 언어 모두 같은 디자인과 그림 미리보기 및 수량 조절 기능을 제공합니다.</p><ol><li>현재 기기에서 읽은 ROM을 엽니다.</li><li>상단에서 한국어·EN·DE 중 하나를 선택한 뒤 <strong>본체 메뉴</strong> 탭을 엽니다.</li><li>저장 슬롯·아이템·다마고치 수정 등 필요한 메뉴 기능을 켭니다.</li><li><strong>새 ROM 저장</strong>으로 결과를 보관합니다. 파일 저장만으로 본체가 바뀌지는 않습니다.</li><li>기기에 적용하려면 ‘기기’에서 기록합니다. 안내되는 저장 보존 조건을 확인하세요.</li></ol><p>한국어판 ROM에 있는 다마고치 이름과 아이템 이름을 본편과 A+C 메뉴에서 사용합니다. 이름 탭에서 수정한 한글도 새 ROM에 반영합니다. 사용할 수 없는 문자를 입력하면 저장 전에 오류가 표시됩니다.</p><p>한국어 A+C 메뉴에서는 한글 목록에서 항목을 고릅니다. 다이얼로 이동하고 B 버튼으로 선택합니다. C 버튼은 뒤로입니다.</p><p>다마고치 이름을 선택하면 그림이 나옵니다. 그림 화면에서 다이얼을 돌리면 같은 성장 단계의 이전 또는 다음 다마고치로 바뀝니다. B 버튼으로 변경을 확정합니다. C 버튼은 목록으로 돌아갑니다. 목록에서 A 버튼을 누르면 성장 단계가 바뀝니다.</p><p>아이템 → 아이템 추가에서 이름을 고르면 그림과 추가할 수량이 나옵니다. 위쪽 휠을 돌려 개수를 조절하고 B 버튼으로 추가합니다. 같은 아이템은 기존 수량에 더해지며 한 종류당 최대 15개까지 보유할 수 있습니다. 아이템 목록에서 C 버튼을 누른 뒤 저장을 확인하면 반영됩니다.</p><div class="shots"><figure><img src="menu-main.png?v=20261110-native-dial" alt="한글 글자 메뉴"><figcaption>한글 글자 메뉴</figcaption></figure><figure><img src="menu-character-list.png?v=20261110-native-dial" alt="다마고치 이름 목록"><figcaption>다마고치 이름 목록</figcaption></figure><figure><img src="menu-character.png?v=20261110-native-dial" alt="선택한 다마고치 확인"><figcaption>선택한 다마고치 확인</figcaption></figure><figure><img src="menu-item-list.png?v=20261110-native-dial" alt="아이템 이름 목록"><figcaption>아이템 이름 목록</figcaption></figure><figure><img src="menu-item.png?v=20261110-native-dial" alt="아이템 그림과 추가할 수량"><figcaption>아이템 그림과 추가할 수량</figcaption></figure><figure><img src="menu-points.png?v=20261110-native-dial" alt="다마포인트 변경"><figcaption>다마포인트 변경</figcaption></figure></div><h3>영어 A+C 메뉴</h3><p>한국어판과 같은 디자인과 기능을 영어로 사용합니다. 한국어 메뉴를 만들려면 홈페이지 언어를 한국어로 바꾼 뒤 새 ROM을 저장하세요.</p><div class="shots"><figure><img src="menu-main-en.png?v=20261111-shared" alt="영어 글자 메뉴"><figcaption>영어 글자 메뉴</figcaption></figure><Line truncated <section><h2>ROM 읽기와 기록</h2><ol><li>USB-UART 어댑터를 PC와 본체에 연결합니다.</li><li>본체에서 다마 우주 → A → 통신 → 다운로드로 이동합니다.</li><li>홈페이지의 기기 → 연결을 누르고 어댑터를 선택합니다.</li><li>ROM 추출·백업 후 다운로드로 현재 상태를 보관합니다.</li></ol><p>본체의 다운로드 메뉴는 ROM 통신을 준비하는 메뉴입니다. PC에 파일을 저장하는 다운로드와 구분하세요.</p></section><section><h2>가상 방문</h2><p>ROM 읽기와 별개의 기능입니다. 홈페이지에서 기기 → 파라다이스 가상 방문을 열고 기종을 선택한 뒤 시작을 누릅니다. 어댑터를 선택하고 본체에서 다마 우주 → A → 통신 → 놀기 → B로 진행하세요. 가상 방문 중에는 ROM 작업용 연결 버튼을 누르지 않습니다.</p></section><section><h2>연결이 되지 않을 때</h2><p>어댑터와 배선을 확인하고 같은 장치를 사용하는 다른 탭이나 프로그램을 닫으세요. ROM을 기록하거나 검증하는 중에는 전원과 케이블을 유지하고 화면의 이어 쓰기 안내를 따르세요.</p><p>복구 기능이 설치된 기기에서는 C 버튼을 누른 채 RESET을 짧게 눌렀다 놓습니다. 복구 화면이 나타나면 C를 놓고 다시 연결하세요. A+C는 편집 메뉴를 여는 조합입니다. ROM 기록 중에는 RESET을 누르지 마세요.</p></section><section><h2>본체 A+C 메뉴(치트 메뉴)</h2><p><strong>메뉴 언어</strong> · 한국어 선택 시 한국어 · EN 선택 시 영어 · DE 선택 시 독일어. 새 ROM 저장 후 본체에 기록하면 적용됩니다.</p><p>영어 A+C 메뉴를 적용하려면 홈페이지 언어를 EN으로 바꾼 뒤 새 ROM을 저장하세요. 한국어 메뉴를 적용하려면 한국어를 선택하세요. 세 언어 모두 같은 디자인과 그림 미리보기 및 수량 조절 기능을 제공합니다.</p><ol><li>현재 기기에서 읽은 ROM을 엽니다.</li><li>상단에서 한국어·EN·DE 중 하나를 선택한 뒤 <strong>본체 메뉴</strong> 탭을 엽니다.</li><li>저장 슬롯·아이템·다마고치 수정 등 필요한 메뉴 기능을 켭니다.</li><li><strong>새 ROM 저장</strong>으로 결과를 보관합니다. 파일 저장만으로 본체가 바뀌지는 않습니다.</li><li>기기에 적용하려면 ‘기기’에서 기록합니다. 안내되는 저장 보존 조건을 확인하세요.</li></ol><p>한국어판 ROM에 있는 다마고치 이름과 아이템 이름을 본편과 A+C 메뉴에서 사용합니다. 이름 탭에서 수정한 한글도 새 ROM에 반영합니다. 사용할 수 없는 문자를 입력하면 저장 전에 오류가 표시됩니다.</p><p>한국어 A+C 메뉴에서는 한글 목록에서 항목을 고릅니다. 다이얼로 이동하고 B 버튼으로 선택합니다. C 버튼은 뒤로입니다.</p><p>다마고치 이름을 선택하면 그림이 나옵니다. 그림 화면에서 다이얼을 돌리면 같은 성장 단계의 이전 또는 다음 다마고치로 바뀝니다. A 버튼으로 색상 조절로 전환한 뒤 다이얼을 돌려 기본색이나 16가지 색상을 고릅니다. A 버튼을 다시 누르면 다마고치 선택으로 돌아갑니다. 그림과 색상을 확인하고 B 버튼으로 변경을 확정합니다. C 버튼은 목록으로 돌아갑니다. 목록에서 A 버튼을 누르면 성장 단계가 바뀝니다.</p><p>아이템 → 아이템 추가에서 이름을 고르면 그림과 추가할 수량이 나옵니다. 위쪽 휠을 돌려 개수를 조절하고 B 버튼으로 추가합니다. 같은 아이템은 기존 수량에 더해지며 한 종류당 최대 15개까지 보유할 수 있습니다. 아이템 목록에서 C 버튼을 누른 뒤 저장을 확인하면 반영됩니다.</p><div class="shots"><figure><img src="menu-main.png?v=20261110-native-dial" alt="한글 글자 메뉴"><figcaption>한글 글자 메뉴</figcaption></figure><figure><img src="menu-character-list.png?v=20261110-native-dial" alt="다마고치 이름 목록"><figcaption>다마고치 이름 목록</figcaption></figure><figure><img src="menu-character.png?v=20261111-colors" alt="선택한 다마고치 확인"><figcaption>선택한 다마고치 확인</figcaption></figure><figure><img src="menu-item-list.png?v=20261110-native-dial" alt="아이템 이름 목록"><figcaption>아이템 이름 목록</figcaption></figure><figure><img src="menu-item.png?v=20261110-native-dial" alt="아이템 그림과 추가할 수량"><figcaption>아이템 그림과 추가할 수량</figcaption></figure><figure><img src="menu-points.png?v=20261110-native-dial" alt="다마포인트 변경"><figcaption>다마포인트 변경</figcaption></figure></div><h3>영어 A+C 메뉴</h3><p>한국어판과 같은 디자인과 기능을 영어로 사용합니다. 한국어 메뉴를 만들려면 홈페이지 언Line truncated
<section><h2>도감과 미션</h2><p>ROM을 열고 저장 관리에서 도감 또는 미션을 선택합니다. 이름과 지역 및 완료 여부로 항목을 찾을 수 있습니다. 원하는 항목을 체크한 뒤 선택한 도감 등록 또는 선택한 미션 완료를 누르세요. 전체 도감 등록과 전체 미션 완료로 한 번에 적용할 수도 있습니다.</p><p>열어 둔 ROM의 도감과 미션 목록을 표시합니다. 미션의 완료 표시를 적용하며 활동 횟수는 바꾸지 않습니다. 보상은 본체의 미션 화면에서 받으세요. 이미 받은 보상 기록은 유지됩니다.</p><p>적용 후 새 ROM 저장으로 파일을 보관하세요. 홈페이지에서 적용한 것만으로 연결된 본체가 바뀌지는 않습니다.</p></section><section><h2>육성 데이터 편집</h2><p>저장 관리에서 ROM의 저장 데이터를 열면 레벨과 다마고치 종류 및 성장 단계를 수정할 수 있습니다. 배부름은 0~6이고 행복은 0~20입니다. 숫자가 클수록 배부르고 행복한 상태입니다. 건강 회복도 선택할 수 있습니다.</p></section><section><h2>서버 우선 백업</h2><p>관리자가 서버 우선 방식을 선택하면 회원과 비회원 모두 기기에서 읽은 데이터를 서버에 저장합니다. 서버에서 내려받은 파일의 크기와 확인값을 검사한 뒤 PC에 저장하고 편집에 사용합니다. 임시 백업은 업로드한 브라우저에서 받을 수 있습니다. 기본 보관 기간은 24시간입니다.</p><p>서버 저장에 실패하면 다운로드하지 않고 읽은 데이터를 현재 탭에 유지합니다. 탭을 닫지 말고 서버 저장 재시도를 누르세요. 관리자는 백업 방식과 임시 저장 용량 및 보관 기간을 바꿀 수 있습니다. 로그인한 회원의 개인 보관함은 별도로 유지됩니다.</p></section><section><h2>기종별 원본 복원</h2><p>로그인한 뒤 기종별 복원 메뉴에서 공개된 파일을 선택하고 파일 검증 → 본체 연결 → 복원을 진행하세요. 복원 시 현재 펌웨어·추가 메뉴·저장 데이터가 백업 당시 상태로 교체됩니다.</p></section><section><h2>여섯 지역 통합 · 회원 전용</h2><ol><li><a href="account.html">회원가입 또는 로그인</a>합니다.</li><li>상단 기기 메뉴에서 트로피컬 또는 글레이셔 본체를 연결합니다.</li><li>기기 메뉴의 여섯 지역 확장을 열어 ROM 읽기·백업을 마친 뒤 <strong>여섯 지역 모두 추가</strong>를 선택합니다.</li><li>지역 그림을 가져올 랜드·워터·스카이 중 하나의 원본 ROM을 선택합니다.</li><li>같은 메뉴의 설정한 ROM을 기기에 기록 버튼으로 진행합니다. 기록 전 확인창에서 내용을 확인하세요.</li></ol><p>제이드 포레스트 원본만으로는 여섯 지역 통합이 되지 않으며 네 지역 확장을 이용할 수 있습니다. 이미 다른 수정을 적용한 펌웨어는 호환 검사에서 차단될 수 있습니다.</p></section><section><h2>회원 개인 보관함</h2><p><a href="account.html">회원가입·내 보관함</a>에서 선택적으로 가입할 수 있습니다. 회원마다 총 160 MiB의 공간에 덤프를 최대 10개까지 보관할 수 있습니다. 비회원도 편집과 추출을 이용할 수 있습니다. 기종별 복원은 로그인 후 이용할 수 있습니다. 로그인 상태에서 본체 ROM을 추출하면 개인 보관함에도 저장됩니다. 서버 우선 방식에서는 서버 저장과 내려받은 파일의 검증을 마친 뒤 PC에 저장합니다. 개인 보관함이 가득 차면 임시 서버 백업을 이용합니다. 임시 서버 백업에 실패하면 현재 탭에서 재시도할 수 있습니다.</p><p>보관함에서 PC 덤프 업로드, 다운로드, 이름 변경, 삭제, 편집 도구에서 열기 및 개인 백업 복원을 사용할 수 있습니다. 개인 파일은 본인만 접근하며 자동 공개되지 않습니다. 회원가입 후 표시하는 복구 코드를 보관하면 이메일 없이 비밀번호를 재설정할 수 있습니다.</p></section><section><h2>언어와 배포 자료</h2><p>상단에서 한국어·EN·DE를 선택할 수 있습니다. </p><p><a href="ParamixStudio.html" download>오프라인 HTML 다운로드</a> · <a href="LICENSE.txt">GPL 라이선스</a> · <a href="NOTICE.txt">저작권 안내</a> · <a href="Galmuri-OFL.txt">한글 글꼴 라이선스</a></p><p>원작: mameise / <a href="https://github.com/mameise/Paramix-Studio">Paramix Studio</a>. 한글 메뉴에는 불러온 ROM의 글꼴을 사용합니다. 대체 글꼴: quiple / Galmuri9. BANDAI의 공식 도구가 아닙니다.</p></section> <section><h2>도감과 미션</h2><p>ROM을 열고 저장 관리에서 도감 또는 미션을 선택합니다. 이름과 지역 및 완료 여부로 항목을 찾을 수 있습니다. 원하는 항목을 체크한 뒤 선택한 도감 등록 또는 선택한 미션 완료를 누르세요. 전체 도감 등록과 전체 미션 완료로 한 번에 적용할 수도 있습니다.</p><p>열어 둔 ROM의 도감과 미션 목록을 표시합니다. 미션의 완료 표시를 적용하며 활동 횟수는 바꾸지 않습니다. 보상은 본체의 미션 화면에서 받으세요. 이미 받은 보상 기록은 유지됩니다.</p><p>적용 후 새 ROM 저장으로 파일을 보관하세요. 홈페이지에서 적용한 것만으로 연결된 본체가 바뀌지는 않습니다.</p></section><section><h2>육성 데이터 편집</h2><p>저장 관리에서 ROM의 저장 데이터를 열면 레벨과 다마고치 종류 및 성장 단계를 수정할 수 있습니다. 색상 목록에서 기본색이나 16가지 색상을 고르면 미리보기에 반영됩니다. 다마고치 종류를 유지하고 색상만 바꾸면 기존 눈 모양은 유지됩니다. 배부름은 0~6이고 행복은 0~20입니다. 숫자가 클수록 배부르고 행복한 상태입니다. 건강 회복도 선택할 수 있습니다.</p></section><section><h2>서버 우선 백업</h2><p>관리자가 서버 우선 방식을 선택하면 회원과 비회원 모두 기기에서 읽은 데이터를 서버에 저장합니다. 서버에서 내려받은 파일의 크기와 확인값을 검사한 뒤 PC에 저장하고 편집에 사용합니다. 임시 백업은 업로드한 브라우저에서 받을 수 있습니다. 기본 보관 기간은 24시간입니다.</p><p>서버 저장에 실패하면 다운로드하지 않고 읽은 데이터를 현재 탭에 유지합니다. 탭을 닫지 말고 서버 저장 재시도를 누르세요. 관리자는 백업 방식과 임시 저장 용량 및 보관 기간을 바꿀 수 있습니다. 로그인한 회원의 개인 보관함은 별도로 유지됩니다.</p></section><section><h2>기종별 원본 복원</h2><p>로그인한 뒤 기종별 복원 메뉴에서 공개된 파일을 선택하고 파일 검증 → 본체 연결 → 복원을 진행하세요. 복원 시 현재 펌웨어·추가 메뉴·저장 데이터가 백업 당시 상태로 교체됩니다.</p></section><section><h2>여섯 지역 통합 · 회원 전용</h2><ol><li><a href="account.html">회원가입 또는 로그인</a>합니다.</li><li>상단 기기 메뉴에서 트로피컬 또는 글레이셔 본체를 연결합니다.</li><li>기기 메뉴의 여섯 지역 확장을 열어 ROM 읽기·백업을 마친 뒤 <strong>여섯 지역 모두 추가</strong>를 선택합니다.</li><li>지역 그림을 가져올 랜드·워터·스카이 중 하나의 원본 ROM을 선택합니다.</li><li>같은 메뉴의 설정한 ROM을 기기에 기록 버튼으로 진행합니다. 기록 전 확인창에서 내용을 확인하세요.</li></ol><p>제이드 포레스트 원본만으로는 여섯 지역 통합이 되지 않으며 네 지역 확장을 이용할 수 있습니다. 이미 다른 수정을 적용한 펌웨어는 호환 검사에서 차단될 수 있습니다.</p></section><section><h2>회원 개인 보관함</h2><p><a href="account.html">회원가입·내 보관함</a>에서 선택적으로 가입할 수 있습니다. 회원마다 총 160 MiB의 공간에 덤프를 최대 10개까지 보관할 수 있습니다. 비회원도 편집과 추출을 이용할 수 있습니다. 기종별 복원은 로그인 후 이용할 수 있습니다. 로그인 상태에서 본체 ROM을 추출하면 개인 보관함에도 저장됩니다. 서버 우선 방식에서는 서버 저장과 내려받은 파일의 검증을 마친 뒤 PC에 저장합니다. 개인 보관함이 가득 차면 임시 서버 백업을 이용합니다. 임시 서버 백업에 실패하면 현재 탭에서 재시도할 수 있습니다.</p><p>보관함에서 PC 덤프 업로드, 다운로드, 이름 변경, 삭제, 편집 도구에서 열기 및 개인 백업 복원을 사용할 수 있습니다. 개인 파일은 본인만 접근하며 자동 공개되지 않습니다. 회원가입 후 표시하는 복구 코드를 보관하면 이메일 없이 비밀번호를 재설정할 수 있습니다.</p></section><section><h2>언어와 배포 자료</h2><p>상단에서 한국어·EN·DE를 선택할 수 있습니다. </p><p><a href="ParamixStudio.html" download>오프라인 HTML 다운로드</a> · <a href="LICENSE.txt">GPL 라이선스</a> · <a href="NOTICE.txt">저작권 안내</a> · <a href="Galmuri-OFL.txt">한글 글꼴 라이선스</a></p><p>원작: mameise / <a href="https://github.com/mameise/Paramix-Studio">Paramix Studio</a>. 한글 메뉴에는 불러온 ROM의 글꼴을 사용합니다. 대체 글꼴: quiple / Galmuri9. BANDAI의 공식 도구가 아닙니다.</p></section>
<script src="member-nav.js"></script></body></html> <script src="member-nav.js"></script></body></html>
+3 -1
View File
@@ -2,6 +2,8 @@
require('./build-menu-en.cjs'); require('./build-menu-en.cjs');
const fs=require('fs'),path=require('path'),dir=path.resolve(__dirname,'../feld/src/feld'); const fs=require('fs'),path=require('path'),dir=path.resolve(__dirname,'../feld/src/feld');
const tr={ const tr={
"ORIGINAL":"ORIGINAL","RED":"ROT","PINK":"ROSA","PURPLE":"VIOLETT","BLUE":"BLAU","SKY BLUE":"HIMMELBLAU","MINT":"MINT","GREEN":"GRÜN","YELLOW":"GELB","ORANGE":"ORANGE","LIGHT PINK":"HELLROSA","LAVENDER":"LAVENDEL","LIGHT BLUE":"HELLBLAU","LIGHT GREEN":"HELLGRÜN","CREAM":"CREME","WHITE":"WEISS","GRAY":"GRAU",
'WHEEL COLOR A TAMA':'RAD FARBE A TAMA','WHEEL TAMA A COLOR':'RAD TAMA A FARBE',
'LAND':'LAND','WATER':'WASSER','SKY':'HIMMEL','SAVING':'SPEICHERN','CHECKING':'PRÜFEN','LOADING':'LADEN','ERROR':'FEHLER','CODE 00':'CODE 00', 'LAND':'LAND','WATER':'WASSER','SKY':'HIMMEL','SAVING':'SPEICHERN','CHECKING':'PRÜFEN','LOADING':'LADEN','ERROR':'FEHLER','CODE 00':'CODE 00',
'SAVE TOO BIG':'SPIELSTAND ZU GROSS','B OR C: BACK':'B/C ZURÜCK','C BACK':'C ZURÜCK','DONE':'FERTIG','PROGRAM':'PROGRAMM','SETTINGS':'EINSTELLUNGEN','DOWNLOAD':'DOWNLOAD','PLEASE WAIT':'BITTE WARTEN','DO NOT SWITCH OFF':'NICHT AUSSCHALTEN', 'SAVE TOO BIG':'SPIELSTAND ZU GROSS','B OR C: BACK':'B/C ZURÜCK','C BACK':'C ZURÜCK','DONE':'FERTIG','PROGRAM':'PROGRAMM','SETTINGS':'EINSTELLUNGEN','DOWNLOAD':'DOWNLOAD','PLEASE WAIT':'BITTE WARTEN','DO NOT SWITCH OFF':'NICHT AUSSCHALTEN',
'SWITCH TO':'WECHSELN ZU','SAVED GAME':'SPIELSTAND','FIELD STARTS':'DIE REGION','WILL BE LOADED':'WIRD GELADEN','FROM SCRATCH':'STARTET NEU','B = YES':'B = JA','C = NO':'C = NEIN','NEVER':'NIE', 'SWITCH TO':'WECHSELN ZU','SAVED GAME':'SPIELSTAND','FIELD STARTS':'DIE REGION','WILL BE LOADED':'WIRD GELADEN','FROM SCRATCH':'STARTET NEU','B = YES':'B = JA','C = NO':'C = NEIN','NEVER':'NIE',
@@ -10,7 +12,7 @@ const tr={
'CLOCK':'UHR','DISPLAY':'ANZEIGE','DISPLAY: DARK':'ANZEIGE: AUS','WITHOUT A KEY':'OHNE EINGABE','B CHANGE':'B ÄNDERN','C SAVE AND BACK':'C SPEICHERN/ZURÜCK','OFF':'AUS','LOW':'LEISE','MEDIUM':'MITTEL','LOUD':'LAUT','SOUND':'TON','SOUND: THE PARADISE':'TON: WIE IM SPIEL','DISPLAY: THIS MENU,':'ANZEIGE: DIESES MENÜ','DARK WITHOUT A KEY':'OHNE EINGABE AUS','NO PICS':'KEIN BILD', 'CLOCK':'UHR','DISPLAY':'ANZEIGE','DISPLAY: DARK':'ANZEIGE: AUS','WITHOUT A KEY':'OHNE EINGABE','B CHANGE':'B ÄNDERN','C SAVE AND BACK':'C SPEICHERN/ZURÜCK','OFF':'AUS','LOW':'LEISE','MEDIUM':'MITTEL','LOUD':'LAUT','SOUND':'TON','SOUND: THE PARADISE':'TON: WIE IM SPIEL','DISPLAY: THIS MENU,':'ANZEIGE: DIESES MENÜ','DARK WITHOUT A KEY':'OHNE EINGABE AUS','NO PICS':'KEIN BILD',
'FOOD':'ESSEN','SNACKS':'SNACKS','TOYS':'SPIELZEUG','GOODS':'ZUBEHÖR','OTHER':'SONSTIGES','+ ADD ITEM':'+ HINZUFÜGEN','ADD':'PLUS','COUNT':'ANZ.','WHEEL: COUNT':'RAD: ANZAHL','B OK C LIST':'B OK C LISTE','MAX 15 ITEMS':'MAXIMAL 15 STÜCK','NO MORE ROOM':'KEIN PLATZ MEHR','NO ITEM LIST':'KEINE ARTIKELLISTE','IN THIS ROM':'IN DIESEM ROM','ADD: ':'NEU: ','A NEXT GROUP C BACK':'A GRUPPE C ZURÜCK','BAG IS FULL':'TASCHE IST VOLL','ITEMS':'ARTIKEL','B EDIT C BACK':'B ÄNDERN C ZURÜCK','SAVE CHANGES?':'ÄNDERUNGEN SPEICHERN?','THE TAMA RESTARTS':'TAMA STARTET NEU','ITEMS SAVED':'ARTIKEL GESPEICHERT', 'FOOD':'ESSEN','SNACKS':'SNACKS','TOYS':'SPIELZEUG','GOODS':'ZUBEHÖR','OTHER':'SONSTIGES','+ ADD ITEM':'+ HINZUFÜGEN','ADD':'PLUS','COUNT':'ANZ.','WHEEL: COUNT':'RAD: ANZAHL','B OK C LIST':'B OK C LISTE','MAX 15 ITEMS':'MAXIMAL 15 STÜCK','NO MORE ROOM':'KEIN PLATZ MEHR','NO ITEM LIST':'KEINE ARTIKELLISTE','IN THIS ROM':'IN DIESEM ROM','ADD: ':'NEU: ','A NEXT GROUP C BACK':'A GRUPPE C ZURÜCK','BAG IS FULL':'TASCHE IST VOLL','ITEMS':'ARTIKEL','B EDIT C BACK':'B ÄNDERN C ZURÜCK','SAVE CHANGES?':'ÄNDERUNGEN SPEICHERN?','THE TAMA RESTARTS':'TAMA STARTET NEU','ITEMS SAVED':'ARTIKEL GESPEICHERT',
'TAMAPOINTS':'TAMAPUNKTE','WHEEL: DIGIT':'RAD: ZIFFER','B NEXT A BACK':'B WEITER A ZURÜCK','C CANCEL':'C ABBRECHEN','SET TAMAPOINTS TO':'TAMAPUNKTE SETZEN','TAMAPOINTS SAVED':'PUNKTE GESPEICHERT', 'TAMAPOINTS':'TAMAPUNKTE','WHEEL: DIGIT':'RAD: ZIFFER','B NEXT A BACK':'B WEITER A ZURÜCK','C CANCEL':'C ABBRECHEN','SET TAMAPOINTS TO':'TAMAPUNKTE SETZEN','TAMAPOINTS SAVED':'PUNKTE GESPEICHERT',
'EGG':'EI','BABY':'BABY','KID':'KIND','YOUNG':'JUGENDLICH','ADULT':'ERWACHSEN','NO CHARACTERS':'KEINE TAMAGOTCHIS','TAMA: ':'TAMA: ','A STAGE B OK C BACK':'A ALTER B OK C ZUR.','WHEEL: PREV/NEXT':'RAD: ZURÜCK/WEITER','B APPLY C LIST':'B WÄHLEN C LISTE','TAMA NOT FOUND':'TAMA NICHT GEFUNDEN','TAMA CHANGED':'TAMA GEÄNDERT','PLANET LEVEL':'PLANETENLEVEL','WHEEL: LEVEL':'RAD: LEVEL','LEVEL SAVED':'LEVEL GESPEICHERT','FULL CARE:':'VOLLE PFLEGE:','FED, HAPPY, HEALTHY':'SATT/FROH/GESUND','TAMA CARED FOR':'TAMA VERSORGT','TAMA':'TAMA','LEVEL':'LEVEL','CHANGE':'ÄNDERN','FOOD ':'SATT ',' JOY ':' FROH ',' SICK':' KRANK','CARE':'PFLEGE', 'EGG':'EI','BABY':'BABY','KID':'KIND','YOUNG':'JUGENDLICH','ADULT':'ERWACHSEN','NO CHARACTERS':'KEINE TAMAGOTCHIS','TAMA: ':'TAMA: ','A STAGE B OK C BACK':'A ALTER B OK C ZUR.','B APPLY C LIST':'B WÄHLEN C LISTE','TAMA NOT FOUND':'TAMA NICHT GEFUNDEN','TAMA CHANGED':'TAMA GEÄNDERT','PLANET LEVEL':'PLANETENLEVEL','WHEEL: LEVEL':'RAD: LEVEL','LEVEL SAVED':'LEVEL GESPEICHERT','FULL CARE:':'VOLLE PFLEGE:','FED, HAPPY, HEALTHY':'SATT/FROH/GESUND','TAMA CARED FOR':'TAMA VERSORGT','TAMA':'TAMA','LEVEL':'LEVEL','CHANGE':'ÄNDERN','FOOD ':'SATT ',' JOY ':' FROH ',' SICK':' KRANK','CARE':'PFLEGE',
'START ON FIELD':'STARTREGION','SAVES':'SPIELSTÄNDE','SAVE ':'STAND ','EMPTY':'LEER','SAVE':'SPEICHERN','UNREADABLE':'NICHT LESBAR','LOAD':'LADEN','NEW GAME IN':'NEUES SPIEL IN','YOUR GAME IS KEPT':'SPIELSTAND BLEIBT','CHEAT MENU':'CHEAT-MENÜ','REGIONS / SAVES':'REGION / SPEICHER','TAMAGOTCHI':'TAMAGOTCHI','A NEXT B OK C BACK':'A WEITER B OK C ZUR.', 'START ON FIELD':'STARTREGION','SAVES':'SPIELSTÄNDE','SAVE ':'STAND ','EMPTY':'LEER','SAVE':'SPEICHERN','UNREADABLE':'NICHT LESBAR','LOAD':'LADEN','NEW GAME IN':'NEUES SPIEL IN','YOUR GAME IS KEPT':'SPIELSTAND BLEIBT','CHEAT MENU':'CHEAT-MENÜ','REGIONS / SAVES':'REGION / SPEICHER','TAMAGOTCHI':'TAMAGOTCHI','A NEXT B OK C BACK':'A WEITER B OK C ZUR.',
'THE TAMA MOVED TO':'TAMA WECHSELTE NACH','IN THE GAME':'IM SPIEL','AN OLDER SAVE OF':'ALTER SPIELSTAND','IS STILL STORED':'IST NOCH GESPEICHERT','B = DELETE IT':'B = LÖSCHEN','C = KEEP IT':'C = BEHALTEN','SWITCH WAS':'WECHSEL WURDE','INTERRUPTED':'UNTERBROCHEN','RESTORE SAVE OF':'SPIELSTAND LADEN','NO PROGRAMS':'KEINE PROGRAMME' 'THE TAMA MOVED TO':'TAMA WECHSELTE NACH','IN THE GAME':'IM SPIEL','AN OLDER SAVE OF':'ALTER SPIELSTAND','IS STILL STORED':'IST NOCH GESPEICHERT','B = DELETE IT':'B = LÖSCHEN','C = KEEP IT':'C = BEHALTEN','SWITCH WAS':'WECHSEL WURDE','INTERRUPTED':'UNTERBROCHEN','RESTORE SAVE OF':'SPIELSTAND LADEN','NO PROGRAMS':'KEINE PROGRAMME'
}; };
+2
View File
@@ -2,6 +2,8 @@
const fs=require('fs'),path=require('path'); const fs=require('fs'),path=require('path');
const dir=path.resolve(__dirname,'../feld/src/feld'); const dir=path.resolve(__dirname,'../feld/src/feld');
const labels={ const labels={
"기본색":"ORIGINAL","빨강":"RED","분홍":"PINK","보라":"PURPLE","파랑":"BLUE","하늘색":"SKY BLUE","민트":"MINT","초록":"GREEN","노랑":"YELLOW","주황":"ORANGE","연분홍":"LIGHT PINK","연보라":"LAVENDER","연하늘":"LIGHT BLUE","연두":"LIGHT GREEN","크림":"CREAM","하양":"WHITE","회색":"GRAY",
'휠 색상 A 이동':'WHEEL COLOR A TAMA','휠 이동 A 색상':'WHEEL TAMA A COLOR',
'치트 메뉴':'CHEAT MENU','지역과 저장':'REGIONS / SAVES','아이템':'ITEMS','다마포인트':'TAMAPOINTS','다마고치':'TAMAGOTCHI','프로그램':'PROGRAMS', '치트 메뉴':'CHEAT MENU','지역과 저장':'REGIONS / SAVES','아이템':'ITEMS','다마포인트':'TAMAPOINTS','다마고치':'TAMAGOTCHI','프로그램':'PROGRAMS',
'A 이동 B 선택 C 뒤로':'A NEXT B OK C BACK','휠 이전 다음':'WHEEL: PREV/NEXT','B 변경 C 목록':'B APPLY C LIST', 'A 이동 B 선택 C 뒤로':'A NEXT B OK C BACK','휠 이전 다음':'WHEEL: PREV/NEXT','B 변경 C 목록':'B APPLY C LIST',
'추가':'ADD','수량':'COUNT','개':'','휠 수량 조절':'WHEEL: COUNT','B 확인 C 목록':'B OK C LIST', '추가':'ADD','수량':'COUNT','개':'','휠 수량 조절':'WHEEL: COUNT','B 확인 C 목록':'B OK C LIST',
+1 -1
View File
@@ -2,7 +2,7 @@
const fs=require('fs'),path=require('path');const root=path.resolve(__dirname,'..'),dir=path.join(root,'feld/src/feld'); const fs=require('fs'),path=require('path');const root=path.resolve(__dirname,'..'),dir=path.join(root,'feld/src/feld');
const tr={};for(const row of fs.readFileSync(dir+'/ko.tsv','utf8').split(/\r?\n/)){if(!row)continue;const p=row.indexOf('\t');tr[row.slice(0,p)]=row.slice(p+1);} const tr={};for(const row of fs.readFileSync(dir+'/ko.tsv','utf8').split(/\r?\n/)){if(!row)continue;const p=row.indexOf('\t');tr[row.slice(0,p)]=row.slice(p+1);}
const fields={LAND:'육지',WATER:'수중',SKY:'하늘',FOREST:'숲',TROPICAL:'트로피컬',GLACIER:'글레이셔'}; const fields={LAND:'육지',WATER:'수중',SKY:'하늘',FOREST:'숲',TROPICAL:'트로피컬',GLACIER:'글레이셔'};
const chars=[...new Set((Object.values({...tr,...fields}).join('')+'치트 메뉴휠 이전 다음다마고치 편집지역과 저장다마포인트아이템프로그램A 이동 B 선택 C 뒤로B 변경 C 목록추가수량개휠 수량 조절B 확인 C 목록최대 15개 보유더 추가할 수 없습니다'))].filter(x=>x.charCodeAt(0)>127).sort(); const chars=[...new Set((Object.values({...tr,...fields}).join('')+'치트 메뉴휠 이전 다음다마고치 편집지역과 저장다마포인트아이템프로그램A 이동 B 선택 C 뒤로B 변경 C 목록추가수량개휠 수량 조절B 확인 C 목록최대 15개 보유더 추가할 수 없습니다기본색빨강분홍보라파랑하늘색민트초록노랑주황연분홍연보라연하늘연두크림하양회색휠 색상 A 이동휠 이동 A 색상'))].filter(x=>x.charCodeAt(0)>127).sort();
const native=require('../src/core.js').KO_CHARS; const native=require('../src/core.js').KO_CHARS;
const wanted=new Set([...chars,...native]); const wanted=new Set([...chars,...native]);
const glyphs=new Map();const bdf=fs.readFileSync(root+'/third-party/Galmuri9.bdf','utf8'); const glyphs=new Map();const bdf=fs.readFileSync(root+'/third-party/Galmuri9.bdf','utf8');
+26 -7
View File
@@ -23,9 +23,22 @@ module.exports=function(s,enc){
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)'); 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. // 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 pos=s.indexOf('static void chr_pick(void){');
const colorNames=["기본색","빨강","분홍","보라","파랑","하늘색","민트","초록","노랑","주황","연분홍","연보라","연하늘","연두","크림","하양","회색"];
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;} 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 u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);} static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}} static u32 ko_colors(void){u32 a=ko_names()+34u*g_cfg.cat_n+8u;return ko_le32(a)==0x314b5043u?a+4u:0;}
static const char *ko_color_name(void){static const char *const names[]={${colorNames.map(n=>'"'+enc(n)+'"').join(',')}};return names[g_chr_color+1];}
static void ko_portrait(u32 k){
u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;
u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}
if(!w||!h||w>64||h>64)return;u32 mask=at+2u*w*h,pal=ko_colors();int colored=g_chr_color>=0&&pal&&ko_le32(mask)==0x314b534du;
int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;
for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){u32 n=y*w+x;const volatile u8 *p=fl(at+2u*n);u32 c=p[0]|((u32)p[1]<<8);if(c==0xf81fu)continue;
if(colored){u32 index=(fl(mask+4u+(n>>1))[0]>>((n&1u)*4u))&15u;if(index<8u){p=fl(pal+16u*(u32)g_chr_color+2u*index);c=p[0]|((u32)p[1]<<8);}}
rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);
}
}
`; `;
s=s.slice(0,pos)+helpers+s.slice(pos); s=s.slice(0,pos)+helpers+s.slice(pos);
s=s.replace('static char g_nm[24];','static char g_nm[64];'); s=s.replace('static char g_nm[24];','static char g_nm[64];');
@@ -52,12 +65,13 @@ static void ko_row(int y,int selected){rect(5,y+2,123,y+14,RGB(18,96,136));rect(
s=s.replace('fn=fname(f-1u); *col=fcol(f-1u);','fn=fname(f-1u); *col=WHITE;'); s=s.replace('fn=fname(f-1u); *col=fcol(f-1u);','fn=fname(f-1u); *col=WHITE;');
const previewStart=s.indexOf(' u32 kk=g_chr[sel]'),previewEnd=s.indexOf(' u32 to=g_cfg.tama_off;',previewStart); const previewStart=s.indexOf(' u32 kk=g_chr[sel]'),previewEnd=s.indexOf(' u32 to=g_cfg.tama_off;',previewStart);
if(previewStart<0||previewEnd<0)throw Error('Character preview not found'); if(previewStart<0||previewEnd<0)throw Error('Character preview not found');
s=s.slice(0,previewStart)+` u32 nw=0,st=0,old=t_id();int accepted=0,back=0; s=s.slice(0,previewStart)+` u32 nw=0,st=0,old=t_id();int accepted=0,back=0,colorMode=0;
g_chr_color=g_set[g_cfg.tama_off+0x19u]&31u;if(g_chr_color>15)g_chr_color=-1;
while(!accepted&&!back){ while(!accepted&&!back){
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0]; u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk); char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
ctext(93,stage_name(st),GREY,1);ctext(105,"${enc('휠 이전 다음')}",GREY,1);ctext(117,"${enc('B 변경 C 목록')}",GREY,1);show();wait_release(); ctext(93,ko_color_name(),GREY,1);ctext(105,colorMode?"${enc('휠 색상 A 이동')}":"${enc('휠 이동 A 색상')}",GREY,1);ctext(117,"${enc('B 변경 C 목록')}",GREY,1);show();wait_release();
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}} for(;;){int key=input();if(key==K_A){colorMode=!colorMode;break;}if(key==1){if(colorMode){g_chr_color+=g_step;if(g_chr_color>15)g_chr_color=-1;if(g_chr_color< -1)g_chr_color=15;break;}int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
} }
if(!accepted)break; if(!accepted)break;
`+s.slice(previewEnd); `+s.slice(previewEnd);
@@ -91,7 +105,7 @@ static u32 count_add(u32 id,u32 owned){
`+s.slice(countEnd); `+s.slice(countEnd);
s=s.replace('count_edit(id, slot<n ? count_get(slot) : 1u, 1u)','count_add(id, slot<n ? count_get(slot) : 0u)'); s=s.replace('count_edit(id, slot<n ? count_get(slot) : 1u, 1u)','count_add(id, slot<n ? count_get(slot) : 0u)');
s=s.replace('u32 v=count_edit(id, slot<n ? count_get(slot) : 1u);\n if(v){','u32 v=count_add(id, slot<n ? count_get(slot) : 0u);\n if(v<16u){'); s=s.replace('u32 v=count_edit(id, slot<n ? count_get(slot) : 1u);\n if(v){','u32 v=count_add(id, slot<n ? count_get(slot) : 0u);\n if(v<16u){');
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('static u32 tama_files(u32 old, u32 nw){','static int g_chr_color;\nstatic u32 ko_colors(void);\nstatic 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_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){ 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;} 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;}
@@ -105,6 +119,7 @@ static u32 count_add(u32 id,u32 owned){
static u32 tama_files(u32 old,u32 nw){ static u32 tama_files(u32 old,u32 nw){
int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0; int k=cat_find(nw);u32 names=ko_names();if(k<0||!names)return 0;
u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0; u32 tab=names+30u*g_cfg.cat_n;if(ghost_rd32(tab)!=0x314b5047u||ghost_rd32(tab+4u)!=g_cfg.cat_n)return 0;
u32 pal=ko_colors();if(g_chr_color>=0&&!pal)return 0;
u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu); u32 rel=ghost_rd32(tab+8u+4u*(u32)k);if(!rel)return 0;u32 src=g_cfg.cat_off+rel,len=ghost_rd32(src+0x10cu);
if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0; if(len<0x1d34u||len>0x4000u||src>=g_cfg.user_start||len>g_cfg.user_start-src||ghost_rd32(src+8u)!=1u||(ghost_rd32(src+0x108u)>>16)!=nw||ghost_rd32(src)+ghost_rd32(src+4u)!=0u)return 0;
for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){ for(u32 a=g_cfg.user_start;a+0x4000u<=g_cfg.user_end&&a+0x4000u<=SET_A;a+=PAGE){
@@ -112,14 +127,18 @@ static u32 tama_files(u32 old,u32 nw){
u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue; u32 n=rd32(a+0x10cu);if(n<0x1d34u||n>0x4000u||rd32(a+0x118u)!=0x1d34u)continue;
// The first native genes slot is the current pet. Never alter later friend slots. // The first native genes slot is the current pet. Never alter later friend slots.
if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0; if(rd16(a+0x10au)!=old&&rd16(a+14u)!=old)return 0;
for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;flash_prog4k(a+off,g_page);} for(u32 off=0;off<0x4000u;off+=PAGE){for(u32 j=0;j<PAGE;j++)g_page[j]=off+j<len?fl(src+off+j)[0]:255u;if(off==0&&g_chr_color>=0){
u32 before=0;for(u32 q=8;q<0x180;q+=4)before+=*(u32*)(g_page+q);
g_page[16]=(u8)g_chr_color;for(u32 q=0;q<16;q++){u8 v=fl(pal+16u*(u32)g_chr_color+q)[0];g_page[0x140+q]=v;g_page[0x160+q]=v;}
u32 sum=ghost_rd32(src)-before;for(u32 q=8;q<0x180;q+=4)sum+=*(u32*)(g_page+q);*(u32*)g_page=sum;*(u32*)(g_page+4)=0u-sum;
}flash_prog4k(a+off,g_page);}
return 1; return 1;
} }
return 0; return 0;
} }
`+s.slice(z);} `+s.slice(z);}
s=s.replace('if(old && old!=nw && !tama_files(old, nw))','if(!tama_files(old, nw))'); s=s.replace('if(old && old!=nw && !tama_files(old, nw))','if(!tama_files(old, nw))');
s=s.replace('g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));','g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));\n g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|31u);'); s=s.replace('g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));','g_set[to+0x18u]=(u8)((g_set[to+0x18u]&~0x1Cu)|((st&7u)<<2));\n g_set[to+0x19u]=(u8)((g_set[to+0x19u]&0xe0u)|(g_chr_color<0?31u:(u32)g_chr_color));');
s=s.replace('RGB(60,60,110)','RGB(205,225,169)').replace('RGB(40,40,70)','BG'); 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;'); 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;');
return s; return s;
+16 -3
View File
@@ -243,6 +243,8 @@ const T = {
}, },
}; };
Object.assign(T.en, { Object.assign(T.en, {
petColorLabel:"Color", petColors:"Original|Red|Pink|Purple|Blue|Sky blue|Mint|Green|Yellow|Orange|Light pink|Lavender|Light blue|Light green|Cream|White|Gray",
"f1": "Open a ROM stored on your PC or read it from a connected device to edit it.", "f1": "Open a ROM stored on your PC or read it from a connected device to edit it.",
"g3t": "Region expansion", "g3t": "Region expansion",
"g3": "Add regions and backgrounds and configure regional characters and lab games.", "g3": "Add regions and backgrounds and configure regional characters and lab games.",
@@ -306,6 +308,8 @@ Object.assign(T.en, {
"g4": "Switch regions, manage save slots, add items, set Tamapoints and change your Tamagotchi." "g4": "Switch regions, manage save slots, add items, set Tamapoints and change your Tamagotchi."
}); });
Object.assign(T.de, { Object.assign(T.de, {
petColorLabel:"Farbe", petColors:"Original|Rot|Rosa|Violett|Blau|Himmelblau|Mint|Grün|Gelb|Orange|Hellrosa|Lavendel|Hellblau|Hellgrün|Creme|Weiß|Grau",
"f1": "Ein gespeichertes ROM öffnen oder vom verbundenen Gerät lesen und bearbeiten.", "f1": "Ein gespeichertes ROM öffnen oder vom verbundenen Gerät lesen und bearbeiten.",
"g3": "Regionen und Hintergründe ergänzen. Regionale Figuren und Laborspiele einstellen.", "g3": "Regionen und Hintergründe ergänzen. Regionale Figuren und Laborspiele einstellen.",
"g5": "ROM und Spielstände sichern. Das bearbeitete ROM auf das Gerät schreiben.", "g5": "ROM und Spielstände sichern. Das bearbeitete ROM auf das Gerät schreiben.",
@@ -1118,7 +1122,9 @@ T.ko = {
"nameLanguageLocked": "수정한 이름을 저장하거나 초기화한 뒤 다른 언어를 편집하세요.", "nameLanguageLocked": "수정한 이름을 저장하거나 초기화한 뒤 다른 언어를 편집하세요.",
"menuLanguageHint": "영어 메뉴는 EN을 선택하고 독일어 메뉴는 DE를 선택한 뒤 새 ROM을 저장하세요.", "menuLanguageHint": "영어 메뉴는 EN을 선택하고 독일어 메뉴는 DE를 선택한 뒤 새 ROM을 저장하세요.",
"languageFeatureTitle": "한국어·영어·독일어 메뉴", "languageFeatureTitle": "한국어·영어·독일어 메뉴",
"languageFeature": "한국어·EN·DE 선택에 따라 편집 화면과 새로 만드는 A+C 메뉴의 언어가 바뀝니다." "languageFeature": "한국어·EN·DE 선택에 따라 편집 화면과 새로 만드는 A+C 메뉴의 언어가 바뀝니다.",
"petColorLabel": "색상",
"petColors": "기본색|빨강|분홍|보라|파랑|하늘색|민트|초록|노랑|주황|연분홍|연보라|연하늘|연두|크림|하양|회색"
}; };
T.en.menuKo="Create A+C cheat menu"; T.en.menuKo="Create A+C cheat menu";
T.de.menuKo="A+C-Cheatmenü erstellen"; T.de.menuKo="A+C-Cheatmenü erstellen";
@@ -1327,6 +1333,7 @@ function applyLang() {
{const chars=C.charTable(state.ctx.files[0]).filter(c=>c.id>1000&&c.id<9000);chars.forEach((c,i)=>state.charNames.set(state.ctx.groups[i+1],C.textGet(state.ctx.rom,c.name,lang)));} {const chars=C.charTable(state.ctx.files[0]).filter(c=>c.id>1000&&c.id<9000);chars.forEach((c,i)=>state.charNames.set(state.ctx.groups[i+1],C.textGet(state.ctx.rom,c.name,lang)));}
document.querySelectorAll('#gridFigs .tile').forEach((b) => { const g = +b.dataset.idx; b.querySelector('.cap span').textContent = [state.charNames.get(g), groupRole(g)].filter(Boolean).join(' '); }); document.querySelectorAll('#gridFigs .tile').forEach((b) => { const g = +b.dataset.idx; b.querySelector('.cap span').textContent = [state.charNames.get(g), groupRole(g)].filter(Boolean).join(' '); });
if (state.open) openDrawer(state.open.kind, state.open.idx); if (state.open) openDrawer(state.open.kind, state.open.idx);
if(!$('petRow').hidden){const names=t('petColors').split('|');[...$('petColor').options].forEach((o,i)=>o.textContent=names[i]);petPreview();}
} }
try { if (!dv.run) devRender(); $('memberLink').textContent=t(memberSix.ready?'vaultLink':'login'); if(!memberSix.ready)$('memberSixStatus').textContent=t('sixNeedLogin'); renderDeviceSix(); try { if (!dv.run) devRender(); $('memberLink').textContent=t(memberSix.ready?'vaultLink':'login'); if(!memberSix.ready)$('memberSixStatus').textContent=t('sixNeedLogin'); renderDeviceSix();
for(const o of $('visEd').options){const entry=VIS_ED.find(x=>x[0]===o.value);o.textContent=lang==='ko'?({land:'랜드',water:'워터',sky:'스카이',jade:'제이드 포레스트',tropics:'트로피컬',glacier:'글레이셔'}[o.value]||entry[1]):entry[1];} for(const o of $('visEd').options){const entry=VIS_ED.find(x=>x[0]===o.value);o.textContent=lang==='ko'?({land:'랜드',water:'워터',sky:'스카이',jade:'제이드 포레스트',tropics:'트로피컬',glacier:'글레이셔'}[o.value]||entry[1]):entry[1];}
@@ -4414,12 +4421,18 @@ function petOpen(save, name, fromRom) {
} }
sel.appendChild(g); sel.appendChild(g);
} }
$('petColor').innerHTML='';t('petColors').split('|').forEach((name,i)=>{const o=document.createElement('option');o.value=i-1;o.textContent=name;$('petColor').appendChild(o);});$('petColor').value=pet.color;petPreview();
$('petStage').value='';$('petHunger').value=pet.hunger;$('petHappy').value=pet.happy;$('petHealth').value=pet.sick?'keep':'0'; $('petStage').value='';$('petHunger').value=pet.hunger;$('petHappy').value=pet.happy;$('petHealth').value=pet.sick?'keep':'0';
$('petCare').checked = false; $('petCare').checked = false;
$('petRow').hidden = false; $('petRow').hidden = false;
$('petStat').textContent = t('petNow', { l: pet.level, c: cur || pet.id, h: pet.hunger, j: pet.happy, s: pet.sick ? t('petSick') : '' }); $('petStat').textContent = t('petNow', { l: pet.level, c: cur || pet.id, h: pet.hunger, j: pet.happy, s: pet.sick ? t('petSick') : '' });
} }
$('petStage').onchange=()=>{const stage=$('petStage').value;$('petChar').value='';[...$('petChar').options].forEach(o=>{o.hidden=!!stage&&!!o.value&&!o.value.endsWith(':'+stage);});}; function petPreview(){
if(!petSave)return;const pet=SV.paraPet(petSave,petSave.edition),selected=$('petChar').value,id=selected?Number(selected.split(':')[0]):pet.id,color=Number($('petColor').value),canvas=$('petPreview');
const img=C.characterPortrait(state.ctx.rom,id,color,state.ctx,selected?null:SV.paraAppearance(petSave));canvas.width=img.w;canvas.height=img.h;canvas.getContext('2d').putImageData(new ImageData(img.data,img.w,img.h),0,0);canvas.setAttribute('aria-label',($('petChar').selectedOptions[0]?.textContent||'')+' '+$('petColor').selectedOptions[0].textContent);
}
$('petChar').onchange=petPreview;$('petColor').onchange=petPreview;
$('petStage').onchange=()=>{const stage=$('petStage').value;$('petChar').value='';[...$('petChar').options].forEach(o=>{o.hidden=!!stage&&!!o.value&&!o.value.endsWith(':'+stage);});petPreview();};
$('btnPetSave').onclick = () => { $('btnPetSave').onclick = () => {
if (!petSave) return; if (!petSave) return;
const ed = petSave.edition, pet = SV.paraPet(petSave, ed), ch = {}; const ed = petSave.edition, pet = SV.paraPet(petSave, ed), ch = {};
@@ -4427,7 +4440,7 @@ $('btnPetSave').onclick = () => {
const v = $('petChar').value; if (v) { const [id, st] = v.split(':').map(Number); ch.id = id; ch.stage = st; } const v = $('petChar').value; if (v) { const [id, st] = v.split(':').map(Number); ch.id = id; ch.stage = st; }
for(const [key,id]of [['hunger','petHunger'],['happy','petHappy']]){const v=Number($(id).value);if(!$(id).checkValidity()){ $(id).reportValidity();return;}if(v!==pet[key])ch[key]=v;} for(const [key,id]of [['hunger','petHunger'],['happy','petHappy']]){const v=Number($(id).value);if(!$(id).checkValidity()){ $(id).reportValidity();return;}if(v!==pet[key])ch[key]=v;}
if($('petHealth').value==='0' && pet.sick)ch.sick=0; if($('petHealth').value==='0' && pet.sick)ch.sick=0;
if(ch.id)ch.ghost=C.characterGhost(state.ctx.rom,ch.id,state.ctx); const color=Number($('petColor').value);if(ch.id||color!==pet.color){ch.color=color;ch.ghost=C.characterGhost(state.ctx.rom,ch.id||pet.id,state.ctx,null,color);}
if ($('petCare').checked) ch.care = true; if ($('petCare').checked) ch.care = true;
if (!Object.keys(ch).length) { toast(t('petNothing')); return; } if (!Object.keys(ch).length) { toast(t('petNothing')); return; }
if (petFromRom) { if (petFromRom) {
+27 -3
View File
@@ -1171,7 +1171,30 @@ function charTable(dp) {
// Native current-pet genes: nine names, two palettes, 54 five-layer frames and // 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. // large/small eye sprites. Header-only ID changes retain the previous pet's look.
// Layout and checksum are checked against independent firmware-generated exports. // Layout and checksum are checked against independent firmware-generated exports.
function characterGhost(rom,id,ctx=null,texts=null){ function characterColorTable(rom,ctx=null){
ctx=ctx||openRom(rom);const e=ctx.entries[197],h=e&&spriteHeader(e);
if(!h||h.numPal!==16||h.bpp!==2||h.palBpp!==17||h.palOffset+512>e.length)throw Error('Native character colors are unavailable');
return Array.from({length:16},(_,i)=>e.slice(h.palOffset+32*i,h.palOffset+32*i+16));
}
function characterPortrait(rom,id,color=-1,ctx=null,genes=null){
ctx=ctx||openRom(rom);if(!Number.isInteger(color)||color< -1||color>15)throw Error('Invalid character color');
const all=charTable(ctx.files[0]).filter(c=>c.id>1000&&c.id<9000),g=ctx.groups[all.findIndex(c=>c.id===id)+1];
if(g===undefined)throw Error('Character sprites are missing');
const pose=faceFirst(ctx.files[0],g,g+1,g+2),dec=spriteDecode(ctx.entries[g]),base=dec.subs[pose.bs];
const img={w:base.w,h:base.h,data:new Uint8ClampedArray(base.w*base.h*4),mask:new Uint8Array(base.w*base.h).fill(15)};
const colors=color<0?null:characterColorTable(rom,ctx)[color];
const paint=(d,sub,dx,dy,recolor)=>{const part=d.subs[sub],h=d.header,iw=Math.max(1,h.iw),ih=Math.max(1,h.ih);
for(let y=0;y<part.h;y++)for(let x=0;x<part.w;x++){const xx=x+dx,yy=y+dy,k=(y*part.w+x)*4;if(xx<0||yy<0||xx>=img.w||yy>=img.h||!part.data[k+3])continue;
const o=(yy*img.w+xx)*4,index=d.cells[sub*iw*ih+Math.floor(y/h.sh)*iw+Math.floor(x/h.sw)][(y%h.sh)*h.sw+x%h.sw];
img.data.set(part.data.subarray(k,k+4),o);img.mask[o/4]=recolor&&d.palettes&&index<8?index:15;
if(colors&&img.mask[o/4]<8)img.data.set(rgb565ToRgb(u16(colors,index*2)),o);
}};
// Eyes use their own palette. Only body and mouth indexes 0..7 are recolored.
paint(dec,pose.bs,0,0,true);for(const[j,v]of[[1,pose.eye],[2,pose.mouth]])if(v){let entry=ctx.entries[g+j];if(j===1&&genes){const off=u32(genes,0x118),len=u32(genes,0x11c);if(off&&len&&off+len<=genes.length)entry=genes.subarray(off,off+len);}const d=spriteDecode(entry),p=d.subs[v.sub];if(!p)throw Error('Character eye frame is unavailable');paint(d,v.sub,(img.w-p.w)/2+v.dx,(img.h-p.h)/2+v.dy,j===2);}
return img;
}
function characterGhost(rom,id,ctx=null,texts=null,color=-1){
if(!Number.isInteger(color)||color< -1||color>15)throw Error('Invalid character color');
ctx=ctx||openRom(rom);texts=texts||textTablesOf(rom);const dp=ctx.files[0],table=i=>u32(dp,i*4)*2; 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;} 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'); if(!rec)throw Error('Character definition is missing');
@@ -1180,10 +1203,11 @@ function characterGhost(rom,id,ctx=null,texts=null){
const eye=ctx.entries[body+1],small=ctx.entries[body+4],align=n=>(n+3)&~3; 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)); const out=new Uint8Array(0x1d34+align(eye.length)+align(small.length));
if(out.length>0x4000)throw Error('Character genes exceed the native slot'); 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]); w32(out,8,1);w16(out,12,4017);w16(out,14,id);out[16]=color<0?Math.min(15,rec[14]):color;
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); 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(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);} 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);}
if(color>=0){const palette=characterColorTable(rom,ctx)[color];out.set(palette,0x140);out.set(palette,0x160);}
const types=[0,1,15,16,17],map=[1,2,6,7,4,3,5,8,9,10,0]; 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 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);} 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);}
@@ -1324,7 +1348,7 @@ function nativePetNames(out,edition,names,language){
return out; return out;
} }
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, root.ParamixCore = { characterColorTable, characterPortrait, 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, fieldSets, charTable, FIELD_NAMES,
ASSET_BASE, EDITIONS, GROUP_PARTS, GROUP_SHEET_W, GROUP_SHEET_H, 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, arc2Parse, arc2Files, arc2Build, arc2Checksum, packSplit, packJoin, spriteHeader, spriteDecode, spriteEncode, spriteBlank, spriteTiny, spriteAlign, partOptions, launcherKeep, launcherChanges, isLauncher,
+9 -14
View File
@@ -572,12 +572,11 @@ function charCatalog(d, P, language='en', pictures=false) {
if (!C) return []; if (!C) return [];
let ctx; try { ctx = C.openRom(d); } catch (e) { return []; } let ctx; try { ctx = C.openRom(d); } catch (e) { return []; }
const tt = textTabelle(d), out = [], ghostTexts=pictures?C.textTablesOf(d):null; const tt = textTabelle(d), out = [], ghostTexts=pictures?C.textTablesOf(d):null;
const all=C.charTable(ctx.files[0]).filter(c=>c.id>1000&&c.id<9000);
for (const c of C.charTable(ctx.files[0])) { for (const c of C.charTable(ctx.files[0])) {
if (c.id < 1001 || c.id > 4999 || c.stage < 2 || c.stage > 5) continue; if (c.id < 1001 || c.id > 4999 || c.stage < 2 || c.stage > 5) continue;
const nm = (language==='ko'||language==='de' ? C.textGet(d,c.name,language) : tt >= 0 ? zeichenkette(d,tt,c.name) : '') || ('NO. ' + c.id); const nm = (language==='ko'||language==='de' ? C.textGet(d,c.name,language) : tt >= 0 ? zeichenkette(d,tt,c.name) : '') || ('NO. ' + c.id);
const fi = P.names.indexOf(TYPE_NAMES[c.field]); 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, ghost:pictures?C.characterGhost(d,c.id,ctx,ghostTexts):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, ' ') }); out.push({ id: c.id, fixed: 2, pic: 0, sum: (c.stage & 255) | ((fi + 1) << 8), at: null, ghost:pictures?C.characterGhost(d,c.id,ctx,ghostTexts):null, nativeName:C.textGet(d,c.name,language), thumbnail:pictures?portrait(C,ctx,c.id):null, name: nm.replace(/\s+/g, ' ') });
} }
return out; return out;
} }
@@ -593,16 +592,12 @@ function characters(d, language='en') {
* reads the picture straight from there (no lookup in the ROM's image table). * reads the picture straight from there (no lookup in the ROM's image table).
*/ */
const EXT_MAGIC = 0x54584550; const EXT_MAGIC = 0x54584550;
function portrait(C,ctx,g){ function portrait(C,ctx,id){
if(g===undefined)return null; const img=C.characterPortrait(ctx.rom,id,-1,ctx),count=img.w*img.h;
try{const pose=C.faceFirst(ctx.files[0],g,g+1,g+2);if(!pose)return null;
const body=C.spriteDecode(ctx.entries[g]).subs[pose.bs];const img={w:body.w,h:body.h,data:new Uint8ClampedArray(body.data)};
for(const [j,v]of [[1,pose.eye],[2,pose.mouth]]){if(!v)continue;const part=C.spriteDecode(ctx.entries[g+j]).subs[v.sub];const x=(body.w-part.w)/2+v.dx,y=(body.h-part.h)/2+v.dy;for(let py=0;py<part.h;py++)for(let px=0;px<part.w;px++){const xx=px+x,yy=py+y;if(xx<0||yy<0||xx>=img.w||yy>=img.h)continue;const k=(py*part.w+px)*4;if(part.data[k+3])img.data.set(part.data.subarray(k,k+4),(yy*img.w+xx)*4);}}
// Keep every original pixel. KPT1 stores dimensions so old 32px catalogs remain readable.
if(img.w>64||img.h>64)throw Error('Character portrait exceeds native canvas'); if(img.w>64||img.h>64)throw Error('Character portrait exceeds native canvas');
const out=new Uint8Array(8+img.w*img.h*2);w32(out,0,0x3154504b);w16(out,4,img.w);w16(out,6,img.h); const out=new Uint8Array(12+count*2+Math.ceil(count/2));w32(out,0,0x3154504b);w16(out,4,img.w);w16(out,6,img.h);
for(let y=0;y<img.h;y++)for(let x=0;x<img.w;x++){const i=(y*img.w+x)*4;const c=img.data[i+3]?((img.data[i]>>3)<<11)|((img.data[i+1]>>2)<<5)|(img.data[i+2]>>3):0xF81F;w16(out,8+(y*img.w+x)*2,c);}return out; for(let p=0;p<count;p++){const i=p*4,c=img.data[i+3]?((img.data[i]>>3)<<11)|((img.data[i+1]>>2)<<5)|(img.data[i+2]>>3):0xf81f;w16(out,8+p*2,c);out[12+count*2+(p>>1)]|=img.mask[p]<<((p&1)*4);}
}catch(e){return null;} w32(out,8+count*2,0x314b534d);return out;
} }
function nativeMenuFont(rom){ function nativeMenuFont(rom){
const M=globalThis.ParamixKoreanMenu,C=globalThis.ParamixCore,font=M.font(); const M=globalThis.ParamixKoreanMenu,C=globalThis.ParamixCore,font=M.font();
@@ -625,10 +620,10 @@ function catalogBlob(cat, korean=false, rom=null, englishPictures=false, german=
const font=korean ? nativeMenuFont(rom) : new Uint8Array(englishPictures?8:0); const font=korean ? nativeMenuFont(rom) : new Uint8Array(englishPictures?8:0);
if(englishPictures){w32(font,0,0x31545045);} if(englishPictures){w32(font,0,0x31545045);}
const encoded=cat.map(c=>korean?globalThis.ParamixKoreanMenu.encode(c.name||('항목 '+c.id),60):(german?(c.name||('NR. '+c.id)):c.name).slice(0,german?60:20)); const encoded=cat.map(c=>korean?globalThis.ParamixKoreanMenu.encode(c.name||('항목 '+c.id),60):(german?(c.name||('NR. '+c.id)):c.name).slice(0,german?60:20));
const base=x+4+12*cat.length+font.length, tails=korean||englishPictures?26*cat.length+4*cat.length+8+4*cat.length+cat.reduce((n,c)=>n+(c.ghost?.length||0),0)+cat.reduce((n,c)=>n+(c.thumbnail?.length||0),0)+(korean||german?encoded.reduce((n,c)=>n+c.length+1,0):0):0; const base=x+4+12*cat.length+font.length, tails=korean||englishPictures?26*cat.length+4*cat.length+8+4*cat.length+260+cat.reduce((n,c)=>n+(c.ghost?.length||0),0)+cat.reduce((n,c)=>n+(c.thumbnail?.length||0),0)+(korean||german?encoded.reduce((n,c)=>n+c.length+1,0):0):0;
const b = new Uint8Array(base+tails); const b = new Uint8Array(base+tails);
const nameOffsets=[]; const nameOffsets=[];
if(korean||englishPictures){const gp=base+30*cat.length;w32(b,gp,0x314b5047);w32(b,gp+4,cat.length);let pos=gp+8+4*cat.length;cat.forEach((c,i)=>{ if(korean||englishPictures){const gp=base+30*cat.length;w32(b,gp,0x314b5047);w32(b,gp+4,cat.length);let pos=gp+8+4*cat.length;w32(b,pos,0x314b5043);if(cat.some(c=>c.ghost))globalThis.ParamixCore.characterColorTable(rom).forEach((p,i)=>b.set(p,pos+4+i*16));pos+=260;cat.forEach((c,i)=>{
if(c.ghost){w32(b,gp+8+4*i,pos);b.set(c.ghost,pos);pos+=c.ghost.length;} if(c.ghost){w32(b,gp+8+4*i,pos);b.set(c.ghost,pos);pos+=c.ghost.length;}
[...(c.nativeName||c.name)].slice(0,12).forEach((ch,j)=>w16(b,base+i*26+j*2,(german?globalThis.ParamixCore.DE_ENC:globalThis.ParamixCore.TXT_ENC)[ch]??globalThis.ParamixCore.KO_ENC[ch]??0)); [...(c.nativeName||c.name)].slice(0,12).forEach((ch,j)=>w16(b,base+i*26+j*2,(german?globalThis.ParamixCore.DE_ENC: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;} if(c.thumbnail){w32(b,base+26*cat.length+i*4,pos);b.set(c.thumbnail,pos);pos+=c.thumbnail.length;}
@@ -678,7 +673,7 @@ function feldStrip(rom, emb, E) {
if(out[last+3]!==255 || ptr<end || ptr+61>out.length)throw Error('한글 이름 자료의 위치가 올바르지 않습니다.'); if(out[last+3]!==255 || ptr<end || ptr+61>out.length)throw Error('한글 이름 자료의 위치가 올바르지 않습니다.');
end=ptr;while(end<ptr+61&&out[end])end++; end=ptr;while(end<ptr+61&&out[end])end++;
if(end===ptr+61)throw Error('한글 이름 자료가 손상되었습니다.');end++; if(end===ptr+61)throw Error('한글 이름 자료가 손상되었습니다.');end++;
} }else if(u32(out,end)===0x314b5047&&u32(out,end+4)===0){end+=8;if(u32(out,end)===0x314b5043)end+=260;}
out.fill(255,f.catOff,page(end)); out.fill(255,f.catOff,page(end));
} }
} }
+2
View File
@@ -643,6 +643,8 @@ html:not([data-feature-consoles="on"]) [data-feature="consoles"]{display:none!im
<label><span data-t="petLevel"></span> <select id="petLevel"></select></label> <label><span data-t="petLevel"></span> <select id="petLevel"></select></label>
<label><span data-t="petStageLabel">성장 단계 </span><select id="petStage"><option value="" data-t="petStageAll">전체</option><option value="3" data-t="petStageBaby">유아기</option><option value="4" data-t="petStageYoung">성장기</option><option value="5" data-t="petStageAdult">성체</option></select></label> <label><span data-t="petStageLabel">성장 단계 </span><select id="petStage"><option value="" data-t="petStageAll">전체</option><option value="3" data-t="petStageBaby">유아기</option><option value="4" data-t="petStageYoung">성장기</option><option value="5" data-t="petStageAdult">성체</option></select></label>
<label><span data-t="petChar"></span> <select id="petChar"></select></label> <label><span data-t="petChar"></span> <select id="petChar"></select></label>
<label><span data-t="petColorLabel">색상</span> <select id="petColor"></select></label>
<canvas id="petPreview" width="64" height="64" style="width:128px;height:128px;image-rendering:pixelated;border:1px solid #cbdbea;border-radius:12px;background:#fff" role="img" aria-label="다마고치 미리보기"></canvas>
<label><span data-t="petHungerLabel">배부름 </span><input id="petHunger" required type="number" min="0" max="6" style="width:65px"></label> <label><span data-t="petHungerLabel">배부름 </span><input id="petHunger" required type="number" min="0" max="6" style="width:65px"></label>
<label><span data-t="petHappyLabel">행복 </span><input id="petHappy" required type="number" min="0" max="20" style="width:65px"></label> <label><span data-t="petHappyLabel">행복 </span><input id="petHappy" required type="number" min="0" max="20" style="width:65px"></label>
<label><span data-t="petHealthLabel">건강 </span><select id="petHealth"><option value="0" data-t="petHealthy">건강함</option><option value="keep" data-t="petHealthKeep">기존 상태 유지</option></select></label> <label><span data-t="petHealthLabel">건강 </span><select id="petHealth"><option value="0" data-t="petHealthy">건강함</option><option value="keep" data-t="petHealthKeep">기존 상태 유지</option></select></label>
+2
View File
@@ -753,3 +753,5 @@ nameLanguageLocked 수정한 이름을 저장하거나 초기화한 뒤 다른
menuLanguageHint 영어 메뉴는 EN을 선택하고 독일어 메뉴는 DE를 선택한 뒤 새 ROM을 저장하세요. menuLanguageHint 영어 메뉴는 EN을 선택하고 독일어 메뉴는 DE를 선택한 뒤 새 ROM을 저장하세요.
languageFeatureTitle 한국어·영어·독일어 메뉴 languageFeatureTitle 한국어·영어·독일어 메뉴
languageFeature 한국어·EN·DE 선택에 따라 편집 화면과 새로 만드는 A+C 메뉴의 언어가 바뀝니다. languageFeature 한국어·EN·DE 선택에 따라 편집 화면과 새로 만드는 A+C 메뉴의 언어가 바뀝니다.
petColorLabel 색상
petColors 기본색|빨강|분홍|보라|파랑|하늘색|민트|초록|노랑|주황|연분홍|연보라|연하늘|연두|크림|하양|회색
1 open ROM 열기
753 menuLanguageHint 영어 메뉴는 EN을 선택하고 독일어 메뉴는 DE를 선택한 뒤 새 ROM을 저장하세요.
754 languageFeatureTitle 한국어·영어·독일어 메뉴
755 languageFeature 한국어·EN·DE 선택에 따라 편집 화면과 새로 만드는 A+C 메뉴의 언어가 바뀝니다.
756 petColorLabel 색상
757 petColors 기본색|빨강|분홍|보라|파랑|하늘색|민트|초록|노랑|주황|연분홍|연보라|연하늘|연두|크림|하양|회색
+1 -1
View File
@@ -1,6 +1,6 @@
// Generated Galmuri9 native Korean font. See third-party/Galmuri-OFL.txt. // Generated Galmuri9 native Korean font. See third-party/Galmuri-OFL.txt.
(function(root){ (function(root){
const fixed="·가간감값강개거건게경계고과관그글금기까꺼끄끔난남뉴는늘니다단대더데도돌동되됨됩뒤드득때램량러레력로록료류름리릭마메면목미방배벨변보복본봄부분불비사삭상새서선설성세셔소손수숫숲습시식실아않알았어업없었에역열예오옵완요용운원유육으을음의이인읽임입있자작잠장재저적전절정제조존중지짐집참체초최추취치캐컬코크타택터템통트패편포품프플픔피하한할함합행현형화확환회후휠", native="가각간갇갈갉갊감갑값갓갔강갖갗같갚갛개객갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫났낭낮낯낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫달닭닮닯닳담답닷닸당닺닻닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많맏말맑맒맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바박밖밗반받발밝밞밟밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤샥샨샬샴샵샷샹섀섄섈섐섕서석섞섟선섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄업없엇었엉엊엌엎에엑엔엘엠엡엣엥여역엮연열엶엷염엽엾엿였영옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕Line truncated const fixed="·가간감값강개거건게경계고과관그글금기까꺼끄끔난남노뉴는늘니다단대더데도돌동되됨됩두뒤드득때라랑램량러레력로록료류름리릭림마메면목미민방배벨변보복본봄부분불비빨사삭상새색서선설성세셔소손수숫숲습시식실아않알았양어업없었에역연열예오옵완요용운원유육으을음의이인읽임입있자작잠장재저적전절정제조존주중지짐집참체초최추취치캐컬코크타택터템통트파패편포품프플픔피하한할함합행현형홍화확환황회후휠", native="가각간갇갈갉갊감갑값갓갔강갖갗같갚갛개객갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫났낭낮낯낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫달닭닮닯닳담답닷닸당닺닻닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많맏말맑맒맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바박밖밗반받발밝밞밟밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤샥샨샬샴샵샷샹섀섄섈섐섕서석섞섟선섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄업없엇었엉엊엌엎에엑엔엘엠엡엣엥여역엮연열엶엷염엽엾엿였영옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝Line truncated
function encode(s,max=255){let out='';for(const c of s){let v=c;if(c.charCodeAt(0)>127){let n=fixed.indexOf(c);if(n<0){let k=native.indexOf(c);if(k<0)throw Error('본체 메뉴에서 지원하지 않는 문자: '+c);n=fixed.length+k;}v=String.fromCharCode(128+(n>>7),128+(n&127));}if(out.length+v.length>max)break;out+=v;}return out;} function encode(s,max=255){let out='';for(const c of s){let v=c;if(c.charCodeAt(0)>127){let n=fixed.indexOf(c);if(n<0){let k=native.indexOf(c);if(k<0)throw Error('본체 메뉴에서 지원하지 않는 문자: '+c);n=fixed.length+k;}v=String.fromCharCode(128+(n>>7),128+(n&127));}if(out.length+v.length>max)break;out+=v;}return out;}
function font(){return typeof Buffer!=='undefined'?new Uint8Array(Buffer.from(data,'base64')):Uint8Array.from(atob(data),c=>c.charCodeAt(0));} function font(){return typeof Buffer!=='undefined'?new Uint8Array(Buffer.from(data,'base64')):Uint8Array.from(atob(data),c=>c.charCodeAt(0));}
root.ParamixKoreanMenu={encode,font,fixed,native}; root.ParamixKoreanMenu={encode,font,fixed,native};
+22 -7
View File
@@ -144,33 +144,48 @@ function paraSettings(save) { for (const a of [SET_A, SET_B]) { const p = save.p
function paraPet(save, edition) { function paraPet(save, edition) {
const p = paraSettings(save), o = PET[family(edition)]; if (!p || !o) return null; const p = paraSettings(save), o = PET[family(edition)]; if (!p || !o) return null;
const t = o.tama; const t = o.tama;
return { level: p[o.level] & 15, id: u16(p, t + 4), stage: (p[t + 0x18] >> 2) & 7, hunger: p[t + 0x1C], happy: p[t + 0x1D], sick: p[t + 0x10] }; const color=p[t+0x19]&31;
return { level: p[o.level] & 15, id: u16(p, t + 4), stage: (p[t + 0x18] >> 2) & 7, color:color<16?color:-1, hunger: p[t + 0x1C], happy: p[t + 0x1D], sick: p[t + 0x10] };
} }
/** /**
* Changed copy of the save. A character change requires the complete native genes * Changed copy of the save. A character change requires the complete native genes
* package from the ROM. Only the current pet's slot is replaced; friends are preserved. * package from the ROM. Only the current pet's slot is replaced; friends are preserved.
*/ */
function paraAppearance(save){
const old=paraPet(save,save.edition)?.id;
for(const[a,p]of [...save.pages].sort((a,b)=>a[0]-b[0])){
const n=u32(p,0x10c);if(u32(p,8)!==1||u16(p,12)!==4017||u16(p,0x10a)!==old||n<0x1d34||n>0x4000||u32(p,0x118)!==0x1d34)continue;
const b=new Uint8Array(0x4000);for(let i=0;i<0x4000;i+=PAGE){if(!save.pages.has(a+i))return null;b.set(save.pages.get(a+i),i);}return b.slice(0,n);
}return null;
}
function paraPetSet(save, edition, ch) { function paraPetSet(save, edition, ch) {
const p0 = paraSettings(save), o = PET[family(edition)]; const p0 = paraSettings(save), o = PET[family(edition)];
if (!p0 || !o) throw new Error('the save has no settings block'); if (!p0 || !o) throw new Error('the save has no settings block');
const t = o.tama, p = p0.slice(), pages = new Map(save.pages); const t = o.tama, p = p0.slice(), pages = new Map(save.pages);
const old = u16(p, t + 4); const old = u16(p, t + 4);
if (ch.level !== undefined) { const v = Math.max(0, Math.min(10, ch.level | 0)), now = p[o.level] & 15; p[o.level] = v > now ? (p[o.level] & 0xF0) | v : (v << 4) | v; } if (ch.level !== undefined) { const v = Math.max(0, Math.min(10, ch.level | 0)), now = p[o.level] & 15; p[o.level] = v > now ? (p[o.level] & 0xF0) | v : (v << 4) | v; }
if (ch.id) { if (ch.id || ch.color!==undefined) {
p[t + 4] = ch.id & 255; p[t + 5] = ch.id >> 8; p[t + 6] = ch.id & 255; p[t + 7] = ch.id >> 8; const target=ch.id||old,color=ch.color??-1;
if(!Number.isInteger(color)||color< -1||color>15)throw Error('Invalid character color');
if(ch.id){p[t + 4] = ch.id & 255; p[t + 5] = ch.id >> 8; p[t + 6] = ch.id & 255; p[t + 7] = ch.id >> 8;}
if (ch.stage) p[t + 0x18] = (p[t + 0x18] & ~0x1C) | ((ch.stage & 7) << 2); if (ch.stage) p[t + 0x18] = (p[t + 0x18] & ~0x1C) | ((ch.stage & 7) << 2);
const ghost=ch.ghost; let ghost=ch.ghost;
if(!(ghost instanceof Uint8Array)||ghost.length<0x1d34||ghost.length>0x4000||u32(ghost,8)!==1||u16(ghost,0x10a)!==ch.id||u32(ghost,0x10c)!==ghost.length||((u32(ghost,0)+u32(ghost,4))>>>0)!==0)throw Error('Character appearance data is missing or invalid'); if(!(ghost instanceof Uint8Array)||ghost.length<0x1d34||ghost.length>0x4000||u32(ghost,8)!==1||u16(ghost,0x10a)!==target||u32(ghost,0x10c)!==ghost.length||((u32(ghost,0)+u32(ghost,4))>>>0)!==0||(color>=0&&ghost[16]!==color))throw Error('Character appearance data is missing or invalid');
let found=false; let found=false;
for(const [a,d] of [...save.pages].sort((a,b)=>a[0]-b[0])){ for(const [a,d] of [...save.pages].sort((a,b)=>a[0]-b[0])){
if(a===SET_A||a===SET_B||d.length!==PAGE||u32(d,8)!==1||u16(d,12)!==4017||((u32(d,0)+u32(d,4))>>>0)!==0)continue; if(a===SET_A||a===SET_B||d.length!==PAGE||u32(d,8)!==1||u16(d,12)!==4017||((u32(d,0)+u32(d,4))>>>0)!==0)continue;
const n=u32(d,0x10c);if(n<0x1d34||n>0x4000||u32(d,0x118)!==0x1d34)continue; const n=u32(d,0x10c);if(n<0x1d34||n>0x4000||u32(d,0x118)!==0x1d34)continue;
if(u16(d,0x10a)!==old&&u16(d,14)!==old)throw Error('Current character genes do not match this save'); if(u16(d,0x10a)!==old&&u16(d,14)!==old)throw Error('Current character genes do not match this save');
if(!ch.id){
const current=new Uint8Array(0x4000);for(let i=0;i<0x4000;i+=PAGE){const pg=save.pages.get(a+i);if(!pg)throw Error('Current character slot is incomplete');current.set(pg,i);}
const next=current.slice(0,n);next[16]=ghost[16];next.set(ghost.subarray(0x140,0x180),0x140);ghost=next;
let sum=0;for(let i=8;i<0x180;i+=4)sum=(sum+u32(ghost,i))>>>0;for(let i=0x600;i<ghost.length;i+=4)sum=(sum+u32(ghost,i))>>>0;w32(ghost,0,sum);w32(ghost,4,-sum>>>0);
}
for(let i=0;i<0x4000;i+=PAGE){if(a+i>=SET_A||!save.pages.has(a+i))throw Error('Current character slot is incomplete');const pg=new Uint8Array(PAGE);pg.fill(255);pg.set(ghost.subarray(i,i+PAGE));pages.set(a+i,pg);} for(let i=0;i<0x4000;i+=PAGE){if(a+i>=SET_A||!save.pages.has(a+i))throw Error('Current character slot is incomplete');const pg=new Uint8Array(PAGE);pg.fill(255);pg.set(ghost.subarray(i,i+PAGE));pages.set(a+i,pg);}
found=true;break; found=true;break;
} }
if(!found)throw Error('Current character appearance data was not found'); if(!found)throw Error('Current character appearance data was not found');
p[t+0x19]=(p[t+0x19]&0xe0)|31; p[t+0x19]=(p[t+0x19]&0xe0)|(color<0?31:color);
} }
for(const [key,off,max]of [['hunger',0x1C,6],['happy',0x1D,20],['sick',0x10,1]]){ for(const [key,off,max]of [['hunger',0x1C,6],['happy',0x1D,20],['sick',0x10,1]]){
@@ -327,6 +342,6 @@ function keepEdits(base, edition, names, changes, expectedId, progress) {
return {...result,image:out,protectedSectors:result.protectedSectors.filter(a=>!updated.has(a))}; return {...result,image:out,protectedSectors:result.protectedSectors.filter(a=>!updated.has(a))};
}; };
} }
root.ParamixSaves = { keepEdits, paraPet, paraPetSet, paraWrite, t7SaveOut, t7SaveIn, t7SaveCheck, T7_EE, idPage, region, family, settingsOk, crc16arc, paraFromImage, paraEncode, paraDecode, paraCheck, paraClock, emuCfg, emuGuestAsync, lzGoneApply, KINDS }; root.ParamixSaves = { paraAppearance, keepEdits, paraPet, paraPetSet, paraWrite, t7SaveOut, t7SaveIn, t7SaveCheck, T7_EE, idPage, region, family, settingsOk, crc16arc, paraFromImage, paraEncode, paraDecode, paraCheck, paraClock, emuCfg, emuGuestAsync, lzGoneApply, KINDS };
if (typeof module !== 'undefined') module.exports = root.ParamixSaves; if (typeof module !== 'undefined') module.exports = root.ParamixSaves;
})(typeof window !== 'undefined' ? window : globalThis); })(typeof window !== 'undefined' ? window : globalThis);
+25
View File
@@ -0,0 +1,25 @@
const fs=require('fs'),path=require('path'),assert=require('assert/strict'),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),chars=F.characters(rom),save={pages:S.paraFromImage(rom,ctx.editionId),edition:ctx.editionId};
const palette=C.characterColorTable(rom,ctx),u16=(b,o)=>b[o]|b[o+1]<<8;let native=0,pictures=0;
assert.equal(palette.length,16);
for(const c of chars){
const plain=C.characterPortrait(rom,c.id,-1,ctx);
const defs=C.charTable(ctx.files[0]).filter(c=>c.id>1000&&c.id<9000),g=ctx.groups[defs.findIndex(v=>v.id===c.id)+1],pose=C.faceFirst(ctx.files[0],g,g+1,g+2),eye=C.spriteDecode(ctx.entries[g+1]).subs[pose.eye.sub];
for(let color=0;color<16;color++){
const ghost=C.characterGhost(rom,c.id,ctx,null,color),changed=S.paraPetSet(save,ctx.editionId,{id:c.id,stage:c.stage,color,ghost});
assert.equal(S.paraPet(changed,ctx.editionId).color,color);assert.deepEqual(S.paraAppearance(changed),ghost);
if(process.argv[3]){assert.deepEqual(Buffer.from(ghost),fs.readFileSync(path.join(process.argv[3],c.id+'-'+color+'.ghost')),'Native firmware color mismatch: '+c.id+'/'+color);native++;}
const picture=C.characterPortrait(rom,c.id,color,ctx);assert.deepEqual(picture.mask,plain.mask);
// Ratchi uses a low eye-palette index too; it must not become the body color.
if(c.id===4021){const dx=(plain.w-eye.w)/2+pose.eye.dx,dy=(plain.h-eye.h)/2+pose.eye.dy;for(let y=0;y<eye.h;y++)for(let x=0;x<eye.w;x++){const i=(y*eye.w+x)*4;if(!eye.data[i+3])continue;const k=((y+dy)*plain.w+x+dx)*4;assert.deepEqual(picture.data.subarray(k,k+4),eye.data.subarray(i,i+4),'Inherited eye palette recolored');}}
for(let i=0;i<plain.mask.length;i++){const k=i*4,index=plain.mask[i];assert.equal(picture.data[k+3],plain.data[k+3]);if(index<8&&plain.data[k+3]){const rgb=u16(palette[color],index*2),actual=((picture.data[k]>>3)<<11)|((picture.data[k+1]>>2)<<5)|(picture.data[k+2]>>3);assert.equal(actual,rgb);}else assert.deepEqual(picture.data.subarray(k,k+4),plain.data.subarray(k,k+4),'Eye/detail pixel recolored');}
pictures++;
}
}
const pet=S.paraPet(save,ctx.editionId),old=S.paraAppearance(save);
const yellow=S.paraPetSet(save,ctx.editionId,{color:7,ghost:C.characterGhost(rom,pet.id,ctx,null,7)}),painted=S.paraAppearance(yellow);
assert.equal(S.paraPet(yellow,ctx.editionId).id,pet.id);assert.equal(S.paraPet(yellow,ctx.editionId).color,7);
assert.deepEqual(painted.subarray(0x600),old.subarray(0x600),'Color-only edit changed inherited eyes or frames');
assert.deepEqual(painted.subarray(18,0x140),old.subarray(18,0x140),'Color-only edit changed names or metadata');
assert.throws(()=>C.characterGhost(rom,pet.id,ctx,null,16),/color/);assert.throws(()=>C.characterPortrait(rom,pet.id,-2,ctx),/color/);
assert.deepEqual(rom,original);console.log(JSON.stringify({passed:true,characters:chars.length,colors:16,nativeComparisons:native,previewCombinations:pictures,colorOnlyPreservesEyes:true}));
+4
View File
@@ -57,6 +57,10 @@ const root=require('path').resolve(__dirname,'..');
assert.equal(S.paraPet({pages:S.paraFromImage(state.ctx.rom,state.ctx.editionId)},state.ctx.editionId).id,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); 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); d.getElementById('btnPetSave').click();assert.deepEqual(Buffer.from(state.ctx.rom.subarray(0xdee000,0xdee000+expected.length)),Buffer.from(expected),'Same-character repair failed: '+lang);
const color=d.getElementById('petColor');assert.equal(color.options.length,17);color.value='7';color.dispatchEvent(new w.Event('change'));d.getElementById('btnPetSave').click();
const yellow=C.characterGhost(state.ctx.rom,4062,state.ctx,null,7);assert.deepEqual(Buffer.from(state.ctx.rom.subarray(0xdee000,0xdee000+yellow.length)),Buffer.from(yellow),'Selected color missing: '+lang);
select.value='';color.value='0';color.dispatchEvent(new w.Event('change'));d.getElementById('btnPetSave').click();assert.equal(S.paraPet({pages:S.paraFromImage(state.ctx.rom,state.ctx.editionId)},state.ctx.editionId).color,0);
assert.deepEqual(Buffer.from(state.ctx.rom.subarray(0xdee600,0xdee000+yellow.length)),Buffer.from(yellow.subarray(0x600)),'Color-only edit changed inherited eyes');
} }
assert.deepEqual(errors,[]);w.close(); assert.deepEqual(errors,[]);w.close();
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'); 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');
+1
View File
@@ -58,6 +58,7 @@ async function main(){
const rebuilt=F.feldApply(stripped,{fields:true,bag:true,tama:true,saves:true},null,emb,E);assert.deepEqual(rebuilt,image,'Menu rebuild round trip'); const rebuilt=F.feldApply(stripped,{fields:true,bag:true,tama:true,saves:true},null,emb,E);assert.deepEqual(rebuilt,image,'Menu rebuild round trip');
const fieldsOnly=F.feldApply(out,{fields:true},null,emb,E),fo=F.feldFind(fieldsOnly,emb.stub); const fieldsOnly=F.feldApply(out,{fields:true},null,emb,E),fo=F.feldFind(fieldsOnly,emb.stub);
assert(F.feldStrip(fieldsOnly,emb,E).subarray(fo.catOff,fo.catOff+4096).every(b=>b===255),'Font-only catalog removal'); assert(F.feldStrip(fieldsOnly,emb,E).subarray(fo.catOff,fo.catOff+4096).every(b=>b===255),'Font-only catalog removal');
assert.deepEqual(F.feldApply(F.feldStrip(fieldsOnly,emb,E),{fields:true},null,emb,E),fieldsOnly,'Empty color catalog strip/rebuild');
if(process.argv[3]){fs.writeFileSync(process.argv[3],image);fs.writeFileSync(process.argv[3]+'.json',JSON.stringify(info));} if(process.argv[3]){fs.writeFileSync(process.argv[3],image);fs.writeFileSync(process.argv[3]+'.json',JSON.stringify(info));}
console.log(JSON.stringify({passed:true,characters:chars.length,items:items.length,portraits,menuBytes:emb.feld.length,keptLatestHappiness:p.happy,physicalDevice:false})); console.log(JSON.stringify({passed:true,characters:chars.length,items:items.length,portraits,menuBytes:emb.feld.length,keptLatestHappiness:p.happy,physicalDevice:false}));
} }