fix: resolve by fix cs2dumper importing

Resolved , fixes URLs and module imports for cs2dumper.
Warning: Untested.
This commit is contained in:
Janek 2024-04-03 17:59:53 +02:00
parent d31c3f8ee5
commit 212c88efaa
9 changed files with 6511 additions and 299 deletions

705
Cargo.lock generated

File diff suppressed because it is too large Load Diff

36
Cargo.toml Executable file → Normal file

@ -1,6 +1,6 @@
[package]
name = "radarflow"
version = "0.2.2"
version = "0.2.3"
authors = ["Janek S <development@superyu.xyz"]
edition = "2021"
@ -8,36 +8,38 @@ edition = "2021"
[dependencies]
# memory
memflow = "0.2.0"
memflow = "0.2.1"
dataview = "1.0.1"
# logging
log = "0.4.19"
simple_logger = "4.2.0"
log = "0.4.21"
simple_logger = "4.3.3"
# error handling
anyhow = "1.0.79"
anyhow = "1.0.81"
# derive stuff
enum-primitive-derive = "0.2.2"
num-traits = "0.2.16"
serde = { version = "1.0.181", features = ["derive"] }
serde_json = "1.0.104"
clap = { version = "4.3.19", features = ["derive", "string"] }
enum-primitive-derive = "0.3.0"
num-traits = "0.2.18"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.115"
clap = { version = "4.5.4", features = ["derive", "string"] }
# tokio
tokio = { version = "1.29.1", features = ["full"] }
tokio = { version = "1.37.0", features = ["full"] }
# networking
axum = { version = "0.6.20", features = ["ws"] }
tower-http = { version = "0.4.3", features = ["fs"] }
axum = { version = "0.7.5", features = ["ws"] }
tower-http = { version = "0.5.2", features = ["fs"] }
tower = "0.4.13"
local-ip-address = "0.5.4"
local-ip-address = "0.6.1"
# other
itertools = "0.12.0"
itertools = "0.12.1"
[build-dependencies]
reqwest = { version = "0.11.18", features = ["blocking"] }
vergen = { version = "8.0.0", features = ["build", "cargo", "git", "gitcl", "rustc", "si"] }
reqwest = { version = "0.12.2", features = ["blocking"] }
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.115"
vergen = { version = "8.3.1", features = ["build", "cargo", "git", "gitcl", "rustc", "si"] }

