From 0d97198f88f17091595728f53509edc6182ba8eb Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Tue, 19 Mar 2013 11:22:52 -0400 Subject: [PATCH] Initial commit of Dota 2 gamedata (bug 5656, r=asherkin). --- gamedata/core.games/common.games.txt | 1 + gamedata/core.games/engine.dota.txt | 55 +++++ gamedata/core.games/master.games.txt | 5 + gamedata/sdktools.games/engine.dota.txt | 282 +++++++++++++++++++++++ gamedata/sdktools.games/master.games.txt | 5 + 5 files changed, 348 insertions(+) create mode 100644 gamedata/core.games/engine.dota.txt create mode 100644 gamedata/sdktools.games/engine.dota.txt diff --git a/gamedata/core.games/common.games.txt b/gamedata/core.games/common.games.txt index f08c5793..ab20cbb2 100644 --- a/gamedata/core.games/common.games.txt +++ b/gamedata/core.games/common.games.txt @@ -95,6 +95,7 @@ "engine" "left4dead2" "engine" "alienswarm" "engine" "csgo" + "engine" "dota" } "Offsets" diff --git a/gamedata/core.games/engine.dota.txt b/gamedata/core.games/engine.dota.txt new file mode 100644 index 00000000..8db0ddf9 --- /dev/null +++ b/gamedata/core.games/engine.dota.txt @@ -0,0 +1,55 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater or by upgrading your SourceMod install. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + +"Games" +{ + /* CGlobalEntityList */ + "#default" + { + "#supported" + { + "game" "dota" + } + + "Offsets" + { + /* Offset into LevelShutdown */ + "gEntList" + { + "windows" "8" + } + + "EntInfo" + { + "windows" "4" + "linux" "4" + "mac" "4" + } + } + + "Signatures" + { + // This isn't LevelShutdown, but there aren't a lot of places to get this from due to crazy insane inlining errwhere + "LevelShutdown" + { + "library" "server" + "windows" "\x8B\x3D\x2A\x2A\x2A\x2A\xC7\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x89\x2A\x2A\x2A\x2A\x2A\x89\x2A\x2A\x2A\x2A\x2A\x89" + } + + "gEntList" + { + "library" "server" + "linux" "@gEntList" + "mac" "@gEntList" + } + } + } +} diff --git a/gamedata/core.games/master.games.txt b/gamedata/core.games/master.games.txt index 18c103b2..eb21a533 100644 --- a/gamedata/core.games/master.games.txt +++ b/gamedata/core.games/master.games.txt @@ -69,6 +69,11 @@ { "engine" "csgo" } + + "engine.dota.txt" + { + "engine" "dota" + } "blacklist.plugins.txt" { diff --git a/gamedata/sdktools.games/engine.dota.txt b/gamedata/sdktools.games/engine.dota.txt new file mode 100644 index 00000000..55f35321 --- /dev/null +++ b/gamedata/sdktools.games/engine.dota.txt @@ -0,0 +1,282 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater or by upgrading your SourceMod install. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + +"Games" +{ + /* Sounds */ + "#default" + { + "Keys" + { + "SlapSoundCount" "7" + "SlapSound1" "vo/axe/axe_pain_01.mp3" + "SlapSound1" "vo/axe/axe_pain_02.mp3" + "SlapSound1" "vo/axe/axe_pain_03.mp3" + "SlapSound1" "vo/axe/axe_pain_04.mp3" + "SlapSound1" "vo/axe/axe_pain_05.mp3" + "SlapSound1" "vo/axe/axe_pain_06.mp3" + "SlapSound1" "vo/axe/axe_pain_07.mp3" + } + } + + /* General Temp Entities */ + "#default" + { + "Offsets" + { + //Offset into CBaseTempEntity constructor + "s_pTempEntities" + { + "windows" "1" + } + "GetTEName" + { + "windows" "4" + } + "GetTENext" + { + "windows" "8" + } + "TE_GetServerClass" + { + "windows" "0" + } + } + + "Signatures" + { + "CBaseTempEntity" + { + "library" "server" + "windows" "\xA1\x2A\x2A\x2A\x2A\xF3\x0F\x10\x15\x2A\x2A\x2A\x2A\xF3" + } + } + } + + /* CGlobalEntityList */ + "#default" + { + "Signatures" + { + /* Functions in CGlobalEntityList */ + "FindEntityByClassname" + { + "library" "server" + "windows" "\x55\x8B\xEC\x53\x8B\x5D\x2A\x56\x57\x85\xC9\x74\x2A\x8B" + } + } + } + + /* General GameRules */ + "#default" + { + "Keys" + { + "GameRulesProxy" "CDOTAGamerulesProxy" + } + + "Offsets" + { + /* Offset into CreateGameRulesObject */ + "g_pGameRules" + { + "windows" "2" + } + } + + "Signatures" + { + /* This signature sometimes has multiple matches, but this + * does not matter as g_pGameRules is involved in all of them. + * The same g_pGameRules offset applies to each match. + * + * Sometimes this block of bytes is at the beginning of the static + * CreateGameRulesObject function and sometimes it is in the middle + * of an entirely different function. This depends on the game. + */ + "CreateGameRulesObject" + { + "library" "server" + "windows" "\x8B\x0D\x2A\x2A\x2A\x2A\x85\xC9\x74\x2A\x8B\x01\x8B\x50\x2A\x6A\x01\xFF\xD2" + } + "g_pGameRules" + { + "library" "server" + } + } + } + + /* IServer interface pointer */ + "#default" + { + "Keys" + { + /* 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 + * function and this signature is used to verify that it contains + * the expected code. A pointer to sv (IServer interface) is used + * here. + */ + "CreateFakeClient_Windows" "\x55\x8B\xEC\x8B\x2A\x2A\x56\x50\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75" + } + + "Offsets" + { + /* Offset into IVEngineServer::CreateFakeClient */ + "sv" + { + "windows" "9" + } + } + } + + /* Resource Entity override */ + "#default" + { + // Dota's player manager does not have DT_PlayerResource embedded, unlike most other games + "Keys" + { + "ResourceEntityClassname" "dota_player_manager" + } + } + + /* EntityFactoryDictionary function */ + "#default" + { + "Signatures" + { + "EntityFactoryFinder" + { + // EntityFactoryDictionary gets inlined on Windows in Dota 2. The pointer to the static factory becomes a global. + "library" "server" + "windows" "\xA1\x2A\x2A\x2A\x2A\x8B\x50\x04\x57\xB9\x2A\x2A\x2A\x2A\xFF\xD2\x33\xF6" + //"linux" "@_Z23EntityFactoryDictionaryv" + //"mac" "@_Z23EntityFactoryDictionaryv" + } + } + + "Offsets" + { + "EntityFactoryOffset" + { + "windows" "1" + } + } + } + + /* CBaseEntityOutput::FireOutput */ + "#default" + { + "Signatures" + { + "FireOutput" + { + "library" "server" + "windows" "\x55\x8B\xEC\x83\x2A\x2A\x81\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\xC4\x89\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x45\x2A\x53\x8B\x59\x2A\x56\x8B" + } + } + } + + /* SetUserInfo data */ + "#default" + { + "Offsets" + { + /** + * CBaseClient::SetUserCVar(char const*,char const*); + * Linux offset straight from VTable dump. + * Windows offset is crazy. Found the windows SetName function using string "(%d)%-.*s" (aD_S in IDA) + * Cross referenced back to the vtable and counted manually (SetUserCvar is 1 higher, offsets start from 1) + */ + "SetUserCvar" + { + "windows" "26" + } + /** + * 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+0B0h], 0 + * Win: mov byte ptr [esi+0B0h], 0 + * + * L4D2: This has been moved into CBaseClient::UpdateUserSettings(), rest of the details are still relevant. + */ + "InfoChanged" + { + "windows" "212" + } + } + } + + "dota" + { + "Offsets" + { + "GiveNamedItem" + { + "windows" "438" + } + "RemovePlayerItem" + { + "windows" "300" + } + "Weapon_GetSlot" + { + "windows" "289" + } + "Ignite" + { + "windows" "231" + } + "Extinguish" + { + "windows" "234" + } + "Teleport" + { + "windows" "114" + } + "CommitSuicide" + { + "windows" "482" + } + "GetVelocity" + { + "windows" "147" + } + "EyeAngles" + { + "windows" "138" + } + "AcceptInput" + { + "windows" "41" + } + "SetEntityModel" + { + "windows" "26" + } + "WeaponEquip" + { + "windows" "292" + } + "Activate" + { + "windows" "37" + } + "PlayerRunCmd" + { + "windows" "458" + } + } + } +} diff --git a/gamedata/sdktools.games/master.games.txt b/gamedata/sdktools.games/master.games.txt index b8d45f20..278b358d 100644 --- a/gamedata/sdktools.games/master.games.txt +++ b/gamedata/sdktools.games/master.games.txt @@ -70,6 +70,11 @@ "engine" "csgo" } + "engine.dota.txt" + { + "engine" "dota" + } + "game.tf.txt" { "game" "tf"