Files
tdkpin/tdkpin-rs/PARITY_AUDIT.md
T
ddidderr 158936577a fix(divergence): replace a full wheel immediately during multiball
Bug: filling the fifth wheel hole with several balls in play awarded the
transfer, multiplier, and extra ball, but did not run the wheel
replacement. The original deferred the 281-frame panel until a later
launcher reset, which with crazy-mode balls could be a long time, while
the full wheel kept every hole closed.

Requirement: a full wheel must be replaced with the same animation and
scoring as in single-ball play. Balls still in play keep moving, with
the wheel's outer border as a solid boundary and no hole captures until
the replacement is done.

Changes:
- complete_lock_hole starts the panel for a multiball fill too (if one
  is not already running). The single-ball path is unchanged and still
  restarts it unconditionally, as in the original. Scoring was already
  identical and is untouched.
- timer_tick only freezes physics during the panel while every ball
  waits in the launcher. That is always the case for the single-ball
  replacement (the locking ball was reset), so it is frozen exactly as
  before; during multiball the balls in play keep integrating.
- While the panel runs, check_lock_holes captures nothing and
  retain_wheel_rim adds a circle around the wheel hub (record 134's
  center, 48 px ball-center radius, enclosing the five hole posts) with
  the hub's material. It only repels balls moving towards it, so a ball
  already inside rolls out instead of being caged.
- Stress runs then showed balls trapped for good at the bottom of a hole
  pocket, cradled between the hub and a post, after another ball filled
  that hole or the panel closed it. The pocket bottom lies outside the
  hole's capture zone, so nothing ever moved them. A filled or closed
  hole now kicks such a ball (more than 4 px inside its rim) out of its
  center, radially away from the hub at 3 px/step, a path that clears
  both neighbouring posts. Balls arriving from outside are reflected by
  the rim before getting that deep.
- A lock or special-hole capture that removes the last remaining ball
  of a multiball callback now resets it to the launcher (or finishes it
  when tilted), exactly like the single-ball capture, instead of ending
  the player's ball.

Test Plan:
- cargo test (164 tests), including
  full_wheel_during_multiball_replaces_it_while_balls_play_on (rim
  bounce, no captures, balls move, wheel cleared after the panel),
  filled_or_closed_lock_hole_kicks_out_a_ball_resting_in_its_pocket
  (the exact trapped position seen in stress runs), and the updated
  fifth_multiball_lock_starts_the_panel_and_caps_survivor_reaward.
- A temporary release-mode stress run (not committed): 40 seeded
  two-player games with crazy mode, autoplay flippers, and nudges all
  finished; 62 wheel replacements happened during multiball; no
  invariant violations.
- Manual: in crazy mode fill the fifth wheel hole; the replacement
  animation plays while the other balls keep moving and bounce off the
  wheel instead of dropping into its holes.
2026-10-10 11:46:28 +02:00

9.0 KiB

Rust player-experience parity audit

Audit date: 2026-08-23

Decision

The Rust rewrite passes the reconstructed-binary requirements for the same game and player experience at the 640x460 logical gameplay boundary. No known raw, placeholder, guessed, partial, or unverified gameplay unit remains in the Rust path. This is a semantic and presentation result, not a claim that a native Rust executable is a byte-identical Win16 implementation.

The authoritative source is the preserved executable with SHA-256 a9022f1894e3e6e21fc42e8f6c932f7c549ca77f63aaa0c488bb9d55d9d0174c, the complete readable C under ../original/reconstructed/, and the zero-gap C ledger in ../original/C_RECONSTRUCTION_FINAL_AUDIT.md.

Requirement matrix

Requirement Binary/C basis Rust evidence Result
Original presentation All 63 resources round-trip; DAT/bitmap bounds and GDI call sites are reconstructed Original images/samples are embedded; loading, attract, game, panel, target, effect-seven, high-score, and name-entry scenarios export 640x460 frames Verified
Collision inventory All 175 initialized records are typed in OBJECTS.tsv; raw scan order is address-linked 109 type-2 lines, 40 type-1 circles, all type-3/4 mechanisms, layer masks, response fields, and initial activity are represented; relative chains 54-59 and 69-74 have record-exact tests Verified
Fixed-point/Real48 physics 1000:c79c and Borland runtime arithmetic are reconstructed; the DOS reference probe is bit-exact 10 ms millipixel steps, both speed clamps, four board bounds, first-record selection, signed dot-product tangent response, spin, auxiliary kick, and dynamic-ball transfer use exact-width arithmetic Verified
Live collision behavior Stopped Wine probes expose position, velocity, and six-byte spin Rails, circles, bumper, record 2, record 57, and record 72 have exact expected transitions in Rust and C tests Verified
Timer ordering 1000:eab1 fixes 5/4/3/2/1 substeps, ball-slot order, countdowns, mechanisms, flippers, and Tilt decay Timer-batch, collision-break, per-slot, target-rotation, panel, claw, countdown, and Tilt tests cover the recovered callback order Verified
Attract mode Raw 1000:01b7-063b distinguishes quotient and remainder outputs; marquee GDI lifetime is reconstructed %32/2, %32/4, %40/4, %16/4, %144/8, magnetic %32, and six-callback marquee cycles are tested and rendered Verified
Inputs 1000:638e/6bf8 define low-byte scans, Key-Up actions, auxiliary-window gate, launcher impulses, nudges, Tilt, and flipper latches Both Ctrl/Enter aliases, both plus positions, release-time add/nudge/F12, held launcher, flipper rearm, and auxiliary-window blocking follow those paths Verified
Rules and scoring 1000:b476, 1000:c4e1, 1000:bc36, 1000:ae6e, and 1000:9e85 define awards and state transitions Bank progression, ninth-diamond order, ball-scoped double, marker comparison, lock transfer, special hole, all seven effects, Type-3 Tilt finish, and score/sound ordering have focused tests Verified
Multiball Records 148, 174, and 175 plus timer collapse/spawn paths define ownership and lifetime Deferred spawn, per-slot capture age, survivor promotion, no-third-ball guard, nudge, fifth-lock deferral/reset, special respawn, and contact clearing are tested Verified
Player turns 1000:ae6e saves all record activity/contact mirrors and advances live players Four-player bounds, add-before-launch, per-player rule state, final-ball high-score ordering, flipper key lifetime, and normal/special drain behavior are tested Verified
Audio Sixteen WAV resources and every in-image play/stop call are inventoried Samples are unchanged; monophonic async replacement, full volume, Tilt suppression, threshold precedence, panel stops, and no-WAV-2022 behavior are represented Verified
High scores/configuration The 276-byte IWIK table, dialog 32514, HighScore child, and INI reads are reconstructed Signed-high comparisons, all ten entries, 21-byte name semantics, OK/Cancel flow, localized help, original settings names/defaults, and screenshots are tested Verified
Randomness The Borland LCG, high-product Random(n), Real48 result, and program-global seed are reconstructed All gameplay draws use one exact stream; seeded traces are repeatable and the final seed continues across games Verified
Stability/build Native replacement must preserve finite state and compile on supported hosts Production Linux build, 125 Rust tests, strict Clippy, two-minute finite autoplay, and Windows/macOS cross-target checks pass; native CI covers all three hosts Verified

