chore: trap WA-side originals of ported DisplayGfx::Destructor
Browse filesInstalls panic traps on the three WA-side functions whose only live
callers were the ported destructor body:
- DisplayGfx::DestructorImpl (0x56A010)
- DisplayGfx::FreeLayerSpriteTable (0x56A280)
- TileBitmapSet::Destructor (0x569BC0)
If any of these fire, the slot 0 port forgot to handle a step or a
caller path we didn't account for.
`TileBitmapSet::Destructor` has a *second* xref chain through
`FUN_0056C2E0` β `CBitmap__Constructor_Maybe` (0x56C060), which sits
in the DisplayGfx vtable .rdata block at slot index 38 (offset 0x98
past the vtable base 0x66A218). Verified that chain is structurally
dead by byte-pattern searching WA.exe for `FF 90 98 00 00 00`
(CALL [reg+0x98]) and `8B 4? 98` (MOV reg,[reg+0x98]) β neither
matches any DisplayGfx-related code. Slots 38 and 39 of the
DisplayGfx vtable were emitted into .rdata by the compiler but have
no live caller in shipping WA β they're vestigial vtable entries
from a removed feature. So the trap is safe.
Verified headful via `replay-test.ps1 bomber_parachute` exits
cleanly without firing any of the new traps.
|
@@ -1403,6 +1403,36 @@ fn install_display() -> Result<(), String> {
|
|
| 1403 |
"DisplayBitGrid__SetExternalBuffer",
|
| 1404 |
va::DISPLAY_BIT_GRID_SET_EXTERNAL_BUFFER
|
| 1405 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1406 |
}
|
| 1407 |
|
| 1408 |
Ok(())
|
|
|
|
| 1403 |
"DisplayBitGrid__SetExternalBuffer",
|
| 1404 |
va::DISPLAY_BIT_GRID_SET_EXTERNAL_BUFFER
|
| 1405 |
);
|
| 1406 |
+
|
| 1407 |
+
// ββ Slot 0 destructor leaves: trap the WA-side originals ββββββ
|
| 1408 |
+
//
|
| 1409 |
+
// After `vtable_replace!` swapped slot 0 to our Rust impl, the
|
| 1410 |
+
// original `DisplayGfx::DestructorImpl` (0x56A010) is no longer
|
| 1411 |
+
// reached, so its only-callee helpers lose their last live
|
| 1412 |
+
// caller too.
|
| 1413 |
+
//
|
| 1414 |
+
// `TileBitmapSet::Destructor` (0x569BC0) has a *second* xref to
|
| 1415 |
+
// `FUN_0056C2E0` (a tile-bitmap-set realloc helper called only
|
| 1416 |
+
// from `CBitmap__Constructor_Maybe` at 0x56C060). That second
|
| 1417 |
+
// chain is **structurally dead** in shipping WA: 0x56C060 sits
|
| 1418 |
+
// in the DisplayGfx vtable .rdata block at slot index 38 (offset
|
| 1419 |
+
// 0x98 past the vtable base 0x66A218), but no instruction in
|
| 1420 |
+
// WA.exe loads from offset 0x98 of any pointer β verified by
|
| 1421 |
+
// byte-pattern search for `FF 90 98 00 00 00` (CALL [reg+0x98])
|
| 1422 |
+
// and `8B 4? 98` (MOV reg,[reg+0x98]) returning no DisplayGfx
|
| 1423 |
+
// hits. The compiler emitted slots 38/39 of DisplayGfx into
|
| 1424 |
+
// .rdata but the C++ source has no live caller for them β they
|
| 1425 |
+
// are vestigial vtable entries from a removed feature. So
|
| 1426 |
+
// trapping `TileBitmapSet::Destructor` is safe.
|
| 1427 |
+
hook::install_trap!(
|
| 1428 |
+
"DisplayGfx__DestructorImpl",
|
| 1429 |
+
va::DISPLAY_GFX_DESTRUCTOR_IMPL
|
| 1430 |
+
);
|
| 1431 |
+
hook::install_trap!(
|
| 1432 |
+
"DisplayGfx__FreeLayerSpriteTable",
|
| 1433 |
+
va::DISPLAY_GFX_FREE_LAYER_SPRITE_TABLE
|
| 1434 |
+
);
|
| 1435 |
+
hook::install_trap!("TileBitmapSet__Destructor", va::TILE_BITMAP_SET_DESTRUCTOR);
|
| 1436 |
}
|
| 1437 |
|
| 1438 |
Ok(())
|