paavohtl's picture
Claude Opus 4.6 (1M context)
feat: add #[vtable(...)] attribute macro for typed vtable definitions
1a163b2
Raw History Blame Contribute Delete
1.91 kB
/// MapView β€” CWnd-derived terrain/map preview and data window (0x29628 bytes).
///
/// Inherits: CWnd β†’ FUN_00425ff0 (vtable 0x64C348) β†’ MapView (vtable 0x64FC60).
/// Secondary vtable at offset +0x54 (0x64FD94).
///
/// A general-purpose map class used across all game modes β€” not replay-specific.
/// Embedded as a child window in frontend dialog classes:
/// - FrontendLocalMP at offset 0x588 (param_1 + 0x162)
/// - FrontendCampaignA at offset 0x140 (param_1 + 0x50)
/// - FrontendNetworkLobby, FrontendNetworkChat (similar embedding)
///
/// In the replay loader, constructed transiently to parse a .thm terrain file
/// and extract map info via `MapView__CopyInfo` (0x449B60).
///
/// Key functions:
/// - Constructor: 0x447E80 β€” stdcall(alloc, flags), RET 0x8
/// - Load: 0x44A9A0 β€” stdcall(this, path, flags), RET 0xC
/// - CopyInfo: 0x449B60 β€” usercall(ESI=this), plain RET
///
/// Loads `.thm` terrain files (`data\current.thm` for live games,
/// `data\playback.thm` for replays).
///
/// PARTIAL: Only the vtable and terrain_flag field are mapped.
#[repr(C)]
pub struct MapView {
/// 0x00000: Vtable pointer (0x64FC60 at image base).
pub vtable: *const MapViewVtable,
/// 0x00004-0x29617: Unknown (CWnd fields, map/terrain data, pixel grids, etc.).
pub _unknown_004: [u8; 0x29618 - 4],
/// 0x29618: Terrain type flag. Zero = cavern terrain (SETZ in replay loader).
pub terrain_flag: u8,
/// 0x29619-0x29627: Unknown trailing bytes.
pub _unknown_29619: [u8; 0x29628 - 0x29619],
}
const _: () = assert!(core::mem::size_of::<MapView>() == 0x29628);
/// MapView vtable (partial β€” only known slots).
#[openwa_core::vtable(size = 2, va = 0x0064_FC60, class = "MapView")]
pub struct MapViewVtable {
/// Destructor β€” thiscall(this, free_flag). Frees the object if flag & 1.
#[slot(1)]
pub destructor: fn(this: *mut MapView, free_flag: i32),
}