paavohtl Claude Opus 4.6 commited on
Commit
5fd6579
·
1 Parent(s): 2438f44

refactor: rename sprite.rs to render.rs, make install() consistently safe

Browse files

Rename replacements/sprite.rs to render.rs to better reflect its scope
(RenderQueue enqueue, trail drawing, crosshair). Wrap unsafe hook calls
internally so all install() functions share a consistent safe signature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Cargo.lock CHANGED
@@ -67,15 +67,6 @@ dependencies = [
67
  name = "openwa-types"
68
  version = "0.1.0"
69
 
70
- [[package]]
71
- name = "openwa-validator"
72
- version = "0.1.0"
73
- dependencies = [
74
- "minhook",
75
- "openwa-types",
76
- "windows-sys",
77
- ]
78
-
79
  [[package]]
80
  name = "openwa-wormkit"
81
  version = "0.1.0"
 
67
  name = "openwa-types"
68
  version = "0.1.0"
69
 
 
 
 
 
 
 
 
 
 
70
  [[package]]
71
  name = "openwa-wormkit"
72
  version = "0.1.0"
crates/openwa-wormkit/src/replacements/mod.rs CHANGED
@@ -1,7 +1,7 @@
1
  mod config;
2
  mod frontend;
3
  mod scheme;
4
- mod sprite;
5
  mod team;
6
  mod weapon;
7
 
@@ -11,6 +11,6 @@ pub fn install_all() -> Result<(), String> {
11
  config::install()?;
12
  weapon::install()?;
13
  team::install()?;
14
- unsafe { sprite::install()? };
15
  Ok(())
16
  }
 
1
  mod config;
2
  mod frontend;
3
  mod scheme;
4
+ mod render;
5
  mod team;
6
  mod weapon;
7
 
 
11
  config::install()?;
12
  weapon::install()?;
13
  team::install()?;
14
+ render::install()?;
15
  Ok(())
16
  }
crates/openwa-wormkit/src/replacements/{sprite.rs → render.rs} RENAMED
@@ -601,7 +601,8 @@ unsafe extern "cdecl" fn draw_crosshair_line_impl(task_ptr: u32) {
601
  // Installation
602
  // ---------------------------------------------------------------------------
603
 
604
- pub unsafe fn install() -> Result<(), String> {
 
605
  let _ = hook::install(
606
  "DrawPixel",
607
  va::DRAW_PIXEL,
@@ -674,5 +675,6 @@ pub unsafe fn install() -> Result<(), String> {
674
  trampoline_draw_crosshair_line as *const (),
675
  )?;
676
 
 
677
  Ok(())
678
  }
 
601
  // Installation
602
  // ---------------------------------------------------------------------------
603
 
604
+ pub fn install() -> Result<(), String> {
605
+ unsafe {
606
  let _ = hook::install(
607
  "DrawPixel",
608
  va::DRAW_PIXEL,
 
675
  trampoline_draw_crosshair_line as *const (),
676
  )?;
677
 
678
+ }
679
  Ok(())
680
  }