paavohtl Claude Opus 4.6 (1M context) commited on
Commit
78813f5
Β·
1 Parent(s): f3de353

cleanup: remove unused DDGame debug param loggers from game_session.rs

Browse files

Removed PCLandscape, HUD_LoadWeaponSprites, and SpriteRegion
constructor passthrough hooks that were used during DDGame constructor
development. These were never installed β€” just leftover debug tools.

Eliminates all 7 compiler warnings from the wormkit crate.

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

crates/openwa-wormkit/src/replacements/game_session.rs CHANGED
@@ -362,112 +362,8 @@ unsafe fn shadow_compare_ddgame(
362
  wa_free(shadow_wrapper);
363
  }
364
 
365
- // ── PCLandscape__Constructor param logger ──────────────────────────
366
- static mut PC_LANDSCAPE_TRAMPOLINE: *const () = core::ptr::null();
367
-
368
- /// Passthrough hook: logs all 11 params, then calls original.
369
- unsafe extern "stdcall" fn hook_pc_landscape_ctor(
370
- p1: u32,
371
- p2: u32,
372
- p3: u32,
373
- p4: u32,
374
- p5: u32,
375
- p6: u32,
376
- p7: u32,
377
- p8: u32,
378
- p9: u32,
379
- p10: u32,
380
- p11: u32,
381
- ) -> u32 {
382
- let _ = log_line(&format!(
383
- "[PCLandscape] p1=0x{:08X} p2=0x{:08X} p3=0x{:08X} p4=0x{:08X} p5=0x{:08X} p6=0x{:08X}",
384
- p1, p2, p3, p4, p5, p6
385
- ));
386
- let _ = log_line(&format!(
387
- "[PCLandscape] p7=0x{:08X} p8=0x{:08X} p9=0x{:08X} p10=0x{:08X} p11=0x{:08X}",
388
- p7, p8, p9, p10, p11
389
- ));
390
- // Call original
391
- let orig: unsafe extern "stdcall" fn(
392
- u32,
393
- u32,
394
- u32,
395
- u32,
396
- u32,
397
- u32,
398
- u32,
399
- u32,
400
- u32,
401
- u32,
402
- u32,
403
- ) -> u32 = core::mem::transmute(PC_LANDSCAPE_TRAMPOLINE);
404
- orig(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
405
- }
406
-
407
- // ── HUD_LoadWeaponSprites param logger ──────────────────────────────
408
- static mut HUD_LOAD_TRAMPOLINE: *const () = core::ptr::null();
409
-
410
- unsafe extern "thiscall" fn hook_hud_load(this_ecx: u32, p1: u32, p2: u32) -> u32 {
411
- let _ = log_line(&format!(
412
- "[HUD] ECX=0x{:08X} p1=0x{:08X} p2=0x{:08X}",
413
- this_ecx, p1, p2
414
- ));
415
- let orig: unsafe extern "thiscall" fn(u32, u32, u32) -> u32 =
416
- core::mem::transmute(HUD_LOAD_TRAMPOLINE);
417
- orig(this_ecx, p1, p2)
418
- }
419
-
420
- // ── SpriteRegion__Constructor param logger ──────────────────────────
421
- static mut SPRITE_REGION_TRAMPOLINE: *const () = core::ptr::null();
422
-
423
- /// Log fastcall params. Called from naked trampoline with all params on stack.
424
- unsafe extern "cdecl" fn log_sprite_region(
425
- ecx: u32,
426
- edx: u32,
427
- p1: u32,
428
- p2: u32,
429
- p3: u32,
430
- p4: u32,
431
- p5: u32,
432
- p6: u32,
433
- ) {
434
- let _ = log_line(&format!(
435
- "[SpriteRgn] ECX=0x{:X} EDX=0x{:X} p1=0x{:X} p2=0x{:X} p3=0x{:X} p4=0x{:X} p5=0x{:X} p6=0x{:X}",
436
- ecx, edx, p1, p2, p3, p4, p5, p6));
437
- }
438
-
439
- /// Naked trampoline: captures ECX/EDX, logs, then calls original fastcall.
440
- #[unsafe(naked)]
441
- unsafe extern "C" fn hook_sprite_region_ctor() {
442
- core::arch::naked_asm!(
443
- // Save all regs
444
- "pushl %eax",
445
- "pushl %ecx",
446
- "pushl %edx",
447
- // Push all 8 params for logger: ECX, EDX, then 6 stack params
448
- // Stack after 3 pushes: [edx][ecx][eax][ret][p1][p2][p3][p4][p5][p6]
449
- // p1 at ESP+16, p2 at ESP+20, ...
450
- "pushl 36(%esp)", // p6
451
- "pushl 36(%esp)", // p5
452
- "pushl 36(%esp)", // p4
453
- "pushl 36(%esp)", // p3
454
- "pushl 36(%esp)", // p2
455
- "pushl 36(%esp)", // p1
456
- "pushl %edx", // EDX
457
- "pushl %ecx", // ECX
458
- "calll {logger}",
459
- "addl $32, %esp", // clean 8 cdecl params
460
- // Restore regs
461
- "popl %edx",
462
- "popl %ecx",
463
- "popl %eax",
464
- // Jump to original (fastcall, same params on stack)
465
- "jmpl *({tramp})",
466
- logger = sym log_sprite_region,
467
- tramp = sym SPRITE_REGION_TRAMPOLINE,
468
- options(att_syntax),
469
- );
470
- }
471
 
472
  pub fn install() -> Result<(), String> {
473
  unsafe {
 
362
  wa_free(shadow_wrapper);
363
  }
364
 
365
+ // Debug param loggers for PCLandscape, HUD, SpriteRegion constructors
366
+ // removed β€” were used during DDGame constructor development, now complete.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
 
368
  pub fn install() -> Result<(), String> {
369
  unsafe {