OpenTPW

Languages#

Theme Park World shipped text, fonts, speech and banner meshes in at least nine languages: English, Danish, French, German and Swedish on the European CD, Dutch (and Polish and Italian) on the Benelux CD, Spanish on the Spanish CD, and Korean on the EA Slim Pack CD; US English (Sim Theme Park) and Hebrew are known from the localisation pack (below). OpenTPW verifies twelve: English, US English, Danish, Dutch, French, German, Hebrew, Italian, Korean, Polish, Spanish and Swedish. A fan-made Russian translation loads too and is labelled as one; it is not an official release. tp.exe's language table also names Japanese, Traditional and Simplified Chinese and Thai, for which no data is available ("The original's language table"). Language selection is folder-based. Original data is never part of this repository.

Where the data lives#

Selecting a language#

bash scripts/run.sh --game-path '/path/to/Theme Park World' --language German --language-data /path/to/extracted-cd
Source (highest first)LanguageOverlay
Command line--language <name>--language-data <dir>
EnvironmentOPENTPW_LANGUAGEOPENTPW_LANGUAGE_DATA
language.json in the OpenTPW config folder (beside display.json), written by OptionsLanguageLanguageDataPath
Old .NET user settings (read only when language.json has no choice)LanguageLanguageDataPath

Names are case-insensitive (german → German). Without a name: an overlay that holds exactly one language selects it; otherwise English if Data/Language/English exists, otherwise the alphabetically first installed language. An unknown name is an error listing the available languages. The startup log prints the choice, e.g. Language: German (/…/German/data/Language/German, language overlay).

--language-data accepts these forms:

A game folder that is such a CD (--game-path /path/to/spanish-cd, with Data and the Spanish folder on the root) starts in the CD's own language when no language is chosen; English stays in the list. The installation check lists both.

Without --language-data, the CD folder (--cd-data, OPENTPW_CD_DATA, or the CD chosen under Options → Game files) serves as the language overlay when it holds more languages than the installed game, so its languages appear in the options' language list. A game folder copied from the CD rather than installed (with Data beside the CD's <Lang> folders) counts as such a CD folder without being chosen separately. Only languages whose MBToUni.dat OpenTPW can read are offered (all twelve verified ones, Polish, Korean and Hebrew through the two-byte layout below, and the fan Russian). Desktop and browser choose their start-up language with the same code (LanguageStartup); the browser reads /config/language.json, falls back to the default with a warning when the saved language is missing, and copies the CD languages' text and banners, and the chosen language's speech (docs/WEB.md, "Languages").

The advisor takes both its global speech bank and lips.wad and the level's own speech/speechHD.SDT (the Welcome line, response 1, is a level response) and lips from the current language, overlay first, each time a line is said. Nothing is cached, so a live switch changes the voice at the next line, on the desktop as in the browser. Until this was found the level bank was always the installed language's.

Two editions of UITEXT.str exist. The installed game examined here has 473 entries; the European CD's languages (its English included) and the Mac version have 474, with an extra message at entry 207 ("You cannot load this park, as it uses new rides which you have not yet downloaded") that moves every later entry up by one. OpenTPW numbers UI strings by the 473-entry edition (UIStrings), so GameLanguage.LoadStrings drops entry 207 from a 474-entry UITEXT; without that, every string from 207 on (Game Options, the option labels, Yes/No, the resolutions, …) showed its neighbour's text. The other 20 tables agree between the editions; CHAT_COMMANDS.str only appends six entries.

The overlay is read-only and is never copied into the game folder or the repository. Files missing from the overlay fall back to the installed data.

Extracting the overlay from the CD image#

Any extractor works; with 7-Zip, outside the repository:

mkdir -p /tmp/tpw-languages
7z x -o/tmp/tpw-languages TPWORLD.ISO 'Danish/data' 'Danish/Meshes' 'French/data' 'French/meshes' \
  'German/data' 'German/Meshes' 'Swedish/data' 'Swedish/Meshes'

