mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-07-06 13:49:52 +08:00
Compare commits
5 Commits
4bf54462ac
...
42ecdf593a
Author | SHA1 | Date | |
---|---|---|---|
|
42ecdf593a | ||
|
8217df5885 | ||
|
7050e0a524 | ||
|
9765aff73f | ||
|
ce25283e79 |
@ -31,7 +31,8 @@ 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, --output <output>`: The output directory to write the generated files to. Default: `output`.
|
||||
- `-o, --os <os>`: The name of the target operating system.
|
||||
- `-d, --directory <directory>`: 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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
namespace CS2Dumper {
|
||||
// Module: libclient.so
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"build_number": 14000,
|
||||
"timestamp": "2024-03-29T08:41:42.046663095+00:00"
|
||||
"timestamp": "2024-03-29T14:38:50.188610842+00:00"
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
namespace CS2Dumper.Interfaces {
|
||||
// Module: libanimationsystem.so
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
namespace CS2Dumper.Offsets {
|
||||
// Module: libclient.so
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:41:42.046663095 UTC
|
||||
// 2024-03-29 14:38:50.188610842 UTC
|
||||
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
|
12553
output/linux/schemas.cs
12553
output/linux/schemas.cs
File diff suppressed because it is too large
Load Diff
12553
output/linux/schemas.hpp
12553
output/linux/schemas.hpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
12553
output/linux/schemas.rs
12553
output/linux/schemas.rs
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
namespace CS2Dumper {
|
||||
// Module: client.dll
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"build_number": 14000,
|
||||
"timestamp": "2024-03-29T08:38:09.039088900+00:00"
|
||||
"timestamp": "2024-03-29T14:47:15.019433800+00:00"
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
namespace CS2Dumper.Interfaces {
|
||||
// Module: animationsystem.dll
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
namespace CS2Dumper.Offsets {
|
||||
// Module: client.dll
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Generated using https://github.com/a2x/cs2-dumper
|
||||
// 2024-03-29 08:38:09.039088900 UTC
|
||||
// 2024-03-29 14:47:15.019433800 UTC
|
||||
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
|
12567
output/win/schemas.cs
12567
output/win/schemas.cs
File diff suppressed because it is too large
Load Diff
12567
output/win/schemas.hpp
12567
output/win/schemas.hpp
File diff suppressed because it is too large
Load Diff
21614
output/win/schemas.json
21614
output/win/schemas.json
File diff suppressed because it is too large
Load Diff
12567
output/win/schemas.rs
12567
output/win/schemas.rs
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@ pub struct Class {
|
||||
pub name: String,
|
||||
pub module_name: String,
|
||||
pub parent: Option<Box<Class>>,
|
||||
pub metadata: Vec<ClassMetadata>,
|
||||
pub metadata: Option<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)?;
|
||||
let metadata = read_class_binding_metadata(process, &binding).map(Some)?;
|
||||
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.len(),
|
||||
metadata.as_ref().map(|metadata| metadata.len()).unwrap_or(0),
|
||||
fields.len()
|
||||
);
|
||||
|
||||
@ -159,7 +159,7 @@ fn read_class_binding_metadata(
|
||||
binding: &SchemaClassBinding,
|
||||
) -> Result<Vec<ClassMetadata>> {
|
||||
if binding.static_metadata.is_null() {
|
||||
return Ok(Vec::new());
|
||||
return Err(Error::Other("class metadata is null"));
|
||||
}
|
||||
|
||||
(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)?.to_string();
|
||||
let ty = var_value.ty.read_string(process)?.replace(" ", "");
|
||||
|
||||
ClassMetadata::NetworkVarNames { name, ty }
|
||||
},
|
||||
|
42
src/main.rs
42
src/main.rs
@ -26,7 +26,7 @@ fn main() -> Result<()> {
|
||||
let start_time = Instant::now();
|
||||
|
||||
let matches = parse_args();
|
||||
let (conn_name, conn_args, indent_size, out_dir) = extract_args(&matches)?;
|
||||
let (conn_name, conn_args, os_name, indent_size, out_dir) = extract_args(&matches)?;
|
||||
|
||||
// Create the output directory if it doesn't exist.
|
||||
fs::create_dir_all(&out_dir)?;
|
||||
@ -34,17 +34,11 @@ 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.
|
||||
@ -92,10 +86,17 @@ fn parse_args() -> ArgMatches {
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("output")
|
||||
.help("The output directory to write the generated files to.")
|
||||
.long("output")
|
||||
Arg::new("os")
|
||||
.help("The name of the target operating system.")
|
||||
.long("os")
|
||||
.short('o')
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("directory")
|
||||
.help("The output directory to write the generated files to.")
|
||||
.long("directory")
|
||||
.short('d')
|
||||
.default_value("output")
|
||||
.value_parser(value_parser!(PathBuf))
|
||||
.required(false),
|
||||
@ -112,7 +113,9 @@ fn parse_args() -> ArgMatches {
|
||||
.get_matches()
|
||||
}
|
||||
|
||||
fn extract_args(matches: &ArgMatches) -> Result<(Option<String>, ConnectorArgs, usize, &PathBuf)> {
|
||||
fn extract_args(
|
||||
matches: &ArgMatches,
|
||||
) -> Result<(Option<String>, ConnectorArgs, String, usize, &PathBuf)> {
|
||||
use std::str::FromStr;
|
||||
|
||||
let log_level = match matches.get_count("verbose") {
|
||||
@ -141,8 +144,17 @@ fn extract_args(matches: &ArgMatches) -> Result<(Option<String>, ConnectorArgs,
|
||||
.map(|s| ConnectorArgs::from_str(&s).expect("unable to parse connector arguments"))
|
||||
.unwrap_or_default();
|
||||
|
||||
let indent_size = *matches.get_one::<usize>("indent-size").unwrap();
|
||||
let out_dir = matches.get_one::<PathBuf>("output").unwrap();
|
||||
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"),
|
||||
});
|
||||
|
||||
Ok((conn_name, conn_args, indent_size, out_dir))
|
||||
let indent_size = *matches.get_one::<usize>("indent-size").unwrap();
|
||||
let out_dir = matches.get_one::<PathBuf>("directory").unwrap();
|
||||
|
||||
Ok((conn_name, conn_args, os_name, indent_size, out_dir))
|
||||
}
|
||||
|
@ -64,7 +64,9 @@ impl CodeGen for SchemaMap {
|
||||
writeln!(fmt, "// Parent: {}", parent_name)?;
|
||||
writeln!(fmt, "// Fields count: {}", class.fields.len())?;
|
||||
|
||||
write_metadata(fmt, &class.metadata)?;
|
||||
if let Some(metadata) = &class.metadata {
|
||||
write_metadata(fmt, metadata)?;
|
||||
}
|
||||
|
||||
fmt.block(
|
||||
&format!("public static class {}", sanitize_name(&class.name)),
|
||||
@ -152,7 +154,9 @@ impl CodeGen for SchemaMap {
|
||||
writeln!(fmt, "// Parent: {}", parent_name)?;
|
||||
writeln!(fmt, "// Fields count: {}", class.fields.len())?;
|
||||
|
||||
write_metadata(fmt, &class.metadata)?;
|
||||
if let Some(metadata) = &class.metadata {
|
||||
write_metadata(fmt, metadata)?;
|
||||
}
|
||||
|
||||
fmt.block(
|
||||
&format!("namespace {}", sanitize_name(&class.name)),
|
||||
@ -198,6 +202,8 @@ impl CodeGen for SchemaMap {
|
||||
|
||||
let metadata: Vec<_> = class
|
||||
.metadata
|
||||
.as_ref()
|
||||
.unwrap_or(&vec![])
|
||||
.iter()
|
||||
.map(|metadata| match metadata {
|
||||
ClassMetadata::NetworkChangeCallback { name } => json!({
|
||||
@ -319,7 +325,9 @@ impl CodeGen for SchemaMap {
|
||||
writeln!(fmt, "// Parent: {}", parent_name)?;
|
||||
writeln!(fmt, "// Fields count: {}", class.fields.len())?;
|
||||
|
||||
write_metadata(fmt, &class.metadata)?;
|
||||
if let Some(metadata) = &class.metadata {
|
||||
write_metadata(fmt, metadata)?;
|
||||
}
|
||||
|
||||
fmt.block(
|
||||
&format!("pub mod {}", sanitize_name(&class.name)),
|
||||
|
@ -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 mut list = Vec::with_capacity(num_blocks);
|
||||
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);
|
||||
|
||||
while !element_ptr.is_null() {
|
||||
let element = element_ptr.read(process)?;
|
||||
|
||||
for i in 0..num_blocks {
|
||||
if i >= block_size || list.len() >= block_size {
|
||||
break;
|
||||
for i in 0..min_size {
|
||||
if list.len() >= self.entry.block_alloc_size as usize {
|
||||
return Ok(list);
|
||||
}
|
||||
|
||||
list.push(element.block_list[i].data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user