GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — handle frame_rate · jerryshell/ac-aimbot@b3c2029

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Cargo.lock
  • src
    • lib.rs
    • model.rs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Cargo.lock‎

Copy file name to clipboardExpand all lines: Cargo.lock
+50-39Lines changed: 50 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎src/lib.rs‎

Copy file name to clipboardExpand all lines: src/lib.rs
+17-20Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,39 @@ mod offset;
33
mod util;
44

55
use anyhow::Result;
6+
use std::time::{Duration, Instant};
67
use windows::{
7-
core::*,
8+
core::s,
89
Win32::{
9-
Foundation::*, System::LibraryLoader::*, System::SystemServices::*,
10+
Foundation::HINSTANCE,
11+
System::{LibraryLoader::GetModuleHandleA, SystemServices::DLL_PROCESS_ATTACH},
1012
UI::Input::KeyboardAndMouse::GetAsyncKeyState,
1113
},
1214
};
1315

16+
const FRAME_RATE: u64 = 60;
17+
1418
const VKEY_F: i32 = 0x46;
1519

1620
fn run() -> Result<()> {
17-
let refresh_interval_ms = 1000 / 60;
18-
1921
let module_base_addr = unsafe { GetModuleHandleA(s!("ac_client.exe")).map(|h| h.0 as u32) }?;
20-
2122
let local_player_base_ptr = util::build_ptr(module_base_addr, offset::LOCAL_PLAYER);
22-
2323
let entity_list_base_ptr = util::build_ptr(module_base_addr, offset::ENTITY_LIST);
2424

2525
let mut aimbot_enable_flag = false;
2626

27-
loop {
28-
let start = std::time::Instant::now();
27+
let tick_rate = Duration::from_millis(1000 / FRAME_RATE);
28+
let mut last_tick = Instant::now();
2929

30+
loop {
3031
unsafe {
3132
if GetAsyncKeyState(VKEY_F) & 0x1 == 1 {
3233
aimbot_enable_flag = !aimbot_enable_flag;
3334
}
3435
};
3536

36-
if !aimbot_enable_flag {
37-
sleep(start, refresh_interval_ms);
37+
if aimbot_enable_flag {
38+
sleep(&tick_rate, &last_tick);
3839
continue;
3940
}
4041

@@ -59,7 +60,7 @@ fn run() -> Result<()> {
5960
.collect::<Vec<model::Entity>>();
6061

6162
if entity_list.is_empty() {
62-
sleep(start, refresh_interval_ms);
63+
sleep(&tick_rate, &last_tick);
6364
continue;
6465
}
6566

@@ -71,18 +72,14 @@ fn run() -> Result<()> {
7172

7273
util::aim(&local_player, &angle);
7374

74-
sleep(start, refresh_interval_ms);
75+
sleep(&tick_rate, &last_tick);
76+
last_tick = Instant::now();
7577
}
7678
}
7779

78-
fn sleep(start: std::time::Instant, refresh_interval_ms: u64) {
79-
let delta = start.elapsed();
80-
let delta_ms = delta.as_millis() as u64;
81-
if refresh_interval_ms > delta_ms {
82-
std::thread::sleep(std::time::Duration::from_millis(
83-
refresh_interval_ms - delta_ms,
84-
));
85-
}
80+
fn sleep(tick_rate: &Duration, last_tick: &Instant) {
81+
let timeout = tick_rate.saturating_sub(last_tick.elapsed());
82+
std::thread::sleep(timeout);
8683
}
8784

8885
#[no_mangle]
Collapse file

‎src/model.rs‎

Copy file name to clipboardExpand all lines: src/model.rs
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub struct Vec3 {
1515
pub struct Entity {
1616
pub base_ptr: *const u32,
1717
pub head_position: Vec3,
18-
pub view_angle: Vec2,
1918
pub health: i32,
2019
pub distance_to_player: f32,
2120
}
@@ -28,17 +27,11 @@ impl Entity {
2827
z: util::read_memory::<f32>(base_ptr, offset::HEAD_POSITION_Z),
2928
};
3029

31-
let view_angle = Vec2 {
32-
x: util::read_memory::<f32>(base_ptr, offset::VIEW_ANGLE_X),
33-
y: util::read_memory::<f32>(base_ptr, offset::VIEW_ANGLE_Y),
34-
};
35-
3630
let health = util::read_memory::<i32>(base_ptr, offset::HEALTH);
3731

3832
Entity {
3933
base_ptr,
4034
head_position,
41-
view_angle,
4235
health,
4336
distance_to_player: 0.0,
4437
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.