About 110 MB. Only data files are extracted; the CD's installers are not needed and must not be run.

Switching languages#

[EXT:live-language] Options → OpenTPW → Language switches when the options are accepted, without a restart. In the front end the language, its string tables and its fonts are loaded once every dialog is closed (a display change may still wait for confirmation), the lobby and the menu are rebuilt, and the options open again in the new language; a language that fails to load leaves the old one in place. In a park the choice waits: the options say it is used when the park is left, leaving the park (to the lobby or into another park) applies it, and choosing the current language again takes it back. The full CD overlay stays available, so every CD language remains in the list. Caches of language data (UITEXT through Localization, the online strings, the chat font, object names in the object catalogue) follow GameLanguage.Version and reload after a switch; an advisor line already playing finishes in the old language. The choice is saved in language.json, so it also survives a new release unpacked in another folder (the old user settings file lived in a folder that depends on the program's location). The front-end smoke test switches to the second available language and back, and switches inside a park, checking the captured text each time.

What uses the selected language#

DataStatus
String tables (*.str)Loaded from the language folder with that folder's own MBToUni.dat (front end, options, HUD, popup help, sandbox text panel; see UI.md).
KEYBOARD.strThe 21 shortcut letters of the language (Dutch buy K, hire A, research O), applied to the HUD shortcuts when the language changes (Input.ApplyKeyboardStrings, tp.exe 0x40cb80); a plain letter that is a camera-pan key (W, A, S, D) keeps its default. In the Polish and Korean tables even an ASCII letter is a two-byte code (the letters sit behind the lead bytes), so those files hold two-byte entries, which decode to the same 21 letters and punctuation marks (BHIASVFLTGRCSVPHCO,.P) as every other language.
BF4 fonts (*.bf4)Loaded from the language folder (UI screens in SMALL/MED/BIG tiers, sandbox text panel). The Korean fonts hold 17,270 glyph records each (every Hangul syllable, KS X 1001 hanja, symbols), see "Korean".
Sign fonts (fonts.wad)The 17 TrueType fonts every CD ships; the Korean CD adds gulim.ttc (Gulim, GulimChe, Dotum, DotumChe), which its sign files name instead of a .ttf, see "Korean signs".
Sign text (OBJECT_NAMES.str)The park gates (their row, such as English 85/86 "LOST"/"Kingdom") and every object sign in the language; --export-signs <language> <dir> writes all of them as PNG with an index (RUNNING.md, "Sign textures").
Banner meshes (bankrupt/congrats/paused.MD2)Resolvable via GameLanguage.FindFile; not drawn by the game yet.
Speech banks, lips.WAD, level .LIPResolvable via GameLanguage.ResolveDataFile (overlay first). --advisor-say N plays global sp_NNN and its lips.WAD mark list from the selected language (see LIPS.md); level LIPs are not used.

String table decoding#

.str (BFST) bytes are 1-based indices into the language's MBToUni.dat (BFMU, uint16 count + UTF-16LE code units). The tables differ: Danish, Spanish and Swedish have 248 entries, English/French/German 249, with different characters at the same index (Spanish is the Latin-1 set, with no typographic apostrophe). Decoding every language with the English table (the earlier behaviour) garbled 2,254 of 2,358 Danish and 2,268 of 2,358 Swedish strings and the French œ / German š cases. Each string record is 0x01, a 24-bit little-endian length, then the bytes; reading one length byte truncated the longest UITEXT entries (over 255 characters in every language).

Two-byte tables (Polish and Korean)#

The Polish and Korean MBToUni.dat files use another header and a two-byte code. Header: BFMU, a uint16 lead-byte count (0 in the single-byte tables), then two bytes: the last byte (0xFF) and the trail count of the last lead byte. For the single-byte tables the same two bytes read as the uint16 character count. The lead bytes are the top count byte values (0xFF down to 0xFF - count + 1, taken in ascending order); a byte below them is a single character (index = byte), and a lead byte L is followed by a trail byte T (1..255) and means the index (first lead - 1) + (L - first lead) * 255 + T. The last lead byte has only its trail count of trails, which gives the character count:

LanguageLead bytesSingle bytesTrails of the last leadCharacters
Polish1 (0xFF)25475329
Korean67 (0xBD..0xFF)18825217,270

The record length of a string counts bytes, not characters (a Korean string of five Hangul syllables is ten bytes long). The characters are in descending code order. In the Polish table the Polish letters (ą ć ę ł ń ó ś ź ż and their capitals) are single bytes, and the ASCII letters and most punctuation sit behind the lead byte; in the Korean table the single bytes are digits, a few symbols and the full-width characters, and the lead bytes cover hanja, KS X 1001 symbols, Hangul (11,172 syllables from U+D7A3 down) and the ASCII letters (A is index 17,225). UniToMB.dat agrees: its entries hold the code as the lead byte (low byte) and trail byte (high byte) for every two-byte character, which cross-checks the layout for all 17,270 Korean entries (TheKoreanTableIsTheSixtySevenLeadByteLayout). tp.exe's loader (0x6ada90, magic check BFMU/BFMH at 0x6adac6) derives the single-byte count as 255 - leads and the table size as 255 * (last - 1 + 0x101) - 254 * (255 - leads) + last trails in 16-bit arithmetic; its string decoder (0x6adc80) maps a byte below the first lead to byte - 1 and a lead L plus trail T to 255 * (L - 1 + 0x101) - 254 * (255 - leads) + T (zero-based, modulo 65536), which is this layout's (first lead - 1) + (L - first lead) * 255 + T minus one, so the formula agrees with the original on the Polish and Korean tables. Two small differences: tp.exe's size is one below the character count (its range check rejects the table's last entry, U+0001 in both tables) and it does not reject trail byte 0; OpenTPW keeps every entry and rejects trail 0. The data agrees (every string table of both languages decodes without an unknown code). Korean text decodes to 697 distinct Hangul syllables; Polish to its 16 letters.

