paavohtl Claude Opus 4.6 (1M context) commited on
Commit
0d5ebac
Β·
1 Parent(s): a3bc020

fix: move loading ticks to correct positions, add second pair

Browse files

Original constructor has 4 DDGameWrapper__LoadingProgressTick calls:
- 2 after coord_list, before load_resource_list
- 2 after DDGame__LoadHudAndWeaponSprites

Our ticks were placed before GfxResource__Create (too early). Moving
them to the correct positions enables the message pump at the right
times during construction, which processes pending sprite loads.

This should fix the weapon menu freeze (sprites weren't loaded during
construction, causing on-demand loading on first right-click).

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

crates/openwa-core/src/engine/ddgame.rs CHANGED
@@ -1326,10 +1326,6 @@ unsafe fn init_graphics_and_resources(
1326
 
1327
  let _ = crate::log::log_line("[DDGame] past ActiveSoundTable");
1328
 
1329
- // ── Loading progress ticks (original calls DDGameWrapper__LoadingProgressTick twice here) ──
1330
- call_usercall_ecx(wrapper, LOADING_PROGRESS_TICK_ADDR);
1331
- call_usercall_ecx(wrapper, LOADING_PROGRESS_TICK_ADDR);
1332
-
1333
  // ── GfxResource: thiscall(ECX=gfx_handler) + EAX=name + 1 stack(output), RET 0x4 ──
1334
  // Test: call GfxResource with real params
1335
  let gfx_resource: *mut u8;
@@ -1660,6 +1656,10 @@ unsafe fn init_graphics_and_resources(
1660
  ));
1661
  }
1662
 
 
 
 
 
1663
  // ── Sprite resource loading via DDGameWrapper vtable[0] ──
1664
  // DDNetGameWrapper__LoadResourceList: thiscall(ECX=wrapper) +
1665
  // 5 stack params (layer, gfx_handler, base_path, data_table, table_size)
@@ -1821,6 +1821,10 @@ unsafe fn init_graphics_and_resources(
1821
  (*ddgame).sprite_cache[144] as u32,
1822
  ));
1823
  }
 
 
 
 
1824
  }
1825
  // ── Gradient image stub (DDGame+0x30) ──
1826
  // The original constructor loads "gradient.img" here and stores the result at DDGame+0x30.
 
1326
 
1327
  let _ = crate::log::log_line("[DDGame] past ActiveSoundTable");
1328
 
 
 
 
 
1329
  // ── GfxResource: thiscall(ECX=gfx_handler) + EAX=name + 1 stack(output), RET 0x4 ──
1330
  // Test: call GfxResource with real params
1331
  let gfx_resource: *mut u8;
 
1656
  ));
1657
  }
1658
 
1659
+ // ── Loading progress ticks (2 of 4 β€” before load_resource_list) ──
1660
+ call_usercall_ecx(wrapper, LOADING_PROGRESS_TICK_ADDR);
1661
+ call_usercall_ecx(wrapper, LOADING_PROGRESS_TICK_ADDR);
1662
+
1663
  // ── Sprite resource loading via DDGameWrapper vtable[0] ──
1664
  // DDNetGameWrapper__LoadResourceList: thiscall(ECX=wrapper) +
1665
  // 5 stack params (layer, gfx_handler, base_path, data_table, table_size)
 
1821
  (*ddgame).sprite_cache[144] as u32,
1822
  ));
1823
  }
1824
+
1825
+ // ── Loading progress ticks (2 of 4 β€” after LoadHudAndWeaponSprites) ──
1826
+ call_usercall_ecx(wrapper, LOADING_PROGRESS_TICK_ADDR);
1827
+ call_usercall_ecx(wrapper, LOADING_PROGRESS_TICK_ADDR);
1828
  }
1829
  // ── Gradient image stub (DDGame+0x30) ──
1830
  // The original constructor loads "gradient.img" here and stores the result at DDGame+0x30.