/**
 * 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"
{
	/* General Temp Entities */
	"#default"
	{
		"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"
			}
			"GetTENext"
			{
				"windows"	"8"
				"windows64"	"16"
				"linux"		"8"
				"linux64"	"16"
			}
			"TE_GetServerClass"
			{
				"windows"	"0"
				"windows64"	"0"
				"linux"		"0"
				"linux64"	"0"
			}
		}

		"Signatures"
		{
			/* CBaseTempEntity constructor (links each TE into the s_pTempEntities list).
			 * windows/windows64 only; linux/linux64 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"
			}
		}
	}

	/* SetUserInfo data */
	"#default"
	{
		"Offsets"
		{
			/**
			 * CBaseClient::SetUserCVar(char  const*,char  const*);
			 * 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"
			}
			/**
			 * CBaseClient::SetName(char  const*);  (name-sanitize fn, string "(%d)%-.*s")
			 */
			"SetClientName"
			{
				"windows"	"17"
				"windows64"	"17"
				"linux"		"57"
				"linux64"	"57"
			}
			/**
			 * 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"
			}
		}
	}
}