Languages added from the Spanish, Korean and Polish CDs#

Spanish (Spanish CD, single-byte table of 248 characters): the 21 string tables (2,358 entries, UITEXT with 473 entries), the 33 fonts, KEYBOARD.str, speech and lip-sync (lips.WAD, 637 lines) and banners all read like Danish's. The non-ASCII characters are ¡ º ¿ Á Í Ó á é í ñ ó ú. Polish (Benelux/Polish CD, Polish/data overlay): the same 21 tables and 33 fonts; the three GAMEBOLD and the two MATISSE fonts have 262 glyphs, the others 329. Korean (EA Slim Pack CD): 21 tables with 2,365 entries (UITEXT has 474), 32 fonts, 637 lip-sync lines. The Korean language folder lacks GAMEBOLD9/10/12 and MATISSE18/36 and adds the four DATE* fonts; the SESH fonts, the CASH fonts, CONSOLE6 and COURIER8 carry only Latin glyphs (229 or 384 of their 17,270 records), and the DATE fonts draw only Latin, Greek and Cyrillic. [EXT:ui-font-korean-bold], [EXT:ui-font-korean-heading] and [EXT:ui-font-korean-date] make UiFonts use the label font where a role font is missing or draws fewer than half the glyphs of the label font (a Hangul date such as 1년 1월 in the HUD, a heading), instead of a blank line. The language row shows a language's own name (한국어, Polski, Español) only when the font in use draws it, else its English name (SupplementaryStrings.DisplayName).

The 17,270-glyph fonts pack into 2048 or 4096 pixel atlases (FontFile.MaximumGlyphs is 20,000 now); the biggest ones (the MENU fonts, 10 million coverage pixels) fill a 4096 x 4096 atlas.

Korean signs#

