mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-10-07 22:50:03 +08:00
Print field types
This commit is contained in:
@@ -2,6 +2,7 @@ pub use schema_class_field_data::SchemaClassFieldData;
|
||||
pub use schema_class_info::SchemaClassInfo;
|
||||
pub use schema_system::SchemaSystem;
|
||||
pub use schema_system_type_scope::SchemaSystemTypeScope;
|
||||
pub use schema_type::SchemaType;
|
||||
pub use schema_type_declared_class::SchemaTypeDeclaredClass;
|
||||
pub use utl_ts_hash::UtlTsHash;
|
||||
|
||||
@@ -9,5 +10,6 @@ pub mod schema_class_field_data;
|
||||
pub mod schema_class_info;
|
||||
pub mod schema_system;
|
||||
pub mod schema_system_type_scope;
|
||||
pub mod schema_type;
|
||||
pub mod schema_type_declared_class;
|
||||
pub mod utl_ts_hash;
|
||||
|
@@ -1,6 +1,8 @@
|
||||
use crate::error::Result;
|
||||
use crate::remote::Process;
|
||||
|
||||
use super::SchemaType;
|
||||
|
||||
pub struct SchemaClassFieldData<'a> {
|
||||
process: &'a Process,
|
||||
address: usize,
|
||||
@@ -12,9 +14,15 @@ impl<'a> SchemaClassFieldData<'a> {
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Result<String> {
|
||||
let name_ptr = self.process.read_memory::<usize>(self.address)?;
|
||||
self.process
|
||||
.read_string(self.process.read_memory::<usize>(self.address)?)
|
||||
}
|
||||
|
||||
self.process.read_string(name_ptr, 64)
|
||||
pub fn r#type(&self) -> Result<SchemaType> {
|
||||
Ok(SchemaType::new(
|
||||
self.process,
|
||||
self.process.read_memory::<usize>(self.address + 0x8)?,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn offset(&self) -> Result<u16> {
|
||||
|
@@ -28,13 +28,13 @@ impl<'a> SchemaClassInfo<'a> {
|
||||
|
||||
let fields: Vec<SchemaClassFieldData> = (0..count as usize)
|
||||
.filter_map(|i| {
|
||||
let field = self
|
||||
let address = self
|
||||
.process
|
||||
.read_memory::<usize>(self.address + 0x28)
|
||||
.ok()?
|
||||
+ (i * 0x20);
|
||||
|
||||
(field != 0).then(|| SchemaClassFieldData::new(self.process, field))
|
||||
(address != 0).then(|| SchemaClassFieldData::new(self.process, address))
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
@@ -35,6 +35,6 @@ impl<'a> SchemaSystemTypeScope<'a> {
|
||||
}
|
||||
|
||||
pub fn module_name(&self) -> Result<String> {
|
||||
self.process.read_string(self.address + 0x8, 256)
|
||||
self.process.read_string(self.address + 0x8)
|
||||
}
|
||||
}
|
||||
|
18
src/sdk/schema_type.rs
Normal file
18
src/sdk/schema_type.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use crate::error::Result;
|
||||
use crate::remote::Process;
|
||||
|
||||
pub struct SchemaType<'a> {
|
||||
process: &'a Process,
|
||||
address: usize,
|
||||
}
|
||||
|
||||
impl<'a> SchemaType<'a> {
|
||||
pub fn new(process: &'a Process, address: usize) -> Self {
|
||||
Self { process, address }
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Result<String> {
|
||||
self.process
|
||||
.read_string(self.process.read_memory::<usize>(self.address + 0x8)?)
|
||||
}
|
||||
}
|
@@ -12,8 +12,7 @@ impl<'a> SchemaTypeDeclaredClass<'a> {
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Result<String> {
|
||||
let name_ptr = self.process.read_memory::<usize>(self.address + 0x8)?;
|
||||
|
||||
self.process.read_string(name_ptr, 64)
|
||||
self.process
|
||||
.read_string(self.process.read_memory::<usize>(self.address + 0x8)?)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user