mirror of
https://github.com/a2x/cs2-dumper.git
synced 2026-04-18 02:09:58 +08:00
0.1.2
* Updated for memflow 0.2.2 * Replaced periods with underscores in generated file names for easier inclusion * Program execution now continues if analysis fails at any point * Removed custom error type in favor of anyhow * Added logging to cs2-dumper.log * Now compilable on Linux
This commit is contained in:
@@ -15,12 +15,8 @@ impl CodeWriter for InterfaceMap {
|
||||
&format!("public static class {}", AsPascalCase(slugify(module_name))),
|
||||
false,
|
||||
|fmt| {
|
||||
for iface in ifaces {
|
||||
writeln!(
|
||||
fmt,
|
||||
"public const nint {} = {:#X};",
|
||||
iface.name, iface.value
|
||||
)?;
|
||||
for (name, value) in ifaces {
|
||||
writeln!(fmt, "public const nint {} = {:#X};", name, value)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -45,12 +41,8 @@ impl CodeWriter for InterfaceMap {
|
||||
&format!("namespace {}", AsSnakeCase(slugify(module_name))),
|
||||
false,
|
||||
|fmt| {
|
||||
for iface in ifaces {
|
||||
writeln!(
|
||||
fmt,
|
||||
"constexpr std::ptrdiff_t {} = {:#X};",
|
||||
iface.name, iface.value
|
||||
)?;
|
||||
for (name, value) in ifaces {
|
||||
writeln!(fmt, "constexpr std::ptrdiff_t {} = {:#X};", name, value)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -67,16 +59,14 @@ impl CodeWriter for InterfaceMap {
|
||||
let content: BTreeMap<_, _> = self
|
||||
.iter()
|
||||
.map(|(module_name, ifaces)| {
|
||||
let ifaces: BTreeMap<_, _> = ifaces
|
||||
.iter()
|
||||
.map(|iface| (&iface.name, iface.value))
|
||||
.collect();
|
||||
let ifaces: BTreeMap<_, _> =
|
||||
ifaces.iter().map(|(name, value)| (name, value)).collect();
|
||||
|
||||
(module_name, ifaces)
|
||||
})
|
||||
.collect();
|
||||
|
||||
fmt.write_str(&serde_json::to_string_pretty(&content).expect("unable to serialize json"))
|
||||
fmt.write_str(&serde_json::to_string_pretty(&content).unwrap())
|
||||
}
|
||||
|
||||
fn write_rs(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
|
||||
@@ -91,12 +81,8 @@ impl CodeWriter for InterfaceMap {
|
||||
&format!("pub mod {}", AsSnakeCase(slugify(module_name))),
|
||||
false,
|
||||
|fmt| {
|
||||
for iface in ifaces {
|
||||
writeln!(
|
||||
fmt,
|
||||
"pub const {}: usize = {:#X};",
|
||||
iface.name, iface.value
|
||||
)?;
|
||||
for (name, value) in ifaces {
|
||||
writeln!(fmt, "pub const {}: usize = {:#X};", name, value)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user