diff --git a/configs/addons/counterstrikesharp/gamedata/gamedata.json b/configs/addons/counterstrikesharp/gamedata/gamedata.json index 6eef982ed..d6aae93e3 100644 --- a/configs/addons/counterstrikesharp/gamedata/gamedata.json +++ b/configs/addons/counterstrikesharp/gamedata/gamedata.json @@ -10,7 +10,7 @@ "signatures": { "library": "server", "windows": "48 85 C9 0F 84 ? ? ? ? 48 89 5C 24 ? 55", - "linux": "55 48 8D 05 F8 5F 8B 00" + "linux": "55 48 8D 05 ? ? ? ? 48 89 E5 41 57 41 89 F7 31 F6" } }, "CCSPlayerController_SwitchTeam": { @@ -22,14 +22,14 @@ }, "CCSPlayerController_ChangeTeam": { "offsets": { - "windows": 100, - "linux": 99 + "windows": 107, + "linux": 106 } }, "CCSPlayerController_Respawn": { "offsets": { - "windows": 257, - "linux": 259 + "windows": 276, + "linux": 278 } }, "CBasePlayerController_SetPawn": { @@ -99,7 +99,7 @@ "signatures": { "library": "server", "windows": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 33 ED 48 8B FA 8B F1", - "linux": "55 48 89 E5 41 54 53 48 81 EC 10 01 00 00 48 85 FF" + "linux": "55 48 89 E5 41 54 53 48 81 EC ? ? ? ? 48 85 FF" } }, "CCSPlayer_ItemServices_GiveNamedItem": { @@ -135,8 +135,8 @@ }, "CCSGameRules_FindPickerEntity": { "offsets": { - "windows": 27, - "linux": 28 + "windows": 25, + "linux": 26 } }, "UTIL_CreateEntityByName": { @@ -163,7 +163,7 @@ "CEntityInstance_AcceptInput": { "signatures": { "library": "server", - "windows": "E8 ? ? ? ? F6 44 24 ? ? 74 ? 48 8B 05 ? ? ? ? 48 8B 54 24 ? 48 8B 08 48 8B 01 FF 50 ? 48 83 C4 ? 5B C3 CC CC CC 48 89 5C 24", + "windows": "89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 49 8B F0 48 8B D9 48 8B 0D", "linux": "55 48 89 F0 48 89 E5 41 57 49 89 FF 41 56 48 8D 7D C0" } }, @@ -183,8 +183,8 @@ }, "CBasePlayerPawn_CommitSuicide": { "offsets": { - "windows": 380, - "linux": 380 + "windows": 404, + "linux": 404 } }, "CBasePlayerPawn_RemovePlayerItem": { @@ -196,8 +196,8 @@ }, "CBaseEntity_Teleport": { "offsets": { - "windows": 157, - "linux": 156 + "windows": 166, + "linux": 165 } }, "CBaseEntity_TakeDamageOld": { @@ -243,8 +243,8 @@ "IGameSystem_InitAllSystems_pFirst": { "signatures": { "library": "server", - "windows": "48 89 5C 24 ? 55 56 57 48 83 EC ? 48 8D 05", - "linux": "4C 8B 35 ? ? ? ? 4D 85 F6 75 ? E9" + "windows": "48 8B 1D ? ? ? ? 48 85 DB 0F 84 ? ? ? ? BD", + "linux": "4C 8B 35 ? ? ? ? 4D 85 F6 75" } }, "CEntityResourceManifest_AddResource": { @@ -262,8 +262,8 @@ }, "CheckTransmitPlayerSlot": { "offsets": { - "windows": 584, - "linux": 584 + "windows": 576, + "linux": 576 } } } diff --git a/managed/CounterStrikeSharp.API/Core/Model/CCSGameRules.cs b/managed/CounterStrikeSharp.API/Core/Model/CCSGameRules.cs index dad1afd20..35ef63c6a 100644 --- a/managed/CounterStrikeSharp.API/Core/Model/CCSGameRules.cs +++ b/managed/CounterStrikeSharp.API/Core/Model/CCSGameRules.cs @@ -14,6 +14,8 @@ * along with CounterStrikeSharp. If not, see . * */ +using System.Runtime.InteropServices; + using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Utils; @@ -30,11 +32,26 @@ public void TerminateRound(float delay, RoundEndReason roundEndReason) VirtualFunctions.TerminateRound(Handle, roundEndReason, delay, 0, 0); } + internal CBaseEntity? FindPickerEntityInternal(CBasePlayerController player) + { + // TODO: TEST! + // the third parameter seems to be something like `CDefaultTypedEntityInstanceFilter` but its optional (earlier it was a string?) + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + VirtualFunctionWithReturn CCSGameRules_FindPickerEntity = new(Handle, GameData.GetOffset("CCSGameRules_FindPickerEntity")); + return CCSGameRules_FindPickerEntity.Invoke(this, player, null); + } else + { + VirtualFunctionWithReturn CCSGameRules_FindPickerEntity = new(Handle, GameData.GetOffset("CCSGameRules_FindPickerEntity")); + return CCSGameRules_FindPickerEntity.Invoke(this, player, null, 0, 0); // on linux we have a fourth and fifth parameter aswell, but they are unused because the condition for them is always unmet. + } + } + public T? FindPickerEntity(CBasePlayerController player) where T : CBaseEntity { - VirtualFunctionWithReturn CCSGameRules_FindPickerEntity = new (Handle, GameData.GetOffset("CCSGameRules_FindPickerEntity")); - CBaseEntity? entity = CCSGameRules_FindPickerEntity.Invoke(this, player); + CBaseEntity? entity = FindPickerEntityInternal(player); if (entity == null || !entity.IsValid) {