Crusader_Decomp/docs/remorse-windows-rebuild-roadmap.md
MaddoScientisto 8907604b84 Add core functionality for loading and processing game assets
- Implemented palette loading from binary files in `palette.cpp`.
- Added runtime utilities for reading text and JSON files in `runtime.cpp`.
- Created shape archive handling in `shape_archive.cpp`, including frame parsing and pixel decoding.
- Introduced type flag loading functionality in `type_flags.cpp`.
- Developed tests for combat tactics, entity dispatch entries, file system operations, fixed maps, flex archives, glob archives, map rendering, palette loading, shape archives, and type flags.
- Added a Python script for importing Ghidra-exported function slices with reporting capabilities.
2026-04-27 21:15:01 +02:00

30 KiB

Remorse Windows Rebuild Roadmap

Purpose

This note records the current effort to turn the live Ghidra analysis and the exported C decompilation of CRUSADER.EXE into a source tree that can be recompiled and eventually run on Windows, including modern Windows.

The short version: the project now has enough decompiled coverage to start a real rebuild lane, but the exported files are still evidence, not directly compilable game source. The safest path is to keep the export as an input corpus and move cleaned, subsystem-sized slices into a separate host rebuild tree with explicit ABI and platform boundaries.

Current Inputs

  • exports/src_remorse/export_manifest.json reports CRUSADER.EXE, 2,984 exported function files, 9 fallback function files, 57 global buckets, and 15,403 global definitions.
  • exports/src_remorse/CRUSADER.EXE.h contains the bulk Ghidra data types and provisional structure definitions.
  • exports/src_remorse/functions/ contains split function bodies, including class-like folders such as Remorse/EntityDispatchEntry, Remorse/SpriteNode, Remorse/EntityVmRuntime, and related process families.
  • Existing rebuild planning is in docs/remorse-cpp-decompilation-plan.md, docs/remorse-rebuild-abi-notes.md, and docs/remorse-cpp-compatibility-header-draft.md.

First Concrete Scaffold

The first host rebuild scaffold is now under rebuild/remorse/.

It is deliberately separate from exports/src_remorse/ because the export is generated, ignored by git, and still contains syntax and ABI artifacts that modern compilers cannot accept wholesale.

