mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-12-18 19:50:01 +08:00
Improve schema parsing
This commit is contained in:
@@ -8,9 +8,9 @@ use pelite::pe64::{Pe, PeView};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::source2::KeyboardKey;
|
||||
use crate::source2::KeyButton;
|
||||
|
||||
/// Represents a key button.
|
||||
/// Represents a keyboard button.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Button {
|
||||
pub name: String,
|
||||
@@ -29,7 +29,7 @@ pub fn buttons(process: &mut IntoProcessInstanceArcBox<'_>) -> Result<Vec<Button
|
||||
.scanner()
|
||||
.finds_code(pattern!("488b15${'} 4885d2 74? 0f1f40"), &mut save)
|
||||
{
|
||||
return Err(Error::Other("unable to find button list signature"));
|
||||
return Err(Error::Other("unable to find button list pattern"));
|
||||
}
|
||||
|
||||
read_buttons(process, &module, module.base + save[1])
|
||||
@@ -42,14 +42,13 @@ fn read_buttons(
|
||||
) -> Result<Vec<Button>> {
|
||||
let mut buttons = Vec::new();
|
||||
|
||||
let mut key_ptr = Pointer64::<KeyboardKey>::from(process.read_addr64(list_addr)?);
|
||||
let mut key_ptr = Pointer64::<KeyButton>::from(process.read_addr64(list_addr)?);
|
||||
|
||||
while !key_ptr.is_null() {
|
||||
let key = key_ptr.read(process)?;
|
||||
let name = key.name.read_string(process)?.to_string();
|
||||
|
||||
let value =
|
||||
((key_ptr.address() - module.base) + offset_of!(KeyboardKey.state) as i64) as u32;
|
||||
let value = ((key_ptr.address() - module.base) + offset_of!(KeyButton.state) as i64) as u32;
|
||||
|
||||
debug!(
|
||||
"found button: {} at {:#X} ({} + {:#X})",
|
||||
|
||||
Reference in New Issue
Block a user