diff --git a/.editorconfig b/.editorconfig index 16ad361..c54886b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,3 +6,6 @@ end_of_line = lf indent_size = 4 indent_style = space trim_trailing_whitespace = true + +[*.json] +indent_size = 2 diff --git a/Cargo.toml b/Cargo.toml index f5f91a9..992980c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] } diff --git a/config.json b/config.json index 657d6e9..bf70c74 100644 --- a/config.json +++ b/config.json @@ -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" + } + ] + } + ] } \ No newline at end of file diff --git a/generated/animationsystem.dll.cs b/generated/animationsystem.dll.cs index 7643a0f..4d99bb4 100644 --- a/generated/animationsystem.dll.cs +++ b/generated/animationsystem.dll.cs @@ -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 diff --git a/generated/animationsystem.dll.hpp b/generated/animationsystem.dll.hpp index 40cb8e6..3efcf28 100644 --- a/generated/animationsystem.dll.hpp +++ b/generated/animationsystem.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/animationsystem.dll.rs b/generated/animationsystem.dll.rs index 979078a..7ed7a5d 100644 --- a/generated/animationsystem.dll.rs +++ b/generated/animationsystem.dll.rs @@ -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 diff --git a/generated/client.dll.cs b/generated/client.dll.cs index b135fcf..26dfaf6 100644 --- a/generated/client.dll.cs +++ b/generated/client.dll.cs @@ -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 diff --git a/generated/client.dll.hpp b/generated/client.dll.hpp index 914ef8a..0460e5e 100644 --- a/generated/client.dll.hpp +++ b/generated/client.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/client.dll.rs b/generated/client.dll.rs index 0ff6820..c3f2ab8 100644 --- a/generated/client.dll.rs +++ b/generated/client.dll.rs @@ -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 diff --git a/generated/engine2.dll.cs b/generated/engine2.dll.cs index d755199..def20d3 100644 --- a/generated/engine2.dll.cs +++ b/generated/engine2.dll.cs @@ -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 diff --git a/generated/engine2.dll.hpp b/generated/engine2.dll.hpp index f3f3291..02309b9 100644 --- a/generated/engine2.dll.hpp +++ b/generated/engine2.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/engine2.dll.rs b/generated/engine2.dll.rs index 0965998..6dd9b5b 100644 --- a/generated/engine2.dll.rs +++ b/generated/engine2.dll.rs @@ -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 diff --git a/generated/host.dll.cs b/generated/host.dll.cs index 370a428..0659924 100644 --- a/generated/host.dll.cs +++ b/generated/host.dll.cs @@ -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 diff --git a/generated/host.dll.hpp b/generated/host.dll.hpp index ce039ee..f1de8d0 100644 --- a/generated/host.dll.hpp +++ b/generated/host.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/host.dll.rs b/generated/host.dll.rs index b9c4f89..93ce1c3 100644 --- a/generated/host.dll.rs +++ b/generated/host.dll.rs @@ -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 diff --git a/generated/interfaces.cs b/generated/interfaces.cs index 0d96f19..92bbcc3 100644 --- a/generated/interfaces.cs +++ b/generated/interfaces.cs @@ -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; diff --git a/generated/interfaces.hpp b/generated/interfaces.hpp index bae042b..4f804e4 100644 --- a/generated/interfaces.hpp +++ b/generated/interfaces.hpp @@ -3,7 +3,7 @@ #include // 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; diff --git a/generated/interfaces.rs b/generated/interfaces.rs index 1208d2e..3c2b4d8 100644 --- a/generated/interfaces.rs +++ b/generated/interfaces.rs @@ -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; diff --git a/generated/materialsystem2.dll.cs b/generated/materialsystem2.dll.cs index 3c71bac..28de30a 100644 --- a/generated/materialsystem2.dll.cs +++ b/generated/materialsystem2.dll.cs @@ -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 diff --git a/generated/materialsystem2.dll.hpp b/generated/materialsystem2.dll.hpp index 5fc13ee..b655438 100644 --- a/generated/materialsystem2.dll.hpp +++ b/generated/materialsystem2.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/materialsystem2.dll.rs b/generated/materialsystem2.dll.rs index acd910f..8d49ec5 100644 --- a/generated/materialsystem2.dll.rs +++ b/generated/materialsystem2.dll.rs @@ -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 diff --git a/generated/networksystem.dll.cs b/generated/networksystem.dll.cs index cedcbf1..1655826 100644 --- a/generated/networksystem.dll.cs +++ b/generated/networksystem.dll.cs @@ -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 diff --git a/generated/networksystem.dll.hpp b/generated/networksystem.dll.hpp index bab52bd..f8e76e1 100644 --- a/generated/networksystem.dll.hpp +++ b/generated/networksystem.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/networksystem.dll.rs b/generated/networksystem.dll.rs index 68b4d69..e80a929 100644 --- a/generated/networksystem.dll.rs +++ b/generated/networksystem.dll.rs @@ -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 diff --git a/generated/offsets.cs b/generated/offsets.cs index 7ecb250..5ee12e5 100644 --- a/generated/offsets.cs +++ b/generated/offsets.cs @@ -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; diff --git a/generated/offsets.hpp b/generated/offsets.hpp index 14c7d7a..508d341 100644 --- a/generated/offsets.hpp +++ b/generated/offsets.hpp @@ -3,7 +3,7 @@ #include // 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; diff --git a/generated/offsets.json b/generated/offsets.json index a7e70c7..5728492 100644 --- a/generated/offsets.json +++ b/generated/offsets.json @@ -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 diff --git a/generated/offsets.rs b/generated/offsets.rs index bf8c27c..4012cb9 100644 --- a/generated/offsets.rs +++ b/generated/offsets.rs @@ -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; diff --git a/generated/particles.dll.cs b/generated/particles.dll.cs index 32a30d0..7c08b90 100644 --- a/generated/particles.dll.cs +++ b/generated/particles.dll.cs @@ -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 diff --git a/generated/particles.dll.hpp b/generated/particles.dll.hpp index 428f500..31b3393 100644 --- a/generated/particles.dll.hpp +++ b/generated/particles.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/particles.dll.rs b/generated/particles.dll.rs index 16a1c16..13c2cb8 100644 --- a/generated/particles.dll.rs +++ b/generated/particles.dll.rs @@ -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 diff --git a/generated/pulse_system.dll.cs b/generated/pulse_system.dll.cs index 98f830a..8f6e173 100644 --- a/generated/pulse_system.dll.cs +++ b/generated/pulse_system.dll.cs @@ -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 diff --git a/generated/pulse_system.dll.hpp b/generated/pulse_system.dll.hpp index 401ca44..f3d3142 100644 --- a/generated/pulse_system.dll.hpp +++ b/generated/pulse_system.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/pulse_system.dll.rs b/generated/pulse_system.dll.rs index e0b7fcb..8226eb3 100644 --- a/generated/pulse_system.dll.rs +++ b/generated/pulse_system.dll.rs @@ -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 diff --git a/generated/rendersystemdx11.dll.cs b/generated/rendersystemdx11.dll.cs index 9d5a8d7..6e53123 100644 --- a/generated/rendersystemdx11.dll.cs +++ b/generated/rendersystemdx11.dll.cs @@ -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] diff --git a/generated/rendersystemdx11.dll.hpp b/generated/rendersystemdx11.dll.hpp index 3d26eb1..4b39e76 100644 --- a/generated/rendersystemdx11.dll.hpp +++ b/generated/rendersystemdx11.dll.hpp @@ -3,7 +3,7 @@ #include // 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] diff --git a/generated/rendersystemdx11.dll.rs b/generated/rendersystemdx11.dll.rs index ce6544c..e85cb94 100644 --- a/generated/rendersystemdx11.dll.rs +++ b/generated/rendersystemdx11.dll.rs @@ -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] diff --git a/generated/resourcesystem.dll.cs b/generated/resourcesystem.dll.cs index 9b0f60a..25cb320 100644 --- a/generated/resourcesystem.dll.cs +++ b/generated/resourcesystem.dll.cs @@ -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 diff --git a/generated/resourcesystem.dll.hpp b/generated/resourcesystem.dll.hpp index 8e31845..ab9b5c1 100644 --- a/generated/resourcesystem.dll.hpp +++ b/generated/resourcesystem.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/resourcesystem.dll.rs b/generated/resourcesystem.dll.rs index 78a299a..848b757 100644 --- a/generated/resourcesystem.dll.rs +++ b/generated/resourcesystem.dll.rs @@ -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 diff --git a/generated/scenesystem.dll.cs b/generated/scenesystem.dll.cs index 9b8d8c2..566c8d7 100644 --- a/generated/scenesystem.dll.cs +++ b/generated/scenesystem.dll.cs @@ -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 diff --git a/generated/scenesystem.dll.hpp b/generated/scenesystem.dll.hpp index 4610ccd..0f93d3e 100644 --- a/generated/scenesystem.dll.hpp +++ b/generated/scenesystem.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/scenesystem.dll.rs b/generated/scenesystem.dll.rs index 070e13a..39cb9ce 100644 --- a/generated/scenesystem.dll.rs +++ b/generated/scenesystem.dll.rs @@ -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 diff --git a/generated/schemasystem.dll.cs b/generated/schemasystem.dll.cs index a54704e..ee5e06c 100644 --- a/generated/schemasystem.dll.cs +++ b/generated/schemasystem.dll.cs @@ -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 diff --git a/generated/schemasystem.dll.hpp b/generated/schemasystem.dll.hpp index e8411ee..ea0788b 100644 --- a/generated/schemasystem.dll.hpp +++ b/generated/schemasystem.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/schemasystem.dll.json b/generated/schemasystem.dll.json index ec747fa..061e30b 100644 --- a/generated/schemasystem.dll.json +++ b/generated/schemasystem.dll.json @@ -1 +1,42 @@ -null \ No newline at end of file +{ + "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 + } +} \ No newline at end of file diff --git a/generated/schemasystem.dll.rs b/generated/schemasystem.dll.rs index 6f19533..dad3004 100644 --- a/generated/schemasystem.dll.rs +++ b/generated/schemasystem.dll.rs @@ -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 diff --git a/generated/server.dll.cs b/generated/server.dll.cs index a3ead11..6bc6794 100644 --- a/generated/server.dll.cs +++ b/generated/server.dll.cs @@ -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 diff --git a/generated/server.dll.hpp b/generated/server.dll.hpp index 1d494d7..2ba7ea7 100644 --- a/generated/server.dll.hpp +++ b/generated/server.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/server.dll.rs b/generated/server.dll.rs index 000dced..ad06c34 100644 --- a/generated/server.dll.rs +++ b/generated/server.dll.rs @@ -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 diff --git a/generated/soundsystem.dll.cs b/generated/soundsystem.dll.cs index e08cd13..d3224d8 100644 --- a/generated/soundsystem.dll.cs +++ b/generated/soundsystem.dll.cs @@ -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 diff --git a/generated/soundsystem.dll.hpp b/generated/soundsystem.dll.hpp index 617b241..a25ed32 100644 --- a/generated/soundsystem.dll.hpp +++ b/generated/soundsystem.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/soundsystem.dll.rs b/generated/soundsystem.dll.rs index ac66d02..f9d2cb8 100644 --- a/generated/soundsystem.dll.rs +++ b/generated/soundsystem.dll.rs @@ -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 diff --git a/generated/vphysics2.dll.cs b/generated/vphysics2.dll.cs index 217ee75..e266ecd 100644 --- a/generated/vphysics2.dll.cs +++ b/generated/vphysics2.dll.cs @@ -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 diff --git a/generated/vphysics2.dll.hpp b/generated/vphysics2.dll.hpp index da89878..5176d11 100644 --- a/generated/vphysics2.dll.hpp +++ b/generated/vphysics2.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/vphysics2.dll.rs b/generated/vphysics2.dll.rs index 579666c..0c2ea70 100644 --- a/generated/vphysics2.dll.rs +++ b/generated/vphysics2.dll.rs @@ -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 diff --git a/generated/worldrenderer.dll.cs b/generated/worldrenderer.dll.cs index b06fbbd..cc44e32 100644 --- a/generated/worldrenderer.dll.cs +++ b/generated/worldrenderer.dll.cs @@ -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 diff --git a/generated/worldrenderer.dll.hpp b/generated/worldrenderer.dll.hpp index d110feb..cfd7ddd 100644 --- a/generated/worldrenderer.dll.hpp +++ b/generated/worldrenderer.dll.hpp @@ -3,7 +3,7 @@ #include // 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 diff --git a/generated/worldrenderer.dll.rs b/generated/worldrenderer.dll.rs index 1011f1f..dc1b5e5 100644 --- a/generated/worldrenderer.dll.rs +++ b/generated/worldrenderer.dll.rs @@ -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 diff --git a/src/builder/cpp_file_builder.rs b/src/builder/cpp_file_builder.rs index 364370e..ad1b9b3 100644 --- a/src/builder/cpp_file_builder.rs +++ b/src/builder/cpp_file_builder.rs @@ -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" } diff --git a/src/builder/csharp_file_builder.rs b/src/builder/csharp_file_builder.rs index fdd6911..f1b1c86 100644 --- a/src/builder/csharp_file_builder.rs +++ b/src/builder/csharp_file_builder.rs @@ -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" } diff --git a/src/builder/json_file_builder.rs b/src/builder/json_file_builder.rs index 3c99b3c..57b9025 100644 --- a/src/builder/json_file_builder.rs +++ b/src/builder/json_file_builder.rs @@ -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!({}); } diff --git a/src/builder/mod.rs b/src/builder/mod.rs index d41968a..a597d24 100644 --- a/src/builder/mod.rs +++ b/src/builder/mod.rs @@ -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, } } } diff --git a/src/builder/rust_file_builder.rs b/src/builder/rust_file_builder.rs index 24907eb..2065b9e 100644 --- a/src/builder/rust_file_builder.rs +++ b/src/builder/rust_file_builder.rs @@ -2,6 +2,7 @@ use std::io::{Result, Write}; use super::FileBuilder; +#[derive(Debug, Default, PartialEq)] pub struct RustFileBuilder; impl FileBuilder for RustFileBuilder { diff --git a/src/config.rs b/src/config.rs index 6414d45..df63ff2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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 }, - Jmp, - Offset { position: usize }, - RipRelative, - Subtract { value: usize }, + Add { + value: usize, + }, + Dereference { + times: Option, + }, + Jmp { + offset: Option, + length: Option, + }, + Offset { + offset: usize, + }, + RipRelative { + offset: Option, + length: Option, + }, + Subtract { + value: usize, + }, } #[derive(Debug, Deserialize, Serialize)] diff --git a/src/dumpers/interfaces.rs b/src/dumpers/interfaces.rs index c9e5525..78cffbf 100644 --- a/src/dumpers/interfaces.rs +++ b/src/dumpers/interfaces.rs @@ -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, process: &Process) -> Result<()> { let module_names = process.get_loaded_modules()?; @@ -16,7 +16,8 @@ pub fn dump_interfaces(builders: &mut Vec, 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::(create_interface_address) @@ -53,9 +54,7 @@ pub fn dump_interfaces(builders: &mut Vec, process: &Process) - } } - for builder in builders { - generate_file(builder, "interfaces", &entries)?; - } + generate_files(builders, &entries, "interfaces")?; Ok(()) } diff --git a/src/dumpers/mod.rs b/src/dumpers/mod.rs index 48bc0dd..c1b308b 100644 --- a/src/dumpers/mod.rs +++ b/src/dumpers/mod.rs @@ -23,9 +23,13 @@ pub type Entries = BTreeMap>; 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, + entries: &Entries, + file_name: &str, +) -> Result<()> { + for builder in builders { + generate_file(builder, &entries, file_name)?; + } + + Ok(()) +} diff --git a/src/dumpers/offsets.rs b/src/dumpers/offsets.rs index 5bfdafe..8173dd8 100644 --- a/src/dumpers/offsets.rs +++ b/src/dumpers/offsets.rs @@ -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, process: &Process) -> Result<()> { let file = File::open("config.json")?; @@ -20,30 +21,33 @@ pub fn dump_offsets(builders: &mut Vec, 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 = None; + let mut offset: Option = 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::(address)?; + address = process.read_memory::(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::(address + position)?); + Offset { + offset: start_offset, + } => { + offset = Some(process.read_memory::(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, 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, process: &Process) -> R }); } - for builder in builders { - generate_file(builder, "offsets", &entries)?; - } + generate_files(builders, &entries, "offsets")?; Ok(()) } diff --git a/src/dumpers/schemas.rs b/src/dumpers/schemas.rs index 92166dd..38761eb 100644 --- a/src/dumpers/schemas.rs +++ b/src/dumpers/schemas.rs @@ -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, 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 = 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, 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 = ®ex_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, 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(()) diff --git a/src/main.rs b/src/main.rs index 7c6fe7e..92126b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 = 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)?; diff --git a/src/mem/address.rs b/src/mem/address.rs new file mode 100644 index 0000000..515c4ca --- /dev/null +++ b/src/mem/address.rs @@ -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(&self) -> *const T { + self.0 as *const T + } + + pub fn as_mut_ptr(&self) -> *mut T { + self.0 as *mut T + } +} + +impl From for Address { + fn from(value: usize) -> Self { + Self(value) + } +} + +impl From
for usize { + fn from(value: Address) -> Self { + value.0 + } +} + +impl Add for Address { + type Output = Self; + + fn add(self, rhs: usize) -> Self::Output { + Self(self.0 + rhs) + } +} + +impl Add
for Address { + type Output = Self; + + fn add(self, rhs: Address) -> Self::Output { + Self(self.0 + rhs.0) + } +} + +impl AddAssign for Address { + fn add_assign(&mut self, rhs: usize) { + self.0 += rhs; + } +} + +impl AddAssign
for Address { + fn add_assign(&mut self, rhs: Address) { + self.0 += rhs.0; + } +} + +impl Sub for Address { + type Output = Self; + + fn sub(self, rhs: usize) -> Self::Output { + Self(self.0 - rhs) + } +} + +impl Sub
for Address { + type Output = Self; + + fn sub(self, rhs: Address) -> Self::Output { + Self(self.0 - rhs.0) + } +} + +impl SubAssign for Address { + fn sub_assign(&mut self, rhs: usize) { + self.0 -= rhs; + } +} + +impl SubAssign
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) + } +} diff --git a/src/mem/mod.rs b/src/mem/mod.rs new file mode 100644 index 0000000..c6e6424 --- /dev/null +++ b/src/mem/mod.rs @@ -0,0 +1,3 @@ +pub use address::Address; + +pub mod address; diff --git a/src/remote/process.rs b/src/remote/process.rs index 73c2921..c088b41 100644 --- a/src/remote/process.rs +++ b/src/remote/process.rs @@ -171,16 +171,26 @@ impl Process { Ok(String::from_utf8(buffer)?) } - pub fn resolve_jmp(&self, address: usize) -> Result { - let displacement = self.read_memory::(address + 0x1)?; + pub fn resolve_jmp( + &self, + address: usize, + offset: Option, + length: Option, + ) -> Result { + let displacement = self.read_memory::(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 { - let displacement = self.read_memory::(address + 0x3)?; + pub fn resolve_rip( + &self, + address: usize, + offset: Option, + length: Option, + ) -> Result { + let displacement = self.read_memory::(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 { diff --git a/src/sdk/schema_class_field_data.rs b/src/sdk/schema_class_field_data.rs index 58def6b..c9f3349 100644 --- a/src/sdk/schema_class_field_data.rs +++ b/src/sdk/schema_class_field_data.rs @@ -14,15 +14,15 @@ impl<'a> SchemaClassFieldData<'a> { } pub fn name(&self) -> Result { - self.process - .read_string(self.process.read_memory::(self.address)?) + let name_ptr = self.process.read_memory::(self.address)?; + + self.process.read_string(name_ptr) } pub fn r#type(&self) -> Result { - Ok(SchemaType::new( - self.process, - self.process.read_memory::(self.address + 0x8)?, - )) + let type_ptr = self.process.read_memory::(self.address + 0x8)?; + + Ok(SchemaType::new(self.process, type_ptr)) } pub fn offset(&self) -> Result { diff --git a/src/sdk/schema_class_info.rs b/src/sdk/schema_class_info.rs index 95b8792..c5f80a6 100644 --- a/src/sdk/schema_class_info.rs +++ b/src/sdk/schema_class_info.rs @@ -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> { let count = self.fields_count()?; - let fields: Vec = (0..count as usize) - .filter_map(|i| { - let address = self - .process - .read_memory::(self.address + 0x28) - .ok()? - + (i * 0x20); + let base_address = self.process.read_memory::(self.address + 0x28)?; - (address != 0).then(|| SchemaClassFieldData::new(self.process, address)) + let fields: Vec = (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(); diff --git a/src/sdk/schema_system.rs b/src/sdk/schema_system.rs index a92b1bd..5dfdb6a 100644 --- a/src/sdk/schema_system.rs +++ b/src/sdk/schema_system.rs @@ -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::(), + addresses.len() * mem::size_of::(), )?; let type_scopes: Vec = addresses diff --git a/src/sdk/schema_system_type_scope.rs b/src/sdk/schema_system_type_scope.rs index a811e8f..c223471 100644 --- a/src/sdk/schema_system_type_scope.rs +++ b/src/sdk/schema_system_type_scope.rs @@ -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(); diff --git a/src/sdk/schema_type.rs b/src/sdk/schema_type.rs index 602b4ac..c3b54e2 100644 --- a/src/sdk/schema_type.rs +++ b/src/sdk/schema_type.rs @@ -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 { - self.process - .read_string(self.process.read_memory::(self.address + 0x8)?) + let name_ptr = self.process.read_memory::(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 } } diff --git a/src/sdk/schema_type_declared_class.rs b/src/sdk/schema_type_declared_class.rs index f779a77..2d4ecc7 100644 --- a/src/sdk/schema_type_declared_class.rs +++ b/src/sdk/schema_type_declared_class.rs @@ -12,7 +12,8 @@ impl<'a> SchemaTypeDeclaredClass<'a> { } pub fn name(&self) -> Result { - self.process - .read_string(self.process.read_memory::(self.address + 0x8)?) + let name_ptr = self.process.read_memory::(self.address + 0x8)?; + + self.process.read_string(name_ptr) } }