Current scaffold files:

  • rebuild/remorse/CMakeLists.txt: CMake target for a Windows-friendly C++17 executable named remorse_rebuild.
  • rebuild/remorse/build_msvc.cmd: repeatable MSVC/CMake build, test, and harness-run command.
  • rebuild/remorse/include/remorse/combat_tactics.h: typed reader for COMBAT.DAT tactic records.
  • rebuild/remorse/include/remorse/compat.h: exact-width aliases, far-pointer placeholders, packing macros, and calling-convention marker macros.
  • rebuild/remorse/include/remorse/export_prelude.h: temporary bridge types for staged Ghidra-export imports.
  • rebuild/remorse/include/remorse/entity_dispatch_entry.h: first hand-maintained class-family skeleton, anchored to the 11e0:0000 / older 0008:ba00 allocation evidence.
  • rebuild/remorse/include/remorse/file_system.h: first host file/path discovery shim for replacing DOS install-path assumptions.
  • rebuild/remorse/include/remorse/flex_archive.h: standard FLEX archive directory parser.
  • rebuild/remorse/include/remorse/fixed_map.h: typed FIXED.DAT map table and 16-byte item-record reader.
  • rebuild/remorse/include/remorse/glob_archive.h: typed GLOB.FLX object-entry reader.
  • rebuild/remorse/include/remorse/map_renderer.h: first dependency-free map preview renderer and BMP writer.
  • rebuild/remorse/include/remorse/palette.h: first game-data parser for 256-color RGB palette files.
  • rebuild/remorse/include/remorse/runtime.h: minimal runtime/export-manifest surface.
  • rebuild/remorse/include/remorse/shape_archive.h: typed SHAPES.FLX shape-frame parser and row-RLE decoder.
  • rebuild/remorse/include/remorse/type_flags.h: typed TYPEFLAG.DAT shape-family and flag decoder.
  • rebuild/remorse/src/combat_tactics.cpp: parses tactic names, four block offsets, and bytecode payloads from COMBAT.DAT entries.
  • rebuild/remorse/src/entity_dispatch_entry.cpp: minimal host-side EntityDispatchEntry behavior stubs for compile-time shape and early probing.
  • rebuild/remorse/src/file_system.cpp: repository/retail data-root discovery using modern std::filesystem.
  • rebuild/remorse/src/flex_archive.cpp: loader for count-at-0x54, table-at-0x80 FLEX archives.
  • rebuild/remorse/src/fixed_map.cpp: loader for FIXED.DAT map tables and scaled fixed-map item coordinates.
  • rebuild/remorse/src/glob_archive.cpp: parser for glob object entry lists inside GLOB.FLX.
  • rebuild/remorse/src/map_preview_main.cpp: command-line preview executable for writing a viewable BMP image.
  • rebuild/remorse/src/map_renderer.cpp: combines fixed maps, glob expansion, typeflags, shape frames, and palette data into a painted preview image.
  • rebuild/remorse/src/palette.cpp: GAMEPAL.PAL-style 768-byte palette parser.
  • rebuild/remorse/src/runtime.cpp: loads a summary from the Ghidra export manifest.
  • rebuild/remorse/src/shape_archive.cpp: ports the documented Crusader frame-table and row-RLE decode rules.
  • rebuild/remorse/src/type_flags.cpp: ports the verified 9-byte Crusader typeflag decode from the map-rendering tool.
  • rebuild/remorse/src/main.cpp: starts the host harness and prints the export status.
  • rebuild/remorse/tests/combat_tactics_tests.cpp: checks COMBAT.DAT parses to 14 tactics and entry 0 is Dumb.
  • rebuild/remorse/tests/entity_dispatch_entry_tests.cpp: first host-side check for the confirmed EntityDispatchEntry offsets.
  • rebuild/remorse/tests/file_system_tests.cpp: first host-side check that the current repository root can be recognized as a game-data root.
  • rebuild/remorse/tests/flex_archive_tests.cpp: checks STATIC/COMBAT.DAT as a small FLEX archive with 14 populated records.
  • rebuild/remorse/tests/fixed_map_tests.cpp: checks STATIC/FIXED.DAT map count and map 0 item-record loading.
  • rebuild/remorse/tests/glob_archive_tests.cpp: checks STATIC/GLOB.FLX parses into at least one populated glob object.
  • rebuild/remorse/tests/map_renderer_tests.cpp: checks map 1 can produce a non-empty preview image.
  • rebuild/remorse/tests/palette_tests.cpp: checks that STATIC/GAMEPAL.PAL parses into 256 colors.
  • rebuild/remorse/tests/shape_archive_tests.cpp: checks STATIC/SHAPES.FLX can decode at least one visible frame.
  • rebuild/remorse/tests/type_flags_tests.cpp: checks STATIC/TYPEFLAG.DAT parses 2,048 shape records and includes glob-family records.
  • rebuild/remorse/tools/import_export_slice.py: stages one exported function folder into rebuild/remorse/imported/ for manual cleanup review.

This is not the game yet. It is the first buildable shell that future cleaned subsystems can link into without mutating the raw Ghidra export.

Why The Export Does Not Compile Yet

The current exported C is very valuable, but it is not compiler-ready source for either DOS or Windows.

Known blockers visible in the export:

  • C++ namespace-qualified function names appear inside .c files, for example Remorse::EntityDispatchEntry::InitBase.
  • Ghidra calling-convention spellings such as __cdecl16far, __cdecl16near, __stdcall16far, and __regcall are not portable host compiler syntax.
  • Ghidra undefined-width types and decompiler temporaries (undefined, undefined2, undefined4, unaff_SS, unaff_CS, synthetic stack variables, and return-storage pointers) need type and calling-convention cleanup.
  • Header output includes invalid or provisional C declarations such as structure names containing spaces.
  • Switch-table and global-byte exports are emitted as raw undefined objects that need relocation-aware or data-layout-aware modeling.
  • Some functions still rely on segmented pointer reconstruction through expressions such as CONCAT22, not host pointers.
  • The original binary is a DOS protected-mode MZ -> NE program using Phar Lap 286 extender behavior and far calls, so a modern Windows build needs a platform/runtime replacement rather than a simple relink.

Rebuild Tracks

Track A: Historical Executable Reconstruction

