diff --git a/config_linux.json b/config_linux.json new file mode 100644 index 0000000..d700ac7 --- /dev/null +++ b/config_linux.json @@ -0,0 +1,132 @@ +{ + "signatures": [ + { + "name": "dwBuildNumber", + "module": "libengine2.so", + "pattern": "89 15 ? ? ? ? 48 83 ? ? 48 8D 3D ? ? ? ?", + "operations": [ + { + "type": "rip", + "offset": 2, + "length": 6 + } + ] + }, + { + "name": "dwNetworkGameClient_deltaTick", + "module": "libengine2.so", + "pattern": "89 83 ? ? ? ? B8 01", + "operations": [ + { + "type": "slice", + "start": 2, + "end": 4 + } + ] + }, + { + "name": "dwEntityList", + "module": "libclient.so", + "pattern": "48 8B 3D ? ? ? ? 44 89 E3 45 89 E6 C1 ? 0E", + "operations": [ + { + "type": "rip" + } + ] + }, + { + "name": "dwForceAttack", + "module": "libclient.so", + "pattern": "4c 8d ? ? ? ? ? 4d 89 ? 48 89 ? ? ? ? ? eb", + "operations": [ + { + "type": "rip" + }, + { + "type": "add", + "value": 48 + } + ] + }, + { + "name": "dwForceAttack2", + "module": "libclient.so", + "pattern": "4c 8d ? ? ? ? ? 48 8d ? ? ? ? ? 48 89 ? ? ? ? ? e8 ? ? ? ? 49 ? ? ? 31 d2 48 c7 ? ? ? ? ? ? 08", + "operations": [ + { + "type": "rip" + }, + { + "type": "add", + "value": 48 + } + ] + }, + { + "name": "dwGameEntitySystem", + "module": "libclient.so", + "pattern": "48 89 3d ? ? ? ? e9 ? ? ? ? 55", + "operations": [ + { + "type": "rip" + } + ] + }, + { + "name": "dwGameEntitySystem_getHighestEntityIndex", + "module": "libclient.so", + "pattern": "8b 87 ? ? ? ? c3 66 ? ? ? ? ? ? ? ? 8b 97", + "operations": [ + { + "type": "slice", + "start": 2, + "end": 4 + } + ] + }, + { + "name": "dwGameRules", + "module": "libclient.so", + "pattern": "48 89 3d ? ? ? ? 8b", + "operations": [ + { + "type": "rip" + } + ] + }, + { + "name": "dwLocalPlayerController", + "module": "libclient.so", + "pattern": "48 8B 15 ? ? ? ? 31 C0 48 85 D2 74 5C", + "operations": [ + { + "type": "rip" + } + ] + }, + { + "name": "dwLocalPlayerPawn", + "module": "libclient.so", + "pattern": "48 8D 05 ? ? ? ? C3 ? ? ? 00 00 00 00 00 C7 47 40", + "operations": [ + { + "type": "rip" + }, + { + "type": "add", + "value": 56 + } + ] + }, + { + "name": "dwViewMatrix", + "module": "libclient.so", + "pattern": "4c 8d 05 ? ? ? ? 48 ? ? 48 8d ? ? ? ? ? e8 ? ? ? ? 8b", + "operations": [ + { + "type": "rip" + } + ] + } + ] +} diff --git a/src/config.rs b/src/config.rs index 7bdd914..875e390 100644 --- a/src/config.rs +++ b/src/config.rs @@ -72,3 +72,9 @@ pub const PROC_NAME: &str = "cs2.exe"; #[cfg(target_os = "linux")] pub const PROC_NAME: &str = "cs2"; + +#[cfg(target_os = "windows")] +pub const OFFSETS_CONF: &str = "config.json"; + +#[cfg(target_os = "linux")] +pub const OFFSETS_CONF: &str = "config_linux.json"; diff --git a/src/dumper/offsets.rs b/src/dumper/offsets.rs index d098b2c..f88510e 100644 --- a/src/dumper/offsets.rs +++ b/src/dumper/offsets.rs @@ -7,8 +7,8 @@ use simplelog::{debug, error, info}; use super::{generate_files, Entries, Entry}; use crate::builder::FileBuilderEnum; -use crate::config::Config; use crate::config::Operation::*; +use crate::config::{self, Config}; use crate::os::Process; pub fn dump_offsets( @@ -17,7 +17,7 @@ pub fn dump_offsets( file_path: &str, indent: usize, ) -> Result<()> { - let file = File::open("config.json")?; + let file = File::open(config::OFFSETS_CONF)?; let config: Config = serde_json::from_reader(file)?; diff --git a/src/main.rs b/src/main.rs index a649573..0982a23 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,8 +86,8 @@ fn main() -> Result<()> { TermLogger::init(log_level, config, TerminalMode::Mixed, ColorChoice::Auto)?; - if !Path::new("config.json").exists() { - bail!("Missing config.json file"); + if !Path::new(config::OFFSETS_CONF).exists() { + bail!("Missing {} file", config::OFFSETS_CONF); } // Create the output directory if it doesn't exist.