mirror of
https://github.com/a2x/cs2-dumper.git
synced 2026-04-17 19:49:58 +08:00
Release 1.1.4
This commit is contained in:
@@ -1,43 +1,57 @@
|
||||
use std::mem;
|
||||
use super::SchemaSystemTypeScope;
|
||||
|
||||
use crate::util::{Address, Process};
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
|
||||
use crate::mem::Address;
|
||||
use crate::remote::Process;
|
||||
|
||||
use super::SchemaSystemTypeScope;
|
||||
use std::mem;
|
||||
|
||||
/// Represents the schema system.
|
||||
pub struct SchemaSystem<'a> {
|
||||
process: &'a Process,
|
||||
|
||||
/// Address of the schema system.
|
||||
addr: Address,
|
||||
address: Address,
|
||||
}
|
||||
|
||||
impl<'a> SchemaSystem<'a> {
|
||||
/// Creates a new `SchemaSystem` instance.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `process` - A reference to the `Process` struct.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<SchemaSystem>` - The new `SchemaSystem` instance.
|
||||
pub fn new(process: &'a Process) -> Result<Self> {
|
||||
let mut addr = process.find_pattern(
|
||||
let mut address = process.find_pattern(
|
||||
"schemasystem.dll",
|
||||
"48 8D 0D ? ? ? ? E9 ? ? ? ? CC CC CC CC 48 8D 0D ? ? ? ? E9 ? ? ? ? CC CC CC CC 48 83 EC 28"
|
||||
)?;
|
||||
).expect("Failed to find SchemaSystem pattern");
|
||||
|
||||
addr = process.resolve_rip(addr, None, None)?;
|
||||
address = process.resolve_rip(address, 0x3, 0x7)?;
|
||||
|
||||
Ok(Self { process, addr })
|
||||
Ok(Self { process, address })
|
||||
}
|
||||
|
||||
/// Returns a list of type scopes.
|
||||
/// Returns a vector of `SchemaSystemTypeScope` objects.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `&self` - A reference to the `SchemaSystem` struct.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<Vec<SchemaSystemTypeScope>>` - A vector of `SchemaSystemTypeScope` objects.
|
||||
pub fn type_scopes(&self) -> Result<Vec<SchemaSystemTypeScope>> {
|
||||
let size = self.process.read_memory::<u32>(self.addr + 0x190)?;
|
||||
let size = self.process.read_memory::<u32>(self.address + 0x190)?;
|
||||
|
||||
if size == 0 {
|
||||
bail!("Type scopes size is 0");
|
||||
}
|
||||
|
||||
let data = self.process.read_memory::<usize>(self.addr + 0x198)?;
|
||||
let data = self.process.read_memory::<usize>(self.address + 0x198)?;
|
||||
|
||||
let mut addresses: Vec<usize> = vec![0; size as usize];
|
||||
let mut addresses = vec![0; size as usize];
|
||||
|
||||
self.process.read_memory_raw(
|
||||
data.into(),
|
||||
@@ -47,7 +61,7 @@ impl<'a> SchemaSystem<'a> {
|
||||
|
||||
let type_scopes: Vec<SchemaSystemTypeScope> = addresses
|
||||
.iter()
|
||||
.map(|&addr| SchemaSystemTypeScope::new(self.process, addr.into()))
|
||||
.map(|&address| SchemaSystemTypeScope::new(self.process, address.into()))
|
||||
.collect();
|
||||
|
||||
Ok(type_scopes)
|
||||
|
||||
Reference in New Issue
Block a user