This track tries to rebuild something close to the original DOS protected-mode executable model.

It must preserve segmented pointers, far-call provenance, original-style packing, external runtime calls, and NE/Phar Lap assumptions. It is the hardest path and is not the primary route to modern Windows compatibility, but it remains important because it keeps the reverse-engineered ABI honest.

Track B: Windows Source Port

This track uses the recovered source, object layouts, and resource formats to build a behaviorally equivalent Windows program.

It can replace DOS extender, VGA, sound, input, timing, file, and memory services with host implementations, but it should initially preserve exact-width data layouts and far-pointer provenance so behavior can be compared back to the original.

For the stated goal of running on modern Windows, Track B is the practical primary track. Track A should still guide early type cleanup so the port does not accidentally erase evidence.

Conversion Strategy

  1. Keep exports/src_remorse/ as generated evidence.
  2. Move one subsystem at a time into rebuild/remorse/ as cleaned C++.
  3. Compile every moved slice immediately, even before it is runnable game logic.
  4. Replace Ghidra pseudo-types with remorse::u8, remorse::u16, remorse::u32, remorse::FarPtr16, and explicit packed structs.
  5. Convert Ghidra calling-convention tokens into marker macros from compat.h until the final host calling surface is chosen.
  6. Keep raw address provenance in comments or mapping tables for every imported function.
  7. Build host runtime shims for platform services before trying to run gameplay.
  8. Validate behavior with extracted resources and deterministic smoke tests.

Full Rebuild Plan

The practical target is Track B first: a modern Windows source port that loads original data and reproduces gameplay behavior. Track A remains an evidence constraint for layout, calling convention, far-pointer provenance, and validation.

Phase 0: Build And Evidence Discipline

Goal: every step builds, runs tests, and keeps provenance visible.

Exit criteria:

  • rebuild\remorse\build_msvc.cmd Debug passes from the repository root
  • every imported subsystem has address/source provenance in code or docs
  • generated Ghidra exports remain input evidence, not hand-edited source

Phase 1: Host Runtime Foundation

Goal: replace DOS installation assumptions with modern host services.

Work:

  • game-data root discovery
  • case-insensitive path resolution
  • binary reads
  • DOS-style file-handle facade
  • writable config/save/user-data root
  • command-line and config parsing
  • logging and fatal-error reporting

Exit criteria: the harness can find data, open/read assets through the same facade future game code will use, and write test save/config output outside the read-only retail data root.

Phase 2: Core Resource Loaders

Goal: typed loaders for the files needed before gameplay can start.

Work:

  • palettes: GAMEPAL.PAL, misc palettes, palette transforms
  • FLEX archives: COMBAT.DAT, GLOB.FLX, SHAPES.FLX, EUSECODE.FLX, fonts/gumps/icons
  • maps: FIXED.DAT, glob expansion, type flags
  • shapes: Crusader frame directory and RLE decode
  • usecode archive chunk discovery

Exit criteria: a smoke test can load one map, expand globs, decode referenced shapes, and produce an in-memory scene without executing gameplay.

Phase 3: Minimal Renderer

Goal: put a real Crusader world image on screen on Windows.

Work:

  • choose initial graphics layer, likely SDL for window/input/timing/audio portability
  • convert paletted frames to host pixels
  • implement deterministic fixed-map painter first
  • add debug overlay/status console for loaded map and camera position

Exit criteria: running the host executable opens a window and displays a recognizable fixed-map scene from retail data.

Phase 4: Process, Item, And Entity Runtime

Goal: lift the core object/process model into host source.

Work:

  • typed Process / EntityDispatchEntry layout
  • item allocation, fixed-format conversion, map item cache
  • scheduler/process list
  • sprite-node/draw-list families
  • core entity fields and update lanes

Exit criteria: the host runtime can instantiate map items/entities and advance a deterministic tick without requiring the full original VM yet.

Phase 5: Input, Camera, And Player Loop

Goal: make the rendered world navigable.

Work:

  • keyboard/mouse abstraction
  • camera scroll/viewport state
  • cursor/selection state
  • player/avatar process skeleton
  • collision/line-of-sight primitives as needed

Exit criteria: the user can launch the host build, view a map, move the camera/avatar test object, and observe stable tick/update behavior.

