graphics.dat: Japanese text decodes garbled #438
Labels
No labels
area/ci-release
area/cli
area/docs
area/dungeon
area/ftl
area/graphics
area/gui
area/music
area/saves
area/tooling
port/amiga
port/dos
port/fm-towns
port/mac
port/pc98
port/sega-cd
priority/high
priority/low
priority/medium
type/bug
type/chore
type/docs
type/feature
type/research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jqueuniet/dm2-tools#438
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Japanese
dtTextrecords decode to mojibake: half-width katakana, U+FFFD and stray rune glyphs. Mac JP weapon names(0x10, 0x00, 0x05, 0x18)and(0x10, 0x01, 0x05, 0x18)readチand�?、ァ肩, both indm2 extract --text --text-language japaneseand ingraphicsLabelsJson/graphicsTextJson(which add rune code points,\uE039チ\uE013).Text::to_display_stringdecodes Japanese literal runs throughencoding_rs::SHIFT_JIS(docs/formats/graphics-dat.md§ "Japanese rendering"); the output suggests the bytes are not plain CP932: a game-specific glyph table, kana in a custom range, or the rune bytes overlapping Shift-JIS lead bytes.Acceptance
https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7
Not Shift-JIS: the bytes index the game's own glyph sheets (SKWINSPX
DRAW_MBCS_STR,QUERY_CHAR_METRICS, font loaderskgdat.cpp:550).0x20..=0xEF: one glyph. Byte>= 0xF0: lead of a two-byte code. Below0x20: control;02 xxswitches font.(0x1c, font, 0x01, n), grids of cells (cell size from the pict offset). Codes run across the sheets from0x20, moving to lead0xF0once0xEFis passed; adtWordValue(0x1c, font, 0x0b, n)can restart a sheet atlead << 8 | first.f0 79 c1 f0 53= kanji + の + kanji (時の目).Glyph sets (sheets compared as 1-bit bitmaps):
About 380 glyphs per set, ~250 of them kana and kanji.
Plan:
https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7
Fixed in v0.8.0 (2026-11-01): Japanese text decodes as glyph codes through per-port
GlyphSettables, not Shift-JIS. Mac JP item(0x10, 0x00)reads 時の眼;japanese_text_codes_have_glyphscovers all six Japanese ports with no U+FFFD. Both acceptance criteria met. Closing.