feat(reconstruction): complete binary-backed C recovery

Replace the partial mechanics transcriptions with a separate, readable C11
reconstruction of the complete Win16 image while preserving the original raw
Ghidra export as immutable evidence. Cover all ordinary and overlapping entry
points, Borland runtime behavior, Win16 imports, segmented data, callbacks,
resources, indirect control flow, physics, rendering, persistence, and
startup/shutdown lifecycles.

Add deterministic extraction and audit tooling plus address-linked ledgers for
functions, imports, DGROUP ranges and objects, relocations, resources, and
callbacks. The final gate records zero raw, partial, restored, unknown,
blocked, or unclassified required units. Keep the semantic-fidelity boundary
explicit: the portable C is not claimed to reproduce a byte-identical Borland
NE build.

Add strict focused harnesses for every reconstructed C unit, exact resource
round-trip checks, and a 16-bit Borland Real48 reference probe. No Rust source
or Cargo metadata is changed in this phase.

Test Plan:
- `bash original/tools/test_reconstructed_c.sh` -- passed
- `bash original/tools/probe_real48_reference.sh` -- passed bit-for-bit
- `python3 original/tools/audit_reconstruction.py --require-complete` -- passed
- `git diff --cached --check` -- passed
- `git diff HEAD -- '*.rs' Cargo.toml Cargo.lock` -- empty
This commit is contained in:
2026-08-23 16:41:17 +02:00
parent aef404c834
commit 8b99e9607c
253 changed files with 79031 additions and 51 deletions
+18 -12
View File
@@ -1,4 +1,11 @@
# Mechanics reconstruction progress
# Historical mechanics reconstruction notes
This file preserves the live-Wine observations from the earlier mechanics-only
pass. Its former partial-status table and pending list are superseded by
`RECONSTRUCTION_PROGRESS.md` and `FUNCTION_RECONSTRUCTION.tsv`: all functions
named below, including the complete `1000:7ed9`, `1000:8b0d`, `1000:c79c`, and
`1000:eab1` paths, now have verified readable-C reconstructions. The runtime
captures below remain useful independent evidence.
This ledger scopes the current reverse-engineering pass to the claw and
flippers. The preserved executable is the authority; `TDKPIN_GHIDRA_RAW.c`
@@ -48,18 +55,16 @@ renamed.
- The speed scalar is 3800 millipixels per tick. Its Borland Real48 direction
constants are decoded for all release cases in the readable C companion.
## Explicit pending evidence
## Evidence that was pending in this historical pass
- Transcribe the full raw fixed-point flipper impulse calculation. Production
behavior currently uses live-fitted up/down transfer curves with exact record
geometry and probe tests.
- Reproduce original callback batching for non-default detail settings. Physics
substeps and claw cadence are recovered, but Rust presents intermediate 10 ms
physics states instead of batching 1-5 substeps into one Win16 repaint.
- The full raw fixed-point flipper impulse calculation is now represented in
`reconstructed/tdkpin_flipper_collision.c` and verified at `1000:7ed9`.
- Original callback batching for detail settings 1..5 is now represented in
`reconstructed/tdkpin_timer_tick.c` and `tdkpin_physics.c`. Any later Rust
transfer remains a separate goal and is not part of this C phase.
Those items are intentionally not counted as semantic parity. The readable
C files preserve their raw constants and label unresolved batching/fitted
arithmetic so later work cannot silently turn an estimate into claimed evidence.
Those items were intentionally excluded from parity at the time of these notes;
their later C closure is recorded in the address-linked main ledger.
## Runtime comparison on 2026-08-22
@@ -147,7 +152,8 @@ from the record geometry. Three live left-edge probes at `(115,390)`,
`(120,390)`, and `(125,390)` produced post-edge positions `(128.718,365)`,
`(133.397,360)`, and `(138.182,355)` with raw velocities `(1932,-3523)`,
`(2079,-4658)`, and `(2217,-5889)`. The Rust upward stroke fits those states;
the full raw calculation remains pending. A separate downstroke probe at
the full raw calculation was still pending in this historical pass and is now
closed by the verified `1000:7ed9` reconstruction. A separate downstroke probe at
`(125,390)` kept position unchanged and assigned `(3519,6302)` before the next
substep clamped speed to 3800; the Rust return edge now matches that state.