Phase 6: USECODE / VM Runtime

Goal: execute game scripts from original EUSECODE.FLX.

Work:

  • import and type EntityVmRuntime, owner-resource, context, and slot-entry families
  • parse usecode chunks and dispatch tables
  • implement VM value stack, globals, calls, and event dispatch
  • cross-check against existing usecode extraction tools

Exit criteria: selected map triggers and object interactions execute through the host VM with traceable parity against known extracted usecode behavior.

Phase 7: Gameplay Systems

Goal: make core No Remorse gameplay work.

Work:

  • actor movement and animation
  • combat tactic interpreter from COMBAT.DAT
  • projectiles and hit resolution
  • inventory/equipment
  • doors, elevators, panels, triggers, movable walls
  • save/load state

Exit criteria: a small scenario can be played end to end with movement, combat, interaction, and persistence.

Phase 8: Media And Presentation

Goal: reach production game flow rather than only a debug map runner.

Work:

  • menu/frontend flow
  • fonts/gumps/icons/HUD
  • music/audio mixer
  • flic/movie playback
  • cutscene and mission transition behavior

Exit criteria: the host build can boot through a recognizable frontend and enter gameplay using retail resources.

Phase 9: Whole-Game Integration And Parity

Goal: turn subsystem success into a working game.

Work:

  • mission progression
  • all retail maps/resource variants
  • error recovery and missing-data handling
  • deterministic trace comparisons for high-risk systems
  • long-run smoke tests

Exit criteria: the game can be started, played across mission transitions, saved, loaded, and exited on modern Windows.

Phase 10: Packaging And Modernization

Goal: make it usable outside the development repo.

Work:

  • data-root picker or command-line root selection
  • per-user config/save directory
  • release build profile
  • crash logs
  • user documentation
  • optional quality-of-life settings that do not obscure parity bugs

Exit criteria: a clean checkout/build can run against a retail data directory with documented setup steps.

Current Execution Focus

The current active phase is Phase 2, core resource loaders. The immediate path is FIXED.DAT map table and item-record loading, then glob expansion, then shape-frame decoding, then a minimal map scene smoke test.

Import-Slice Tool

The first source-conversion helper is rebuild/remorse/tools/import_export_slice.py.

Its job is intentionally modest: copy one folder from exports/src_remorse/functions/ into ignored staging output under rebuild/remorse/imported/, rewrite Ghidra's direct CRUSADER.EXE.h include to remorse/export_prelude.h, convert known 16-bit calling-convention tokens to compatibility macros, and write an import report listing cleanup signals such as unaff_SS, unaff_CS, CONCAT22, and hidden return-storage parameters.

Example:

python rebuild/remorse/tools/import_export_slice.py classes/Remorse/EntityDispatchEntry

The generated staging files are not linked into remorse_rebuild. They are a workbench for turning one exported subsystem into hand-maintained source.

The first run against classes/Remorse/EntityDispatchEntry staged 24 files, replaced 62 calling-convention tokens, preserved 46 namespace-qualified references, and reported CONCAT22, unaff_CS, and unaff_SS as cleanup signals.

Windows Runtime Work Needed

To run on Windows, the rebuild needs replacement layers for these original services:

  • process startup and command-line/config parsing
  • DOS file APIs and search paths
  • Phar Lap / DOS extender memory services
  • segmented far-pointer memory model, at least as a compatibility abstraction
  • VGA/SVGA video mode setup, palette writes, bank switching, and blitting
  • keyboard, mouse, and joystick input
  • timer/tick scheduling
  • audio device and mixer services
  • movie playback and RIFF/audio frame handling
  • save/load paths and user-writable data locations
  • game data discovery for retail install layouts and repository fixtures

The first Windows runtime should prefer clear host abstractions over direct Win32 calls where possible. SDL or another portability layer is a reasonable later choice for graphics, input, timing, and audio, but that should be selected after the first resource-loading and render smoke tests are defined.

The first source slices should be small enough to compile and test without the entire game loop.

  1. Compatibility/runtime layer: exact types, packed layout helpers, far-pointer wrappers, host file paths, and logging.
  2. Resource/file loading helpers from the low segments, with DOS file calls replaced by host file services.
  3. Palette and fixed-format data structures, validated against known assets.
  4. EntityDispatchEntry as the first class-like family because it already has a named export folder and prior class-lifting notes.
  5. Sprite/node or map rendering data structures after basic resource loading is stable.