@ -1,7 +1,14 @@
use std::error::Error;
use serde::{Deserialize, Serialize};
use vergen::EmitBuilder;
#[derive(Clone, Deserialize, Serialize)]
struct InfoJson {
build_number: usize,
timestamp: String
}
fn download(url: &str, to: &str) -> Result<(), Box<dyn Error>> {
let content = reqwest::blocking::get(url)
.unwrap_or_else(|_| panic!("Downloading \"{to}\""))
@ -14,23 +21,37 @@ fn download(url: &str, to: &str) -> Result<(), Box<dyn Error>> {
Ok(())
}
fn build_number() -> Result<(), Box<dyn Error>> {
let content = reqwest::blocking::get("https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/info.json")
.unwrap_or_else(|_| panic!("Downloading info.json"))
.text()
.expect("Convert response to text");
let info = serde_json::from_str::<InfoJson>(&content)?;
println!("cargo:rustc-env=CS2_BUILD_NUMBER={}", info.build_number);
Ok(())
}
fn main() -> Result<(), Box<dyn Error>> {
download(
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/generated/client.dll.rs",
"./src/dma/cs2dumper/client.rs"
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/client.dll.rs",
"./src/dma/cs2dumper/client_mod.rs"
).expect("Failed to download build file \"client.dll.rs\"");
download(
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/generated/offsets.rs",
"./src/dma/cs2dumper/offsets.rs"
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/offsets.rs",
"./src/dma/cs2dumper/offsets_mod.rs"
).expect("Failed to download build file \"offsets.rs\"");
download(
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/generated/engine2.dll.rs",
"./src/dma/cs2dumper/engine2.rs"
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/engine2.dll.rs",
"./src/dma/cs2dumper/engine2_mod.rs"
).expect("Failed to download build file \"engine2.dll.rs\"");
build_number()?;
EmitBuilder::builder()
.git_sha(true)
.git_commit_date()

@ -18,7 +18,7 @@ pub struct DmaCtx {
impl DmaCtx {
fn check_version(&mut self) -> anyhow::Result<()> {
let game_build_number: u32 = self.process.read(self.engine_module.base + cs2dumper::offsets::engine2_dll::dwBuildNumber)?;
let offset_build_number = cs2dumper::offsets::game_info::buildNumber;
let offset_build_number = env!("CS2_BUILD_NUMBER").parse::<usize>()?;
if game_build_number as usize != offset_build_number {
return Err(anyhow::anyhow!(

File diff suppressed because it is too large Load Diff

@ -0,0 +1,79 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-04-02 16:10:48.961749300 UTC
#![allow(non_upper_case_globals, non_camel_case_types, unused)]
pub mod cs2_dumper {
pub mod schemas {
// Module: engine2.dll
// Classes count: 2
// Enums count: 4
pub mod engine2_dll {
// Alignment: 4
// Members count: 3
#[repr(u32)]
pub enum SpawnDebugOverrideState_t {
SPAWN_DEBUG_OVERRIDE_NONE = 0x0,
SPAWN_DEBUG_OVERRIDE_FORCE_ENABLED = 0x1,
SPAWN_DEBUG_OVERRIDE_FORCE_DISABLED = 0x2
}
// Alignment: 4
// Members count: 5
#[repr(u32)]
pub enum SpawnDebugRestrictionOverrideState_t {
SPAWN_DEBUG_RESTRICT_NONE = 0x0,
SPAWN_DEBUG_RESTRICT_IGNORE_MANAGER_DISTANCE_REQS = 0x1,
SPAWN_DEBUG_RESTRICT_IGNORE_TEMPLATE_DISTANCE_LOS_REQS = 0x2,
SPAWN_DEBUG_RESTRICT_IGNORE_TEMPLATE_COOLDOWN_LIMITS = 0x4,
SPAWN_DEBUG_RESTRICT_IGNORE_TARGET_COOLDOWN_LIMITS = 0x8
}
// Alignment: 4
// Members count: 3
#[repr(u32)]
pub enum EntityDormancyType_t {
ENTITY_NOT_DORMANT = 0x0,
ENTITY_DORMANT = 0x1,
ENTITY_SUSPENDED = 0x2
}
// Alignment: 4
// Members count: 4
#[repr(u32)]
pub enum EntityIOTargetType_t {
ENTITY_IO_TARGET_INVALID = 0xFFFFFFFFFFFFFFFF,
ENTITY_IO_TARGET_ENTITYNAME = 0x2,
ENTITY_IO_TARGET_EHANDLE = 0x6,
ENTITY_IO_TARGET_ENTITYNAME_OR_CLASSNAME = 0x7
}
// Parent: None
// Fields count: 11
//
// Metadata:
// NetworkVarNames: m_nameStringableIndex (int32)
pub mod CEntityIdentity {
pub const m_nameStringableIndex: usize = 0x14; // int32
pub const m_name: usize = 0x18; // CUtlSymbolLarge
pub const m_designerName: usize = 0x20; // CUtlSymbolLarge
pub const m_flags: usize = 0x30; // uint32
pub const m_worldGroupId: usize = 0x38; // WorldGroupId_t
pub const m_fDataObjectTypes: usize = 0x3C; // uint32
pub const m_PathIndex: usize = 0x40; // ChangeAccessorFieldPathIndex_t
pub const m_pPrev: usize = 0x58; // CEntityIdentity*
pub const m_pNext: usize = 0x60; // CEntityIdentity*
pub const m_pPrevByClass: usize = 0x68; // CEntityIdentity*
pub const m_pNextByClass: usize = 0x70; // CEntityIdentity*
}
// Parent: None
// Fields count: 4
//
// Metadata:
// NetworkVarNames: m_pEntity (CEntityIdentity*)
// NetworkVarNames: m_CScriptComponent (CScriptComponent::Storage_t)
pub mod CEntityInstance {
pub const m_iszPrivateVScripts: usize = 0x8; // CUtlSymbolLarge
pub const m_pEntity: usize = 0x10; // CEntityIdentity*
pub const m_CScriptComponent: usize = 0x28; // CScriptComponent*
pub const m_bVisibleinPVS: usize = 0x30; // bool
}
}
}
}

@ -1,4 +1,12 @@
#![allow(dead_code)]
pub mod client;
pub mod engine2;
pub mod offsets;
#![allow(overflowing_literals)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
mod client_mod;
mod engine2_mod;
mod offsets_mod;
pub use client_mod::cs2_dumper::schemas::client_dll as client;
pub use engine2_mod::cs2_dumper::schemas::engine2_dll as engine;
pub use offsets_mod::cs2_dumper::offsets as offsets;

@ -0,0 +1,48 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-04-02 16:10:48.961749300 UTC
#![allow(non_upper_case_globals, non_camel_case_types, unused)]
pub mod cs2_dumper {
pub mod offsets {
// Module: client.dll
pub mod client_dll {
pub const dwCSGOInput: usize = 0x192B620;
pub const dwEntityList: usize = 0x18C2D58;
pub const dwGameEntitySystem: usize = 0x19E0790;
pub const dwGameEntitySystem_getHighestEntityIndex: usize = 0x1510;
pub const dwGameRules: usize = 0x191FCA0;
pub const dwGlobalVars: usize = 0x172ABA0;
pub const dwGlowManager: usize = 0x19200C0;
pub const dwLocalPlayerController: usize = 0x1912578;
pub const dwLocalPlayerPawn: usize = 0x17371A8;
pub const dwPlantedC4: usize = 0x1928AD8;
pub const dwPrediction: usize = 0x1737070;
pub const dwSensitivity: usize = 0x19209E8;
pub const dwSensitivity_sensitivity: usize = 0x40;
pub const dwViewAngles: usize = 0x19309B0;
pub const dwViewMatrix: usize = 0x19241A0;
pub const dwViewRender: usize = 0x1924A20;
}
// Module: engine2.dll
pub mod engine2_dll {
pub const dwBuildNumber: usize = 0x514574;
pub const dwNetworkGameClient: usize = 0x513AC8;
pub const dwNetworkGameClient_deltaTick: usize = 0x258;
pub const dwNetworkGameClient_getLocalPlayer: usize = 0xF0;
pub const dwNetworkGameClient_getMaxClients: usize = 0x250;
pub const dwNetworkGameClient_signOnState: usize = 0x240;
pub const dwWindowHeight: usize = 0x5CCCDC;
pub const dwWindowWidth: usize = 0x5CCCD8;
}
// Module: inputsystem.dll
pub mod inputsystem_dll {
pub const dwInputSystem: usize = 0x367A0;
}
// Module: matchmaking.dll
pub mod matchmaking_dll {
pub const dwGameTypes: usize = 0x1D21E0;
pub const dwGameTypes_mapName: usize = 0x1D2300;
}
}
}

@ -60,9 +60,8 @@ pub async fn run(path: PathBuf, port: u16, data_lock: Arc<RwLock<RadarData>>) ->
.with_state(AppState { data_lock });
let address = format!("0.0.0.0:{}", port);
axum::Server::bind(&address.parse()?)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind(address).await?;
axum::serve(listener, app.into_make_service())
.await?;
Ok(())