From 0171b36297c23d480c17631561c98c0ff2afca28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordan=20Bri=C3=A8re?= Date: Thu, 9 Feb 2023 06:20:26 -0500 Subject: [PATCH] Update CS:GO data (#462) --- .../source-python/entities/csgo/CCSPlayer.ini | 8 ++++---- .../entities/csgo/CSensorGrenadeProjectile.ini | 6 +++--- .../entities/csgo/CSmokeGrenadeProjectile.ini | 2 +- .../entity_output/csgo/CBaseEntityOutput.ini | 2 +- .../memory/csgo/global_pointers.ini | 16 +++++++++------- .../packages/source-python/memory/helpers.py | 2 ++ .../packages/source-python/memory/manager.py | 17 +++++++++++++++-- 7 files changed, 35 insertions(+), 18 deletions(-) diff --git a/addons/source-python/data/source-python/entities/csgo/CCSPlayer.ini b/addons/source-python/data/source-python/entities/csgo/CCSPlayer.ini index 9fd7ee5aa..273026857 100755 --- a/addons/source-python/data/source-python/entities/csgo/CCSPlayer.ini +++ b/addons/source-python/data/source-python/entities/csgo/CCSPlayer.ini @@ -7,14 +7,14 @@ srv_check = False [[add_account]] identifier_windows = 55 8B EC 83 E4 F8 81 EC 4C 01 00 00 53 56 57 8B F9 8B 07 8B 80 # identifier_linux = _ZN9CCSPlayer10AddAccountEibbPKc - identifier_linux = 55 89 E5 57 56 53 81 EC 2A 01 00 00 8B 5D 08 0F B6 45 10 + identifier_linux = 55 89 E5 57 56 53 81 EC 2A 01 00 00 8B 45 10 8B 5D 08 89 arguments = INT, BOOL, STRING # Reference string: #Cannot_Carry_Anymore [[buy_internal]] identifier_windows = 55 8B EC 83 EC 24 53 56 57 6A 01 # indentifier_linux = _ZN9CCSPlayer26HandleCommand_Buy_InternalEPKcib - identifier_linux = 55 89 E5 83 EC 78 0F B6 55 14 89 75 F8 + identifier_linux = 55 89 E5 57 56 53 83 EC 54 8B 5D 08 6A 01 8B 7D 14 arguments = INT, STRING, BOOL, BOOL return_type = INT @@ -27,13 +27,13 @@ srv_check = False [[_spawn]] identifier_windows = 55 8B EC 83 EC 0C 53 56 57 8B F9 8B 0D 2A 2A 2A 2A 8B 01 # identifier_linux = _ZN9CCSPlayer12RoundRespawnEv - identifier_linux = 55 89 E5 57 56 53 83 EC 3C A1 2A 2A 2A 2A 8B 5D 08 89 04 24 + identifier_linux = 55 89 E5 56 53 83 EC 1C 8B 5D 08 FF 35 2A 2A 2A 2A E8 AA 32 F8 FF # Reference string: CCSPlayer::SwitchTeam( %d ) - invalid t [[switch_team]] identifier_windows = 55 8B EC 83 EC 10 53 56 8B 75 08 57 8B F9 85 F6 # identifier_linux = _ZN9CCSPlayer10SwitchTeamEi - identifier_linux = 55 89 E5 83 EC 68 89 75 F8 8B 75 0C 89 5D F4 8B 5D 08 89 7D FC 89 34 24 E8 2A 2A 2A 2A 85 C0 + identifier_linux = 55 89 E5 56 53 83 EC 2C 8B 5D 0C 8B 75 08 53 E8 0C 7E C7 FF arguments = INT diff --git a/addons/source-python/data/source-python/entities/csgo/CSensorGrenadeProjectile.ini b/addons/source-python/data/source-python/entities/csgo/CSensorGrenadeProjectile.ini index 2ff27ef6c..c483d9045 100755 --- a/addons/source-python/data/source-python/entities/csgo/CSensorGrenadeProjectile.ini +++ b/addons/source-python/data/source-python/entities/csgo/CSensorGrenadeProjectile.ini @@ -6,17 +6,17 @@ srv_check = False # CSensorGrenadeProjectile::Think_Arm [[start_timer]] identifier_windows = 56 8B F1 57 8B 86 D4 00 00 00 C1 E8 0C A8 01 74 2A E8 2A 2A 2A 2A F3 0F 10 86 80 01 00 00 F3 0F 10 96 7C 01 00 00 F3 0F 10 8E 84 01 00 00 F3 0F 59 D2 F3 0F 59 C0 F3 0F 59 C9 F3 0F 58 D0 F3 0F 58 D1 F3 0F 10 0D 2A 2A 2A 2A 0F 28 C2 F3 0F 51 C0 0F 2F C1 76 2A 8B 0D 2A 2A 2A 2A F3 0F 10 41 10 F3 0F 58 C1 0F 2E 05 2A 2A 2A 2A 9F F6 C4 44 7A 2A 83 CF FF EB 2A F3 0F 5E 41 20 F3 0F 58 05 2A 2A 2A 2A F3 0F 2C F8 39 BE A4 00 00 00 8D 96 A4 00 00 00 74 2A 8B 82 5C FF FF FF 8D 8A 5C FF FF FF 52 FF 90 D4 00 00 00 89 BE A4 00 00 00 83 FF FF 8B CE 0F 95 C0 0F B6 C0 50 E8 2A 2A 2A 2A 5F 5E C3 - identifier_linux = 55 89 E5 53 83 EC 34 8B 5D 08 F6 83 2A 00 00 00 10 + identifier_linux = 55 89 E5 53 83 EC 14 8B 5D 08 F6 83 DD 00 00 00 10 0F 85 B9 00 00 00 F3 0F 10 83 84 # CSensorGrenadeProjectile::SensorThink [[detonate]] identifier_windows = 55 8B EC 83 E4 F8 51 53 56 57 8B F1 E8 2A 2A 2A 2A 8B F8 - identifier_linux = 55 89 E5 57 56 53 83 EC 3C 8B 5D 08 89 1C 24 E8 2A 2A 2A 2A 85 C0 + identifier_linux = 55 89 E5 57 56 53 83 EC 28 8B 5D 08 53 E8 EE 49 95 FF 83 C4 10 85 # CSensorGrenadeProjectile::DoDetectWave [[do_detect_wave]] identifier_windows = 53 8B DC 83 EC 08 83 E4 F0 83 C4 04 55 8B 6B 04 89 6C 24 04 8B EC 81 EC 38 01 00 00 56 8B F1 - identifier_linux = 55 89 E5 57 56 53 81 EC BC 01 00 00 8B 55 08 89 14 24 + identifier_linux = 55 89 E5 57 56 53 81 EC 68 01 00 00 FF 75 08 E8 4C 58 95 FF [instance_attribute] diff --git a/addons/source-python/data/source-python/entities/csgo/CSmokeGrenadeProjectile.ini b/addons/source-python/data/source-python/entities/csgo/CSmokeGrenadeProjectile.ini index 1e8a34668..ab5caaeb2 100755 --- a/addons/source-python/data/source-python/entities/csgo/CSmokeGrenadeProjectile.ini +++ b/addons/source-python/data/source-python/entities/csgo/CSmokeGrenadeProjectile.ini @@ -6,7 +6,7 @@ srv_check = False # CSmokeGrenadeProjectile::SmokeDetonate [[detonate]] identifier_windows = 55 8B EC 83 EC 18 56 8B F1 8B 0D 2A 2A 2A 2A 57 - identifier_linux = 55 89 E5 57 56 53 83 EC 5C 8B 75 08 C7 44 24 08 00 00 26 43 + identifier_linux = 55 89 E5 57 56 53 83 EC 50 8B 5D 08 68 00 00 26 43 53 FF 35 [property] diff --git a/addons/source-python/data/source-python/entity_output/csgo/CBaseEntityOutput.ini b/addons/source-python/data/source-python/entity_output/csgo/CBaseEntityOutput.ini index b8c774d5c..88497072f 100644 --- a/addons/source-python/data/source-python/entity_output/csgo/CBaseEntityOutput.ini +++ b/addons/source-python/data/source-python/entity_output/csgo/CBaseEntityOutput.ini @@ -6,7 +6,7 @@ srv_check = False [function] [[fire_output]] # identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f - identifier_linux = 55 89 E5 57 56 53 81 EC 7C 01 00 00 8B 55 08 8B 75 14 + identifier_linux = 55 89 E5 57 56 53 81 EC 4C 01 00 00 8B 45 08 65 8B 1D 14 00 00 00 identifier_windows = 55 8B EC 83 2A 2A 81 EC 2A 2A 2A 2A 8B C1 53 56 57 8B 2A 2A 89 2A 2A 2A 33 arguments_linux = POINTER, POINTER, POINTER, FLOAT arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT diff --git a/addons/source-python/data/source-python/memory/csgo/global_pointers.ini b/addons/source-python/data/source-python/memory/csgo/global_pointers.ini index 706b3a1ff..6ef05378e 100644 --- a/addons/source-python/data/source-python/memory/csgo/global_pointers.ini +++ b/addons/source-python/data/source-python/memory/csgo/global_pointers.ini @@ -4,31 +4,33 @@ binary = server srv_check = False # identifier_linux = _ZZ23EntityFactoryDictionaryvE15s_EntityFactory -identifier_linux = 55 89 E5 83 EC 28 80 3D 2A 2A 2A 2A 00 74 2A C9 B8 2A 2A 2A 2A C3 8D 76 00 8D BC 27 00 00 00 00 C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A 85 C0 74 2A C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A C7 44 24 08 2A 2A 2A 2A C7 44 24 04 2A 2A 2A 2A C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A B8 2A 2A 2A 2A C9 C3 89 45 F4 C7 04 24 2A 2A 2A 2A E8 2A 2A 2A 2A 8B 45 F4 89 04 24 E8 2A 2A 2A 2A 90 8D 76 00 8D BC 27 00 00 00 00 55 89 E5 57 +identifier_linux = 55 89 E5 53 83 EC 04 8B 5D 08 E8 2A 2A 2A 2A 83 EC 08 8B 10 53 identifier_windows = A1 2A 2A 2A 2A B9 2A 2A 2A 2A 56 FF 75 08 FF 50 04 8B C8 C7 05 2A 2A 2A 2A 00 00 00 00 85 C9 75 2A 33 F6 EB offset_windows = 6 -offset_linux = 17 -level = 1 +offset_linux = 15 +level_windows = 1 +accessor_linux = true +accessor_offset_linux = 11 [CGlobalEntityList] binary = server srv_check = False -identifier_linux = E8 2A 2A 2A 2A E8 2A 2A 2A 2A C7 2A 2A 2A 2A 2A 2A E8 2A 2A 2A 2A E8 +identifier_linux = E8 2A 2A 2A 2A E8 2A 2A 2A 2A 83 EC 0C 68 2A 2A 2A 2A # Search the signature of OnCBaseEntityList::AddNonNetworkableEntity(IHandleEntity *) # Note: The Linux binary does not contain the gEntList pointer in that function! identifier_windows = 55 8B EC 8B 0D 2A 2A 2A 2A 53 offset_windows = 101 -offset_linux = 13 +offset_linux = 14 level = 1 [IServer] binary = bin/engine srv_check = False # identifier_linux = sv -identifier_linux = 55 89 E5 53 83 EC 14 8B 45 0C C7 04 24 2A 2A 2A 2A +identifier_linux = 55 89 E5 53 83 EC 0C FF 75 0C 68 2A 2A 2A 2A identifier_windows = 55 8B EC 56 FF 2A 2A B9 2A 2A 2A 2A E8 2A 2A 2A 2A 8B offset_windows = 8 -offset_linux = 13 +offset_linux = 11 level = 1 [CBaseTempEntity] diff --git a/addons/source-python/packages/source-python/memory/helpers.py b/addons/source-python/packages/source-python/memory/helpers.py index f776735b7..4c0ba2177 100755 --- a/addons/source-python/packages/source-python/memory/helpers.py +++ b/addons/source-python/packages/source-python/memory/helpers.py @@ -84,6 +84,8 @@ class Key(object): # Pointer keys LEVEL = 'level' + ACCESSOR = 'accessor' + ACCESSOR_OFFSET = 'accessor_offset' # (Virtual) function keys ARGS = 'arguments' diff --git a/addons/source-python/packages/source-python/memory/manager.py b/addons/source-python/packages/source-python/memory/manager.py index be6230f17..b09649420 100755 --- a/addons/source-python/packages/source-python/memory/manager.py +++ b/addons/source-python/packages/source-python/memory/manager.py @@ -722,7 +722,8 @@ def create_function_typedefs_from_file(self, f): self.function_typedef(name, *data) def global_pointer( - self, cls, binary, identifier, offset=0, level=0, srv_check=True): + self, cls, binary, identifier, offset=0, level=0, srv_check=True, + accessor=False, accessor_offset=0): """Search for a global pointer and wrap the it.""" manager_logger.log_debug( 'Retrieving global pointer for {}...'.format(cls.__name__)) @@ -731,7 +732,17 @@ def global_pointer( binary = find_binary(binary, srv_check) # Get the global pointer - ptr = binary.find_pointer(identifier, offset, level) + if accessor: + ptr = binary[identifier] + ptr = (ptr + offset + ptr.get_pointer(accessor_offset)).make_function( + Convention.CDECL, + (), + DataType.POINTER + )() + for _ in range(level): + ptr = ptr.get_pointer() + else: + ptr = binary.find_pointer(identifier, offset, level) # Raise an error if the pointer is invalid if not ptr: @@ -753,6 +764,8 @@ def create_global_pointers_from_file(self, f): (Key.OFFSET, Key.as_int, 0), (Key.LEVEL, Key.as_int, 0), (Key.SRV_CHECK, Key.as_bool, True), + (Key.ACCESSOR, Key.as_bool, False), + (Key.ACCESSOR_OFFSET, Key.as_int, 0) ) )