Skip to content

Improve compatibility with translated Undertale data files - #1

Open
jsjsjsjsjsjsjson wants to merge 1 commit into
kptmx:mainfrom
jsjsjsjsjsjsjson:main
Open

Improve compatibility with translated Undertale data files#1
jsjsjsjsjsjsjson wants to merge 1 commit into
kptmx:mainfrom
jsjsjsjsjsjsjson:main

Conversation

@jsjsjsjsjsjsjson

@jsjsjsjsjsjsjson jsjsjsjsjsjsjson commented May 19, 2026

Copy link
Copy Markdown

Summary

This PR improves compatibility with modified Undertale data.win / game.unx files, especially translation patches that relocate expanded text and font data outside of the original chunks.

Some patched files store translated strings, font records, glyph data, and font texture page entries in locations that the original parser did not expect. This could cause parse-time errors such as:

BinaryReader: buffer seek to 0xF4933F out of buffer range [...]

or allow the game to start while leaving translated dialogue blank, or directly cause Butterscotch to crash.

What changed

This PR adds support for:

  • external string pools referenced by STRG entries
  • relocated FONT records and glyph records
  • relocated font TPAG entries used by patched fonts
  • UTF-8-aware string builtins used by dialogue/typewriter text

The updated string handling affects:

  • string_length
  • string_char_at
  • string_copy
  • string_pos
  • string_delete
  • string_insert

Why

Some translation patches do not fully rebuild the GameMaker archive layout. Instead, they append expanded translated text and related font metadata elsewhere in the file, then update offsets to point to those relocated records.

The existing parser assumes that these offsets always stay inside their original chunks. That works for the original Undertale data files, but it breaks with some translated files.

This patch keeps the original fast path for normal files, but adds fallback handling when relocated offsets are detected.

Testing

Tested with:

  • original Undertale game.unx
  • translated Undertale game.unx with relocated strings and fonts

Results:

  • original Undertale still loads normally
  • translated files no longer fail during FONT parsing
  • static translated text renders
  • dialogue text using typewriter-style string operations renders UTF-8 characters correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant