paavohtl Claude Opus 4.6 (1M context) commited on
Commit
e565bdc
Β·
1 Parent(s): e4126c2

feat: port Air Strike, Indian Nuclear Test, and Jet Pack to Rust

Browse files

Eliminate call_fire_usercall from all reachable match arms except Low Gravity:

- Air Strike (0x51E710): pure Rust dispatch with 4 naked sub-function
bridges (play sound, spawn effect, position update, landing check)
- Indian Nuclear Test (0x51EB00, was misnamed "Teleport Execute"):
pure Rust β€” sends 3 team messages (RaiseWater, NukeBlast, PoisonWorm)
+ 2 queue_sound calls (direct Rust-to-Rust, no bridge)
- Jet Pack (0x51EC30): already ported, uses queue_sound directly
- Low Gravity: kept on bridge β€” still triggers codegen UB when changed

Also:
- Rename fire_teleport_execute β†’ fire_indian_nuclear_test (subtype 16
is Nuke, not Teleport β€” sends RaiseWater/NukeBlast/PoisonWorm messages)
- Rename can_teleport β†’ can_fire_subtype16
- Add WormState::from_raw_unchecked for undiscovered states (0x6F)
- Add CTaskWorm::set_state_raw/set_fire_complete_raw β€” raw-pointer
methods avoiding &mut self to mitigate potential noalias UB
- Make sound::queue_sound public for direct Rust-to-Rust calls

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

