Compare commits

..

No commits in common. "42ecdf593ad6a7b4cbb1713367aa4443620a6e52" and "4bf54462ac380a998ebf9e99819746a6ed62b6f4" have entirely different histories.

33 changed files with 19021 additions and 99702 deletions

View File

@ -31,8 +31,7 @@ E.g. `cs2-dumper.exe -c pcileech -a device=fpga -vvv`
- `-v...`: Increase logging verbosity. Can be specified multiple times.
- `-c, --connector <connector>`: The name of the memflow connector to use.
- `-a, --connector-args <connector-args>`: Additional arguments to supply to the connector.
- `-o, --os <os>`: The name of the target operating system.
- `-d, --directory <directory>`: The output directory to write the generated files to. Default: `output`.
- `-o, --output <output>`: The output directory to write the generated files to. Default: `output`.
- `-i, --indent-size <indent-size>`: The number of spaces to use per indentation level. Default: `4`.
- `-h, --help`: Print help.
- `-V, --version`: Print version.

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
namespace CS2Dumper {
// Module: libclient.so

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
#pragma once

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
#![allow(non_upper_case_globals, unused)]

View File

@ -1,4 +1,4 @@
{
"build_number": 14000,
"timestamp": "2024-03-29T14:38:50.188610842+00:00"
"timestamp": "2024-03-29T08:41:42.046663095+00:00"
}

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
namespace CS2Dumper.Interfaces {
// Module: libanimationsystem.so

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
#pragma once

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
#![allow(non_upper_case_globals, unused)]

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
namespace CS2Dumper.Offsets {
// Module: libclient.so

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
#pragma once

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:38:50.188610842 UTC
// 2024-03-29 08:41:42.046663095 UTC
#![allow(non_upper_case_globals, unused)]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
namespace CS2Dumper {
// Module: client.dll

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
#pragma once

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
#![allow(non_upper_case_globals, unused)]

View File

@ -1,4 +1,4 @@
{
"build_number": 14000,
"timestamp": "2024-03-29T14:47:15.019433800+00:00"
"timestamp": "2024-03-29T08:38:09.039088900+00:00"
}

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
namespace CS2Dumper.Interfaces {
// Module: animationsystem.dll

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
#pragma once

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
#![allow(non_upper_case_globals, unused)]

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
namespace CS2Dumper.Offsets {
// Module: client.dll

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
#pragma once

View File

@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-03-29 14:47:15.019433800 UTC
// 2024-03-29 08:38:09.039088900 UTC
#![allow(non_upper_case_globals, unused)]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ pub struct Class {
pub name: String,
pub module_name: String,
pub parent: Option<Box<Class>>,
pub metadata: Option<Vec<ClassMetadata>>,
pub metadata: Vec<ClassMetadata>,
pub fields: Vec<ClassField>,
}
@ -99,7 +99,7 @@ fn read_class_binding(
.map(Box::new)
});
let metadata = read_class_binding_metadata(process, &binding).map(Some)?;
let metadata = read_class_binding_metadata(process, &binding)?;
let fields = read_class_binding_fields(process, &binding)?;
debug!(
@ -108,7 +108,7 @@ fn read_class_binding(
binding_ptr.to_umem(),
module_name,
parent.as_ref().map(|parent| parent.name.clone()),
metadata.as_ref().map(|metadata| metadata.len()).unwrap_or(0),
metadata.len(),
fields.len()
);
@ -159,7 +159,7 @@ fn read_class_binding_metadata(
binding: &SchemaClassBinding,
) -> Result<Vec<ClassMetadata>> {
if binding.static_metadata.is_null() {
return Err(Error::Other("class metadata is null"));
return Ok(Vec::new());
}
(0..binding.static_metadata_count)
@ -190,7 +190,7 @@ fn read_class_binding_metadata(
let var_value = network_value.union_data.var_value;
let name = var_value.name.read_string(process)?.to_string();
let ty = var_value.ty.read_string(process)?.replace(" ", "");
let ty = var_value.ty.read_string(process)?.to_string();
ClassMetadata::NetworkVarNames { name, ty }
},

View File

@ -26,7 +26,7 @@ fn main() -> Result<()> {
let start_time = Instant::now();
let matches = parse_args();
let (conn_name, conn_args, os_name, indent_size, out_dir) = extract_args(&matches)?;
let (conn_name, conn_args, indent_size, out_dir) = extract_args(&matches)?;
// Create the output directory if it doesn't exist.
fs::create_dir_all(&out_dir)?;
@ -34,11 +34,17 @@ fn main() -> Result<()> {
let os = if let Some(conn_name) = conn_name {
let inventory = Inventory::scan();
let os_name = match env::consts::OS {
"linux" => "linux",
"windows" => "win32",
_ => panic!("unsupported os"),
};
inventory
.builder()
.connector(&conn_name)
.args(conn_args)
.os(&os_name)
.os(os_name)
.build()?
} else {
// Fallback to the native OS layer if no connector name was provided.
@ -86,17 +92,10 @@ fn parse_args() -> ArgMatches {
.required(false),
)
.arg(
Arg::new("os")
.help("The name of the target operating system.")
.long("os")
.short('o')
.required(false),
)
.arg(
Arg::new("directory")
Arg::new("output")
.help("The output directory to write the generated files to.")
.long("directory")
.short('d')
.long("output")
.short('o')
.default_value("output")
.value_parser(value_parser!(PathBuf))
.required(false),
@ -113,9 +112,7 @@ fn parse_args() -> ArgMatches {
.get_matches()
}
fn extract_args(
matches: &ArgMatches,
) -> Result<(Option<String>, ConnectorArgs, String, usize, &PathBuf)> {
fn extract_args(matches: &ArgMatches) -> Result<(Option<String>, ConnectorArgs, usize, &PathBuf)> {
use std::str::FromStr;
let log_level = match matches.get_count("verbose") {
@ -144,17 +141,8 @@ fn extract_args(
.map(|s| ConnectorArgs::from_str(&s).expect("unable to parse connector arguments"))
.unwrap_or_default();
let os_name = matches
.get_one::<String>("os")
.map(|s| s.to_string())
.unwrap_or_else(|| match env::consts::OS {
"linux" => "linux".to_string(),
"windows" => "win32".to_string(),
_ => panic!("unsupported os"),
});
let indent_size = *matches.get_one::<usize>("indent-size").unwrap();
let out_dir = matches.get_one::<PathBuf>("directory").unwrap();
let out_dir = matches.get_one::<PathBuf>("output").unwrap();
Ok((conn_name, conn_args, os_name, indent_size, out_dir))
Ok((conn_name, conn_args, indent_size, out_dir))
}

View File

@ -64,9 +64,7 @@ impl CodeGen for SchemaMap {
writeln!(fmt, "// Parent: {}", parent_name)?;
writeln!(fmt, "// Fields count: {}", class.fields.len())?;
if let Some(metadata) = &class.metadata {
write_metadata(fmt, metadata)?;
}
write_metadata(fmt, &class.metadata)?;
fmt.block(
&format!("public static class {}", sanitize_name(&class.name)),
@ -154,9 +152,7 @@ impl CodeGen for SchemaMap {
writeln!(fmt, "// Parent: {}", parent_name)?;
writeln!(fmt, "// Fields count: {}", class.fields.len())?;
if let Some(metadata) = &class.metadata {
write_metadata(fmt, metadata)?;
}
write_metadata(fmt, &class.metadata)?;
fmt.block(
&format!("namespace {}", sanitize_name(&class.name)),
@ -202,8 +198,6 @@ impl CodeGen for SchemaMap {
let metadata: Vec<_> = class
.metadata
.as_ref()
.unwrap_or(&vec![])
.iter()
.map(|metadata| match metadata {
ClassMetadata::NetworkChangeCallback { name } => json!({
@ -325,9 +319,7 @@ impl CodeGen for SchemaMap {
writeln!(fmt, "// Parent: {}", parent_name)?;
writeln!(fmt, "// Fields count: {}", class.fields.len())?;
if let Some(metadata) = &class.metadata {
write_metadata(fmt, metadata)?;
}
write_metadata(fmt, &class.metadata)?;
fmt.block(
&format!("pub mod {}", sanitize_name(&class.name)),

View File

@ -74,19 +74,19 @@ pub struct UtlTsHash<T: HashData, K: HashKey = u64> {
impl<T: HashData, K: HashKey> UtlTsHash<T, K> {
pub fn elements(&self, process: &mut IntoProcessInstanceArcBox<'_>) -> Result<Vec<T>> {
let block_size = self.entry.blocks_per_blob as usize;
let num_blocks = self.entry.block_alloc_size as usize;
let mut element_ptr = self.buckets.unallocated_data;
let min_size =
(self.entry.blocks_per_blob as usize).min(self.entry.block_alloc_size as usize);
let mut list = Vec::with_capacity(min_size);
let mut list = Vec::with_capacity(num_blocks);
while !element_ptr.is_null() {
let element = element_ptr.read(process)?;
for i in 0..min_size {
if list.len() >= self.entry.block_alloc_size as usize {
return Ok(list);
for i in 0..num_blocks {
if i >= block_size || list.len() >= block_size {
break;
}
list.push(element.block_list[i].data);