Files
tdkpin/original/reconstructed/tdkpin_data.c
T
ddidderr 8b99e9607c 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
2026-08-23 16:41:17 +02:00

50 lines
1.7 KiB
C

/* Address-linked initialized DGROUP objects from TDKPIN.EXE. */
#include "tdkpin_dgroup.h"
#include "tdkpin_sound.h"
enum {
WIN16_VK_PRIOR = 0x21,
WIN16_VK_NEXT = 0x22,
WIN16_VK_END = 0x23,
WIN16_VK_HOME = 0x24,
WIN16_VK_LEFT = 0x25,
WIN16_VK_UP = 0x26,
WIN16_VK_RIGHT = 0x27,
WIN16_VK_DOWN = 0x28,
};
/*
* DGROUP 1028:0590..05bf — twelve exact four-byte key bindings consumed by
* 1008:2147. Entry order is significant because the binary stops at the first
* virtual-key/control-state match.
*/
const TpWinCrtKeyBinding g_tpwincrt_key_bindings[12] = {
{WIN16_VK_LEFT, 0, 0, TPWINCRT_SB_LINEUP},
{WIN16_VK_RIGHT, 0, 0, TPWINCRT_SB_LINEDOWN},
{WIN16_VK_LEFT, 1, 0, TPWINCRT_SB_PAGEUP},
{WIN16_VK_RIGHT, 1, 0, TPWINCRT_SB_PAGEDOWN},
{WIN16_VK_HOME, 0, 0, TPWINCRT_SB_TOP},
{WIN16_VK_END, 0, 0, TPWINCRT_SB_BOTTOM},
{WIN16_VK_UP, 0, 1, TPWINCRT_SB_LINEUP},
{WIN16_VK_DOWN, 0, 1, TPWINCRT_SB_LINEDOWN},
{WIN16_VK_PRIOR, 0, 1, TPWINCRT_SB_PAGEUP},
{WIN16_VK_NEXT, 0, 1, TPWINCRT_SB_PAGEDOWN},
{WIN16_VK_HOME, 1, 1, TPWINCRT_SB_TOP},
{WIN16_VK_END, 1, 1, TPWINCRT_SB_BOTTOM},
};
/*
* DGROUP 1028:03ea..0441 — payload lengths copied from WAV resources
* 2001..2022. Zero entries are the six resource numbers absent from the NE
* resource table; nonzero values equal the RIFF length, excluding NE padding.
*/
const uint32_t g_sound_resource_byte_counts[22] = {
6302, 4594, 0, 7554, 0, 2906, 30452, 39134, 0, 0, 6710,
320, 46348, 0, 7946, 3518, 34842, 0, 5148, 30000, 3194, 22122,
};
_Static_assert(
sizeof(g_sound_resource_byte_counts) == 88,
"TDKPIN sound-resource length table drift");