crates/openwa-core/src/task/worm.rs CHANGED
@@ -95,6 +95,35 @@ pub enum WormState {
95
  Unknown_0x8B = 0x8B,
96
  }
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  crate::define_addresses! {
99
  class "CTaskWorm" {
100
  /// CTaskWorm vtable
 
95
  Unknown_0x8B = 0x8B,
96
  }
97
 
98
+ impl WormState {
99
+ /// Create a WormState from a raw u8 value without validation.
100
+ /// Use for states not yet added to the enum.
101
+ pub const unsafe fn from_raw_unchecked(val: u8) -> Self {
102
+ core::mem::transmute(val)
103
+ }
104
+ }
105
+
106
+ /// Raw-pointer methods for CTaskWorm.
107
+ ///
108
+ /// These avoid creating `&mut CTaskWorm` references, which give LLVM noalias
109
+ /// guarantees that can cause miscompilation when WA code modifies the same
110
+ /// memory through raw pointers during bridge calls. Use these in weapon
111
+ /// dispatch and other hot paths that mix Rust and WA function calls.
112
+ impl CTaskWorm {
113
+ /// Call set_state through the vtable without creating `&mut self`.
114
+ /// Avoids noalias issues when WA code may alias the worm memory.
115
+ pub unsafe fn set_state_raw(this: *mut CTaskWorm, state: WormState) {
116
+ let vtable = *(this as *const *const CTaskWormVTable);
117
+ ((*vtable).set_state)(this, state);
118
+ }
119
+
120
+ /// Set the weapon fire completion flag at +0x3C without creating `&mut self`.
121
+ pub unsafe fn set_fire_complete_raw(this: *mut CTaskWorm, value: i32) {
122
+ let base = this as *mut u8;
123
+ core::ptr::write(base.add(0x3C) as *mut i32, value);
124
+ }
125
+ }
126
+
127
  crate::define_addresses! {
128
  class "CTaskWorm" {
129
  /// CTaskWorm vtable
crates/openwa-wormkit/src/replacements/sound.rs CHANGED
@@ -28,7 +28,7 @@ static SOUND_LOG_ENABLED: std::sync::atomic::AtomicBool = std::sync::atomic::Ato
28
  ///
29
  /// Returns a pointer to the new entry, or None if the queue is full
30
  /// or sound is disabled.
31
- unsafe fn queue_sound(
32
  ddgame: *mut DDGame,
33
  sound_id: u32,
34
  flags: u32,
 
28
  ///
29
  /// Returns a pointer to the new entry, or None if the queue is full
30
  /// or sound is disabled.
31
+ pub unsafe fn queue_sound(
32
  ddgame: *mut DDGame,
33
  sound_id: u32,
34
  flags: u32,
crates/openwa-wormkit/src/replacements/weapon.rs CHANGED
@@ -214,7 +214,7 @@ unsafe extern "cdecl" fn fire_weapon_impl(
214
  weapon_name, weapon_id, weapon_type, subtype_34, subtype_38
215
  ));
216
 
217
- (*worm).set_fire_complete(0);
218
 
219
  match weapon_type {
220
  1 => match subtype_38 {
@@ -241,7 +241,7 @@ unsafe extern "cdecl" fn fire_weapon_impl(
241
  _ => {}
242
  }
243
 
244
- (*worm).set_fire_complete(1);
245
  }
246
 
247
  // ── Sub-function bridges ────────────────────────────────────
@@ -358,43 +358,42 @@ unsafe fn fire_weapon_special(
358
 
359
  match subtype {
360
  // Blowtorch
361
- 1 => (*worm).set_state(WormState::Blowtorch),
362
  // Pneumatic Drill (pure Rust)
363
  2 => fire_drill(worm, local_struct),
364
  // Girder (pure Rust)
365
  3 => fire_girder(worm, params_38_ptr, local_struct),
366
  // Baseball Bat
367
- 4 => (*worm).set_state(WormState::BaseballBat),
368
  // Fire Punch
369
- 5 => (*worm).set_state(WormState::FirePunch),
370
  // Dragon Ball
371
- 6 => (*worm).set_state(WormState::DragonBall),
372
  // Kamikaze
373
- 8 => (*worm).set_state(WormState::Kamikaze),
374
  // Prod (pure Rust)
375
  9 => fire_prod(worm, local_struct),
376
- // Air Strike (EAX=worm)
377
- 10 => call_fire_usercall(worm as *const (), worm, rb(0x51E710)),
378
  // Scales of Justice
379
- 11 => (*worm).set_state(WormState::ScalesOfJustice),
380
  // Napalm Strike
381
  13 => fire_send_team_message(worm, 0x2B),
382
  // Mail/Mine/Mole (pure Rust)
383
  14 => fire_mail_mine_mole(worm),
384
- // Teleport: check worm state, then execute or cancel
385
  16 => {
386
  let worm_state = (*worm).state();
387
- if can_teleport(worm_state) {
388
- call_fire_usercall(worm_state as *const (), worm, rb(0x51EB00));
389
  } else {
390
- // Teleport denied β€” return to cancelled state
391
- (*worm).set_state(WormState::TeleportCancelled_Maybe);
392
  }
393
  }
394
  // Freeze (pure Rust)
395
  17 => fire_freeze(worm),
396
  // Suicide Bomber
397
- 18 => (*worm).set_state(WormState::SuicideBomber),
398
  // Skip Go (pure Rust)
399
  19 => fire_skip_go(worm, entry),
400
  // Surrender (pure Rust)
@@ -404,18 +403,16 @@ unsafe fn fire_weapon_special(
404
  // Jet Pack (pure Rust)
405
  22 => fire_jet_pack(worm),
406
  // Magic Bullet
407
- 23 => (*worm).set_state(WormState::WeaponAimed_Maybe),
408
- // Low Gravity β€” kept on bridge. Changing this arm to non-naked-fn code causes
409
- // a codegen-dependent desync: LLVM's register allocation for the match changes,
410
- // exposing latent UB somewhere in the reachable code paths. See investigation notes.
411
  24 => call_fire_usercall(entry as *const (), worm, rb(0x51EA60)),
412
  _ => {}
413
  }
414
  }
415
 
416
- /// Teleport validity check β€” pure Rust port of 0x516930.
417
- /// Returns true if the worm's current state allows teleportation.
418
- fn can_teleport(state: u32) -> bool {
419
  state == WormState::WeaponAimed_Maybe as u32
420
  || (WormState::AimingAngle_Maybe as u32..=WormState::PreFire_Maybe as u32).contains(&state)
421
  }
@@ -545,7 +542,7 @@ unsafe fn fire_mail_mine_mole(worm: *mut CTaskWorm) {
545
  || (worm_state == WormState::WeaponAimed_Maybe as u32 && version < 8)));
546
 
547
  if should_call_vtable {
548
- (*worm).set_state(WormState::Idle);
549
  }
550
 
551
  fire_send_team_message(worm, 0x28);
@@ -557,6 +554,185 @@ unsafe fn fire_mail_mine_mole(worm: *mut CTaskWorm) {
557
  entry.turn_action_counter_Maybe += 7;
558
  }
559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  /// Jet Pack (subtype 22) β€” pure Rust port of 0x51EC30.
561
  ///
562
  /// Sends message 0x5E to CTaskTeam, then plays a jet pack sound.
@@ -753,6 +929,26 @@ unsafe extern "C" fn call_girder_ctor(
753
  );
754
  }
755
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
756
  /// Freeze (subtype 17) β€” pure Rust port of 0x51E920.
757
  ///
758
  /// Plays a freeze sound, optionally creates a freeze visual overlay on the
@@ -992,26 +1188,6 @@ unsafe extern "C" fn call_missile_ctor(
992
  );
993
  }
994
 
995
- /// Bridge: usercall(EAX=eax_val, ESI=worm, EDI=worm), plain RET.
996
- /// Args: (eax_val, worm, addr). Saves/restores ESI+EDI. Uses EBX to hold addr.
997
- #[unsafe(naked)]
998
- unsafe extern "C" fn call_fire_usercall(_eax: *const (), _worm: *mut CTaskWorm, _addr: u32) {
999
- core::arch::naked_asm!(
1000
- "push ebx",
1001
- "push esi",
1002
- "push edi",
1003
- "mov eax, [esp+16]", // eax_val (3 saves=12 + ret=4 = 16)
1004
- "mov esi, [esp+20]", // worm
1005
- "mov edi, [esp+20]",
1006
- "mov ebx, [esp+24]", // addr
1007
- "call ebx",
1008
- "pop edi",
1009
- "pop esi",
1010
- "pop ebx",
1011
- "ret",
1012
- );
1013
- }
1014
-
1015
 
1016
  // ============================================================
1017
  // Passthrough hooks β€” fire sub-functions
 
214
  weapon_name, weapon_id, weapon_type, subtype_34, subtype_38
215
  ));
216
 
217
+ CTaskWorm::set_fire_complete_raw(worm, 0);
218
 
219
  match weapon_type {
220
  1 => match subtype_38 {
 
241
  _ => {}
242
  }
243
 
244
+ CTaskWorm::set_fire_complete_raw(worm, 1);
245
  }
246
 
247
  // ── Sub-function bridges ────────────────────────────────────
 
358
 
359
  match subtype {
360
  // Blowtorch
361
+ 1 => CTaskWorm::set_state_raw(worm,WormState::Blowtorch),
362
  // Pneumatic Drill (pure Rust)
363
  2 => fire_drill(worm, local_struct),
364
  // Girder (pure Rust)
365
  3 => fire_girder(worm, params_38_ptr, local_struct),
366
  // Baseball Bat
367
+ 4 => CTaskWorm::set_state_raw(worm,WormState::BaseballBat),
368
  // Fire Punch
369
+ 5 => CTaskWorm::set_state_raw(worm,WormState::FirePunch),
370
  // Dragon Ball
371
+ 6 => CTaskWorm::set_state_raw(worm,WormState::DragonBall),
372
  // Kamikaze
373
+ 8 => CTaskWorm::set_state_raw(worm,WormState::Kamikaze),
374
  // Prod (pure Rust)
375
  9 => fire_prod(worm, local_struct),
376
+ // Air Strike (pure Rust)
377
+ 10 => fire_air_strike(worm),
378
  // Scales of Justice
379
+ 11 => CTaskWorm::set_state_raw(worm,WormState::ScalesOfJustice),
380
  // Napalm Strike
381
  13 => fire_send_team_message(worm, 0x2B),
382
  // Mail/Mine/Mole (pure Rust)
383
  14 => fire_mail_mine_mole(worm),
384
+ // Indian Nuclear Test: check worm state, then detonate or cancel
385
  16 => {
386
  let worm_state = (*worm).state();
387
+ if can_fire_subtype16(worm_state) {
388
+ fire_indian_nuclear_test(worm);
389
  } else {
390
+ CTaskWorm::set_state_raw(worm,WormState::TeleportCancelled_Maybe);
 
391
  }
392
  }
393
  // Freeze (pure Rust)
394
  17 => fire_freeze(worm),
395
  // Suicide Bomber
396
+ 18 => CTaskWorm::set_state_raw(worm,WormState::SuicideBomber),
397
  // Skip Go (pure Rust)
398
  19 => fire_skip_go(worm, entry),
399
  // Surrender (pure Rust)
 
403
  // Jet Pack (pure Rust)
404
  22 => fire_jet_pack(worm),
405
  // Magic Bullet
406
+ 23 => CTaskWorm::set_state_raw(worm,WormState::WeaponAimed_Maybe),
407
+ // Low Gravity β€” kept on bridge pending codegen UB investigation
 
 
408
  24 => call_fire_usercall(entry as *const (), worm, rb(0x51EA60)),
409
  _ => {}
410
  }
411
  }
