Use table file for text

This commit is contained in:
Kaisaan 2024-12-30 17:33:01 -05:00
parent 24ee16e8f7
commit c9af681d42
5 changed files with 3282 additions and 19 deletions

View File

@ -11,11 +11,14 @@ Currently using Sam Farron's translation from his [Translation Series](https://w
- Extracted .bin files with `_anm` in the filename are animation files with indexed 8BPP graphics
- Extracted .HGB files are texture files with 32BPP RGBA graphics
- Music files are `.hd` (header), `.bd` (header), and `.sq` (sequence) files
- In `SLPM_663.60` the font is located at $1A3E90 as 4BPP graphics, its palette is stored at $25E4C0, and the fontmap is at $1A31F0
# Extracting the DATA.BIN Files
`extract.py` extracts all the files from DATA.BIN and its folders into a `DATA` folder but does not extract the files into their correct folders yet, a `logfile.txt` is also created for fixing issues with the script
# Font info
`font.py` extracts the fontmap from `SLPM_663.60` to create a quick `font.tbl` table file. Use `kefin.tbl` for corrected values and control codes (also used by `patch.asm`)
In `SLPM_663.60` the font is located at $1A3E90 as 4BPP graphics, its palette is stored at $25E4C0, and the fontmap is at $1A31F0
# To do
- Create a proper table file (since the game does not use SHIFT-JIS encoding fully)
- Updated extractiong script to extract `DATA0.BIN`, `DATA1.BIN`, and `SLPM_663.60`

25
font.py Normal file
View File

@ -0,0 +1,25 @@
import os
slpm = open("extracted/SLPM_663.60", "rb")
table = open("font.tbl", "w", encoding="shift-jis")
start = 0x1A31F0
end = 0x1A3E98
fileptr = start
while fileptr < end:
slpm.seek(fileptr)
charval = slpm.read(2)
char = charval.decode(encoding="shift-jis", errors="backslashreplace").lstrip(" ")
# char
charval = int.from_bytes(charval, "big")
charval = hex(charval).removeprefix("0x").upper().removeprefix("20")
table.write(f"{charval}={char}\n")
print(fileptr)
print(char)
print(charval)
fileptr += 2

1620
font.tbl Normal file

File diff suppressed because it is too large Load Diff

1625
kefin.tbl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,27 +4,18 @@
.open "extracted/DATA.BIN", "DATA.BIN", 0x0
.loadtable "kefin.tbl", "SJIS"
.orga 0x094BC858
.db 0x3A, 0x80
.ascii "<K3>"
.ascii "Hey"
.db 0x81, 0x43
.ascii "where are you planning to go on that ship?"
.db 0xFF, 0xFD, 0x19
.ascii "<K0>"
.strn "<K3>Hey", 0x81, 0x43, "where are you planning to go on that ship?[WAIT]", 0x19, "<K0>" ; For some reason, the "" character won't work
.db 0x07, 0x32, 0x2F, 0x01, 0x00, 0x0A, 0x50, 0x00, 0xA5, 0x00, 0x3F, 0x80 ; originally 0x53, 0x80
.ascii "<K3>Oh really? The Safar desert on the Afroca continent?"
.db 0xFF, 0xFD, 0x19
.ascii "<K0>"
.strn "<K3>Oh really? The Safar desert on the Afroca continent?[WAIT]", 0x19, "<K0>"
.db 0x2F, 0x02, 0x00, 0x0A, 0x50, 0x00, 0x96, 0x00, 0x8B, 0x80 ; originally 0x90, 0x80
.ascii "<K3>Does that mean you're searching for \"that\"?"
.db 0x0A
.ascii "The City of Sand and Mirages, Kefin?"
.db 0x0A
.ascii "Apparently it used to be a magnificent kingdom."
.db 0xFF, 0xFD, 0x19
.ascii "<K0>"
.strn "<K3>Does that mean you're searching for \"that\"?\n"
.strn "The City of Sand and Mirages", 0x81, 0x43, "Kefin?\n"
.strn "Apparently it used to be a magnificent kingdom.[WAIT]", 0x19, "<K0>"
.db 0x2F, 0x03, 0x00, 0x0A, 0x50, 0x00, 0x96, 0x00, 0x89, 0x80
@ -35,8 +26,7 @@
.orga 0x0025FD45
.sjisn "Kaisaan"
.db 0x81, 0x43
.strn "KaisaanTest", 0x81, 0x43
.close