fix: initialize DisplayGfx at DDGame+0x138 with TaskStateMachine__Init
Browse filesThe DisplayGfx object was only getting its vtable set, but not
initialized with dimensions via task_state_machine_init. The original
calls TSM_Init(param1=8, width=0x100, height=0x1E0) = 256x480.
This object is used by the weapon panel rendering system. Without
proper dimensions, the weapon menu cursor appeared but the panel
itself was invisible and stuck at the corner.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
crates/openwa-core/src/engine/ddgame.rs
CHANGED
|
@@ -1600,13 +1600,13 @@ unsafe fn init_graphics_and_resources(
|
|
| 1600 |
// Original: alloc 0x4C, memset 0x2C, PUSH 0x100, MOV ECX=8, MOV EDI=0x1E0,
|
| 1601 |
// CALL 0x4F6370, MOV [alloc]=0x664144
|
| 1602 |
{
|
| 1603 |
-
let tsm = wa_malloc(0x4C);
|
| 1604 |
core::ptr::write_bytes(tsm, 0, 0x2C);
|
| 1605 |
if !tsm.is_null() {
|
| 1606 |
-
//
|
| 1607 |
-
//
|
| 1608 |
-
|
| 1609 |
-
*(tsm as *mut u32) = rb(0x664144); //
|
| 1610 |
}
|
| 1611 |
(*ddgame).display_gfx = tsm;
|
| 1612 |
}
|
|
|
|
| 1600 |
// Original: alloc 0x4C, memset 0x2C, PUSH 0x100, MOV ECX=8, MOV EDI=0x1E0,
|
| 1601 |
// CALL 0x4F6370, MOV [alloc]=0x664144
|
| 1602 |
{
|
| 1603 |
+
let tsm = wa_malloc(0x4C);
|
| 1604 |
core::ptr::write_bytes(tsm, 0, 0x2C);
|
| 1605 |
if !tsm.is_null() {
|
| 1606 |
+
// Original: TaskStateMachine__Init(ECX=8, EDI=0x1E0, stack=0x100)
|
| 1607 |
+
// → task_state_machine_init(object, param1=8, width=0x100, height=0x1E0)
|
| 1608 |
+
task_state_machine_init(tsm, 8, 0x100, 0x1E0);
|
| 1609 |
+
*(tsm as *mut u32) = rb(0x664144); // Override vtable to DisplayGfx
|
| 1610 |
}
|
| 1611 |
(*ddgame).display_gfx = tsm;
|
| 1612 |
}
|