412
 
413
+ /// Worm state validity check for subtype 16 β€” pure Rust port of 0x516930.
414
+ /// Used by Indian Nuclear Test (and possibly Teleport) to gate firing.
415
+ fn can_fire_subtype16(state: u32) -> bool {
416
  state == WormState::WeaponAimed_Maybe as u32
417
  || (WormState::AimingAngle_Maybe as u32..=WormState::PreFire_Maybe as u32).contains(&state)
418
  }
 
542
  || (worm_state == WormState::WeaponAimed_Maybe as u32 && version < 8)));
543
 
544
  if should_call_vtable {
545
+ CTaskWorm::set_state_raw(worm,WormState::Idle);
546
  }
547
 
548
  fire_send_team_message(worm, 0x28);
 
554
  entry.turn_action_counter_Maybe += 7;
555
  }
556
 
557
+ /// Air Strike (subtype 10) β€” pure Rust port of 0x51E710.
558
+ ///
559
+ /// If CTaskWorm+0x208 == 0: set state to 0x6F (air strike pending).
560
+ /// Otherwise: play sound, spawn visual effect, update position, compute
561
+ /// new state based on game version, clear action fields.
562
+ ///
563
+ /// Convention: usercall(EAX=worm, ESI=worm, EDI=worm), plain RET.
564
+ unsafe fn fire_air_strike(worm: *mut CTaskWorm) {
565
+ use openwa_core::rebase::rb;
566
+
567
+ let worm_raw = worm as *mut u8;
568
+ let field_208 = *(worm_raw.add(0x208) as *const i32);
569
+
570
+ if field_208 == 0 {
571
+ CTaskWorm::set_state_raw(worm,WormState::from_raw_unchecked(0x6F));
572
+ return;
573
+ }
574
+
575
+ // Play air strike sound: usercall(EDI=worm) + stdcall(sound_id=0x36, volume=0x10000, flags=3)
576
+ call_worm_play_sound(worm, 0x36, 0x10000, 3, rb(0x515020));
577
+
578
+ // Spawn visual effect: usercall(EAX=0x80000, ECX=x) + stdcall(y, 0, 0, 0, 600, 0x10000, 0x1999)
579
+ let fire_x = *(worm_raw.add(0x2E0) as *const i32);
580
+ let fire_y = *(worm_raw.add(0x2E4) as *const i32);
581
+ call_spawn_effect(fire_x, fire_y, rb(0x547C30));
582
+
583
+ // Temporarily swap worm+0x34 with worm+0x190, call position update, restore
584
+ let saved_34 = *(worm_raw.add(0x34) as *const i32);
585
+ let field_190 = *(worm_raw.add(0x190) as *const i32);
586
+ *(worm_raw.add(0x34) as *mut i32) = field_190;
587
+ call_position_update(worm, fire_x, fire_y, rb(0x4FE070));
588
+ *(worm_raw.add(0x34) as *mut i32) = saved_34;
589
+
590
+ // Compute new state: version < 455 β†’ Idle (0x65), else β†’ 0x8B
591
+ let ddgame = (*worm).ddgame();
592
+ let game_version = (*(*ddgame).game_info).game_version;
593
+ let new_state = if game_version < 0x1C7 {
594
+ WormState::Idle
595
+ } else {
596
+ WormState::Unknown_0x8B
597
+ };
598
+ CTaskWorm::set_state_raw(worm,new_state);
599
+
600
+ // Clear action fields
601
+ *(worm_raw.add(0x48) as *mut i32) = 0;
602
+ *(worm_raw.add(0x208) as *mut i32) = 0;
603
+ *(worm_raw.add(0x198) as *mut i32) = 0;
604
+ *(worm_raw.add(0x19C) as *mut i32) = 0;
605
+ *(worm_raw.add(0x1AC) as *mut i32) = 0;
606
+
607
+ // FUN_0050D450: usercall(ESI=worm), cleanup/landing check
608
+ call_worm_landing_check(worm, rb(0x50D450));
609
+
610
+ // Debug log block (ddgame+0x8144) omitted β€” only writes to debug file
611
+ }
612
+
613
+ /// Indian Nuclear Test (subtype 16) β€” pure Rust port of 0x51EB00.
614
+ ///
615
+ /// Sends three messages to CTaskTeam: RaiseWater (0x59), NukeBlast (0x5A),
616
+ /// PoisonWorm (0x51), and plays two sounds. Gated by can_fire_subtype16.
617
+ ///
618
+ /// Convention: usercall(EAX=worm_state, ESI=worm, EDI=worm), plain RET.
619
+ unsafe fn fire_indian_nuclear_test(worm: *mut CTaskWorm) {
620
+ use crate::replacements::sound;
621
+
622
+ let ddgame = (*worm).ddgame();
623
+ let entry = &*(*worm).active_weapon_entry;
624
+ let team = lookup_team_task(worm);
625
+
626
+ // Message 0x59 (RaiseWater): buf[0]=fire_subtype_38, buf[4]=8
627
+ if !team.is_null() {
628
+ let mut buf = [0u8; 0x40C];
629
+ buf[0..4].copy_from_slice(&entry.fire_subtype_38.to_ne_bytes());
630
+ buf[4..8].copy_from_slice(&8i32.to_ne_bytes());
631
+ (*team).handle_message((*worm).as_task_ptr_mut(), 0x59, 0x408, buf.as_ptr());
632
+ }
633
+
634
+ // Message 0x5A (NukeBlast): buf[0]=8
635
+ let team = lookup_team_task(worm);
636
+ if !team.is_null() {
637
+ let mut buf = [0u8; 0x40C];
638
+ buf[0..4].copy_from_slice(&8i32.to_ne_bytes());
639
+ (*team).handle_message((*worm).as_task_ptr_mut(), 0x5A, 0x408, buf.as_ptr());
640
+ }
641
+
642
+ // PlaySoundGlobal(7, 8, 0x10000, 0x10000)
643
+ sound::queue_sound(ddgame, 7, 8, 0x10000, 0x10000);
644
+
645
+ // Message 0x51 (PoisonWorm): buf[0]=shot_count, buf[4]=2, buf[8]=team_index
646
+ let team = lookup_team_task(worm);
647
+ if !team.is_null() {
648
+ let mut buf = [0u8; 0x40C];
649
+ buf[0..4].copy_from_slice(&entry.fire_params.shot_count.to_ne_bytes());
650
+ buf[4..8].copy_from_slice(&2i32.to_ne_bytes());
651
+ buf[8..12].copy_from_slice(&(*worm).team_index.to_ne_bytes());
652
+ (*team).handle_message((*worm).as_task_ptr_mut(), 0x51, 0x408, buf.as_ptr());
653
+ }
654
+
655
+ // PlaySoundGlobal(0x1E, 5, 0x10000, 0x10000)
656
+ sound::queue_sound(ddgame, 0x1E, 5, 0x10000, 0x10000);
657
+ }
658
+
659
+ // ── Air Strike sub-function bridges ───────────────────────
660
+
661
+ /// Bridge: FUN_00515020 β€” usercall(EDI=worm) + stdcall(sound_id, volume, flags). RET 0xC.
662
+ #[unsafe(naked)]
663
+ unsafe extern "C" fn call_worm_play_sound(
664
+ _worm: *mut CTaskWorm, _sound_id: u32, _volume: u32, _flags: u32, _addr: u32,
665
+ ) {
666
+ core::arch::naked_asm!(
667
+ "push edi",
668
+ // Stack: 1 save(4) + ret(4) = 8 to first arg
669
+ "mov edi, [esp+8]", // worm
670
+ "mov eax, [esp+24]", // addr
671
+ "push [esp+20]", // flags
672
+ "push [esp+20]", // volume (shifted +4)
673
+ "push [esp+20]", // sound_id (shifted +8)
674
+ "call eax",
675
+ "pop edi",
676
+ "ret",
677
+ );
678
+ }
679
+
680
+ /// Bridge: FUN_00547C30 β€” usercall(EAX=0x80000, ECX=x) + stdcall(y, 0,0,0, 600, 0x10000, 0x1999).
681
+ #[unsafe(naked)]
682
+ unsafe extern "C" fn call_spawn_effect(_x: i32, _y: i32, _addr: u32) {
683
+ core::arch::naked_asm!(
684
+ "push ebx",
685
+ // Stack: 1 save(4) + ret(4) = 8 to first arg
686
+ "mov ecx, [esp+8]", // x
687
+ "mov ebx, [esp+16]", // addr
688
+ "push 0x1999",
689
+ "push 0x10000",
690
+ "push 0x258", // 600
691
+ "push 0",
692
+ "push 0",
693
+ "push 0",
694
+ "push [esp+36]", // y (8 + 4 + 6*4 = 36)
695
+ "mov eax, 0x80000",
696
+ "call ebx",
697
+ "pop ebx",
698
+ "ret",
699
+ );
700
+ }
701
+
702
+ /// Bridge: FUN_004FE070 β€” usercall(ESI=worm, EDI=y) + stdcall(x). Plain RET.
703
+ #[unsafe(naked)]
704
+ unsafe extern "C" fn call_position_update(
705
+ _worm: *mut CTaskWorm, _x: i32, _y: i32, _addr: u32,
706
+ ) {
707
+ core::arch::naked_asm!(
708
+ "push ebx",
709
+ "push esi",
710
+ "push edi",
711
+ // Stack: 3 saves(12) + ret(4) = 16 to first arg
712
+ "mov esi, [esp+16]", // worm
713
+ "mov edi, [esp+24]", // y
714
+ "mov ebx, [esp+28]", // addr
715
+ "push [esp+20]", // x
716
+ "call ebx",
717
+ "pop edi",
718
+ "pop esi",
719
+ "pop ebx",
720
+ "ret",
721
+ );
722
+ }
723
+
724
+ /// Bridge: FUN_0050D450 β€” usercall(ESI=worm). Plain RET.
725
+ #[unsafe(naked)]
726
+ unsafe extern "C" fn call_worm_landing_check(_worm: *mut CTaskWorm, _addr: u32) {
727
+ core::arch::naked_asm!(
728
+ "push esi",
729
+ "mov esi, [esp+8]", // worm (1 save + ret = 8)
730
+ "call [esp+12]", // addr (8 + 4 = 12)
731
+ "pop esi",
732
+ "ret",
733
+ );
734
+ }
735
+
736
  /// Jet Pack (subtype 22) β€” pure Rust port of 0x51EC30.
