Skip to content

Commit 018b1c6

Browse files
committed
Bump version to 0.2.0 and update dependencies in Cargo files; add Windows Direct2D link in README
1 parent 5cfa4b1 commit 018b1c6

File tree

4 files changed

+79
-116
lines changed

4 files changed

+79
-116
lines changed

Cargo.lock

Lines changed: 60 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
[package]
2-
name = "ac-esp"
3-
version = "0.1.2"
42
edition = "2021"
3+
name = "ac-esp"
4+
version = "0.2.0"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
1010
anyhow = "*"
11-
windows = { version = "*", features = [
12-
"Win32_System_LibraryLoader",
13-
"Win32_System_SystemServices",
14-
] }
15-
windows-ez-overlay = { git = "https://github.com/jerryshell/windows-ez-overlay" }
11+
windows = {git = "https://github.com/microsoft/windows-rs", features = [
12+
"Win32_System_LibraryLoader",
13+
"Win32_System_SystemServices",
14+
]}
15+
windows-ez-overlay = {git = "https://github.com/jerryshell/windows-ez-overlay"}
1616

1717
[profile.release]
18+
codegen-units = 1
1819
lto = true
19-
strip = true
2020
panic = "abort"
21-
codegen-units = 1
21+
strip = true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cross build --release --target=i686-pc-windows-gnu
3838
- [About Windows](https://learn.microsoft.com/en-us/windows/win32/winmsg/about-windows)
3939
- [Rust for Windows](https://kennykerr.ca/rust-getting-started)
4040
- [Windows GDI](https://learn.microsoft.com/en-us/windows/win32/gdi/windows-gdi)
41+
- [Windows Direct2D](https://learn.microsoft.com/en-us/windows/win32/direct2d/direct2d-portal)
4142

4243
## License
4344

src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ use std::{
99
time::{Duration, Instant},
1010
};
1111
use windows::{
12-
core::s,
12+
core::*,
1313
Win32::{
14-
Foundation::{HINSTANCE, RECT},
15-
System::{LibraryLoader::GetModuleHandleA, SystemServices::DLL_PROCESS_ATTACH},
16-
UI::WindowsAndMessaging::{FindWindowA, GetWindowInfo, WINDOWINFO},
14+
Foundation::*,
15+
System::{LibraryLoader::*, SystemServices::*},
16+
UI::WindowsAndMessaging::*,
1717
},
1818
};
1919

2020
const FRAME_RATE: u64 = 60;
21+
const TICK_RATE: Duration = Duration::from_millis(1000 / FRAME_RATE);
2122

2223
fn run() -> Result<()> {
2324
let draw_rect_list = Arc::new(RwLock::new(Vec::<RECT>::with_capacity(32)));
@@ -35,11 +36,10 @@ fn run() -> Result<()> {
3536
window_info.rcClient.right,
3637
window_info.rcClient.bottom,
3738
draw_rect_list_clone,
38-
FRAME_RATE,
3939
true,
40-
);
41-
overlay.pen_width = 2;
42-
let _ = overlay.window_loop();
40+
)
41+
.unwrap();
42+
let _ = overlay.run();
4343
});
4444

4545
let window_width = window_info.rcClient.right - window_info.rcClient.left;
@@ -67,7 +67,6 @@ fn read_game_data_loop(
6767
window_height: i32,
6868
draw_rect_list: Arc<RwLock<Vec<RECT>>>,
6969
) {
70-
let tick_rate = Duration::from_millis(1000 / FRAME_RATE);
7170
let mut last_tick = Instant::now();
7271
loop {
7372
let player_count = util::read_memory::<u32>(module_base_addr, offset::PLAYER_COUNT);
@@ -116,7 +115,7 @@ fn read_game_data_loop(
116115
draw_rect_list.extend(new_draw_rect_list);
117116
}
118117

119-
let timeout = tick_rate.saturating_sub(last_tick.elapsed());
118+
let timeout = TICK_RATE.saturating_sub(last_tick.elapsed());
120119
thread::sleep(timeout);
121120
last_tick = Instant::now();
122121
}

0 commit comments

Comments
 (0)