First Hand-Maintained Game Skeleton

The first manually maintained game-shaped source is EntityDispatchEntry.

Current evidence used:

  • live export folder: exports/src_remorse/functions/classes/Remorse/EntityDispatchEntry/
  • base initializer: InitBase@11e0_0000.c
  • older note anchor recorded in the decompiler comment: 0008:ba00
  • allocation size visible in the decompiled initializer: 0x32 bytes

The current rebuild skeleton preserves the 0x32-byte object size and provides host-side stubs for base init, group-id update, source/item update, and event/proc-type update. The first confirmed offsets from the exported setter bodies are: source item at +0x04, event/proc type at +0x06, and group id in the low five bits at +0x08. These names are still conservative because the surrounding Process layout is not fully lifted into typed fields yet.

First Windows Runtime Shim

The first platform-replacement layer is a host file-system shim.

Current behavior:

  • inspects a candidate root for CRUSADER.EXE, CRUSADER.CFG, STATIC, and USECODE
  • walks upward from the current directory until it finds a usable game-data root
  • resolves game-data-relative paths case-insensitively for ASCII DOS-style names
  • blocks parent traversal through ..
  • reads binary files into host byte buffers
  • reports the root path from the host harness
  • adds a CTest target that expects the repository root to contain the retail executable and data folders, then reads STATIC/GAMEPAL.PAL

This starts replacing the original DOS install-directory assumptions with explicit modern path discovery. It is intentionally narrow; file handles, writable save paths, and retail/install-layout variants are still to come.

First Data Parser

The first parsed retail data asset is STATIC/GAMEPAL.PAL.

Current behavior:

  • resolves STATIC/GAMEPAL.PAL through the host file-system shim
  • requires exactly 768 bytes
  • parses the file into 256 RGB triples
  • reports the parsed color count from the host harness
  • validates the path through palette_tests

This gives the future renderer a tiny but real data pipeline: host path discovery, binary load, format validation, and typed in-memory representation.

First Archive Parser

The first archive parser handles the standard Crusader FLEX directory used by files such as COMBAT.DAT, GLOB.FLX, SHAPES.FLX, and EUSECODE.FLX.

Current behavior:

  • reads the entry count at file offset 0x54
  • reads 8-byte directory rows at file offset 0x80
  • treats rows as little-endian <u32 offset, u32 size>
  • skips empty rows and rejects out-of-file entries
  • extracts individual populated entries by index
  • validates STATIC/COMBAT.DAT as 14 populated records with entry 0 named Dumb

This is the first reusable loader shared by AI tactics, glob objects, shapes, and usecode archives.

First Typed Archive Consumer

The first typed FLEX consumer is COMBAT.DAT.

Current behavior:

  • loads the outer FLEX directory through loadFlexArchive
  • parses each populated record's 16-byte NUL-padded tactic name
  • reads four little-endian block offsets
  • exposes the remaining bytes as tactic bytecode
  • validates the shipped archive as 14 tactics, with entry 0 named Dumb and block offsets 0x002c / 0x0031

This is not yet the combat bytecode interpreter, but it establishes the pattern for moving from raw archive chunks to typed subsystem inputs.

First Fixed-Map Loader

FIXED.DAT is now the next typed world-data input.

Current behavior:

  • reads the map count at file offset 0x54
  • reads 8-byte map table rows at file offset 0x80
  • treats each row as little-endian <u32 offset, u32 size>
  • parses 16-byte fixed-item records into typed fields
  • applies the verified Crusader coordinate scale: disk x/y * 2
  • validates all map table rows parse, at least one map is non-empty, and out-of-range map indices are rejected

This is the first step toward a host-side map scene assembled from retail data.

First Glob Loader

GLOB.FLX is now parsed as the companion object-expansion archive for fixed maps.

Current behavior:

  • loads the outer FLEX directory through loadFlexArchive
  • reads each glob object as u16 count followed by repeated 6-byte entries
  • parses each entry as x:u8, y:u8, z:u8, shape:u16, frame:u8
  • validates the archive contains at least one glob object with entries

