Skip to content

Commit e691d72

Browse files
committed
rust rewrite
1 parent 8b22bea commit e691d72

File tree

9 files changed

+123
-212
lines changed

9 files changed

+123
-212
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.idea
2-
packages
3-
ExoTracker/bin
4-
ExoTracker/obj
1+
.idea
2+
target
3+
Cargo.lock
4+
*.iml

Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "exotracker-rs"
3+
version = "0.1.0"
4+
authors = ["LastExceed <[email protected]>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
10+
console = "0.15.0"
11+
win_mem = "0.2.2"
12+
nalgebra = "0.29.0"

ExoTracker.sln

Lines changed: 0 additions & 16 deletions
This file was deleted.

ExoTracker/ExoTracker.csproj

Lines changed: 0 additions & 56 deletions
This file was deleted.

ExoTracker/Program.cs

Lines changed: 0 additions & 99 deletions
This file was deleted.

ExoTracker/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# ExoTracker
22

3-
very rushed initial version. code is total spaghetti. full refactor incoming
3+
Completely rewritten in Rust. Code is still somewhat spaghetti. Currently depends on [this PR](https://github.com/nevalackin/win_mem/pull/2)
44

55
# About virus warnings
66

7-
Releases aren't signed yet, so expect your browser and anti-virus software to not like the executable. If you don't trust me (which is fair) you can always check the code and compile it yourself
7+
[Explanation and workaround here](https://stackoverflow.com/a/66582477). I'm not gonna pay money for a certificate, and manually submitting each version for verification is way too much work
8+
9+
If you don't trust me (which is fair) you can always look at the code and compile it yourself

src/main.rs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
mod utils;
2+
3+
use std::thread;
4+
use std::time::Duration;
5+
use console::Term;
6+
use nalgebra::Vector3;
7+
use win_mem::process::Process;
8+
use win_mem::utils::WinResult;
9+
use utils::*;
10+
11+
const CANNON: Vector3<f32> = Vector3::new(
12+
-66000f32,
13+
0f32,
14+
0f32
15+
);
16+
17+
fn main() {
18+
let term = Term::stdout();
19+
term.hide_cursor().expect("");
20+
term.set_title("ExoTracker v1.00");
21+
22+
loop {
23+
term.clearprint("searching for game process...");
24+
let process = loop {
25+
if let Ok(process) = Process::find("EXO ONE.exe") {
26+
break process
27+
}
28+
thread::sleep(Duration::from_millis(1000));
29+
};
30+
31+
term.clearprint("in menu");//desktop->menu
32+
let mut in_menu = true;
33+
while let Ok(unity_player) = process.find_module("UnityPlayer.dll") {
34+
while let Ok(_) = read_and_print(&term, &process, unity_player.address()) {
35+
in_menu = false;
36+
thread::sleep(Duration::from_millis(20));
37+
};
38+
if in_menu {
39+
thread::sleep(Duration::from_millis(20));
40+
} else {
41+
term.clearprint("in menu");//ingame -> menu
42+
in_menu = true;
43+
}
44+
}
45+
}
46+
}
47+
48+
fn read_and_print(term: &Term, process: &Process, unity_player: usize) -> WinResult<()> {
49+
let address = resolve_multilevel_pointer(
50+
&process,
51+
unity_player + 0x0156C900,
52+
&[0x3F8, 0x1A8, 0x28, 0xA0]
53+
)?;
54+
55+
let position = process.read_mem::<Vector3<f32>>(address + 0x00)?;
56+
let velocity = process.read_mem::<Vector3<f32>>(address + 0x30)?;
57+
58+
let distance = CANNON - position;
59+
60+
term.move_cursor_to(0, 0).expect("");
61+
println!("speed vertical {} ", velocity.y as i32);
62+
println!("speed horizontal {} ", velocity.xz().magnitude() as i32);
63+
println!("speed total {} ", velocity.magnitude() as i32);
64+
println!();
65+
println!("distance to go {} ", distance.magnitude() as i32 - 7500);
66+
67+
Ok(())
68+
}

src/utils.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use console::Term;
2+
use win_mem::process::Process;
3+
use win_mem::utils::WinResult;
4+
5+
pub trait TermEx {
6+
fn clearprint(&self, text: &str) -> ();
7+
}
8+
9+
impl TermEx for Term {
10+
fn clearprint(&self, text: &str) -> () {
11+
self.clear_screen().expect("screen clear failed");
12+
println!("{}", text);
13+
}
14+
}
15+
16+
pub fn resolve_multilevel_pointer(process: &Process, base: usize, offsets: &[usize]) -> WinResult<usize> {
17+
let mut address = base;
18+
19+
for offset in offsets {
20+
address = process.read_mem::<usize>(address)? + offset;
21+
}
22+
Ok(address)
23+
}
24+
25+
// recursive approach for novelty
26+
27+
// pub fn resolve_multilevel_pointer2(process: &Process, base: usize, offsets: &[usize]) -> WinResult<usize> {
28+
// if let [first_offset, remaining_offsets @ ..] = offsets {
29+
// resolve_multilevel_pointer2(
30+
// process,
31+
// process.read_mem::<usize>(base)? + first_offset,
32+
// remaining_offsets
33+
// )
34+
// } else { Ok(base) }
35+
// }

0 commit comments

Comments
 (0)