This commit is contained in:
a2x 2023-10-15 22:17:02 +10:00
parent 33a08d218d
commit c55bdf15a2
59 changed files with 335 additions and 182 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "cs2-dumper"
version = "1.1.0"
version = "1.1.1"
authors = ["a2x"]
edition = "2021"
readme = "README.md"

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.831799400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.539445700 UTC
*/
public static class AimMatrixOpFixedSettings_t {
public const nint m_attachment = 0x0; // CAnimAttachment

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.808630100 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.515770200 UTC
*/
namespace AimMatrixOpFixedSettings_t {
constexpr std::ptrdiff_t m_attachment = 0x0; // CAnimAttachment

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.856065600 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.563817600 UTC
*/
pub mod AimMatrixOpFixedSettings_t {
pub const m_attachment: usize = 0x0; // CAnimAttachment

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.188128400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.884630900 UTC
*/
public static class ActiveModelConfig_t {
public const nint m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.147412100 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.843400800 UTC
*/
namespace ActiveModelConfig_t {
constexpr std::ptrdiff_t m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.229902300 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.927109500 UTC
*/
pub mod ActiveModelConfig_t {
pub const m_Handle: usize = 0x28; // ModelConfigHandle_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.666106100 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.375847600 UTC
*/
public static class CEntityComponentHelper {
public const nint m_flags = 0x8; // uint32_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.664094400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.373798700 UTC
*/
namespace CEntityComponentHelper {
constexpr std::ptrdiff_t m_flags = 0x8; // uint32_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.668437300 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.378512600 UTC
*/
pub mod CEntityComponentHelper {
pub const m_flags: usize = 0x8; // uint32_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.272441400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.969358100 UTC
*/
public static class CAnimScriptBase {
public const nint m_bIsValid = 0x8; // bool

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.271971 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.968868800 UTC
*/
namespace CAnimScriptBase {
constexpr std::ptrdiff_t m_bIsValid = 0x8; // bool

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.273270 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.970197200 UTC
*/
pub mod CAnimScriptBase {
pub const m_bIsValid: usize = 0x8; // bool

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.552341700 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:33.222923700 UTC
*/
public static class animationsystem_dll {
public const nint AnimationSystemUtils_001 = 0x64670;

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.549930800 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:33.220433600 UTC
*/
namespace animationsystem_dll {
constexpr std::ptrdiff_t AnimationSystemUtils_001 = 0x64670;

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:09.554948500 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:33.225495 UTC
*/
pub mod animationsystem_dll {
pub const AnimationSystemUtils_001: usize = 0x64670;

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.677717800 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.387776500 UTC
*/
public static class MaterialParamBuffer_t {
public const nint m_value = 0x8; // CUtlBinaryBlock

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.675997500 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.386044300 UTC
*/
namespace MaterialParamBuffer_t {
constexpr std::ptrdiff_t m_value = 0x8; // CUtlBinaryBlock

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.679671600 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.389748900 UTC
*/
pub mod MaterialParamBuffer_t {
pub const m_value: usize = 0x8; // CUtlBinaryBlock

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.681994300 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.392118600 UTC
*/
public static class ChangeAccessorFieldPathIndex_t {
public const nint m_Value = 0x0; // int16_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.681603300 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.391722300 UTC
*/
namespace ChangeAccessorFieldPathIndex_t {
constexpr std::ptrdiff_t m_Value = 0x0; // int16_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.682654600 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.392830500 UTC
*/
pub mod ChangeAccessorFieldPathIndex_t {
pub const m_Value: usize = 0x0; // int16_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:10.045575200 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:33.672128500 UTC
*/
public static class client_dll {
public const nint dwEntityList = 0x178FC88;

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:10.044386600 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:33.670867800 UTC
*/
namespace client_dll {
constexpr std::ptrdiff_t dwEntityList = 0x178FC88;

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:10.046951800 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:33.673543400 UTC
*/
pub mod client_dll {
pub const dwEntityList: usize = 0x178FC88;

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.263690400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.967344 UTC
*/
public static class CBaseRendererSource2 {
public const nint m_flRadiusScale = 0x200; // CParticleCollectionRendererFloatInput

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.224701300 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.927930 UTC
*/
namespace CBaseRendererSource2 {
constexpr std::ptrdiff_t m_flRadiusScale = 0x200; // CParticleCollectionRendererFloatInput

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.305765 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.008264 UTC
*/
pub mod CBaseRendererSource2 {
pub const m_flRadiusScale: usize = 0x200; // CParticleCollectionRendererFloatInput

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.008265200 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.713845500 UTC
*/
public static class CPulseCell_Base {
public const nint m_nEditorNodeID = 0x8; // PulseDocNodeID_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.005583400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.711122600 UTC
*/
namespace CPulseCell_Base {
constexpr std::ptrdiff_t m_nEditorNodeID = 0x8; // PulseDocNodeID_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.011364200 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.716897500 UTC
*/
pub mod CPulseCell_Base {
pub const m_nEditorNodeID: usize = 0x8; // PulseDocNodeID_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.652584400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.362776200 UTC
*/
public static class RenderInputLayoutField_t {
public const nint m_pSemanticName = 0x0; // uint8_t[32]

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.651789100 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.361960700 UTC
*/
namespace RenderInputLayoutField_t {
constexpr std::ptrdiff_t m_pSemanticName = 0x0; // uint8_t[32]

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.653714500 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.363913900 UTC
*/
pub mod RenderInputLayoutField_t {
pub const m_pSemanticName: usize = 0x0; // uint8_t[32]

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.648012200 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.358179600 UTC
*/
public static class AABB_t {
public const nint m_vMinBounds = 0x0; // Vector

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.646852600 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.356904800 UTC
*/
namespace AABB_t {
constexpr std::ptrdiff_t m_vMinBounds = 0x0; // Vector

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.649503 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.359706 UTC
*/
pub mod AABB_t {
pub const m_vMinBounds: usize = 0x0; // Vector

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.969286700 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.675288600 UTC
*/
public static class CSSDSEndFrameViewInfo {
public const nint m_nViewId = 0x0; // uint64_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.968148600 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.674184500 UTC
*/
namespace CSSDSEndFrameViewInfo {
constexpr std::ptrdiff_t m_nViewId = 0x0; // uint64_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.970666700 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.676655900 UTC
*/
pub mod CSSDSEndFrameViewInfo {
pub const m_nViewId: usize = 0x0; // uint64_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.637873300 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.348418900 UTC
*/
public static class CExampleSchemaVData_Monomorphic {
public const nint m_nExample1 = 0x0; // int32_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.636407800 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.347354400 UTC
*/
namespace CExampleSchemaVData_Monomorphic {
constexpr std::ptrdiff_t m_nExample1 = 0x0; // int32_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.639317700 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.349825800 UTC
*/
pub mod CExampleSchemaVData_Monomorphic {
pub const m_nExample1: usize = 0x0; // int32_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.785381800 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.484000900 UTC
*/
public static class ActiveModelConfig_t {
public const nint m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.715646100 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.413845700 UTC
*/
namespace ActiveModelConfig_t {
constexpr std::ptrdiff_t m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:08.856435 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:32.557311800 UTC
*/
pub mod ActiveModelConfig_t {
pub const m_Handle: usize = 0x28; // ModelConfigHandle_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.958367400 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.664413500 UTC
*/
public static class CDSPMixgroupModifier {
public const nint m_mixgroup = 0x0; // CUtlString

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.954931600 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.660932900 UTC
*/
namespace CDSPMixgroupModifier {
constexpr std::ptrdiff_t m_mixgroup = 0x0; // CUtlString

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.962135 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.668319800 UTC
*/
pub mod CDSPMixgroupModifier {
pub const m_mixgroup: usize = 0x0; // CUtlString

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.923654100 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.630609100 UTC
*/
public static class CFeIndexedJiggleBone {
public const nint m_nNode = 0x0; // uint32_t

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.915889900 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.622787900 UTC
*/
namespace CFeIndexedJiggleBone {
constexpr std::ptrdiff_t m_nNode = 0x0; // uint32_t

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.931753800 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.638771500 UTC
*/
pub mod CFeIndexedJiggleBone {
pub const m_nNode: usize = 0x0; // uint32_t

View File

@ -1,5 +1,7 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.986008800 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.691751700 UTC
*/
public static class AggregateLODSetup_t {
public const nint m_vLODOrigin = 0x0; // Vector

View File

@ -2,8 +2,10 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.983315700 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.689004 UTC
*/
namespace AggregateLODSetup_t {
constexpr std::ptrdiff_t m_vLODOrigin = 0x0; // Vector

View File

@ -1,7 +1,9 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-14 05:19:07.989091200 UTC
/*
* https://github.com/a2x/cs2-dumper
* 2023-10-15 12:13:31.694871800 UTC
*/
pub mod AggregateLODSetup_t {
pub const m_vLODOrigin: usize = 0x0; // Vector

View File

@ -1,3 +1,6 @@
use std::ffi::c_char;
use std::mem::offset_of;
use crate::builder::FileBuilderEnum;
use crate::dumpers::Entry;
use crate::error::Result;
@ -5,12 +8,44 @@ use crate::remote::Process;
use super::{generate_files, Entries};
#[derive(Debug)]
#[repr(C)]
struct InterfaceReg {
create_fn: *const (), // 0x0000
name: *const c_char, // 0x0008
next: *mut InterfaceReg, // 0x0010
}
impl InterfaceReg {
pub fn ptr(&self, process: &Process) -> Result<usize> {
process
.read_memory::<usize>(self as *const _ as usize + offset_of!(InterfaceReg, create_fn))
}
pub fn name(&self, process: &Process) -> Result<String> {
let name_ptr = process
.read_memory::<usize>(self as *const _ as usize + offset_of!(InterfaceReg, name))?;
process.read_string(name_ptr)
}
pub fn next(&self, process: &Process) -> Result<*mut InterfaceReg> {
process.read_memory::<*mut InterfaceReg>(
self as *const _ as usize + offset_of!(InterfaceReg, next),
)
}
}
pub fn dump_interfaces(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> Result<()> {
let module_names = process.get_loaded_modules()?;
let mut entries = Entries::new();
for module_name in module_names {
if module_name == "crashhandler64.dll" {
continue;
}
let module = process.get_module_by_name(&module_name)?;
if let Some(create_interface_export) = module.export("CreateInterface") {
@ -19,37 +54,32 @@ pub fn dump_interfaces(builders: &mut Vec<FileBuilderEnum>, process: &Process) -
let create_interface_address =
process.resolve_rip(create_interface_export.va, None, None)?;
let mut interface_registry_ptr = process
.read_memory::<usize>(create_interface_address)
.unwrap_or(0);
while interface_registry_ptr != 0 {
let interface_ptr = process.read_memory::<usize>(interface_registry_ptr)?;
let interface_version_ptr =
process.read_memory::<usize>(interface_registry_ptr + 0x8)?;
let interface_version = process.read_string(interface_version_ptr)?;
if let Ok(mut interface_reg) =
process.read_memory::<*mut InterfaceReg>(create_interface_address)
{
while !interface_reg.is_null() {
let ptr = unsafe { (*interface_reg).ptr(process) }?;
let name = unsafe { (*interface_reg).name(process) }?;
log::debug!(
" └─ {} @ {:#X} ({} + {:#X})",
interface_version,
interface_ptr,
name,
ptr,
module_name,
interface_ptr - module.base()
ptr - module.base()
);
entries
.entry(module_name.replace(".", "_"))
.or_default()
.push(Entry {
name: interface_version.clone(),
value: interface_ptr - module.base(),
name: name.clone(),
value: ptr - module.base(),
comment: None,
});
interface_registry_ptr =
process.read_memory::<usize>(interface_registry_ptr + 0x10)?;
interface_reg = unsafe { (*interface_reg).next(process) }?;
}
}
}
}

View File

@ -39,7 +39,7 @@ pub fn generate_file(
if builder.extension() != "json" {
write!(
file,
"// Created using https://github.com/a2x/cs2-dumper\n// {}\n\n",
"/*\n * https://github.com/a2x/cs2-dumper\n * {}\n */\n\n",
chrono::Utc::now()
)?;
}

View File

@ -1,4 +1,5 @@
#![allow(dead_code)]
#![feature(offset_of)]
use std::fs;
use std::time::Instant;

View File

@ -1,86 +1,102 @@
use std::mem::offset_of;
use crate::error::Result;
use crate::remote::Process;
#[derive(Debug)]
#[repr(C)]
pub struct HashBucketDataInternal<T, K> {
data: T,
pad_0: [u8; 8],
ui_key: K,
pub struct HashFixedDataInternal<T, K> {
ui_key: K, // 0x0010
next: *mut HashFixedDataInternal<T, K>, // 0x0010
data: T, // 0x0010
}
impl<T, K> HashBucketDataInternal<T, K> {
pub fn next(&self, process: &Process) -> Result<*const HashBucketDataInternal<T, K>> {
process
.read_memory::<*const HashBucketDataInternal<T, K>>((self as *const _ as usize) + 0x8)
impl<T, K> HashFixedDataInternal<T, K> {
pub fn next(&self, process: &Process) -> Result<*mut HashFixedDataInternal<T, K>> {
process.read_memory::<*mut HashFixedDataInternal<T, K>>(
(self as *const _ as usize) + offset_of!(HashFixedDataInternal<T, K>, next),
)
}
}
#[derive(Debug)]
#[repr(C)]
pub struct HashFixedDataInternal<T, K> {
ui_key: K,
pad_0: [u8; 8],
data: T,
pub struct HashBucketDataInternal<T, K> {
data: T, // 0x0000
next: *mut HashFixedDataInternal<T, K>, // 0x0008
ui_key: K, // 0x0010
}
impl<T, K> HashFixedDataInternal<T, K> {
pub fn next(&self, process: &Process) -> Result<*const HashFixedDataInternal<T, K>> {
process.read_memory::<*const HashFixedDataInternal<T, K>>((self as *const _ as usize) + 0x8)
impl<T, K> HashBucketDataInternal<T, K> {
pub fn next(&self, process: &Process) -> Result<*mut HashFixedDataInternal<T, K>> {
process.read_memory::<*mut HashFixedDataInternal<T, K>>(
(self as *const _ as usize) + offset_of!(HashBucketDataInternal<T, K>, next),
)
}
}
#[derive(Debug)]
#[repr(C)]
pub struct HashAllocatedData<T, K> {
list: [HashFixedDataInternal<T, K>; 128],
pad_0: [u8; 0x18], // 0x0000
list: [HashFixedDataInternal<T, K>; 128], // 0x0018
}
impl<T, K> HashAllocatedData<T, K> {
pub fn list(&self, process: &Process) -> Result<[HashFixedDataInternal<T, K>; 128]> {
process
.read_memory::<[HashFixedDataInternal<T, K>; 128]>((self as *const _ as usize) + 0x18)
process.read_memory::<[HashFixedDataInternal<T, K>; 128]>(
(self as *const _ as usize) + offset_of!(HashAllocatedData<T, K>, list),
)
}
}
#[derive(Debug)]
#[repr(C)]
pub struct HashUnallocatedData<T, K> {
block_list: [HashBucketDataInternal<T, K>; 256],
next: *mut HashUnallocatedData<T, K>, // 0x0000
unknown_1: K, // 0x0008
ui_key: K, // 0x0010
unknown_2: K, // 0x0018
block_list: [HashBucketDataInternal<T, K>; 256], // 0x0020
}
impl<T, K> HashUnallocatedData<T, K> {
pub fn next(&self, process: &Process) -> Result<*const HashUnallocatedData<T, K>> {
process.read_memory::<*const HashUnallocatedData<T, K>>(self as *const _ as usize)
pub fn next(&self, process: &Process) -> Result<*mut HashUnallocatedData<T, K>> {
process.read_memory::<*mut HashUnallocatedData<T, K>>(
self as *const _ as usize + offset_of!(HashUnallocatedData<T, K>, next),
)
}
pub fn ui_key(&self, process: &Process) -> Result<K> {
process.read_memory::<K>((self as *const _ as usize) + 0x10)
process.read_memory::<K>(
(self as *const _ as usize) + offset_of!(HashUnallocatedData<T, K>, ui_key),
)
}
pub fn block_list(&self, process: &Process) -> Result<[HashBucketDataInternal<T, K>; 256]> {
process
.read_memory::<[HashBucketDataInternal<T, K>; 256]>((self as *const _ as usize) + 0x20)
process.read_memory::<[HashBucketDataInternal<T, K>; 256]>(
(self as *const _ as usize) + offset_of!(HashUnallocatedData<T, K>, block_list),
)
}
}
#[derive(Debug)]
#[repr(C)]
pub struct HashBucket<T, K> {
pad_0: [u8; 16],
allocated_data: *const HashAllocatedData<T, K>,
unallocated_data: *const HashUnallocatedData<T, K>,
pad_0: [u8; 0x10], // 0x0000
allocated_data: *const HashAllocatedData<T, K>, // 0x0010
unallocated_data: *const HashUnallocatedData<T, K>, // 0x0018
}
#[derive(Debug)]
#[repr(C)]
pub struct UtlMemoryPool {
block_size: i32,
blocks_per_blob: i32,
grow_mode: i32,
blocks_allocated: i32,
block_allocated_size: i32,
peak_alloc: i32,
block_size: i32, // 0x0000
blocks_per_blob: i32, // 0x0004
grow_mode: i32, // 0x0008
blocks_allocated: i32, // 0x000C
block_allocated_size: i32, // 0x0010
peak_alloc: i32, // 0x0014
}
impl UtlMemoryPool {
@ -98,8 +114,8 @@ impl UtlMemoryPool {
#[derive(Debug)]
#[repr(C)]
pub struct UtlTsHash<T, K = u64> {
entry_memory: UtlMemoryPool,
buckets: HashBucket<T, K>,
entry_memory: UtlMemoryPool, // 0x0000
buckets: HashBucket<T, K>, // 0x0018
}
impl<T, K> UtlTsHash<T, K>
@ -124,8 +140,7 @@ where
let mut address = self.buckets.unallocated_data;
while !address.is_null() {
unsafe {
let block_list = (*address).block_list(process)?;
let block_list = unsafe { (*address).block_list(process) }?;
for i in 0..min_size {
list.push(block_list[i].data);
@ -135,8 +150,7 @@ where
}
}
address = (*address).next(process)?;
}
address = unsafe { (*address).next(process) }?;
}
Ok(list)