Some improvements

This commit is contained in:
a2x 2023-10-05 19:24:14 +10:00
parent 85e6224275
commit d392a319ac
79 changed files with 653 additions and 426 deletions

View File

@ -6,3 +6,6 @@ end_of_line = lf
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
[*.json]
indent_size = 2

View File

@ -1,6 +1,6 @@
[package]
name = "cs2-dumper"
version = "1.0.9"
version = "1.1.0"
authors = ["a2x"]
edition = "2021"
repository = "https://github.com/a2x/cs2-dumper"
@ -9,6 +9,7 @@ license = "MIT"
[dependencies]
chrono = "0.4"
clap = { version = "4.4", features = ["derive"] }
lazy_static = "1.4"
log = "0.4"
regex = "1.9"
serde = { version = "1.0", features = ["derive"] }

View File

@ -1,211 +1,233 @@
{
"signatures": [
"signatures": [
{
"name": "dwBuildNumber",
"module": "engine2.dll",
"pattern": "8B 05 ? ? ? ? C3 CC CC CC CC CC CC CC CC CC 48 8B 0D ? ? ? ? 48 8D 05",
"operations": [
{
"name": "dwEntityList",
"module": "client.dll",
"pattern": "48 8B 0D ? ? ? ? 48 89 7C 24 ? 8B FA C1 EB",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwForceBackward",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 4C 8D 1D",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceCrouch",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 4C 8D 3D ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceForward",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 4C 8D 0D ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceJump",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 8D 1D ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceLeft",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 8D 0D ? ? ? ? 44 8B 15",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceRight",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 8D 15 ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwGlobalVars",
"module": "client.dll",
"pattern": "48 89 0D ? ? ? ? 48 89 41",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwInterfaceLinkList",
"module": "client.dll",
"pattern": "4C 8B 0D ? ? ? ? 4C 8B D2 4C 8B D9",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwLocalPlayerController",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 85 C0 74 4F",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwLocalPlayerPawn",
"module": "client.dll",
"pattern": "48 8D 05 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 83 EC ? 8B 0D",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 280
}
]
},
{
"name": "dwNetworkGameClient",
"module": "engine2.dll",
"pattern": "48 89 3D ? ? ? ? 48 8D 15",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwNetworkGameClient_maxClients",
"module": "engine2.dll",
"pattern": "8B 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC CC 48 8D 81",
"operations": [
{
"type": "offset",
"position": 2
}
]
},
{
"name": "dwNetworkGameClient_signOnState",
"module": "engine2.dll",
"pattern": "44 8B 81 ? ? ? ? 48 8D 0D",
"operations": [
{
"type": "offset",
"position": 3
}
]
},
{
"name": "dwPlantedC4",
"module": "client.dll",
"pattern": "48 89 05 ? ? ? ? 8B 05 ? ? ? ? A9 ? ? ? ? 74 ? 25 ? ? ? ? 89 05 ? ? ? ? 8B 0D",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwViewAngles",
"module": "client.dll",
"pattern": "48 8B 0D ? ? ? ? 48 8B 01 48 FF 60 30",
"operations": [
{
"type": "ripRelative"
},
{
"type": "dereference"
},
{
"type": "add",
"value": 17680
}
]
},
{
"name": "dwViewMatrix",
"module": "client.dll",
"pattern": "48 8D 0D ? ? ? ? 48 C1 E0 06",
"operations": [
{
"type": "ripRelative"
}
]
"type": "ripRelative",
"offset": 2,
"length": 6
}
]
]
},
{
"name": "dwEntityList",
"module": "client.dll",
"pattern": "48 8B 0D ? ? ? ? 48 89 7C 24 ? 8B FA C1 EB",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwForceBackward",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 4C 8D 1D",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceCrouch",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 4C 8D 3D ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceForward",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 4C 8D 0D ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceJump",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 8D 1D ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceLeft",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 8D 0D ? ? ? ? 44 8B 15",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwForceRight",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 8D 15 ? ? ? ? 48 89 45",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 48
}
]
},
{
"name": "dwGlobalVars",
"module": "client.dll",
"pattern": "48 89 0D ? ? ? ? 48 89 41",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwInterfaceLinkList",
"module": "client.dll",
"pattern": "4C 8B 0D ? ? ? ? 4C 8B D2 4C 8B D9",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwLocalPlayerController",
"module": "client.dll",
"pattern": "48 8B 05 ? ? ? ? 48 85 C0 74 4F",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwLocalPlayerPawn",
"module": "client.dll",
"pattern": "48 8D 05 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 83 EC ? 8B 0D",
"operations": [
{
"type": "ripRelative"
},
{
"type": "add",
"value": 280
}
]
},
{
"name": "dwNetworkGameClient",
"module": "engine2.dll",
"pattern": "48 89 3D ? ? ? ? 48 8D 15",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwNetworkGameClient_maxClients",
"module": "engine2.dll",
"pattern": "8B 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC CC 48 8D 81",
"operations": [
{
"type": "offset",
"offset": 2
}
]
},
{
"name": "dwNetworkGameClient_signOnState",
"module": "engine2.dll",
"pattern": "44 8B 81 ? ? ? ? 48 8D 0D",
"operations": [
{
"type": "offset",
"offset": 3
}
]
},
{
"name": "dwPlantedC4",
"module": "client.dll",
"pattern": "48 89 05 ? ? ? ? 8B 05 ? ? ? ? A9 ? ? ? ? 74 ? 25 ? ? ? ? 89 05 ? ? ? ? 8B 0D",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwViewAngles",
"module": "client.dll",
"pattern": "48 8B 0D ? ? ? ? 48 8B 01 48 FF 60 30",
"operations": [
{
"type": "ripRelative"
},
{
"type": "dereference"
},
{
"type": "add",
"value": 17680
}
]
},
{
"name": "dwViewMatrix",
"module": "client.dll",
"pattern": "48 8D 0D ? ? ? ? 48 C1 E0 06",
"operations": [
{
"type": "ripRelative"
}
]
},
{
"name": "dwViewRender",
"module": "client.dll",
"pattern": "48 89 05 ? ? ? ? 48 8B C8 48 85 C0",
"operations": [
{
"type": "ripRelative"
}
]
}
]
}

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.293186400 UTC
// 2023-10-05 09:19:34.667241100 UTC
public static class AimMatrixOpFixedSettings_t {
public const nint m_attachment = 0x0; // CAnimAttachment

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.268839400 UTC
// 2023-10-05 09:19:34.642827900 UTC
namespace AimMatrixOpFixedSettings_t {
constexpr std::ptrdiff_t m_attachment = 0x0; // CAnimAttachment

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.318124500 UTC
// 2023-10-05 09:19:34.695120700 UTC
pub mod AimMatrixOpFixedSettings_t {
pub const m_attachment: usize = 0x0; // CAnimAttachment

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.651759900 UTC
// 2023-10-05 09:19:35.662868800 UTC
public static class ActiveModelConfig_t {
public const nint m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.609246100 UTC
// 2023-10-05 09:19:35.619759200 UTC
namespace ActiveModelConfig_t {
constexpr std::ptrdiff_t m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.695616700 UTC
// 2023-10-05 09:19:35.711809400 UTC
pub mod ActiveModelConfig_t {
pub const m_Handle: usize = 0x28; // ModelConfigHandle_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.127847500 UTC
// 2023-10-05 09:19:34.560560900 UTC
public static class CEntityComponentHelper {
public const nint m_flags = 0x8; // uint32_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.125851100 UTC
// 2023-10-05 09:19:34.558788900 UTC
namespace CEntityComponentHelper {
constexpr std::ptrdiff_t m_flags = 0x8; // uint32_t

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.130237900 UTC
// 2023-10-05 09:19:34.562792700 UTC
pub mod CEntityComponentHelper {
pub const m_flags: usize = 0x8; // uint32_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.739512800 UTC
// 2023-10-05 09:19:35.757364200 UTC
public static class CAnimScriptBase {
public const nint m_bIsValid = 0x8; // bool

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.738920100 UTC
// 2023-10-05 09:19:35.757106900 UTC
namespace CAnimScriptBase {
constexpr std::ptrdiff_t m_bIsValid = 0x8; // bool

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.740509700 UTC
// 2023-10-05 09:19:35.758160200 UTC
pub mod CAnimScriptBase {
pub const m_bIsValid: usize = 0x8; // bool

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.958671700 UTC
// 2023-10-05 09:19:36.014308700 UTC
public static class animationsystem_dll {
public const nint AnimationSystemUtils_001 = 0x64510;

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.956230300 UTC
// 2023-10-05 09:19:36.012124900 UTC
namespace animationsystem_dll {
constexpr std::ptrdiff_t AnimationSystemUtils_001 = 0x64510;

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.961425300 UTC
// 2023-10-05 09:19:36.016851600 UTC
pub mod animationsystem_dll {
pub const AnimationSystemUtils_001: usize = 0x64510;

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.140123200 UTC
// 2023-10-05 09:19:34.569383800 UTC
public static class MaterialParamBuffer_t {
public const nint m_value = 0x8; // CUtlBinaryBlock

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.138264800 UTC
// 2023-10-05 09:19:34.567983900 UTC
namespace MaterialParamBuffer_t {
constexpr std::ptrdiff_t m_value = 0x8; // CUtlBinaryBlock

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.142070700 UTC
// 2023-10-05 09:19:34.571142800 UTC
pub mod MaterialParamBuffer_t {
pub const m_value: usize = 0x8; // CUtlBinaryBlock

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.144410300 UTC
// 2023-10-05 09:19:34.573415400 UTC
public static class ChangeAccessorFieldPathIndex_t {
public const nint m_Value = 0x0; // int16_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.143969300 UTC
// 2023-10-05 09:19:34.572930200 UTC
namespace ChangeAccessorFieldPathIndex_t {
constexpr std::ptrdiff_t m_Value = 0x0; // int16_t

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.145143100 UTC
// 2023-10-05 09:19:34.574196800 UTC
pub mod ChangeAccessorFieldPathIndex_t {
pub const m_Value: usize = 0x0; // int16_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:56.262084800 UTC
// 2023-10-05 09:19:39.896759200 UTC
public static class client_dll {
public const nint dwEntityList = 0x178D8D8;
@ -16,9 +16,11 @@ public static class client_dll {
public const nint dwPlantedC4 = 0x1880D80;
public const nint dwViewAngles = 0x18DA6F0;
public const nint dwViewMatrix = 0x187B720;
public const nint dwViewRender = 0x187C110;
}
public static class engine2_dll {
public const nint dwBuildNumber = 0x48B504;
public const nint dwNetworkGameClient = 0x48AAB0;
public const nint dwNetworkGameClient_maxClients = 0x250;
public const nint dwNetworkGameClient_signOnState = 0x240;

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:56.260802500 UTC
// 2023-10-05 09:19:39.896326900 UTC
namespace client_dll {
constexpr std::ptrdiff_t dwEntityList = 0x178D8D8;
@ -20,9 +20,11 @@ namespace client_dll {
constexpr std::ptrdiff_t dwPlantedC4 = 0x1880D80;
constexpr std::ptrdiff_t dwViewAngles = 0x18DA6F0;
constexpr std::ptrdiff_t dwViewMatrix = 0x187B720;
constexpr std::ptrdiff_t dwViewRender = 0x187C110;
}
namespace engine2_dll {
constexpr std::ptrdiff_t dwBuildNumber = 0x48B504;
constexpr std::ptrdiff_t dwNetworkGameClient = 0x48AAB0;
constexpr std::ptrdiff_t dwNetworkGameClient_maxClients = 0x250;
constexpr std::ptrdiff_t dwNetworkGameClient_signOnState = 0x240;

View File

@ -13,9 +13,11 @@
"dwLocalPlayerPawn": 25668664,
"dwPlantedC4": 25693568,
"dwViewAngles": 26060528,
"dwViewMatrix": 25671456
"dwViewMatrix": 25671456,
"dwViewRender": 25674000
},
"engine2_dll": {
"dwBuildNumber": 4764932,
"dwNetworkGameClient": 4762288,
"dwNetworkGameClient_maxClients": 592,
"dwNetworkGameClient_signOnState": 576

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:56.263443200 UTC
// 2023-10-05 09:19:39.897461600 UTC
pub mod client_dll {
pub const dwEntityList: usize = 0x178D8D8;
@ -18,9 +18,11 @@ pub mod client_dll {
pub const dwPlantedC4: usize = 0x1880D80;
pub const dwViewAngles: usize = 0x18DA6F0;
pub const dwViewMatrix: usize = 0x187B720;
pub const dwViewRender: usize = 0x187C110;
}
pub mod engine2_dll {
pub const dwBuildNumber: usize = 0x48B504;
pub const dwNetworkGameClient: usize = 0x48AAB0;
pub const dwNetworkGameClient_maxClients: usize = 0x250;
pub const dwNetworkGameClient_signOnState: usize = 0x240;

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.725198 UTC
// 2023-10-05 09:19:34.974961300 UTC
public static class CBaseRendererSource2 {
public const nint m_flRadiusScale = 0x200; // CParticleCollectionRendererFloatInput

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.684167100 UTC
// 2023-10-05 09:19:34.932966200 UTC
namespace CBaseRendererSource2 {
constexpr std::ptrdiff_t m_flRadiusScale = 0x200; // CParticleCollectionRendererFloatInput

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.767600300 UTC
// 2023-10-05 09:19:35.022167300 UTC
pub mod CBaseRendererSource2 {
pub const m_flRadiusScale: usize = 0x200; // CParticleCollectionRendererFloatInput

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.471908300 UTC
// 2023-10-05 09:19:34.810876 UTC
public static class CPulseCell_Base {
public const nint m_nEditorNodeID = 0x8; // PulseDocNodeID_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.469179200 UTC
// 2023-10-05 09:19:34.808438400 UTC
namespace CPulseCell_Base {
constexpr std::ptrdiff_t m_nEditorNodeID = 0x8; // PulseDocNodeID_t

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.475045800 UTC
// 2023-10-05 09:19:34.813877 UTC
pub mod CPulseCell_Base {
pub const m_nEditorNodeID: usize = 0x8; // PulseDocNodeID_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.114930700 UTC
// 2023-10-05 09:19:34.552716500 UTC
public static class RenderInputLayoutField_t {
public const nint m_pSemanticName = 0x0; // uint8_t[32]

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.114211100 UTC
// 2023-10-05 09:19:34.552277100 UTC
namespace RenderInputLayoutField_t {
constexpr std::ptrdiff_t m_pSemanticName = 0x0; // uint8_t[32]

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.116018500 UTC
// 2023-10-05 09:19:34.553405700 UTC
pub mod RenderInputLayoutField_t {
pub const m_pSemanticName: usize = 0x0; // uint8_t[32]

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.110426400 UTC
// 2023-10-05 09:19:34.549605700 UTC
public static class AABB_t {
public const nint m_vMinBounds = 0x0; // Vector

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.109276500 UTC
// 2023-10-05 09:19:34.548743800 UTC
namespace AABB_t {
constexpr std::ptrdiff_t m_vMinBounds = 0x0; // Vector

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.111906500 UTC
// 2023-10-05 09:19:34.550779500 UTC
pub mod AABB_t {
pub const m_vMinBounds: usize = 0x0; // Vector

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.433173600 UTC
// 2023-10-05 09:19:34.784427700 UTC
public static class CSSDSEndFrameViewInfo {
public const nint m_nViewId = 0x0; // uint64_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.432163400 UTC
// 2023-10-05 09:19:34.783762800 UTC
namespace CSSDSEndFrameViewInfo {
constexpr std::ptrdiff_t m_nViewId = 0x0; // uint64_t

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.434471200 UTC
// 2023-10-05 09:19:34.785367500 UTC
pub mod CSSDSEndFrameViewInfo {
pub const m_nViewId: usize = 0x0; // uint64_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.100269600 UTC
// 2023-10-05 09:19:34.542653200 UTC
public static class CExampleSchemaVData_Monomorphic {
public const nint m_nExample1 = 0x0; // int32_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.099083300 UTC
// 2023-10-05 09:19:34.541875600 UTC
namespace CExampleSchemaVData_Monomorphic {
constexpr std::ptrdiff_t m_nExample1 = 0x0; // int32_t

View File

@ -1 +1,42 @@
null
{
"CExampleSchemaVData_Monomorphic": {
"m_nExample1": 0,
"m_nExample2": 4
},
"CExampleSchemaVData_PolymorphicBase": {
"m_nBase": 8
},
"CExampleSchemaVData_PolymorphicDerivedA": {
"m_nDerivedA": 16
},
"CExampleSchemaVData_PolymorphicDerivedB": {
"m_nDerivedB": 16
},
"CSchemaSystemInternalRegistration": {
"m_CTransform": 256,
"m_CUtlBinaryBlock": 296,
"m_CUtlString": 320,
"m_CUtlSymbol": 328,
"m_Color": 224,
"m_DegreeEuler": 100,
"m_KV3": 368,
"m_QAngle": 64,
"m_Quaternion": 48,
"m_QuaternionStorage": 112,
"m_RadianEuler": 88,
"m_ResourceTypes": 360,
"m_RotationVector": 76,
"m_Vector": 8,
"m_Vector2D": 0,
"m_Vector4D": 228,
"m_VectorAligned": 32,
"m_matrix3x4_t": 128,
"m_matrix3x4a_t": 176,
"m_pKeyValues": 288,
"m_stringToken": 332,
"m_stringTokenWithStorage": 336
},
"ResourceId_t": {
"m_Value": 0
}
}

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.101575700 UTC
// 2023-10-05 09:19:34.543706300 UTC
pub mod CExampleSchemaVData_Monomorphic {
pub const m_nExample1: usize = 0x0; // int32_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.246729700 UTC
// 2023-10-05 09:19:35.342246200 UTC
public static class ActiveModelConfig_t {
public const nint m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.174798400 UTC
// 2023-10-05 09:19:35.267923100 UTC
namespace ActiveModelConfig_t {
constexpr std::ptrdiff_t m_Handle = 0x28; // ModelConfigHandle_t

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:55.321471200 UTC
// 2023-10-05 09:19:35.425521100 UTC
pub mod ActiveModelConfig_t {
pub const m_Handle: usize = 0x28; // ModelConfigHandle_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.422369100 UTC
// 2023-10-05 09:19:34.775389500 UTC
public static class CDSPMixgroupModifier {
public const nint m_mixgroup = 0x0; // CUtlString

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.418762100 UTC
// 2023-10-05 09:19:34.772136700 UTC
namespace CDSPMixgroupModifier {
constexpr std::ptrdiff_t m_mixgroup = 0x0; // CUtlString

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.426359200 UTC
// 2023-10-05 09:19:34.779289900 UTC
pub mod CDSPMixgroupModifier {
pub const m_mixgroup: usize = 0x0; // CUtlString

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.387194800 UTC
// 2023-10-05 09:19:34.747380500 UTC
public static class CFeIndexedJiggleBone {
public const nint m_nNode = 0x0; // uint32_t

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.379324500 UTC
// 2023-10-05 09:19:34.739694300 UTC
namespace CFeIndexedJiggleBone {
constexpr std::ptrdiff_t m_nNode = 0x0; // uint32_t

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.395829400 UTC
// 2023-10-05 09:19:34.756221200 UTC
pub mod CFeIndexedJiggleBone {
pub const m_nNode: usize = 0x0; // uint32_t

View File

@ -1,5 +1,5 @@
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.450170100 UTC
// 2023-10-05 09:19:34.795569700 UTC
public static class AggregateLODSetup_t {
public const nint m_vLODOrigin = 0x0; // Vector

View File

@ -3,7 +3,7 @@
#include <cstddef>
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.447335200 UTC
// 2023-10-05 09:19:34.792876300 UTC
namespace AggregateLODSetup_t {
constexpr std::ptrdiff_t m_vLODOrigin = 0x0; // Vector

View File

@ -1,7 +1,7 @@
#![allow(non_snake_case, non_upper_case_globals)]
// Created using https://github.com/a2x/cs2-dumper
// 2023-10-04 03:08:54.453415300 UTC
// 2023-10-05 09:19:34.798871100 UTC
pub mod AggregateLODSetup_t {
pub const m_vLODOrigin: usize = 0x0; // Vector

View File

@ -2,9 +2,10 @@ use std::io::{Result, Write};
use super::FileBuilder;
pub struct CppBuilder;
#[derive(Debug, PartialEq)]
pub struct CppFileBuilder;
impl FileBuilder for CppBuilder {
impl FileBuilder for CppFileBuilder {
fn extension(&mut self) -> &str {
"hpp"
}

View File

@ -2,9 +2,10 @@ use std::io::{Result, Write};
use super::FileBuilder;
pub struct CSharpBuilder;
#[derive(Debug, PartialEq)]
pub struct CSharpFileBuilder;
impl FileBuilder for CSharpBuilder {
impl FileBuilder for CSharpFileBuilder {
fn extension(&mut self) -> &str {
"cs"
}

View File

@ -1,15 +1,24 @@
use std::io::{Result, Write};
use serde_json::{json, Value};
use serde_json::{json, Map, Value};
use super::FileBuilder;
#[derive(Default)]
#[derive(Debug, PartialEq)]
pub struct JsonFileBuilder {
json: Value,
namespace: String,
}
impl Default for JsonFileBuilder {
fn default() -> Self {
Self {
json: Value::Object(Map::new()),
namespace: String::new(),
}
}
}
impl FileBuilder for JsonFileBuilder {
fn extension(&mut self) -> &str {
"json"
@ -32,13 +41,11 @@ impl FileBuilder for JsonFileBuilder {
value: usize,
_comment: Option<&str>,
) -> Result<()> {
if let Some(json_as_map) = self.json.as_object_mut() {
let namespace_entry = json_as_map
.entry(self.namespace.clone())
.or_insert_with(|| json!({}));
if let Some(map) = self.json.as_object_mut() {
let entry = map.entry(&self.namespace).or_insert_with(|| json!({}));
if let Some(namespace_object) = namespace_entry.as_object_mut() {
namespace_object.insert(name.to_string(), json!(value));
if let Some(object) = entry.as_object_mut() {
object.insert(name.to_string(), json!(value));
}
}
@ -47,12 +54,7 @@ impl FileBuilder for JsonFileBuilder {
fn write_closure(&mut self, output: &mut dyn Write, eof: bool) -> Result<()> {
if eof {
write!(
output,
"{}",
serde_json::to_string_pretty(&self.json).unwrap()
)
.unwrap();
write!(output, "{}", serde_json::to_string_pretty(&self.json)?)?;
self.json = json!({});
}

View File

@ -1,7 +1,7 @@
pub use std::io::{Result, Write};
pub use cpp_file_builder::CppBuilder;
pub use csharp_file_builder::CSharpBuilder;
pub use cpp_file_builder::CppFileBuilder;
pub use csharp_file_builder::CSharpFileBuilder;
pub use file_builder::FileBuilder;
pub use json_file_builder::JsonFileBuilder;
pub use rust_file_builder::RustFileBuilder;
@ -12,39 +12,25 @@ pub mod file_builder;
pub mod json_file_builder;
pub mod rust_file_builder;
#[derive(Debug, PartialEq)]
pub enum FileBuilderEnum {
CppBuilder(CppBuilder),
CSharpBuilder(CSharpBuilder),
CppFileBuilder(CppFileBuilder),
CSharpFileBuilder(CSharpFileBuilder),
JsonFileBuilder(JsonFileBuilder),
RustFileBuilder(RustFileBuilder),
}
impl FileBuilder for FileBuilderEnum {
fn extension(&mut self) -> &str {
match self {
FileBuilderEnum::CppBuilder(builder) => builder.extension(),
FileBuilderEnum::CSharpBuilder(builder) => builder.extension(),
FileBuilderEnum::JsonFileBuilder(builder) => builder.extension(),
FileBuilderEnum::RustFileBuilder(builder) => builder.extension(),
}
self.as_mut().extension()
}
fn write_top_level(&mut self, output: &mut dyn Write) -> Result<()> {
match self {
FileBuilderEnum::CppBuilder(builder) => builder.write_top_level(output),
FileBuilderEnum::CSharpBuilder(builder) => builder.write_top_level(output),
FileBuilderEnum::JsonFileBuilder(builder) => builder.write_top_level(output),
FileBuilderEnum::RustFileBuilder(builder) => builder.write_top_level(output),
}
self.as_mut().write_top_level(output)
}
fn write_namespace(&mut self, output: &mut dyn Write, name: &str) -> Result<()> {
match self {
FileBuilderEnum::CppBuilder(builder) => builder.write_namespace(output, name),
FileBuilderEnum::CSharpBuilder(builder) => builder.write_namespace(output, name),
FileBuilderEnum::JsonFileBuilder(builder) => builder.write_namespace(output, name),
FileBuilderEnum::RustFileBuilder(builder) => builder.write_namespace(output, name),
}
self.as_mut().write_namespace(output, name)
}
fn write_variable(
@ -54,28 +40,21 @@ impl FileBuilder for FileBuilderEnum {
value: usize,
comment: Option<&str>,
) -> Result<()> {
match self {
FileBuilderEnum::CppBuilder(builder) => {
builder.write_variable(output, name, value, comment)
}
FileBuilderEnum::CSharpBuilder(builder) => {
builder.write_variable(output, name, value, comment)
}
FileBuilderEnum::JsonFileBuilder(builder) => {
builder.write_variable(output, name, value, comment)
}
FileBuilderEnum::RustFileBuilder(builder) => {
builder.write_variable(output, name, value, comment)
}
}
self.as_mut().write_variable(output, name, value, comment)
}
fn write_closure(&mut self, output: &mut dyn Write, eof: bool) -> Result<()> {
self.as_mut().write_closure(output, eof)
}
}
impl FileBuilderEnum {
fn as_mut(&mut self) -> &mut dyn FileBuilder {
match self {
FileBuilderEnum::CppBuilder(builder) => builder.write_closure(output, eof),
FileBuilderEnum::CSharpBuilder(builder) => builder.write_closure(output, eof),
FileBuilderEnum::JsonFileBuilder(builder) => builder.write_closure(output, eof),
FileBuilderEnum::RustFileBuilder(builder) => builder.write_closure(output, eof),
FileBuilderEnum::CppFileBuilder(builder) => builder,
FileBuilderEnum::CSharpFileBuilder(builder) => builder,
FileBuilderEnum::JsonFileBuilder(builder) => builder,
FileBuilderEnum::RustFileBuilder(builder) => builder,
}
}
}

View File

@ -2,6 +2,7 @@ use std::io::{Result, Write};
use super::FileBuilder;
#[derive(Debug, Default, PartialEq)]
pub struct RustFileBuilder;
impl FileBuilder for RustFileBuilder {

View File

@ -3,12 +3,26 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
#[serde(tag = "type", rename_all = "camelCase")]
pub enum Operation {
Add { value: usize },
Dereference { times: Option<u16> },
Jmp,
Offset { position: usize },
RipRelative,
Subtract { value: usize },
Add {
value: usize,
},
Dereference {
times: Option<u16>,
},
Jmp {
offset: Option<usize>,
length: Option<usize>,
},
Offset {
offset: usize,
},
RipRelative {
offset: Option<usize>,
length: Option<usize>,
},
Subtract {
value: usize,
},
}
#[derive(Debug, Deserialize, Serialize)]

View File

@ -3,7 +3,7 @@ use crate::dumpers::Entry;
use crate::error::Result;
use crate::remote::Process;
use super::{generate_file, Entries};
use super::{generate_files, Entries};
pub fn dump_interfaces(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> Result<()> {
let module_names = process.get_loaded_modules()?;
@ -16,7 +16,8 @@ pub fn dump_interfaces(builders: &mut Vec<FileBuilderEnum>, process: &Process) -
log::info!("Dumping interfaces in {}...", module_name);
if let Some(create_interface_export) = module.export("CreateInterface") {
let create_interface_address = process.resolve_rip(create_interface_export.va)?;
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)
@ -53,9 +54,7 @@ pub fn dump_interfaces(builders: &mut Vec<FileBuilderEnum>, process: &Process) -
}
}
for builder in builders {
generate_file(builder, "interfaces", &entries)?;
}
generate_files(builders, &entries, "interfaces")?;
Ok(())
}

View File

@ -23,9 +23,13 @@ pub type Entries = BTreeMap<String, Vec<Entry>>;
pub fn generate_file(
builder: &mut FileBuilderEnum,
file_name: &str,
entries: &Entries,
file_name: &str,
) -> Result<()> {
if entries.is_empty() {
return Ok(());
}
let file_path = format!("generated/{}.{}", file_name, builder.extension());
let mut file = File::create(file_path)?;
@ -59,3 +63,15 @@ pub fn generate_file(
Ok(())
}
pub fn generate_files(
builders: &mut Vec<FileBuilderEnum>,
entries: &Entries,
file_name: &str,
) -> Result<()> {
for builder in builders {
generate_file(builder, &entries, file_name)?;
}
Ok(())
}

View File

@ -1,12 +1,13 @@
use std::fs::File;
use crate::builder::FileBuilderEnum;
use crate::config::{Config, Operation};
use crate::config::{Config, Operation::*};
use crate::dumpers::Entry;
use crate::error::{Error, Result};
use crate::mem::Address;
use crate::remote::Process;
use super::{generate_file, Entries};
use super::{generate_files, Entries};
pub fn dump_offsets(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> Result<()> {
let file = File::open("config.json")?;
@ -20,30 +21,33 @@ pub fn dump_offsets(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> R
for signature in config.signatures {
let module = process.get_module_by_name(&signature.module)?;
let mut address = process.find_pattern(&signature.module, &signature.pattern)?;
let mut address =
Address::from(process.find_pattern(&signature.module, &signature.pattern)?);
let mut offset: Option<u16> = None;
let mut offset: Option<u32> = None;
for operation in signature.operations {
match operation {
Operation::Add { value } => {
Add { value } => {
address += value;
}
Operation::Dereference { times } => {
Dereference { times } => {
for _ in 0..times.unwrap_or(1) {
address = process.read_memory::<usize>(address)?;
address = process.read_memory::<usize>(address.0)?.into();
}
}
Operation::Jmp => {
address = process.resolve_jmp(address)?;
Jmp { offset, length } => {
address = process.resolve_jmp(address.0, offset, length)?.into();
}
Operation::Offset { position } => {
offset = Some(process.read_memory::<u16>(address + position)?);
Offset {
offset: start_offset,
} => {
offset = Some(process.read_memory::<u32>(address.0 + start_offset)?);
}
Operation::RipRelative => {
address = process.resolve_rip(address)?;
RipRelative { offset, length } => {
address = process.resolve_rip(address.0, offset, length)?.into();
}
Operation::Subtract { value } => {
Subtract { value } => {
address -= value;
}
}
@ -62,7 +66,7 @@ pub fn dump_offsets(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> R
address - module.address()
);
(signature.name, address - module.address())
(signature.name, address.0 - module.address())
};
entries
@ -75,9 +79,7 @@ pub fn dump_offsets(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> R
});
}
for builder in builders {
generate_file(builder, "offsets", &entries)?;
}
generate_files(builders, &entries, "offsets")?;
Ok(())
}

View File

@ -1,36 +1,14 @@
use std::collections::HashMap;
use regex::Regex;
use crate::builder::FileBuilderEnum;
use crate::dumpers::Entry;
use crate::error::Result;
use crate::remote::Process;
use crate::sdk::SchemaSystem;
use super::{generate_file, Entries};
use super::{generate_files, Entries};
pub fn dump_schemas(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> Result<()> {
let schema_system = SchemaSystem::new(&process)?;
let type_map = HashMap::from([
("uint8", "uint8_t"),
("uint16", "uint16_t"),
("uint32", "uint32_t"),
("uint64", "uint64_t"),
("int8", "int8_t"),
("int16", "int16_t"),
("int32", "int32_t"),
("int64", "int64_t"),
("float32", "float"),
("float64", "double"),
]);
let regex_map: HashMap<String, Regex> = type_map
.iter()
.map(|(k, _v)| ((k.to_string()), Regex::new(&format!(r"\b{}\b", k)).unwrap()))
.collect();
for type_scope in schema_system.type_scopes()? {
let module_name = type_scope.module_name()?;
@ -44,20 +22,13 @@ pub fn dump_schemas(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> R
for field in class.fields()? {
let field_name = field.name()?;
let field_offset = field.offset()?;
let mut type_name = field.r#type()?.name()?.replace(" ", "");
for k in type_map.keys() {
let re = &regex_map[*k];
type_name = re.replace_all(&type_name, type_map[*k]).to_string();
}
let field_type_name = field.r#type()?.name()?;
log::debug!(
" └─ {} = {:#X} // {}",
field_name,
field_offset,
type_name
field_type_name
);
entries
@ -66,16 +37,12 @@ pub fn dump_schemas(builders: &mut Vec<FileBuilderEnum>, process: &Process) -> R
.push(Entry {
name: field_name,
value: field_offset as usize,
comment: Some(type_name),
comment: Some(field_type_name),
});
}
}
if !entries.is_empty() {
for builder in builders.iter_mut() {
generate_file(builder, &module_name, &entries)?;
}
}
generate_files(builders, &entries, &module_name)?;
}
Ok(())

View File

@ -16,15 +16,13 @@ mod builder;
mod config;
mod dumpers;
mod error;
mod mem;
mod remote;
mod sdk;
#[derive(Debug, Parser)]
#[command(author, version, about, long_about = None)]
struct Args {
#[arg(long)]
all: bool,
#[arg(short, long)]
interfaces: bool,
@ -40,7 +38,6 @@ struct Args {
fn main() -> Result<()> {
let Args {
all,
interfaces,
offsets,
schemas,
@ -66,13 +63,13 @@ fn main() -> Result<()> {
fs::create_dir_all("generated")?;
let mut builders: Vec<FileBuilderEnum> = vec![
FileBuilderEnum::CppBuilder(CppBuilder),
FileBuilderEnum::CSharpBuilder(CSharpBuilder),
FileBuilderEnum::CppFileBuilder(CppFileBuilder),
FileBuilderEnum::CSharpFileBuilder(CSharpFileBuilder),
FileBuilderEnum::JsonFileBuilder(JsonFileBuilder::default()),
FileBuilderEnum::RustFileBuilder(RustFileBuilder),
];
let all = all || !(interfaces || offsets || schemas);
let all = !(interfaces || offsets || schemas);
if schemas || all {
dump_schemas(&mut builders, &process)?;

104
src/mem/address.rs Normal file
View File

@ -0,0 +1,104 @@
use std::fmt::{LowerHex, UpperHex};
use std::ops::{Add, AddAssign, Sub, SubAssign};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(transparent)]
pub struct Address(pub usize);
impl Address {
pub fn add(&self, offset: usize) -> Self {
Self(self.0 + offset)
}
pub fn sub(&self, offset: usize) -> Self {
Self(self.0 - offset)
}
pub fn as_ptr<T>(&self) -> *const T {
self.0 as *const T
}
pub fn as_mut_ptr<T>(&self) -> *mut T {
self.0 as *mut T
}
}
impl From<usize> for Address {
fn from(value: usize) -> Self {
Self(value)
}
}
impl From<Address> for usize {
fn from(value: Address) -> Self {
value.0
}
}
impl Add<usize> for Address {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(self.0 + rhs)
}
}
impl Add<Address> for Address {
type Output = Self;
fn add(self, rhs: Address) -> Self::Output {
Self(self.0 + rhs.0)
}
}
impl AddAssign<usize> for Address {
fn add_assign(&mut self, rhs: usize) {
self.0 += rhs;
}
}
impl AddAssign<Address> for Address {
fn add_assign(&mut self, rhs: Address) {
self.0 += rhs.0;
}
}
impl Sub<usize> for Address {
type Output = Self;
fn sub(self, rhs: usize) -> Self::Output {
Self(self.0 - rhs)
}
}
impl Sub<Address> for Address {
type Output = Self;
fn sub(self, rhs: Address) -> Self::Output {
Self(self.0 - rhs.0)
}
}
impl SubAssign<usize> for Address {
fn sub_assign(&mut self, rhs: usize) {
self.0 -= rhs;
}
}
impl SubAssign<Address> for Address {
fn sub_assign(&mut self, rhs: Address) {
self.0 -= rhs.0;
}
}
impl UpperHex for Address {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:#X}", self.0)
}
}
impl LowerHex for Address {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:#x}", self.0)
}
}

3
src/mem/mod.rs Normal file
View File

@ -0,0 +1,3 @@
pub use address::Address;
pub mod address;

View File

@ -171,16 +171,26 @@ impl Process {
Ok(String::from_utf8(buffer)?)
}
pub fn resolve_jmp(&self, address: usize) -> Result<usize> {
let displacement = self.read_memory::<i32>(address + 0x1)?;
pub fn resolve_jmp(
&self,
address: usize,
offset: Option<usize>,
length: Option<usize>,
) -> Result<usize> {
let displacement = self.read_memory::<i32>(address + offset.unwrap_or(0x1))?;
Ok((address + 0x5) + displacement as usize)
Ok((address + length.unwrap_or(0x5)) + displacement as usize)
}
pub fn resolve_rip(&self, address: usize) -> Result<usize> {
let displacement = self.read_memory::<i32>(address + 0x3)?;
pub fn resolve_rip(
&self,
address: usize,
offset: Option<usize>,
length: Option<usize>,
) -> Result<usize> {
let displacement = self.read_memory::<i32>(address + offset.unwrap_or(0x3))?;
Ok((address + 0x7) + displacement as usize)
Ok((address + length.unwrap_or(0x7)) + displacement as usize)
}
fn get_process_id_by_name(process_name: &str) -> Result<u32> {

View File

@ -14,15 +14,15 @@ impl<'a> SchemaClassFieldData<'a> {
}
pub fn name(&self) -> Result<String> {
self.process
.read_string(self.process.read_memory::<usize>(self.address)?)
let name_ptr = self.process.read_memory::<usize>(self.address)?;
self.process.read_string(name_ptr)
}
pub fn r#type(&self) -> Result<SchemaType> {
Ok(SchemaType::new(
self.process,
self.process.read_memory::<usize>(self.address + 0x8)?,
))
let type_ptr = self.process.read_memory::<usize>(self.address + 0x8)?;
Ok(SchemaType::new(self.process, type_ptr))
}
pub fn offset(&self) -> Result<u16> {

View File

@ -14,7 +14,7 @@ impl<'a> SchemaClassInfo<'a> {
Self {
process,
address,
class_name: class_name.into(),
class_name: class_name.to_string(),
}
}
@ -26,15 +26,16 @@ impl<'a> SchemaClassInfo<'a> {
pub fn fields(&self) -> Result<Vec<SchemaClassFieldData>> {
let count = self.fields_count()?;
let fields: Vec<SchemaClassFieldData> = (0..count as usize)
.filter_map(|i| {
let address = self
.process
.read_memory::<usize>(self.address + 0x28)
.ok()?
+ (i * 0x20);
let base_address = self.process.read_memory::<usize>(self.address + 0x28)?;
(address != 0).then(|| SchemaClassFieldData::new(self.process, address))
let fields: Vec<SchemaClassFieldData> = (0..count as usize)
.map(|i| base_address + (i * 0x20))
.filter_map(|address| {
if address != 0 {
Some(SchemaClassFieldData::new(self.process, address))
} else {
None
}
})
.collect();

View File

@ -1,3 +1,5 @@
use std::mem;
use crate::error::Result;
use crate::remote::Process;
@ -15,7 +17,7 @@ impl<'a> SchemaSystem<'a> {
"48 8D 0D ? ? ? ? E9 ? ? ? ? CC CC CC CC 48 8D 0D ? ? ? ? E9 ? ? ? ? CC CC CC CC 48 83 EC 28"
)?;
address = process.resolve_rip(address)?;
address = process.resolve_rip(address, None, None)?;
Ok(Self { process, address })
}
@ -29,7 +31,7 @@ impl<'a> SchemaSystem<'a> {
self.process.read_memory_raw(
data,
addresses.as_mut_ptr() as *mut _,
addresses.len() * std::mem::size_of::<usize>(),
addresses.len() * mem::size_of::<usize>(),
)?;
let type_scopes: Vec<SchemaSystemTypeScope> = addresses

View File

@ -22,12 +22,14 @@ impl<'a> SchemaSystemTypeScope<'a> {
.elements(self.process)?
.iter()
.filter_map(|&address| {
let declared_class = SchemaTypeDeclaredClass::new(self.process, address as usize);
let address = address as usize;
let declared_class = SchemaTypeDeclaredClass::new(self.process, address);
declared_class
.name()
.ok()
.map(|name| SchemaClassInfo::new(self.process, address as usize, &name))
.map(|name| SchemaClassInfo::new(self.process, address, &name))
})
.collect();

View File

@ -1,6 +1,37 @@
use std::collections::HashMap;
use lazy_static::lazy_static;
use regex::Regex;
use crate::error::Result;
use crate::remote::Process;
const TYPE_MAP: &[(&'static str, &'static str)] = &[
("uint8", "uint8_t"),
("uint16", "uint16_t"),
("uint32", "uint32_t"),
("uint64", "uint64_t"),
("int8", "int8_t"),
("int16", "int16_t"),
("int32", "int32_t"),
("int64", "int64_t"),
("float32", "float"),
("float64", "double"),
];
lazy_static! {
static ref REGEX_MAP: HashMap<&'static str, Regex> = {
let mut map = HashMap::with_capacity(TYPE_MAP.len());
for (k, _v) in TYPE_MAP.iter() {
map.insert(*k, Regex::new(&format!(r"\b{}\b", k)).unwrap());
}
map
};
}
pub struct SchemaType<'a> {
process: &'a Process,
address: usize,
@ -12,7 +43,26 @@ impl<'a> SchemaType<'a> {
}
pub fn name(&self) -> Result<String> {
self.process
.read_string(self.process.read_memory::<usize>(self.address + 0x8)?)
let name_ptr = self.process.read_memory::<usize>(self.address + 0x8)?;
let name = self
.process
.read_string(name_ptr)?
.replace(" ", "")
.to_string();
Ok(Self::convert_type_name(&name))
}
fn convert_type_name(type_name: &str) -> String {
let mut result = type_name.to_string();
for (k, v) in TYPE_MAP.iter() {
let re = REGEX_MAP.get(*k).unwrap();
result = re.replace_all(&result, &v.to_string()).to_string();
}
result
}
}

View File

@ -12,7 +12,8 @@ impl<'a> SchemaTypeDeclaredClass<'a> {
}
pub fn name(&self) -> Result<String> {
self.process
.read_string(self.process.read_memory::<usize>(self.address + 0x8)?)
let name_ptr = self.process.read_memory::<usize>(self.address + 0x8)?;
self.process.read_string(name_ptr)
}
}