Every .sgn of the Korean CD (80 files, 160 text slots) names gulim.ttc as its font file in 159 slots, with the face 굴림 (Gulim) or, in a few, 굴림체 (GulimChe) as the code page 949 bytes of its LOGFONT (B1 BC B8 B2; SignFile reads face names as Latin-1); the 160th slot names gargsai_.ttf. The Korean fonts.wad holds that TrueType collection (12.7 MB: Gulim, GulimChe, Dotum, DotumChe, 40,087 glyphs and 20,608 cmap entries each, a format 4 BMP cmap), and TrueTypeFont.ParseCollection/SignFontLibrary.Find(file, face) pick the member by face name (the English or Korean family name, or the code page 949 bytes of the Korean one; an unknown face keeps the first member). SignFile accepts a .ttc file name next to .ttf. Sign text is laid out as for Latin (what tp.exe and the shipped usp10.dll say, read statically):

The original's language table#

tp.exe selects its language from the registry value Language (a DWORD under HKLM\Software\Bullfrog Productions Ltd\Theme Park World, default 0x809) through a switch at 0x5c0d00: each known value sets one bit, the lowest set bit indexes a table of sixteen names (0x4193d0, one copy per translation unit), and that name is the folder Data\Language\<Name> (0x419710 opens it) and the suffix of the loading-screen pictures. Any other value stores 0x809 (English). GameLanguage.OriginalLanguageTable holds the table; the save container's language byte is a separate, shorter list (SaveContainerFields).

IndexName (folder)Language valueOpenTPWData
0English0x809verifiedEuropean CD, every CD's English, pack
1French0x40CverifiedEuropean CD, pack
2German0x07verifiedEuropean CD, pack
3Spanish0x0AverifiedSpanish CD, pack
4Swedish0x1DverifiedEuropean CD, pack
5Italian0x10verifiedBenelux CD (Italian/data), pack
6Dutch0x13verifiedBenelux CD, pack
7Polish0x15verifiedBenelux/Polish CD, pack
8Danish0x06verifiedEuropean CD, pack
9Japanese0x11no datanot available
10TraditionalChinese0x404no datanot available (the pack has only a .reg file)
11SimplifiedChinese0x804no datanot available
12Thai0x41Eno datanot available
13Korean0x412verifiedKorean EA Slim Pack CD, pack
14Hebrew0x40Dverified (right to left)pack
15American0x409verified (US English)pack (USEnglish)

Some values are full language ids (0x809, 0x40C, 0x412), others primary language ids (0x07 German, 0x10 Italian); the pack's .reg files use exactly these. The full Italian id 0x410 or a Russian id would select English. The fan Russian has no entry: it replaces the American folder and is selected with 0x409. The language word is also read by the online code (0x41a830; untouched here) and by 0x41a850, which tests for Hebrew (0x40D).

The localisation pack#

The ModDB "Sim Theme Park World Localization Files" pack holds one folder per language with a data folder to copy over the game's and a .reg file that sets Language: English, USEnglish, Danish, Dutch, French, German, Hebrew, Italian, Korean, Polish, Russian, Spanish, Swedish. Each data holds Language/<Name> (US English and Russian in language/american and language/American), Init/<width>/ pictures (not for Korean), ui.wad, postcard/tpwlogo.tga and the global and per-level speech. Read it as data only; nothing in it is run (the German folder contains an ip.exe).

bash scripts/run.sh --game-path '/path/to/Theme Park World' --language Hebrew --language-data /path/to/tpw-language-pack

--language-data takes the pack's root (every language), one of its folders (.../tpw-language-pack/USEnglish) or that folder's data. A pack folder whose language folder has another name is named by its language folder (USEnglish → American, also accepted as --language USEnglish or "English (US)"), except a fan translation, which keeps its own name ([EXT:fan-translations]): the Russian folder is the language Russian, whose files are the American folder's. The options list it as "Russian (fan translation)" in every interface language. A game folder into which the Russian data was copied cannot be told from US English and shows as US English.

Files beside the text: ui.wad, Init and postcard#