This prepares the next step: expanding fixed-map glob eggs into concrete world objects using the coordinate rules in docs/map-rendering.md.

First Typeflag Loader

TYPEFLAG.DAT is now parsed as the shape-family metadata source needed by map expansion and rendering.

Current behavior:

  • requires 9-byte records
  • decodes the 20-bit typeflag field using the same byte layout as the Python map renderer
  • decodes shape family, footpad dimensions, and animation type
  • validates the shipped file contains 2,048 shape records and includes glob-family shapes

This is the shape metadata layer needed before fixed-map records can be classified as drawables, glob eggs, triggers, roofs, editor objects, or other family-specific runtime objects.

First Shape Decoder

SHAPES.FLX is now parsed as the first renderable art source.

Current behavior:

  • loads the outer FLEX directory through loadFlexArchive
  • parses the Crusader shape header and 8-byte per-frame table
  • reads 28-byte frame bodies, per-line RLE offsets, frame dimensions, and draw offsets
  • decodes row RLE into transparent-or-palette-index pixels
  • validates the shipped archive can decode at least one visible frame

This completes the remaining Phase 2 requirement needed for a minimal map image: fixed records, glob records, shape metadata, palette, and decoded shape pixels.

First Visual Preview Renderer

Phase 3 now has its first concrete artifact: remorse_map_preview writes a 24-bit BMP preview using only the source-port rebuild code and the shipped retail data.

Current behavior:

  • defaults to map 1, the first non-empty fixed-map table entry in this data set
  • expands first-level glob eggs using GLOB.FLX
  • filters hidden marker/egg/roof families by default, matching the offline map-rendering workbench's first-pass policy
  • decodes visible SHAPES.FLX frames and paints them with GAMEPAL.PAL
  • writes a dependency-free BMP image under rebuild/remorse/out/preview/

Validated preview:

  • command: rebuild\remorse\out\build\Debug\remorse_map_preview.exe rebuild\remorse\out\preview\map1-preview.bmp 1
  • output: rebuild/remorse/out/preview/map1-preview.bmp
  • image size: 1600x900
  • raw fixed records: 7,547
  • render items after filters/globs: 15,318
  • decoded items: 15,318
  • painted items in the preview crop: 178
  • full scene bounds: 30,977 x 15,617

This is still a smoke renderer, not the final game renderer. It uses a simple stable paint order rather than the full engine/item-sorter dependency graph, but it proves the rebuild tree can now load original resources and produce a visible world image.

After reviewing the first preview, the chosen next direction is render correctness: port fuller item sorting, improve roof/hidden-object policy, and add better crop/navigation controls before moving to an interactive runtime.

Immediate Build Loop

The first chosen Windows toolchain is Visual Studio Build Tools plus CMake. That means the expected compiler is MSVC cl.exe, usually reached through a Developer PowerShell or Developer Command Prompt.

Until CMake and MSVC are available in PATH, the source scaffold can be edited and syntax-checked by VS Code, but it cannot be built locally from this shell.

Current local toolchain finding:

  • Visual Studio Community 2026 is installed at I:\Apps\VS\18\Community.
  • After installing the Desktop C++ workload, vcvars64.bat, MSVC 19.50.35729.0, and VS-bundled CMake 4.2.3 are usable through the Visual Studio developer environment.
  • Plain cmake is still not available before the Visual Studio environment is initialized, so build_msvc.cmd uses vswhere and vcvars64.bat before invoking CMake.

Host Harness

From rebuild/remorse/, the intended host build loop is:

cmake -S . -B out/build
cmake --build out/build
ctest --test-dir out/build -C Debug --output-on-failure
.\out\build\Debug\remorse_rebuild.exe ..\..\exports\src_remorse\export_manifest.json

For single-config generators, the executable may be under out/build/remorse_rebuild.exe instead of out/build/Debug/.

From the repository root, the repeatable MSVC path is:

rebuild\remorse\build_msvc.cmd Debug

Staging One Export Slice

From the repository root:

python rebuild/remorse/tools/import_export_slice.py classes/Remorse/EntityDispatchEntry

