Crate obfuscate_integer[−][src]
Expand description
This is a crate for test purpose, which may stop most Cheat Engine (and other variants)
program scanning for the relative address, and thus stop further modification.
most of the type here provided start with an ‘O’ and the remain parts are the same to its actual kind
e.g., Oi32
is actually an obfuscate i32
actually for most Cheat Engine user, it is difficult even modify a very simple program with Oi32
license: GPL-v3 or later
Examples
#![feature(bench_black_box)]
use std::hint::black_box;
#[macro_use] // if you want to import the macro
extern crate obfuscate_integer;
use obfuscate_integer::*;
fn main(){cai!{
let mut player_hp:Oi32:=500000;
let mut enemy_hp:Oi32:=1000000;
let mut round:Oi16:=0;
let now=std::time::Instant::now();
loop{
round+=1;
enemy_hp-=1;
if enemy_hp<0 {break}
player_hp-=1;
if player_hp<0 {break}
}
println!("execute 5000000 loops, cost {:?}",now.elapsed());
let mut player_hp:Oi32:=500000;
let mut enemy_hp:Oi32:=1000000;
let mut round:Oi16:=0;
let now=std::time::Instant::now();
loop{
round+=black_box(1);
enemy_hp-=black_box(1);
if enemy_hp<0 {break}
player_hp-=black_box(1);
if player_hp<0 {break}
}
println!("execute 5000000 loops, cost {:?}",now.elapsed());
let mut stdin = std::io::stdin();
let mut player_hp:Oi32:=500000;
let mut enemy_hp:Oi32:=1000000;
let mut round:Oi16:=0;
let mut buffer = String::new();
} // at least 0.1.0, `cai!` does not support complicated instructions like the following one. it might be solved in future versions.
if loop{
round+=1;
println!("Round {} is comming, player's hp is {} and enemy's hp is {}. Press `Enter` to continue.",&round,&player_hp,&enemy_hp);
stdin.read_line(&mut buffer).unwrap();
buffer.clear();
enemy_hp-=1;
if enemy_hp<0 {break true}
player_hp-=1;
if player_hp<0 {break false}
}{
println!("You win!");
}else{
println!("You dead.");
}
}
Restrictions
program must be compiled with overflow-checks = false
, since Debug mode could not handle the highly possible wrapping ops.
using std::hint::black_box, it is not difficult figure out that Oi32 makes program run 100x slower than using i32
thus, do not use Oi* or Ou* dealing massive calculations.
for normal (e.g., gaming) use, that is acceptable.
Re-exports
pub use crate::custom_ops::CustomInitialize;
pub use crate::custom_ops::CustomAssign;
Modules
Macros
Custom Initialize and Assign statement with macro cai!
Structs
Oi8 is the obfuscate version of i8
Oi16 is the obfuscate version of i16
Oi32 is the obfuscate version of i32
Oi64 is the obfuscate version of i64
Oi128 is the obfuscate version of i128
Oisize is the obfuscate version of isize
Ou8 is the obfuscate version of u8
Ou16 is the obfuscate version of u16
Ou32 is the obfuscate version of u32
Ou64 is the obfuscate version of u64
Ou128 is the obfuscate version of u128
Ousize is the obfuscate version of usize
Enums
Ei8 is the basic storage unit of Oi8
Ei16 is the basic storage unit of Oi16
Ei32 is the basic storage unit of Oi32
Ei64 is the basic storage unit of Oi64
Ei128 is the basic storage unit of Oi128
Eisize is the basic storage unit of Oisize
Eu8 is the basic storage unit of Ou8
Eu16 is the basic storage unit of Ou16
Eu32 is the basic storage unit of Ou32
Eu64 is the basic storage unit of Ou64
Eu128 is the basic storage unit of Ou128
Eusize is the basic storage unit of Ousize