Files
linkatplugandClaude Opus 5.5 7485f5fc00 Doc : version du jeu compatible (CD français, image ISO)
Lien vers la fiche Abandonware France (partie « version ISO »), repère de
taille de TUCKER.EXE, versions étrangères pas encore prises en charge.
README, guide et documentation technique, en français et en anglais.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 07:37:27 +01:00

16 KiB
Raw Permalink Blame History

Technical documentation: what we know about the game, how the recomp works

🇺🇸 English · 🇫🇷 Français · To play: complete guide

This page gathers what studying the game and recompiling it taught us about Bud Tucker in Double Trouble: its executable, its files, its game loop, and how the project runs it natively. It is the starting point for anyone who wants to work on the project: the full detail of the formats and routines is in the game analysis (the reverse-engineering notebook), the detail of the code is in the comments of runtime/ and tools/.

No game code, image or sound is published: only addresses, formats and behaviours. The translated C is generated on the player's PC, from their own copy, and stays in build/.

French names in the code. The project was written in French: many identifiers (FN_VOIX_JOUE = "play voice", ADR_DEFILEMENT = "scroll"), command-line options (--sans-intro, --charger) and file names (attentes_intro.txt = "intro waits") are French. This page translates them where it helps.

Contents


1. Where to find what

I am looking for… Where
The format of a file (PCX, SPR, .C, saves, sounds) ANALYSE.en.md, § 4
The cutscene language (CSDATA.C, 42 instructions) ANALYSE.en.md, § 4.8
What a game address does ANALYSE.en.md (search by address) and runtime/addr_fr.h
How x86 becomes C tools/recomp.py (header), § 5
The emulated CPU, DOS, sound runtime/cpu.h, dos.c, machine.c, ail.c, audio.c
The HD pack and mods MODS.en.md, TEXTURES.en.md, runtime/hd.h, runtime/sprites.h
settings.ini, command-line options SETTINGS.en.md
What is planned Roadmap

2. The executable

