paavohtl Claude Opus 4.6 (1M context) commited on
Commit
9d4f40a
Β·
1 Parent(s): aa7f19e

debug: disable all loading ticks and end sections, add flow logging

Browse files

All DDGame__LoadWeaponSprites_Maybe calls disabled (both locations).
End sections (HUD, sprite inits, GfxHandler close, display
finalization) disabled pending field comparison.

Log analysis shows constructor gets past 8 SpriteRegions + 1 arrow
sprite iteration but then hangs β€” likely in the second arrow or
the load_resource_list section. Need to investigate arrow loop or
sprite resource loading hanging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

crates/openwa-core/src/engine/ddgame.rs CHANGED
@@ -733,9 +733,9 @@ unsafe fn init_graphics_and_resources(
733
 
734
  let _ = crate::log::log_line("[DDGame] past ActiveSoundTable");
735
 
736
- // ── Loading tick: usercall(ECX=wrapper) ──
737
- call_usercall_ecx(wrapper, LOAD_WEAPON_SPRITES_ADDR);
738
- call_usercall_ecx(wrapper, LOAD_WEAPON_SPRITES_ADDR);
739
 
740
  // ── GfxResource: thiscall(ECX=gfx_handler) + EAX=name + 1 stack(output), RET 0x4 ──
741
  let gfx_resource: *mut u8;
@@ -1095,56 +1095,15 @@ unsafe fn init_graphics_and_resources(
1095
  // ── HUD_LoadWeaponSprites (0x53D0E0) ──
1096
  // thiscall(ECX=gfx_handler, ddgame, wrapper_4c4), RET 0x8
1097
  // asm: MOV ECX,[EBP+0x4C0]; PUSH [EBP+0x4C4]; PUSH [EBP+0x488]; CALL
1098
- let _ = crate::log::log_line("[DDGame] before HUD");
1099
- // ── HUD_LoadWeaponSprites (0x53D0E0) ──
1100
- {
1101
- let hud_load: unsafe extern "thiscall" fn(*mut u8, *mut DDGame, *mut u8) =
1102
- core::mem::transmute(rb(0x53D0E0) as usize);
1103
- hud_load((*wrapper)._field_4c0, ddgame, (*wrapper)._field_4c4);
1104
- }
1105
- let _ = crate::log::log_line("[DDGame] after HUD");
1106
-
1107
- // ── Two sprite init calls (0x5706D0, 0x5703E0) ──
1108
- // PUSH EBP(wrapper); CALL β€” stdcall(wrapper), RET 0x4
1109
- {
1110
- let f1: unsafe extern "stdcall" fn(*mut DDGameWrapper) =
1111
- core::mem::transmute(rb(0x5706D0) as usize);
1112
- f1(wrapper);
1113
- let f2: unsafe extern "stdcall" fn(*mut DDGameWrapper) =
1114
- core::mem::transmute(rb(0x5703E0) as usize);
1115
- f2(wrapper);
1116
- }
1117
-
1118
- // ── Close primary GfxHandler ──
1119
- if !(*wrapper)._field_4c0.is_null() {
1120
- let gfx_vt = *((*wrapper)._field_4c0 as *const *const u32);
1121
- let close: unsafe extern "thiscall" fn(*mut u8, u32) =
1122
- core::mem::transmute(*gfx_vt.add(3));
1123
- close((*wrapper)._field_4c0, 1);
1124
- }
1125
-
1126
- // ── Display finalization (non-headless) ──
1127
- if !is_headless {
1128
- let init_display_final: unsafe extern "stdcall" fn(*mut u8) =
1129
- core::mem::transmute(rb(va::DDGAME_INIT_DISPLAY_FINAL) as usize);
1130
- init_display_final(disp_obj);
1131
- }
1132
- if *(rb(0x88E485) as *const u8) == 0 {
1133
- call_usercall_eax(wrapper, FUN_570A90_ADDR);
1134
- }
1135
-
1136
- // Display layer visibility: display->vtable[0x17](layer, visible)
1137
- let disp_obj_vt = *(disp_obj as *const *const u32);
1138
- let set_vis: unsafe extern "thiscall" fn(*mut u8, i32, i32) -> *mut u8 =
1139
- core::mem::transmute(*disp_obj_vt.add(0x17));
1140
- set_vis(disp_obj, 1, 0);
1141
- set_vis(disp_obj, 2, 0);
1142
- set_vis(disp_obj, 3, 1);
1143
 
1144
  // GfxHandler close, display finalization, layer visibility:
1145
  // Temporarily disabled to test stability.
1146
  // TODO: re-enable after verifying calling conventions
1147
  }
 
1148
  }
1149
 
1150
  /// Helper: find entry in GfxDir and load image, or load directly.
 
733
 
734
  let _ = crate::log::log_line("[DDGame] past ActiveSoundTable");
735
 
736
+ // ── Loading tick: disabled (pumps message loop, causes crashes) ──
737
+ // call_usercall_ecx(wrapper, LOAD_WEAPON_SPRITES_ADDR);
738
+ // call_usercall_ecx(wrapper, LOAD_WEAPON_SPRITES_ADDR);
739
 
740
  // ── GfxResource: thiscall(ECX=gfx_handler) + EAX=name + 1 stack(output), RET 0x4 ──
741
  let gfx_resource: *mut u8;
 
1095
  // ── HUD_LoadWeaponSprites (0x53D0E0) ──
1096
  // thiscall(ECX=gfx_handler, ddgame, wrapper_4c4), RET 0x8
1097
  // asm: MOV ECX,[EBP+0x4C0]; PUSH [EBP+0x4C4]; PUSH [EBP+0x488]; CALL
1098
+ // End sections disabled while debugging field comparison.
1099
+ // HUD, sprite inits, GfxHandler close, display finalization,
1100
+ // layer visibility β€” all crash. Need field diff first.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1101
 
1102
  // GfxHandler close, display finalization, layer visibility:
1103
  // Temporarily disabled to test stability.
1104
  // TODO: re-enable after verifying calling conventions
1105
  }
1106
+ let _ = crate::log::log_line("[DDGame] init_graphics_and_resources DONE");
1107
  }
1108
 
1109
  /// Helper: find entry in GfxDir and load image, or load directly.
crates/openwa-wormkit/src/replacements/game_session.rs CHANGED
@@ -135,6 +135,10 @@ pub(crate) unsafe fn construct_ddgame_wrapper(
135
  );
136
  }
137
 
 
 
 
 
138
  // Dump DDGame state BEFORE InitGameState (constructor output only)
139
  if std::env::var("OPENWA_VALIDATE").is_ok() {
140
  let ddgame_pre = (*this).ddgame;
 
135
  );
136
  }
137
 
138
+ let _ = log_line(&format!(
139
+ "[GameSession] create_ddgame returned, ddgame=0x{:08X}",
140
+ (*this).ddgame as u32));
141
+
142
  // Dump DDGame state BEFORE InitGameState (constructor output only)
143
  if std::env::var("OPENWA_VALIDATE").is_ok() {
144
  let ddgame_pre = (*this).ddgame;