paavohtl commited on
Commit
0c9ee19
·
1 Parent(s): 54f9e4d

docs: refresh DisplayGfx slot 0 docstring after the destructor port

Browse files

Updates the slot 0 entry in `DisplayGfxVtable` to point at the new
Rust impl `display::destructor::display_gfx_destructor`, document
the trapped helpers, and switch the typed `flags` parameter from
`u8` to `u32` so it matches the actual Rust impl signature (the
underlying x86 stack slot is 4 bytes either way, but `u32` is more
honest about what the function reads).

The project memory (`MEMORY.md` + `project_display_porting.md`) is
updated separately to reflect that the display *frontend* is now
100% Rust including shutdown teardown, and to record three new
lessons from the port:

35. Ghidra plate comments can fabricate semantics the disasm
contradicts (the "rebind to DDDisplay parent vtable"
annotation was actually rebinding to the most-derived
DisplayGfx vtable).
36. Vestigial vtable slots in .rdata are normal — DisplayGfx
slots 38/39 exist but are never dispatched, which is what
let us trap TileBitmapSet::Destructor.
37. The startup-check VALID_PROLOGUES list isn't just frame
setups — `F6` (TEST [mem], imm8) is a legitimate function
start byte for thunks that check a flag without setting up
a frame.

crates/openwa-core/src/render/display/vtable.rs CHANGED
@@ -47,9 +47,20 @@ use crate::wa_alloc::wa_malloc_struct_zeroed;
47
  /// - Methods that add `camera` directly take pixel-integer coordinates.
48
  #[vtable(size = 38, va = 0x0066_A218, class = "DisplayGfx")]
49
  pub struct DisplayGfxVtable {
50
- /// destructor (0x569CE0, RET 0x4)
 
 
 
 
 
 
 
 
 
 
 
51
  #[slot(0)]
52
- pub destructor: fn(this: *mut DisplayGfx, flags: u8) -> *mut DisplayGfx,
53
  /// get display dimensions in pixels (0x56A460, RET 0x8)
54
  #[slot(1)]
55
  pub get_dimensions: fn(this: *mut DisplayGfx, out_w: *mut u32, out_h: *mut u32),
 
47
  /// - Methods that add `camera` directly take pixel-integer coordinates.
48
  #[vtable(size = 38, va = 0x0066_A218, class = "DisplayGfx")]
49
  pub struct DisplayGfxVtable {
50
+ /// scalar deleting destructor (original at 0x569CE0, RET 0x4).
51
+ ///
52
+ /// **Ported.** Native Rust impl is
53
+ /// [`crate::render::display::destructor::display_gfx_destructor`].
54
+ /// The thunk runs the cleanup body (`DestructorImpl`, originally
55
+ /// 0x56A010) and then `_free(this)` if `flags & 1` is set, returning
56
+ /// `this` per the MSVC ABI. Wired via `vtable_replace!` in
57
+ /// `install_display`. The three WA-side helpers
58
+ /// (`DestructorImpl`, `FreeLayerSpriteTable`,
59
+ /// `TileBitmapSet::Destructor`) are trapped — see commit 5 of the
60
+ /// destructor port for the dead-slot analysis behind trapping the
61
+ /// `TileBitmapSet` helper.
62
  #[slot(0)]
63
+ pub destructor: fn(this: *mut DisplayGfx, flags: u32) -> *mut DisplayGfx,
64
  /// get display dimensions in pixels (0x56A460, RET 0x8)
65
  #[slot(1)]
66
  pub get_dimensions: fn(this: *mut DisplayGfx, out_w: *mut u32, out_h: *mut u32),