tp.exe reads these from fixed paths below its one data folder: data\ui.wad with data\ui, data\language.wad and data\Postcard(.wad) (the folder table at 0x747c84), and the loading screen's pictures data\init\<width>\splash_<Name>.tga, legal_<Name>.tga, welcome_<Name>.tga and welcome.tga (0x587380, called by the start-up routine 0x54dcf0 and the main state machine 0x54e360 with the table name of 0x41a820; the width folder is the screen width when it is 400, 512, 640, 800 or 1024, else 640). The splash shows first at start-up, then welcome.tga with the legal notice; later loading screens show welcome.tga with welcome_<Name>; a missing picture is simply not shown. tp.exe has no per-language lookup for any of these: a language's own copies are used only because its data was copied over the game's, as the localisation pack's readme instructs.

Sourceui.wadInitpostcard
Benelux and Spanish CDsone, the European oneData/Init holds Splash, Legal and Welcome pictures for nine languages and Welcome_Hebrew; the overlays (Dutch/data) have noneone
Korean CDits own: another logo, an IME list frame (f_imelist.md2)Welcome.tga onlythe European one
Localisation packper language; US English's differs only in tpw_logo.wct (Sim Theme Park, both texture sizes), the others are the European oneper language, named with the table name (Splash_American); Hebrew has only Welcome_Hebrew, Korean noneper language; US English's logo differs

OpenTPW layers the language's data over the game's as before (overlay first, then the game): GameLanguage.ResolveInitImage and ResolvePostcardFile resolve these files, and a language whose overlay has its own ui.wad (OwnInterfaceArchive) replaces the game's for every /ui/... read (LanguageInterfaceArchive, BaseFileSystem.ArchiveRedirect), at start-up and on a live switch (interface images reload). That swap is OpenTPW's ([EXT:language-settings]): it models an install the language's data was copied over. It also applies to Korean loaded from the Korean CD's own Data folder, which now uses that CD's ui.wad (its own logo, the IME list frame f_imelist.md2 and its own qickload.txt), as a Korean install would; the Spanish CD's ui.wad is the European one. In US English the lobby's and the player screen's logo is Sim Theme Park's. OpenTPW draws no loading screen and does not compose the original postcard picture, so the Init and postcard files are resolved but not shown yet.

US English#

Tables, fonts and fonts' glyphs as the UK English (21 tables, 2,365 entries, 248-character table; the only non-ASCII character used is é), with the US speech bank (Terry McGovern; the UK voice is Lewis Macleod), its own ui.wad, Init pictures and postcard logo. It is offered as "English (US)" and uses the English OpenTPW labels.

Italian#

Italian (Benelux CD and pack, identical language folders): 21 tables, 2,365 entries, the 248-character table, non-ASCII ° à è é ì ò ù, 37 fonts with a glyph for every used character, 637 lip-sync lines. KEYBOARD.str differs from the other languages in two letters (BHIASVFLTGRCSVCHKO,.P). OpenTPW's own labels are translated (no native speaker has reviewed them).

Hebrew#

Hebrew is right to left. What tp.exe does, read statically:

OpenTPW's own labels are translated into Hebrew with ASCII punctuation only and without words that mix Hebrew and Latin letters (the pass above would reverse the Latin part), and multi-word Latin names are joined with no-break spaces (Theme Park Inc) so they keep their order. No native speaker has reviewed them.

Russian (fan translation)#

The pack's Russian replaces the American folder: the same 248-character Latin table as US English, but its strings are Windows-1251 bytes, so they decode to Latin-1 look-alikes (Ïîòåðÿíîå Êîðîëåâñòâî for Потеряное Королевство), and its fonts draw Cyrillic shapes at those Latin positions. That is how the original shows it too, and OpenTPW draws it the same way with no new code: the interface table UITEXT is untranslated (English), the names, objects, staff states and messages are Russian; the speech bank and Welcome.tga are its own. Sign fonts and OpenTPW's own labels have no such Cyrillic positions, so signs show the Latin look-alikes and the labels stay English. Text in logs and saves is the Latin form.

Theme Park Inc#