Differential evidence

  • Record 2 special response: (157000,453000)/(0,3000) publishes the special ball at (17000,23000)/(0,3040) and continues to (16698,21191)/(-302,-1809).
  • Record 57 left relative slingshot: (75530,354765)/(3000,15) becomes (77369,356597)/(1839,1832), Real48 spin -5.28 (83 5d 8f c2 f5 a8).
  • Record 72 right relative slingshot: (235348,356825)/(-3000,15) becomes (233253,358494)/(-2095,1669), Real48 spin +5.46 (83 86 eb 51 b8 2e).
  • Ordinary circle 155, the outer/inner shooter rails, bumper response, all four claw terminals, moving flippers, Type-3/4 records, scoring, and multiball also have focused C/Rust or Wine-backed tests documented in RECONSTRUCTION.md.

Deliberate host substitutions

  • The native fixed window replaces ObjectWindows/Win16 ownership, but retains the title, logical client size, original pixels, controls, modal gameplay blocking, and visible flows.
  • Portable JSON replaces writes to HISCORES.DAT and TDKPIN.INI; the original files are imported, while table ordering, names, settings, and UI semantics remain unchanged. F9/F10 expose additional viewers/settings without replacing any original gameplay key.
  • Windows and macOS were cross-checked in this Linux checkout; native execution on those hosts is delegated to the repository's three-OS CI matrix. The semantic core is platform-independent and has no target-specific branches.

Modern additions and their divergences

Crazy mode (main-row 0) adds up to 64 live balls. To make every ball behave identically, the two original timer slots became one ordered ball list. One- and two-ball play keeps the recovered slot order, slot-numbered contact ownership, deferred effect-seven spawn, survivor identity, nudge draws, and multiball scoring, and all multiball tests above still pass. These deliberate differences follow from treating every ball alike:

  • A ball resting on the shooter stop returns to the launcher from any slot (the original deleted a slot-two ball there) unless another ball already waits.
  • Flipper kicks, record countdowns, and target rotation continue for balls in play while another ball waits in the launcher.
  • Ball-to-ball contact ignores only the claw-held ball, and every ball's collision is published as the last collision record.
  • When a ball leaves, claw and lock-hole contact owners move with their ball, and a lock hole the leaving ball was settling into is freed.
  • The rim of a filled lock hole only repels balls from the outside, so a ball that was settling into it when another ball filled it rolls back out.
  • The release-ball effect (effect seven) frees a parked special-hole ball whenever one is parked, not only when exactly one ball is in play. The released ball owns the hole's contact under its own slot number.
  • The claw re-targets a shooter-lane release (terminal frame 18) to a table release whenever more than one ball is in play during its ride, not only when the capture began in multiball.
  • A full wheel during multiball starts the 281-frame replacement immediately (the original deferred it to the next launcher reset). The table only freezes while every ball waits in the launcher; otherwise balls keep moving, the lock holes do not capture, and the wheel's outer rim (record 134's center, 48 px ball contact radius) repels balls from outside.
  • A ball resting inside a filled or closed lock hole's pocket is kicked out from the hole center, radially away from the hub. A capture that removes the last ball of a multiball callback resets it to the launcher like a single-ball capture instead of ending the ball.
  • High-score entries carry a crazy flag that both local storage and the shared service persist; older entries default to normal scores.

Reproducible final gates

cargo build --profile production
cargo test --workspace --all-targets --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo check --target x86_64-pc-windows-gnu
cargo check --target x86_64-apple-darwin
bash original/tools/test_reconstructed_c.sh
python3 original/tools/audit_reconstruction.py --require-complete

The C ledger gate reports zero raw, partial, restored, unknown, blocked, or unclassified required units. The only files intentionally outside commits are user diagnostic media in the repository root.