mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-10-07 16:30:01 +08:00
📦 Game Update 13965
This commit is contained in:
@@ -22,9 +22,9 @@ impl FileBuilder for CppFileBuilder {
|
||||
name: &str,
|
||||
comment: Option<&str>,
|
||||
) -> Result<()> {
|
||||
let comment = comment.map_or(String::new(), |c| format!("// {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" // {}", c));
|
||||
|
||||
write!(output, "namespace {} {{ {}\n", name, comment)
|
||||
write!(output, "namespace {} {{{}\n", name, comment)
|
||||
}
|
||||
|
||||
fn write_variable(
|
||||
@@ -37,11 +37,11 @@ impl FileBuilder for CppFileBuilder {
|
||||
) -> Result<()> {
|
||||
let indentation = " ".repeat(indentation.unwrap_or(4));
|
||||
|
||||
let comment = comment.map_or(String::new(), |c| format!("// {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" // {}", c));
|
||||
|
||||
write!(
|
||||
output,
|
||||
"{}constexpr std::ptrdiff_t {} = {:#X}; {}\n",
|
||||
"{}constexpr std::ptrdiff_t {} = {:#X};{}\n",
|
||||
indentation, name, value, comment
|
||||
)
|
||||
}
|
||||
|
@@ -22,9 +22,9 @@ impl FileBuilder for CSharpFileBuilder {
|
||||
name: &str,
|
||||
comment: Option<&str>,
|
||||
) -> Result<()> {
|
||||
let comment = comment.map_or(String::new(), |c| format!("// {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" // {}", c));
|
||||
|
||||
write!(output, "public static class {} {{ {}\n", name, comment)
|
||||
write!(output, "public static class {} {{{}\n", name, comment)
|
||||
}
|
||||
|
||||
fn write_variable(
|
||||
@@ -37,11 +37,11 @@ impl FileBuilder for CSharpFileBuilder {
|
||||
) -> Result<()> {
|
||||
let indentation = " ".repeat(indentation.unwrap_or(4));
|
||||
|
||||
let comment = comment.map_or(String::new(), |c| format!("// {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" // {}", c));
|
||||
|
||||
write!(
|
||||
output,
|
||||
"{}public const nint {} = {:#X}; {}\n",
|
||||
"{}public const nint {} = {:#X};{}\n",
|
||||
indentation, name, value, comment
|
||||
)
|
||||
}
|
||||
|
@@ -22,9 +22,9 @@ impl FileBuilder for PythonFileBuilder {
|
||||
name: &str,
|
||||
comment: Option<&str>,
|
||||
) -> Result<()> {
|
||||
let comment = comment.map_or(String::new(), |c| format!("# {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" # {}", c));
|
||||
|
||||
write!(output, "class {}: {}\n", name, comment)
|
||||
write!(output, "class {}:{}\n", name, comment)
|
||||
}
|
||||
|
||||
fn write_variable(
|
||||
@@ -37,11 +37,11 @@ impl FileBuilder for PythonFileBuilder {
|
||||
) -> Result<()> {
|
||||
let indentation = " ".repeat(indentation.unwrap_or(4));
|
||||
|
||||
let comment = comment.map_or(String::new(), |c| format!("# {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" # {}", c));
|
||||
|
||||
write!(
|
||||
output,
|
||||
"{}{} = {:#X} {}\n",
|
||||
"{}{} = {:#X}{}\n",
|
||||
indentation, name, value, comment
|
||||
)
|
||||
}
|
||||
|
@@ -25,9 +25,9 @@ impl FileBuilder for RustFileBuilder {
|
||||
name: &str,
|
||||
comment: Option<&str>,
|
||||
) -> Result<()> {
|
||||
let comment = comment.map_or(String::new(), |c| format!("// {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" // {}", c));
|
||||
|
||||
write!(output, "pub mod {} {{ {}\n", name, comment)
|
||||
write!(output, "pub mod {} {{{}\n", name, comment)
|
||||
}
|
||||
|
||||
fn write_variable(
|
||||
@@ -40,11 +40,11 @@ impl FileBuilder for RustFileBuilder {
|
||||
) -> Result<()> {
|
||||
let indentation = " ".repeat(indentation.unwrap_or(4));
|
||||
|
||||
let comment = comment.map_or(String::new(), |c| format!("// {}", c));
|
||||
let comment = comment.map_or(String::new(), |c| format!(" // {}", c));
|
||||
|
||||
write!(
|
||||
output,
|
||||
"{}pub const {}: usize = {:#X}; {}\n",
|
||||
"{}pub const {}: usize = {:#X};{}\n",
|
||||
indentation, name, value, comment
|
||||
)
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ use simplelog::{debug, error, info};
|
||||
|
||||
use std::fs::File;
|
||||
|
||||
// Dumps all offsets specified in the `config.json` file and writes the results to a file.
|
||||
/// Dumps all offsets specified in the `config.json` file and writes the results to a file.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
@@ -144,9 +144,17 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
fn setup() -> Result<Process> {
|
||||
let mut process = Process::new("cs2.exe")?;
|
||||
|
||||
process.initialize()?;
|
||||
|
||||
Ok(process)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_number() -> Result<()> {
|
||||
let process = Process::new("cs2.exe")?;
|
||||
let process = setup()?;
|
||||
|
||||
let engine_base = process
|
||||
.get_module_by_name("engine2.dll")
|
||||
@@ -199,14 +207,14 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
let process = Process::new("cs2.exe")?;
|
||||
let process = setup()?;
|
||||
|
||||
let client_base = process
|
||||
.get_module_by_name("client.dll")
|
||||
.expect("Failed to find client.dll")
|
||||
.base();
|
||||
|
||||
let global_vars = process.read_memory::<*const GlobalVarsBase>(client_base + 0x1696F40)?;
|
||||
let global_vars = process.read_memory::<*const GlobalVarsBase>(client_base + 0x169AFE0)?;
|
||||
|
||||
let current_map_name = unsafe {
|
||||
(*global_vars)
|
||||
@@ -221,14 +229,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn local_player() -> Result<()> {
|
||||
let process = Process::new("cs2.exe")?;
|
||||
let process = setup()?;
|
||||
|
||||
let client_base = process
|
||||
.get_module_by_name("client.dll")
|
||||
.expect("Failed to find client.dll")
|
||||
.base();
|
||||
|
||||
let local_player_controller = process.read_memory::<usize>(client_base + 0x17E27C8)?;
|
||||
let local_player_controller = process.read_memory::<usize>(client_base + 0x17E8158)?;
|
||||
|
||||
let player_name = process.read_string((local_player_controller + 0x610).into())?;
|
||||
|
||||
@@ -239,15 +247,15 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn window_size() -> Result<()> {
|
||||
let process = Process::new("cs2.exe")?;
|
||||
let process = setup()?;
|
||||
|
||||
let engine_base = process
|
||||
.get_module_by_name("engine2.dll")
|
||||
.expect("Failed to find engine2.dll")
|
||||
.base();
|
||||
|
||||
let window_width = process.read_memory::<u32>(engine_base + 0x5386D0)?;
|
||||
let window_height = process.read_memory::<u32>(engine_base + 0x5386D4)?;
|
||||
let window_width = process.read_memory::<u32>(engine_base + 0x5386A8)?;
|
||||
let window_height = process.read_memory::<u32>(engine_base + 0x5386AC)?;
|
||||
|
||||
println!("Window size: {}x{}", window_width, window_height);
|
||||
|
||||
|
@@ -8,7 +8,7 @@ use anyhow::Result;
|
||||
|
||||
use simplelog::{debug, info};
|
||||
|
||||
// Dumps all schema system defined classes and writes the results to a file.
|
||||
/// Dumps all schema system classes and writes the results to a file.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
@@ -36,20 +36,17 @@ pub fn dump_schemas(
|
||||
let mut entries = Entries::new();
|
||||
|
||||
for class in type_scope.classes()? {
|
||||
let parent_name = match class.parent()?.map(|p| p.name().to_string()) {
|
||||
Some(name) => name,
|
||||
None => continue,
|
||||
};
|
||||
let parent_name = class.parent()?.map(|p| p.name().to_string());
|
||||
|
||||
debug!(
|
||||
"<i><u><bright-yellow>{}</></></> : <i><u><yellow>{}</></></>",
|
||||
class.name(),
|
||||
parent_name
|
||||
parent_name.clone().unwrap_or_default()
|
||||
);
|
||||
|
||||
let container = entries.entry(class.name().replace("::", "_")).or_default();
|
||||
|
||||
container.comment = Some(parent_name);
|
||||
container.comment = parent_name;
|
||||
|
||||
for field in class.fields()? {
|
||||
let name = field.name()?;
|
||||
|
@@ -38,7 +38,7 @@ struct Args {
|
||||
#[arg(short, long)]
|
||||
offsets: bool,
|
||||
|
||||
/// Dump schemas.
|
||||
/// Dump schema system classes.
|
||||
#[arg(short, long)]
|
||||
schemas: bool,
|
||||
|
||||
@@ -47,7 +47,7 @@ struct Args {
|
||||
verbose: bool,
|
||||
|
||||
/// Output folder.
|
||||
#[arg(short, long, default_value = "generated")]
|
||||
#[arg(long, default_value = "generated")]
|
||||
output: String,
|
||||
|
||||
/// Indentation level.
|
||||
|
Reference in New Issue
Block a user