Theme Park Inc ships its own language folders (Data/Language/{Dutch,English,French,German,Swedish}: 37 string tables and the fonts each, 3,775 entries per language, single-byte MBToUni.dat tables of 248 or 250 characters), which the extracted CD has next to _Support_<Language>_String_Tables folders (InstallShield string-table pointers for the installer, not game text). They go through the same GameLanguage path: FindLanguages, Readable and Resolve list the five, the default is English, and --language Dutch (or OPENTPW_LANGUAGE, or the saved language.json) selects one for the experimental slice, which has no options screen. What follows the choice:

Verification#

Synthetic tests (no assets) cover the reader, the 24-bit length, per-folder character tables, and language resolution (defaults, case-insensitive names and paths, both overlay forms, mesh and speech fallbacks). With OPENTPW_GAME_PATH (installed English) and OPENTPW_LANGUAGE_DATA (extracted CD folders, plus Dutch from the Benelux CD), for each of the six European and Benelux languages:

Spanish, Korean and Polish have their own data tests (NewLanguageDataTests), gated on OPENTPW_ES_PATH (the Spanish CD's root), OPENTPW_KR_PATH (the Korean CD's root) and OPENTPW_PL_PATH (a folder that holds Polish/data, such as the Benelux CD's root); OPENTPW_GAME_PATH adds the overlay checks. They pin: all 21 tables decode with no unknown code (2,358 / 2,365 / 2,358 entries; the character inventories), sample strings, the 21 KEYBOARD shortcuts, UniToMB.dat round trips of every string, the Korean and Polish table layouts, the glyphs of every used character in every font, UiFonts in all tiers, speech, lip-sync and banners, edition detection from the autorun cabinets, both overlay forms, and for Korean the sign fonts (gulim.ttc, all signs' faces) and a sign with Hangul text. Synthetic tests (MultiByteLanguageTests) cover the lead/trail layout, malformed codes, the two-byte codec, CD folder detection and the TrueType collection without any data. LanguagePackDataTests (OPENTPW_LANGUAGE_PACK, the pack's root; with OPENTPW_GAME_PATH the pack goes over that game) cover US English, Hebrew, Italian and the fan Russian: all 21 tables decode (2,365 entries, the character inventories), sample strings, the KEYBOARD letters, UniToMB.dat round trips, the Hebrew table's layout and repertoire, the fonts' glyphs, UiFonts in every tier, the language list in all thirteen pack languages, Hebrew drawn right to left and right aligned, US English's ui.wad, Init pictures and postcard (and its own voice), the Init names, speech and lip-sync; LanguagePackTests cover the language table, the right-to-left pass, the alignment swap, the Hebrew keyboard, the Init paths, the pack's folder names and a language's own ui.wad without any data. ThemeParkIncLanguageTests (OPENTPW_TPI_PATH) decode all 37 tables in all five Theme Park Inc languages and pin Dutch, French, German and Swedish strings and names.

OPENTPW_GAME_PATH='/path/to/Theme Park World' OPENTPW_LANGUAGE_DATA=/tmp/tpw-languages \
  dotnet test source/OpenTPW.Tests/OpenTPW.Tests.csproj --filter 'FullyQualifiedName~LanguageTests|FullyQualifiedName~StringTableTests'
bash scripts/run.sh --game-path '/path/to/Theme Park World' --language German --language-data /tmp/tpw-languages --smoke-test

The German native smoke test draws "Totemfall", "Spaßfaktor", "Zuverlässigkeit"… and its readback matches the CPU composite (max difference 0 on Metal). The front-end smoke runs in Spanish (--game-path <Spanish CD> --language Spanish --front-end --smoke-test) and in Korean the same way: the lobby menu, options, mods, game files, online screens, HUD, buy window, finance, research and staff windows are drawn and read back from the GPU in Hangul (no boxes), and the language switch inside the smoke goes to the other language and back. --load-original-level science --language Dutch --capture-world out.png --capture-interface writes a Theme Park Inc capture in Dutch.

Not done#

Source: docs/LANGUAGES.md in the project repository.