File TUCKER\TUCKER.EXE, 284,677 bytes (French version); INTRO.EXE for the intro
Format MZ + LE (Linear Executable): 32-bit protected-mode program, started by the DOS/4GW extender
Compiler Watcom C/C++32 (1988-1994 library); arguments passed in EAX, EDX, EBX, ECX
Memory flat model: code at 0x10000 (object 1), data at 0x40000 (object 2), VGA screen at 0xA0000
Entry point 0x2E318 (Watcom's _cstart_) → main at 0x12300
Relocations 8,389, all "internal 32-bit offset": every absolute code address is a relocation
Libraries Watcom C and Miles AIL 3.02 (sound), beyond 0x27200; the game code has no int instruction
Translated size TUCKER.EXE: 960 functions; INTRO.EXE: 540

The game wants 320×200 VGA in 256 colours (mode 13h), a mouse (int 33h), and reads its voices straight from the CD (X:\tucker\speech\).

Details: ANALYSE.en.md, § 2 and 3.


3. How does the game run?

main 0x12300
 ├─ mouse, a single 5.6 MB malloc split into ~18 fixed areas
 ├─ sound (Miles AIL) + 46 Hz timer (callback 0x12250: tick counter)
 ├─ tucker.cfg, infobar.txt, .c/.enc texts, nofiles.dta
 ├─ VGA mode 13h (320×200×256)
 ├─ game loop 0x129DC  ◄── everything happens here
 └─ stop the timer and the sound, back to text mode

One game frame, in the 0x129DC loop:

  1. Pacing: the loop waits until the 46 Hz timer has advanced by enough ticks (a busy-wait in the original: see § 5).
  2. Input: mouse (int 33h), keyboard.
  3. Logic: fades, current cutscene (interpreter 0x20A00), Bud (0x17B80), characters (0x200E4), animated objects, location change, per-location code (0x24C8C).
  4. Rendering into a buffer 640 pixels wide (the whole room): background, objects, characters, Bud, cursor, texts; then a 320×200 window of it is copied to the screen, scrolling included.

A few mechanisms worth knowing:

  • Depth through the palette: Bud goes behind a part of the background when the background pixel under him has a colour index ≥ 0xF8 (or ≥ 0xE0 below a line specific to each location). The high colours of the palette act as a depth layer. (§ 4.13)
  • Walk masks: pathNN.pcx, same size as the background; a byte > 0 = walkable.
  • Wide rooms: two backgrounds side by side (LOCxxA + LOCxxB, 640 px) with scrolling; locations with 4 images (A to D) are animated backgrounds, not wide rooms. (§ 4.3)
  • 300 game flags (0x47800): the whole state of the adventure, saved as is.
  • Three parts: locations 1–23; then 24–40, 70–72 and 79–82; then 41–69 and 73–78. Each part has its own text, object and action files.

4. The game files

Files What they are Details
LOCnn[a-d].PCX (122) room backgrounds, 320×200, 8-bit, PCX RLE § 4.2, 4.3
PATHnn.PCX walk masks § 4.3
SPRITES\*.SPR (654, 17,022 frames) animations: Ann_nn (Bud, scenes), Cnn_nn (characters); RLE, absolute position § 4.4
BUD_n, PEG_n, MAC_n.PCX sheets for Bud's walk (cut out using CTABLE01.C) § 4.13
SCROBJnn.PCX, PANOBJSn.PCX scenery objects, inventory icons § 4.11
*.C (28) / *.ENC not C code: fixed-column tables (!!NN, dw …) and CP437 texts § 4.5, 4.9
CSDATA.C every cutscene and dialogue, in a small scripting language § 4.8
PTnTEXT.C, OBJTXTn.C, BGTEXT.C, INFOBAR.TXT lines of dialogue, object names, verbs § 4.5, 4.10
ACTIONn.C "verb + target → result" rules § 4.14
SPEECH\SAMnnnn.WAV (4,196) voices; number = (part − 1) × 3000 + tpo base + line number − 1 § 4.7
MUSIC\, FX\, FX.C music, sound effects, per-location ambience (7 effect types) § 4.7
SAVEGM.nn, NOFILES.DTA saves: 2,000 bytes (flags, inventory, location, Bud's position) § 4.6
CHARSET.PCX, CHARSIZE.DTA 10×10 font and character widths § 4.10

The trap with the .C files: the game reads them by fixed-width columns and ignores the separator. dw 04-178,040 and bus,014;wa+; are therefore valid. A tool that splits on commas gets it wrong.


5. How the recompilation works

The game is neither emulated nor rewritten: its x86 code is translated to C, then compiled for Windows.

TUCKER.EXE (player's) ──► tools/le.py: reads the LE, relocations
                      ──► tools/recomp.py: disassembly (Capstone), one C function per x86 function
                      ──► build/gen_*/*.c  (never distributed)
                      ──► MSVC + runtime/  ──► build/tucker.exe

The translator (tools/recomp.py)

  • Code discovery by recursive descent from the entry point, the call targets and every relocated code address. In an LE, a function pointer is necessarily a relocation: coverage is therefore complete, with no heuristics.
  • One C function per x86 function. A jump into another function becomes a tail call; a block shared by two functions is duplicated in each.
  • Faithfulness: each instruction becomes C acting on the state of the emulated CPU. call really pushes the return address, ret pops it: the game's stack is the real one.
  • Lazy flags: an instruction that changes CF, ZF… only records (operation, size, operands, result); the flags are computed only if an instruction reads them.

The runtime (runtime/)

File Role
cpu.h, cpu.c, fpu.c registers, single flat memory, flags, x87 (the subset Watcom uses)
loader.c loads the player's LE into memory and applies the relocations
dos.c DOS/4GW (int 21h), DPMI (31h), BIOS (10h, 16h), mouse (33h), CD (2Fh); redirects files to the game, the mods and saves/
machine.c VGA, PIT timer, PIC, keyboard; hardware interrupts
ail.c, audio.c Miles AIL replaced by a modern mixer
overrides.c game functions rewritten by hand (sound, timer, int386x, intercepted drawing)
host_sdl.c, gfx_gl.c SDL2 window, OpenGL 3.3 rendering and filters (sharp, smooth, xBR, CRT)
menu.c F12 menu and settings.ini
mods.c, hd.c, sprites.c, hd_sprites.c, png.c mods, HD background pack, HD sprites (in progress)
main.c runs INTRO.EXE then TUCKER.EXE, like the original BUD.BAT

Overrides

runtime/overrides_tucker.txt and overrides_intro.txt list the game functions replaced by hand-written C. The original stays callable (ORIG(FN_xxx)). This is how the modern sound is plugged in instead of Miles AIL, how sprite drawing is intercepted for HD, and it is the future hook point for code mods.

Busy-waits: the game sleeps instead of spinning

In 1996, a DOS game waited in a loop: while (ticks < ticks_per_frame) ;. Translated as is, this loop kept a CPU core busy for nothing (about 20 % of a core for the game, 55 % for the intro).

  • The translator recognises pure wait loops by itself (loops that only re-read memory without changing anything): 7 in TUCKER.EXE, all on the tick counter.
  • The ones that call a function on each pass (the intro keeps the sound fed while waiting) are listed by hand in runtime/attentes_intro.txt (14 loops).
  • On each pass, the runtime sleeps until the next event (clock, timer, frame): the only thing that can end the loop. The game's pace does not change.
  • Result: 1 to 3 % of a core for the game, 1.1 % for the intro. Nothing is redrawn when the screen does not change or the window is minimised.

6. Named addresses

Every address of the French version that the runtime uses is in runtime/addr_fr.h, with a name and a comment. Elsewhere in runtime/, a raw address is never written.

Prefix Meaning Examples
FN_ function of TUCKER.EXE (generated name F_ + address) FN_VOIX_JOUE (play voice, 0x11F64), FN_SPR_DESSINE (draw sprite, 0x10F18), FN_COPIE_ECRAN (copy to screen, 0x10D88)
ADR_ variable or point in the code ADR_SOUND_ON (0x41F90), ADR_TICS (0x46634), ADR_LECTEUR_CD (CD drive, 0x4671C), ADR_DEFILEMENT (scroll, 0x46854)
INTRO_ same thing for INTRO.EXE the 18 emulated Miles AIL API functions, the intro's sound channels

This is what will make the other versions of the game possible: write an addr_xx.h with the same names, without touching the rest of the code.


7. Game versions

💿 To play today: the French version as an ISO image, the one on this Abandonware France page ("ISO version" section). It is the reference version in the table below.

Survey of the available versions, 2026-12-05:

Version TUCKER.EXE Texts Voices Status
French (reference) 284,677 bytes plain .C; partial translation: verbs, objects and voices in French, ~80 % of the dialogue lines in English 4,196 ✅ supported
English 283,861 bytes .ENC 4,048 to do
German 285,277 bytes .ENC, names ending in …GR (PT1TXTGR.ENC) 4,154 to do
Spanish 285,149 bytes .ENC none (text only) to do
Polish (ISO image) not studied to do
  • .ENC = the same text as .C, each byte increased by 0x80 (the game tries .enc then .c, and subtracts 0x80 on reading). Same format.
  • Each language has its own TUCKER.EXE, rebuilt by the publisher: the code is shifted, so the addresses change. DOS4GW.EXE and SETSOUND.EXE are identical everywhere; INTRO.EXE is identical between the French, English and Spanish versions, different in the German one.
  • Plan: one address table per version (addr_xx.h), found by byte signatures, and version detection at install time. No fork. See the roadmap.

8. What the project adds on top

Addition How Docs
Modern rendering and filters the game's 320×200 screen becomes an OpenGL texture, filtered by a shader Guide § 8
HD background pack the engine recognises the displayed background (and its scroll) in the game screen, and shows the HD image wherever the game has drawn nothing on top; fades carried over TEXTURES.en.md, MODS.en.md
HD sprites (in progress) the 3 RLE drawing routines and the sheet cutting are intercepted: for each frame we know which sprite is drawn, where it comes from and where it goes runtime/sprites.h
Mods dos.c serves a mod's files instead of the originals (files/) MODS.en.md
Sound SDL2 mixer instead of Miles AIL, separate volumes runtime/audio.c
Settings F12 menu, settings.ini shared with the launcher SETTINGS.en.md

9. Curiosities found along the way

  • A debug mode exists ([0x46714] ≠ 0, set by the header of DATA4.C): F1 next location, F3 object number, F5 to F10 Bud's animations. The shipped version has it disabled.
  • An F3 hint system is coded (steps, "Press F3" after 1,000 idle ticks) but switched off in the shipped version (dw 00,00).
  • Pause (P) lets you replay Bud's last 5 lines with keys 1 to 5.
  • Files never read: ACTION.C, DATA2.C, EXIT.C, COMMON.C, PT1.C, TEST.C, OBJTXT.C, CSDATA1.C: development leftovers.
  • Errors in the data, kept as they are: bud,004 in CSDATA.C (argument too long, "Instruction not recognised"), a missing fx226.wav sound effect, an FX slot pointing to a slot not loaded yet.
  • The ax/ay fields of sprites are read and never used: the engine takes the absolute position. Leftovers of the cutting tool.
  • A single frame out of 17,022 overflows (frame 19 of C24_09.SPR, 3 bytes): no visible effect.
  • The terminal in location 70 compares the input with a line of INFOBAR.TXT: the password therefore depends on the language.

All of this is detailed, with the addresses, in ANALYSE.en.md.


10. What remains to be understood

  • The town map and Bud's walk are understood, but only by reading the code: the recomp runs them as they are, without having reimplemented them.
  • The INTRO.EXE cutscenes (FLC): translated and run, little documented.
  • The other versions: only the file differences are surveyed (§ 7).
  • The HD sprites: capture is done and checked to the pixel; rendering is in progress.

A question, a discovery? Open an issue on the repository.