What Is Done

  • Established a separate rebuild tree under rebuild/remorse/.
  • Added a CMake-based C++17 executable target.
  • Added an initial compatibility header matching the earlier ABI draft categories.
  • Added a temporary export prelude for staged decompiler-source imports.
  • Added a minimal runtime harness that reads the exported decompilation manifest and reports the current export scope.
  • Added an import-slice tool for staging individual exported function folders without linking them yet.
  • Ran the importer on classes/Remorse/EntityDispatchEntry; it staged 24 files, replaced 62 calling-convention tokens, and reported CONCAT22, unaff_CS, and unaff_SS as cleanup signals.
  • Added the first hand-maintained EntityDispatchEntry source skeleton and wired it into the CMake target.
  • Split the scaffold into a remorse_core library, host executable, and first CTest target for EntityDispatchEntry setters.
  • Added the first host file-system shim and CTest target for game-data root discovery.
  • Extended the host file-system shim with case-insensitive data-path resolution, parent-traversal blocking, and binary file reads.
  • Added the first typed game-data parser for 256-color palette files and verified STATIC/GAMEPAL.PAL parses to 256 colors.
  • Added a standard FLEX archive parser and verified STATIC/COMBAT.DAT exposes 14 populated records.
  • Added a typed COMBAT.DAT tactic parser and verified entry 0 metadata against the existing combat note.
  • Added a full staged rebuild plan from current harness through a playable and packaged modern Windows source port.
  • Added a typed FIXED.DAT map loader for map table and 16-byte fixed-item records.
  • Added a typed GLOB.FLX object parser for the fixed-map glob-expansion path.
  • Added a typed TYPEFLAG.DAT parser for shape family, flags, dimensions, and animation metadata.
  • Added a typed SHAPES.FLX parser and row-RLE decoder for renderable frame pixels.
  • Added the first visual map preview renderer and BMP output command.
  • Validated remorse_map_preview by rendering map 1 to rebuild/remorse/out/preview/map1-preview.bmp from original retail data.
  • Verified the scaffold with Visual Studio Community 2026: CMake configure succeeded, MSVC build succeeded, ctest -C Debug passed 2/2 tests, and remorse_rebuild.exe ran against exports/src_remorse/export_manifest.json.
  • Added build_msvc.cmd so the working build/test/harness loop is repeatable from the repository root.
  • Documented the current blockers between the Ghidra export and compiler-ready source.
  • Split the goal into historical reconstruction and Windows source-port tracks.
  • Chose Visual Studio Build Tools plus CMake as the first intended Windows host toolchain.

What Is Left To Do

  • Keep the host scaffold building as new source slices are added.
  • Lift the confirmed EntityDispatchEntry byte offsets into named packed fields once the surrounding Process layout is stable.
  • Convert the compatibility header from placeholders into enforced layout macros with static assertions.
  • Pick the first real subsystem slice and move it into rebuild/remorse/.
  • Expand the host file-system shim into DOS file-handle replacements and writable save/config locations.
  • Model far pointers and segmented memory in a way that can support both trace comparison and Windows execution.
  • Normalize Ghidra exported types into valid C++ names without losing address provenance.
  • Replace raw global-byte exports with typed data definitions or resource loaders.
  • Define resource fixture tests for palette, shape, map, and usecode data.
  • Replace the current preview painter's simple ordering with a fuller item-sorter dependency graph.
  • Decide whether the first interactive window should use SDL, raw Win32/GDI, or another host layer.
  • Decide the graphics/input/audio platform layer for the Windows runtime.
  • Add CI-style smoke tests once the host toolchain and first resource loader compile reliably.

Near-Term Next Actions

  1. Open a Developer PowerShell with MSVC and CMake available, then run the CMake scaffold build.
  2. Replace the current EntityDispatchEntry byte-array fields with named packed fields as evidence allows.
  3. Add a small host-side test for the confirmed +0x04, +0x06, and +0x08 setters once the MSVC/CMake toolchain is available.
  4. Map the first old DOS file functions onto the new host file-system shim.
  5. Add writable save/config path handling.
  6. Add layout assertions for the first recovered packed structs.
  7. Start a render/runtime decision note once the first resource smoke test passes.

Current Bottom Line

The project is now at the start of the recompilation lane: there is a buildable host target scaffold, a compatibility surface, and a documented path for importing cleaned decompiler output. The major remaining work is systematic conversion, platform replacement, and behavior validation, not another bulk export.