cleanup: fix all compiler warnings in replay.rs
Browse files- Remove unused variable team_idx, team_count, tn_len
- Suppress unused_assignments on scheme_version (set in match arms)
- Remove unused call_usercall_esi_stdcall1 naked bridge
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
crates/openwa-wormkit/src/replacements/replay.rs
CHANGED
|
@@ -275,6 +275,7 @@ unsafe fn parse_and_write_v2plus(
|
|
| 275 |
let _extra = s.read_u32()?;
|
| 276 |
}
|
| 277 |
|
|
|
|
| 278 |
let mut scheme_version: u8 = 0;
|
| 279 |
|
| 280 |
if scheme_present == 1 {
|
|
@@ -725,9 +726,8 @@ unsafe fn write_replay_log(state: u32, log_file: *mut FILE) -> Result<(), Replay
|
|
| 725 |
|
| 726 |
// Team data is in the team header buffer at 0x877FFC + i*0xD7B.
|
| 727 |
// Per-team: +0x00=type, +0x01=alliance(color), +0x14=team_name(prefixed)
|
| 728 |
-
let
|
| 729 |
|
| 730 |
-
let mut team_idx = 0u32;
|
| 731 |
for slot in 0..6u32 {
|
| 732 |
let tb = rb(0x877FFC + slot * 0xD7B) as *const u8;
|
| 733 |
let flag = *(rb(0x878120 + slot * 0xD7B) as *const u8);
|
|
@@ -742,7 +742,6 @@ unsafe fn write_replay_log(state: u32, log_file: *mut FILE) -> Result<(), Replay
|
|
| 742 |
// The displayed team name comes from the pre-loop name field at +0x03
|
| 743 |
// (e.g., "CPU 2"), not the custom team name at +0x14 ("thrombosis1").
|
| 744 |
let team_name = tb.add(0x03);
|
| 745 |
-
let tn_len = c_strlen(team_name);
|
| 746 |
|
| 747 |
let color_len = clen;
|
| 748 |
|
|
@@ -819,26 +818,6 @@ unsafe fn c_strlen(s: *const u8) -> usize {
|
|
| 819 |
|
| 820 |
// βββ Naked asm bridges ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 821 |
|
| 822 |
-
/// Bridge for usercall(ESI=val) + stdcall(1 param). cdecl(esi_val, param, func_addr).
|
| 823 |
-
#[unsafe(naked)]
|
| 824 |
-
unsafe extern "cdecl" fn call_usercall_esi_stdcall1(
|
| 825 |
-
_esi_val: u32, _param: u32, _func: u32,
|
| 826 |
-
) {
|
| 827 |
-
// Stack on entry: [ESP+0]=ret [ESP+4]=esi_val [ESP+8]=param [ESP+12]=func
|
| 828 |
-
core::arch::naked_asm!(
|
| 829 |
-
"push esi",
|
| 830 |
-
"push edi",
|
| 831 |
-
// Now: [ESP+0]=edi [ESP+4]=esi [ESP+8]=ret [ESP+12]=esi_val [ESP+16]=param [ESP+20]=func
|
| 832 |
-
"mov esi, [esp+12]", // esi_val
|
| 833 |
-
"push [esp+16]", // push param for stdcall
|
| 834 |
-
// Now: [ESP+0]=param [ESP+4]=edi [ESP+8]=esi [ESP+12]=ret [ESP+16]=esi_val [ESP+20]=param_orig [ESP+24]=func
|
| 835 |
-
"mov eax, [esp+24]", // func_addr
|
| 836 |
-
"call eax", // stdcall cleans 1 param (4 bytes)
|
| 837 |
-
"pop edi",
|
| 838 |
-
"pop esi",
|
| 839 |
-
"ret",
|
| 840 |
-
);
|
| 841 |
-
}
|
| 842 |
|
| 843 |
/// Bridge for usercall(EAX=value) + plain call. cdecl(eax_val, func_addr).
|
| 844 |
#[unsafe(naked)]
|
|
|
|
| 275 |
let _extra = s.read_u32()?;
|
| 276 |
}
|
| 277 |
|
| 278 |
+
#[allow(unused_assignments)]
|
| 279 |
let mut scheme_version: u8 = 0;
|
| 280 |
|
| 281 |
if scheme_present == 1 {
|
|
|
|
| 726 |
|
| 727 |
// Team data is in the team header buffer at 0x877FFC + i*0xD7B.
|
| 728 |
// Per-team: +0x00=type, +0x01=alliance(color), +0x14=team_name(prefixed)
|
| 729 |
+
let _team_count = *(rb(0x87D0E0) as *const u8) as u32;
|
| 730 |
|
|
|
|
| 731 |
for slot in 0..6u32 {
|
| 732 |
let tb = rb(0x877FFC + slot * 0xD7B) as *const u8;
|
| 733 |
let flag = *(rb(0x878120 + slot * 0xD7B) as *const u8);
|
|
|
|
| 742 |
// The displayed team name comes from the pre-loop name field at +0x03
|
| 743 |
// (e.g., "CPU 2"), not the custom team name at +0x14 ("thrombosis1").
|
| 744 |
let team_name = tb.add(0x03);
|
|
|
|
| 745 |
|
| 746 |
let color_len = clen;
|
| 747 |
|
|
|
|
| 818 |
|
| 819 |
// βββ Naked asm bridges ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 820 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 821 |
|
| 822 |
/// Bridge for usercall(EAX=value) + plain call. cdecl(eax_val, func_addr).
|
| 823 |
#[unsafe(naked)]
|