737
  ///
738
  /// Sends message 0x5E to CTaskTeam, then plays a jet pack sound.
 
929
  );
930
  }
931
 
932
+ /// Bridge: usercall(EAX=eax_val, ESI=worm, EDI=worm), plain RET.
933
+ /// Kept for Low Gravity until the codegen UB is resolved.
934
+ #[unsafe(naked)]
935
+ unsafe extern "C" fn call_fire_usercall(_eax: *const (), _worm: *mut CTaskWorm, _addr: u32) {
936
+ core::arch::naked_asm!(
937
+ "push ebx",
938
+ "push esi",
939
+ "push edi",
940
+ "mov eax, [esp+16]",
941
+ "mov esi, [esp+20]",
942
+ "mov edi, [esp+20]",
943
+ "mov ebx, [esp+24]",
944
+ "call ebx",
945
+ "pop edi",
946
+ "pop esi",
947
+ "pop ebx",
948
+ "ret",
949
+ );
950
+ }
951
+
952
  /// Freeze (subtype 17) β€” pure Rust port of 0x51E920.
953
  ///
954
  /// Plays a freeze sound, optionally creates a freeze visual overlay on the
 
1188
  );
1189
  }
1190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1191
 
1192
  // ============================================================
1193
  // Passthrough hooks β€” fire sub-functions