From 119d4b83c9be0cd623eb1ee7f95a5de121e05f23 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Sat, 11 Jul 2026 12:36:36 -0400 Subject: [PATCH] gamedata: update PVKII for 1.0 (fix #2348) and add 64-bit support --- gamedata/core.games/engine.pvkii.txt | 20 +- gamedata/sdkhooks.games/game.pvkii.txt | 368 +++++++++++++---------- gamedata/sdktools.games/engine.pvkii.txt | 74 +++-- gamedata/sdktools.games/game.pvkii.txt | 44 ++- 4 files changed, 318 insertions(+), 188 deletions(-) diff --git a/gamedata/core.games/engine.pvkii.txt b/gamedata/core.games/engine.pvkii.txt index da4ee8ad..243ac705 100644 --- a/gamedata/core.games/engine.pvkii.txt +++ b/gamedata/core.games/engine.pvkii.txt @@ -13,46 +13,54 @@ { /* CGlobalEntityList */ "#default" - { + { "Offsets" { - /* Offset into LevelShutdown */ + /* Offset into LevelShutdown (windows) / into the gEntList-reference + * signature below (windows64: position of the lea disp32) */ "gEntList" { "windows" "11" + "windows64" "25" "linux" "13" } } - + "Signatures" { "LevelShutdown" { "library" "server" "windows" "\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8" + /* Not the literal LevelShutdown; a unique function that references + * gEntList via "lea rcx, [rip+gEntList]" (disp32 at offset 25). */ + "windows64" "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x33\xFF\x48\x8D\x51\x10\x48\x85\xC9\x48\x8B\xD9\x48\x8D\x0D\x2A\x2A\x2A\x2A" "linux" "\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xC7\x2A\x2A\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8" } "gEntList" { "library" "server" + "linux64" "@gEntList" "mac" "@gEntList" } } } - + "#default" { "Keys" { "UseInvalidUniverseInSteam2IDs" "1" } - + "Offsets" { "EntInfo" { - "windows" "4" + "windows" "4" + "windows64" "8" "linux" "4" + "linux64" "8" "mac" "4" } } diff --git a/gamedata/sdkhooks.games/game.pvkii.txt b/gamedata/sdkhooks.games/game.pvkii.txt index 212772a1..d62cc070 100644 --- a/gamedata/sdkhooks.games/game.pvkii.txt +++ b/gamedata/sdkhooks.games/game.pvkii.txt @@ -1,159 +1,209 @@ -"Games" -{ - /* Pirates, Vikings and Knights II */ - "pvkii" - { - "Offsets" - { - "EntityListeners" - { - "windows" "262180" - "linux" "262180" - } - "Blocked" - { - "windows" "104" - "linux" "105" - "mac" "105" - } - "EndTouch" - { - "windows" "102" - "linux" "103" - "mac" "103" - } - "FireBullets" - { - "windows" "114" - "linux" "115" - "mac" "115" - } - "GetMaxHealth" - { - "windows" "119" - "linux" "120" - "mac" "120" - } - "GroundEntChanged" - { - "windows" "179" - "linux" "181" - "mac" "181" - } - "OnTakeDamage" - { - "windows" "64" - "linux" "65" - "mac" "65" - } - "OnTakeDamage_Alive" - { - "windows" "276" - "linux" "277" - "mac" "277" - } - "PreThink" - { - "windows" "337" - "linux" "338" - "mac" "338" - } - "PostThink" - { - "windows" "338" - "linux" "339" - "mac" "339" - } - "Reload" - { - "windows" "274" - "linux" "275" - "mac" "275" - } - "SetTransmit" - { - "windows" "22" - "linux" "23" - "mac" "23" - } - "ShouldCollide" - { - "windows" "17" - "linux" "18" - "mac" "18" - } - "Spawn" - { - "windows" "24" - "linux" "25" - "mac" "25" - } - "StartTouch" - { - "windows" "100" - "linux" "101" - "mac" "101" - } - "Think" - { - "windows" "49" - "linux" "50" - "mac" "50" - } - "Touch" - { - "windows" "101" - "linux" "102" - "mac" "102" - } - "TraceAttack" - { - "windows" "62" - "linux" "63" - "mac" "63" - } - "Use" - { - "windows" "99" - "linux" "100" - "mac" "100" - } - "VPhysicsUpdate" - { - "windows" "159" - "linux" "160" - "mac" "160" - } - "Weapon_CanSwitchTo" - { - "windows" "270" - "linux" "271" - "mac" "271" - } - "Weapon_CanUse" - { - "windows" "264" - "linux" "265" - "mac" "265" - } - "Weapon_Drop" - { - "windows" "267" - "linux" "268" - "mac" "268" - } - "Weapon_Equip" - { - "windows" "265" - "linux" "266" - "mac" "266" - } - "Weapon_Switch" - { - "windows" "268" - "linux" "269" - "mac" "269" - } - } - } -} +"Games" +{ + /* Pirates, Vikings and Knights II */ + "pvkii" + { + "Offsets" + { + "EntityListeners" + { + "windows" "262180" + "windows64" "524344" + "linux" "262180" + "linux64" "524344" + } + "Blocked" + { + "windows" "104" + "windows64" "104" + "linux" "105" + "linux64" "105" + "mac" "105" + } + "EndTouch" + { + "windows" "102" + "windows64" "102" + "linux" "103" + "linux64" "103" + "mac" "103" + } + "FireBullets" + { + "windows" "114" + "windows64" "114" + "linux" "115" + "linux64" "115" + "mac" "115" + } + "GetMaxHealth" + { + "windows" "119" + "windows64" "119" + "linux" "120" + "linux64" "120" + "mac" "120" + } + "GroundEntChanged" + { + "windows" "179" + "windows64" "179" + "linux" "181" + "linux64" "181" + "mac" "181" + } + "OnTakeDamage" + { + "windows" "64" + "windows64" "64" + "linux" "65" + "linux64" "65" + "mac" "65" + } + "OnTakeDamage_Alive" + { + "windows" "276" + "windows64" "276" + "linux" "277" + "linux64" "277" + "mac" "277" + } + "PreThink" + { + "windows" "337" + "windows64" "337" + "linux" "338" + "linux64" "338" + "mac" "338" + } + "PostThink" + { + "windows" "338" + "windows64" "338" + "linux" "339" + "linux64" "339" + "mac" "339" + } + "Reload" + { + "windows" "274" + "windows64" "274" + "linux" "275" + "linux64" "275" + "mac" "275" + } + "SetTransmit" + { + "windows" "22" + "windows64" "22" + "linux" "23" + "linux64" "23" + "mac" "23" + } + "ShouldCollide" + { + "windows" "17" + "windows64" "17" + "linux" "18" + "linux64" "18" + "mac" "18" + } + "Spawn" + { + "windows" "24" + "windows64" "24" + "linux" "25" + "linux64" "25" + "mac" "25" + } + "StartTouch" + { + "windows" "100" + "windows64" "100" + "linux" "101" + "linux64" "101" + "mac" "101" + } + "Think" + { + "windows" "49" + "windows64" "49" + "linux" "50" + "linux64" "50" + "mac" "50" + } + "Touch" + { + "windows" "101" + "windows64" "101" + "linux" "102" + "linux64" "102" + "mac" "102" + } + "TraceAttack" + { + "windows" "62" + "windows64" "62" + "linux" "63" + "linux64" "63" + "mac" "63" + } + "Use" + { + "windows" "99" + "windows64" "99" + "linux" "100" + "linux64" "100" + "mac" "100" + } + "VPhysicsUpdate" + { + "windows" "159" + "windows64" "159" + "linux" "160" + "linux64" "160" + "mac" "160" + } + "Weapon_CanSwitchTo" + { + "windows" "270" + "windows64" "270" + "linux" "271" + "linux64" "271" + "mac" "271" + } + "Weapon_CanUse" + { + "windows" "264" + "windows64" "264" + "linux" "265" + "linux64" "265" + "mac" "265" + } + "Weapon_Drop" + { + "windows" "267" + "windows64" "267" + "linux" "268" + "linux64" "268" + "mac" "268" + } + "Weapon_Equip" + { + "windows" "265" + "windows64" "265" + "linux" "266" + "linux64" "266" + "mac" "266" + } + "Weapon_Switch" + { + "windows" "268" + "windows64" "268" + "linux" "269" + "linux64" "269" + "mac" "269" + } + } + } +} diff --git a/gamedata/sdktools.games/engine.pvkii.txt b/gamedata/sdktools.games/engine.pvkii.txt index 29c73df1..082d02e0 100644 --- a/gamedata/sdktools.games/engine.pvkii.txt +++ b/gamedata/sdktools.games/engine.pvkii.txt @@ -16,33 +16,67 @@ { "Offsets" { + /* Offset in the CBaseTempEntity ctor to the s_pTempEntities reference. + * windows: imm32 operand of "mov eax, s_pTempEntities" + * windows64: disp32 of "mov rax, [rip+s_pTempEntities]" */ + "s_pTempEntities" + { + "windows" "16" + "windows64" "17" + } "GetTEName" { "windows" "4" + "windows64" "8" "linux" "4" + "linux64" "8" "mac" "4" } "GetTENext" { "windows" "8" + "windows64" "16" "linux" "8" + "linux64" "16" "mac" "8" } "TE_GetServerClass" { "windows" "0" + "windows64" "0" "linux" "0" + "linux64" "0" "mac" "0" } } + + "Signatures" + { + /* CBaseTempEntity constructor (links each TE into the s_pTempEntities list). + * windows/windows64 only; linux/mac resolve s_pTempEntities via symbol below. */ + "CBaseTempEntity" + { + "library" "server" + "windows" "\x55\x8B\xEC\x8B\x45\x08\x89\x41\x04\xC7\x01\x2A\x2A\x2A\x2A\xA1" + "windows64" "\x48\x8D\x05\x2A\x2A\x2A\x2A\x48\x89\x51\x08\x48\x89\x01\x48\x8B\x05" + } + /* Head of the temp-entity linked list */ + "s_pTempEntities" + { + "library" "server" + "linux" "@_ZN15CBaseTempEntity15s_pTempEntitiesE" + "linux64" "@_ZN15CBaseTempEntity15s_pTempEntitiesE" + "mac" "@_ZN15CBaseTempEntity15s_pTempEntitiesE" + } + } } - + /* IServer interface pointer */ "#default" { "Keys" { - /* Signature for the beginning of IVEngineServer::CreateFakeClientEx. + /* Signature for the beginning of IVEngineServer::CreateFakeClient. * * The engine binary is not actually scanned in order to look for * this. SourceHook is used to used to determine the address of the @@ -50,15 +84,18 @@ * the expected code. A pointer to sv (IServer interface) is used * here. */ - "CreateFakeClient_Windows" "\x55\x8B\xEC\x8B\x2A\x2A\x50\xB9\x2A\x2A\x2A\x2A\xE8" + "CreateFakeClient_Windows" "\x55\x8B\xEC\xFF\x75\x08\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75" + "CreateFakeClient_Windows64" "\x48\x83\xEC\x28\x48\x8D\x0D\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x48\x85\xC0\x75" } - + "Offsets" { - /* Offset into IVEngineServer::CreateFakeClient */ + /* Offset into IVEngineServer::CreateFakeClient + * (windows: imm32 of "mov ecx, sv"; windows64: disp32 of "lea rcx, [rip+sv]") */ "sv" { - "windows" "8" + "windows" "7" + "windows64" "7" } } @@ -69,11 +106,12 @@ { "library" "engine" "linux" "@sv" + "linux64" "@sv" "mac" "@sv" } } } - + /* SetUserInfo data */ "#default" { @@ -81,37 +119,39 @@ { /** * CBaseClient::SetUserCVar(char const*,char const*); - * Linux offset straight from VTable dump. - * Windows offset is crazy. Found the windows SetName function using string "(%d)%-0.*s" - * Cross referenced back to the vtable and counted manually (SetUserCvar is 1 higher, offsets start from 1) + * SetName is one slot lower; identified via the name-sanitize function + * (strings "(%d)%-.*s", "unnamed") and CBaseClient RTTI. Verified for 1.0. */ "SetUserCvar" { "windows" "18" + "windows64" "18" "linux" "58" + "linux64" "58" "mac" "58" } /** - * CBaseClient::SetName(char const*); - * Linux offset straight from VTable dump. - * Has string "(%d)%-0.*s" + * CBaseClient::SetName(char const*); (name-sanitize fn, string "(%d)%-.*s") */ "SetClientName" { "windows" "17" + "windows64" "17" "linux" "57" + "linux64" "57" "mac" "57" } /** - * Offset into CBaseClient - Used by CBaseServer::UpdateUserSettings to determine when changes have been made. - * Find CBaseClient::UpdateUserSettings (strings "net_maxroutable", "cl_updaterate" etc) and the offset is set to 0 near the end. - * Linux: mov byte ptr [esi+98h], 0 - * Win: mov byte ptr [esi+0A4h], 0 + * Offset into CBaseClient (m_bConVarsChanged) - set to 1 near the end of + * CBaseClient::SetName; reset to 0 in UpdateUserSettings. + * 32-bit = 140; 64-bit = 160 (verified: mov byte [client+0xA0], 1 in SetName). */ "InfoChanged" { "windows" "140" + "windows64" "160" "linux" "140" + "linux64" "160" "mac" "140" } } diff --git a/gamedata/sdktools.games/game.pvkii.txt b/gamedata/sdktools.games/game.pvkii.txt index a8ad48d5..dc74261a 100644 --- a/gamedata/sdktools.games/game.pvkii.txt +++ b/gamedata/sdktools.games/game.pvkii.txt @@ -12,9 +12,9 @@ "Games" { /* Pirates, Vikings and Knights II */ - - + + /* CBaseEntityOutput::FireOutput */ "pvkii" { @@ -23,13 +23,15 @@ "FireOutput" { "library" "server" - "windows" "\x55\x8B\xEC\x81\xEC\x04\x04\x00\x00\x53\x8B\xD9" - "linux" "\xE8\xA2\xAE\xC7\xFF\x05\x9B\xB8\x5E\x00\x55\x89\xE5\x57\x56\x53" + "windows" "\x55\x8B\xEC\x6A\x2A\x68\x2A\x2A\x2A\x2A\x64\xA1\x2A\x2A\x2A\x2A\x50\x64\x89\x25\x2A\x2A\x2A\x2A\x81\xEC\x2A\x2A\x2A\x2A\x8B\xC1\xC7\x45" + "windows64" "\x48\x8B\xC4\x48\x89\x50\x10\x48\x89\x48\x08\x55\x53\x56" + "linux" "\x55\x57\x56\x53\xE8\x2A\x2A\x2A\x2A\x81\xC3\x2A\x2A\x2A\x2A\x81\xEC\x2A\x2A\x2A\x2A\x8B\x84\x24\x2A\x2A\x2A\x2A\x8B\xAC\x24\x2A\x2A\x2A\x2A\x66\x0F\x6E\x84\x24" + "linux64" "\x41\x57\x66\x48\x0F\x6E\xCF" "mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" } } } - + "pvkii" { "Offsets" @@ -38,95 +40,125 @@ "GiveNamedItem" { "windows" "405" + "windows64" "405" "linux" "406" + "linux64" "406" "mac" "406" } "RemovePlayerItem" { "windows" "274" + "windows64" "274" "linux" "275" + "linux64" "275" "mac" "275" } "Weapon_GetSlot" { "windows" "272" + "windows64" "272" "linux" "273" + "linux64" "273" "mac" "273" } "Ignite" { "windows" "213" + "windows64" "213" "linux" "214" + "linux64" "214" "mac" "214" } "Extinguish" { "windows" "217" + "windows64" "217" "linux" "218" + "linux64" "218" "mac" "218" } "Teleport" { "windows" "110" + "windows64" "110" "linux" "111" + "linux64" "111" "mac" "111" } "CommitSuicide" { "windows" "444" + "windows64" "444" "linux" "444" + "linux64" "444" "mac" "444" } "GetVelocity" { "windows" "142" + "windows64" "142" "linux" "143" + "linux64" "143" "mac" "143" } "EyeAngles" { "windows" "133" + "windows64" "133" "linux" "134" + "linux64" "134" "mac" "134" } "AcceptInput" { "windows" "38" + "windows64" "38" "linux" "39" + "linux64" "39" "mac" "39" } "SetEntityModel" { "windows" "26" + "windows64" "26" "linux" "27" + "linux64" "27" "mac" "27" } "WeaponEquip" { "windows" "265" + "windows64" "265" "linux" "266" + "linux64" "266" "mac" "266" } "Activate" { "windows" "35" + "windows64" "35" "linux" "36" + "linux64" "36" "mac" "36" } "PlayerRunCmd" { "windows" "423" + "windows64" "423" "linux" "424" + "linux64" "424" "mac" "424" } "GiveAmmo" { "windows" "256" + "windows64" "256" "linux" "257" + "linux64" "257" "mac" "257" } } - + "Keys" { "GameRulesProxy" "CPVK2GameRulesProxy"