diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d77a1f5c8e..d8bb398eff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: path: sourcemod - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: hl2sdk-mysql-mmsource with: diff --git a/bridge/include/IFileSystemBridge.h b/bridge/include/IFileSystemBridge.h index 73fdec8d60..4c62506f76 100644 --- a/bridge/include/IFileSystemBridge.h +++ b/bridge/include/IFileSystemBridge.h @@ -44,6 +44,7 @@ class IFileSystemBridge virtual char *ReadLine(char *pOutput, int maxChars, FileHandle_t file) = 0; virtual bool EndOfFile(FileHandle_t file) = 0; virtual bool FileExists(const char *pFileName, const char *pPathID = 0) = 0; + virtual unsigned int Size(FileHandle_t file) = 0; virtual unsigned int Size(const char *pFileName, const char *pPathID = 0) = 0; virtual int Read(void* pOutput, int size, FileHandle_t file) = 0; virtual int Write(void const* pInput, int size, FileHandle_t file) = 0; diff --git a/configs/languages.cfg b/configs/languages.cfg index ed21be9732..d4d39073f7 100644 --- a/configs/languages.cfg +++ b/configs/languages.cfg @@ -1,37 +1,38 @@ "Languages" { - "en" "English" // English "ar" "Arabic" // Arabic - "pt" "Brazilian" // Brazilian Portuguese "bg" "Bulgarian" // Bulgarian - "cze" "Czech" // Czech + "chi" "SChinese" // Chinese (Simplified) + "cze" "Czech" // Czech "da" "Danish" // Danish - "nl" "Dutch" // Dutch + "de" "German" // German + "el" "Greek" // Greek + "en" "English" // English + "es" "Spanish" // Spanish "fi" "Finnish" // Finnish "fr" "French" // French - "de" "German" // German - "el" "Greek" // Greek "he" "Hebrew" // Hebrew "hu" "Hungarian" // Hungarian "it" "Italian" // Italian "jp" "Japanese" // Japanese - "ko" "KoreanA" // Korean "ko" "Korean" // Korean - "las" "LatAm" // Latin American Spanish - "lv" "Latvian" // Latvian + "ko" "KoreanA" // Korean (https://bugs.alliedmods.net/show_bug.cgi?id=4667) + "las" "LatAm" // Latin American Spanish "lt" "Lithuanian" // Lithuanian + "lv" "Latvian" // Latvian + "nl" "Dutch" // Dutch "no" "Norwegian" // Norwegian "pl" "Polish" // Polish + "pt" "Brazilian" // Brazilian Portuguese "pt_p" "Portuguese" // Portuguese "ro" "Romanian" // Romanian "ru" "Russian" // Russian - "chi" "SChinese" // Chinese (Simplified) "sk" "Slovak" // Slovak - "es" "Spanish" // Spanish "sv" "Swedish" // Swedish - "zho" "TChinese" // Chinese (Traditional) - "th" "Thai" // Thai + "th" "Thai" // Thai "tr" "Turkish" // Turkish "ua" "Ukrainian" // Ukrainian "vi" "Vietnamese" // Vietnamese + "zho" "TChinese" // Chinese (Traditional) + } diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index 53af3dc891..7600917b40 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -1099,8 +1099,26 @@ int CHalfLife2::ReferenceToIndex(cell_t entRef) return hndl.GetEntryIndex(); } + else + { + CEntInfo *pInfo = LookupEntity(entRef); + if (!pInfo) + { + return INVALID_EHANDLE_INDEX; + } + IServerUnknown *pUnk = static_cast(pInfo->m_pEntity); + if (!pUnk) + { + return INVALID_EHANDLE_INDEX; + } + CBaseEntity *pEntity = pUnk->GetBaseEntity(); + if (!pEntity) + { + return INVALID_EHANDLE_INDEX; + } - return entRef; + return entRef; + } } cell_t CHalfLife2::EntityToBCompatRef(CBaseEntity *pEntity) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 3a5c193279..1d541daa36 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -59,6 +59,8 @@ bool g_OnMapStarted = false; IForward *PreAdminCheck = NULL; IForward *PostAdminCheck = NULL; IForward *PostAdminFilter = NULL; +IForward *ServerEnterHibernation = NULL; +IForward *ServerExitHibernation = NULL; const unsigned int *g_NumPlayersToAuth = NULL; int lifestate_offset = -1; @@ -203,6 +205,8 @@ void PlayerManager::OnSourceModAllInitialized() PreAdminCheck = forwardsys->CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1); PostAdminCheck = forwardsys->CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1); PostAdminFilter = forwardsys->CreateForward("OnClientPostAdminFilter", ET_Ignore, 1, p1); + ServerEnterHibernation = forwardsys->CreateForward("OnServerEnterHibernation", ET_Ignore, 0, NULL); + ServerExitHibernation = forwardsys->CreateForward("OnServerExitHibernation", ET_Ignore, 0, NULL); m_bIsListenServer = !engine->IsDedicatedServer(); m_ListenClient = 0; @@ -254,6 +258,8 @@ void PlayerManager::OnSourceModShutdown() forwardsys->ReleaseForward(PreAdminCheck); forwardsys->ReleaseForward(PostAdminCheck); forwardsys->ReleaseForward(PostAdminFilter); + forwardsys->ReleaseForward(ServerEnterHibernation); + forwardsys->ReleaseForward(ServerExitHibernation); delete [] m_Players; @@ -646,7 +652,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername int userId = engine->GetPlayerUserId(pEntity); #if (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_SDK2013 \ - || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_LEFT4DEAD2 || SOURCE_ENGINE == SE_PVKII) + || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_PVKII) static ConVar *tv_name = icvar->FindVar("tv_name"); #endif #if SOURCE_ENGINE == SE_TF2 @@ -675,7 +681,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername #elif SOURCE_ENGINE == SE_BLADE || strcmp(playername, "BBTV") == 0 #elif (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_SDK2013 \ - || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_LEFT4DEAD2 || SOURCE_ENGINE == SE_PVKII) + || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_PVKII) || (tv_name && strcmp(playername, tv_name->GetString()) == 0) || (tv_name && tv_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0) #else || strcmp(playername, "SourceTV") == 0 @@ -778,6 +784,11 @@ void PlayerManager::OnSourceModLevelEnd() void PlayerManager::OnServerHibernationUpdate(bool bHibernating) { + cell_t res; + if (bHibernating) + ServerEnterHibernation->Execute(&res); + else + ServerExitHibernation->Execute(&res); /* If bots were added at map start, but not fully inited before hibernation, there will * be no OnClientDisconnect for them, despite them getting booted right before this. */ diff --git a/core/logic/smn_datapacks.cpp b/core/logic/smn_datapacks.cpp index 3276c30086..9cf2a4a323 100644 --- a/core/logic/smn_datapacks.cpp +++ b/core/logic/smn_datapacks.cpp @@ -244,7 +244,19 @@ static cell_t smn_WritePackFunction(IPluginContext *pContext, const cell_t *para pDataPack->RemoveItem(); } - pDataPack->PackFunction(params[2]); + cell_t funcid = params[2]; + if (pContext->IsNullFunctionId(funcid)) + { + pDataPack->PackFunction(0); + } + else if (funcid <= 0) + { + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); + } + else + { + pDataPack->PackFunction(funcid); + } return 1; } @@ -365,7 +377,12 @@ static cell_t smn_ReadPackFunction(IPluginContext *pContext, const cell_t *param return pContext->ThrowNativeError("Invalid data pack type (got %d / expected %d).", pDataPack->GetCurrentType(), CDataPackType::Function); } - return pDataPack->ReadFunction(); + cell_t funcid = pDataPack->ReadFunction(); + if (!funcid) + { + return pContext->GetNullFunctionValue(); + } + return funcid; } static cell_t smn_ReadPackCellArray(IPluginContext *pContext, const cell_t *params) diff --git a/core/logic/smn_fakenatives.cpp b/core/logic/smn_fakenatives.cpp index cbbca65e86..e68e527a6d 100644 --- a/core/logic/smn_fakenatives.cpp +++ b/core/logic/smn_fakenatives.cpp @@ -366,6 +366,33 @@ static cell_t SetNativeArray(IPluginContext *pContext, const cell_t *params) return SP_ERROR_NONE; } +static cell_t GetNativeFunction(IPluginContext *pContext, const cell_t *params) +{ + if (!s_curnative || (s_curnative->ctx != pContext)) + { + return pContext->ThrowNativeError("Not called from inside a native function"); + } + + cell_t param = params[1]; + if (param < 1 || param > s_curparams[0]) + { + return pContext->ThrowNativeErrorEx(SP_ERROR_PARAM, "Invalid parameter number: %d", param); + } + + cell_t funcid = s_curparams[param]; + if (s_curcaller->IsNullFunctionId(funcid)) + { + // see alliedmodders/sourcepawn#912, alliedmodders/sourcemod#2068 + // convert null function to receiver's expected value so equality checks against INVALID_FUNCTION pass + return pContext->GetNullFunctionValue(); + } + else if (funcid <= 0) + { + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); + } + return funcid; +} + static cell_t FormatNativeString(IPluginContext *pContext, const cell_t *params) { if (!s_curnative || (s_curnative->ctx != pContext)) @@ -483,7 +510,7 @@ REGISTER_NATIVES(nativeNatives) {"GetNativeArray", GetNativeArray}, {"GetNativeCell", GetNativeCell}, {"GetNativeCellRef", GetNativeCellRef}, - {"GetNativeFunction", GetNativeCell}, + {"GetNativeFunction", GetNativeFunction}, {"GetNativeString", GetNativeString}, {"GetNativeStringLength", GetNativeStringLength}, {"FormatNativeString", FormatNativeString}, diff --git a/core/logic/smn_filesystem.cpp b/core/logic/smn_filesystem.cpp index 032f951e60..0577bf4d59 100644 --- a/core/logic/smn_filesystem.cpp +++ b/core/logic/smn_filesystem.cpp @@ -73,6 +73,7 @@ class FileObject public: virtual ~FileObject() {} + virtual size_t Size() = 0; virtual size_t Read(void *pOut, int size) = 0; virtual char *ReadLine(char *pOut, int size) = 0; virtual size_t Write(const void *pData, int size) = 0; @@ -119,6 +120,10 @@ class ValveFile : public FileObject return true; } + size_t Size() override { + return (size_t)bridge->filesystem->Size(handle_); + } + size_t Read(void *pOut, int size) override { return (size_t)bridge->filesystem->Read(pOut, size, handle_); } @@ -183,6 +188,30 @@ class SystemFile : public FileObject return unlink(path) == 0; } + size_t Size() override { +#ifdef PLATFORM_WINDOWS + struct _stat s; + int fd = _fileno(fp_); + if (fd == -1) + return -1; + if (_fstat(fd, &s) != 0) + return -1; + if (s.st_mode & S_IFREG) + return static_cast(s.st_size); + return -1; +#elif defined PLATFORM_POSIX + struct stat s; + int fd = fileno(fp_); + if (fd == -1) + return -1; + if (fstat(fd, &s) != 0) + return -1; + if (S_ISREG(s.st_mode)) + return static_cast(s.st_size); + return -1; +#endif + } + size_t Read(void *pOut, int size) override { return fread(pOut, 1, size, fp_); } @@ -610,7 +639,7 @@ static cell_t sm_RenameFile(IPluginContext *pContext, const cell_t *params) g_pSM->BuildPath(Path_Game, old_realpath, sizeof(old_realpath), "%s", oldpath); #ifdef PLATFORM_WINDOWS - return (MoveFileA(old_realpath, new_realpath)) ? 1 : 0; + return (MoveFileExA(old_realpath, new_realpath, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) ? 1 : 0; #elif defined PLATFORM_POSIX return (rename(old_realpath, new_realpath)) ? 0 : 1; #endif @@ -1125,6 +1154,15 @@ static cell_t sm_RemoveGameLogHook(IPluginContext *pContext, const cell_t *param return 1; } +static cell_t File_Size(IPluginContext *pContext, const cell_t *params) +{ + OpenHandle file(pContext, params[1], g_FileType); + if (!file.Ok()) + return -1; + + return file->Size(); +} + template static cell_t File_ReadTyped(IPluginContext *pContext, const cell_t *params) { @@ -1197,6 +1235,7 @@ REGISTER_NATIVES(filesystem) {"File.Seek", sm_FileSeek}, {"File.Flush", sm_FlushFile}, {"File.Position.get", sm_FilePosition}, + {"File.Size", File_Size}, {"File.ReadInt8", File_ReadTyped}, {"File.ReadUint8", File_ReadTyped}, {"File.ReadInt16", File_ReadTyped}, diff --git a/core/logic/smn_functions.cpp b/core/logic/smn_functions.cpp index ea1acaba78..41349f96ee 100644 --- a/core/logic/smn_functions.cpp +++ b/core/logic/smn_functions.cpp @@ -228,11 +228,15 @@ static cell_t sm_AddToForward(IPluginContext *pContext, const cell_t *params) } } - IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[3]); - + cell_t funcid = params[3]; + if (funcid <= 0) + { + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); + } + IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(funcid); if (!pFunction) { - return pContext->ThrowNativeError("Invalid function id (%X)", params[3]); + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); } return pForward->AddFunction(pFunction); @@ -265,11 +269,15 @@ static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *param } } - IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[3]); - + cell_t funcid = params[3]; + if (funcid <= 0) + { + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); + } + IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(funcid); if (!pFunction) { - return pContext->ThrowNativeError("Invalid function id (%X)", params[3]); + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); } return pForward->RemoveFunction(pFunction); @@ -327,11 +335,15 @@ static cell_t sm_CallStartFunction(IPluginContext *pContext, const cell_t *param } } - s_pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[2]); - + cell_t funcid = params[2]; + if (funcid <= 0) + { + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); + } + s_pFunction = pPlugin->GetBaseContext()->GetFunctionById(funcid); if (!s_pFunction) { - return pContext->ThrowNativeError("Invalid function id (%X)", params[2]); + return pContext->ThrowNativeError("Invalid function id (%X)", funcid); } s_pCallable = static_cast(s_pFunction); diff --git a/core/logic_bridge.cpp b/core/logic_bridge.cpp index a718c32345..4cc1128a78 100644 --- a/core/logic_bridge.cpp +++ b/core/logic_bridge.cpp @@ -138,6 +138,10 @@ class VFileSystem_Logic : public IFileSystemBridge { return filesystem->FileExists(pFileName, pPathID); } + unsigned int Size(FileHandle_t file) override + { + return filesystem->Size(file); + } unsigned int Size(const char *pFileName, const char *pPathID = 0) override { return filesystem->Size(pFileName, pPathID); diff --git a/core/smn_console.cpp b/core/smn_console.cpp index dc03668412..29b830a865 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -979,11 +979,14 @@ static cell_t sm_ServerCommandEx(IPluginContext *pContext, const cell_t *params) } engine->ServerExecute(); - - g_ShouldCatchSpew = true; - engine->ServerCommand("sm_conhook_start\n"); - engine->ServerCommand(buffer); - engine->ServerCommand("sm_conhook_stop\n"); + if (!g_ShouldCatchSpew) { + g_ShouldCatchSpew = true; + engine->ServerCommand("sm_conhook_start\n"); + engine->ServerCommand(buffer); + engine->ServerCommand("sm_conhook_stop\n"); + } else { + engine->ServerCommand(buffer); + } engine->ServerExecute(); diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index 139da9cc1d..d2986ca437 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -285,6 +285,11 @@ static cell_t RemoveEdict(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Edict %d (%d) is not a valid edict", g_HL2.ReferenceToIndex(params[1]), params[1]); } + if (g_HL2.ReferenceToIndex(params[1]) == 0) + { + return pContext->ThrowNativeError("Cannot remove worldspawn (edict 0)"); + } + engine->RemoveEdict(pEdict); return 1; @@ -298,6 +303,11 @@ static cell_t RemoveEntity(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Entity %d (%d) is not a valid entity", g_HL2.ReferenceToIndex(params[1]), params[1]); } + if (g_HL2.ReferenceToIndex(params[1]) == 0) + { + return pContext->ThrowNativeError("Cannot remove worldspawn (entity 0)"); + } + // Some games have UTIL_Remove exposed on IServerTools, but for consistence, we'll // use this method for all. Results in DeathNotice( this ) being called on parent, // and parent being cleared (both if any parent) before UTIL_Remove is called. diff --git a/extensions/bintools/jit_call_x64.cpp b/extensions/bintools/jit_call_x64.cpp index a2a47fad02..d404498015 100644 --- a/extensions/bintools/jit_call_x64.cpp +++ b/extensions/bintools/jit_call_x64.cpp @@ -725,7 +725,7 @@ inline void Write_PushObject(JitWriter *jit, const SourceHook::PassInfo *info, u ObjectClass classes[MAX_CLASSES]; int numWords = ClassifyObject(smInfo, classes); - if (classes[0] == ObjectClass::Pointer) + if (classes[0] == ObjectClass::Pointer || classes[0] == ObjectClass::Memory) goto push_byref; int neededIntRegs = 0; @@ -787,7 +787,7 @@ inline void Write_PushObject(JitWriter *jit, const SourceHook::PassInfo *info, u return; #elif defined PLATFORM_WINDOWS - if (info->size < 64 && (info->size & (info->size - 1)) == 0) + if (info->size > 8 || (info->size & (info->size - 1)) != 0) goto push_byref; else { SourceHook::PassInfo podInfo; @@ -1055,7 +1055,11 @@ void *JIT_CallCompile(CallWrapper *pWrapper, FuncAddrMethod method) int numWords; #endif +#ifdef PLATFORM_POSIX g_StackUsage = 0; +#elif defined PLATFORM_WINDOWS + g_StackUsage = 32; // Shadow space +#endif writer.outbase = NULL; writer.outptr = NULL; @@ -1155,8 +1159,12 @@ void *JIT_CallCompile(CallWrapper *pWrapper, FuncAddrMethod method) #endif /* Clean up the calling stack */ +#ifdef PLATFORM_POSIX if (hasParams && g_StackUsage) +#endif + { Write_RectifyStack(jit, g_StackAlign); + } /* Copy the return type to the return buffer if the function is not void */ if (pRet && !Needs_Retbuf) diff --git a/extensions/sdkhooks/extension.h b/extensions/sdkhooks/extension.h index 89576098da..0a9b326bad 100644 --- a/extensions/sdkhooks/extension.h +++ b/extensions/sdkhooks/extension.h @@ -139,11 +139,15 @@ class IEntityListener { public: #if SOURCE_ENGINE == SE_BMS + virtual ~IEntityListener() {}; virtual void OnEntityPreSpawned( CBaseEntity *pEntity ) {}; #endif virtual void OnEntityCreated( CBaseEntity *pEntity ) {}; virtual void OnEntitySpawned( CBaseEntity *pEntity ) {}; virtual void OnEntityDeleted( CBaseEntity *pEntity ) {}; +#if SOURCE_ENGINE == SE_BMS + virtual void OnEntityFlagsChanged( CBaseEntity *pEntity, int nAddedFlags, int nRemovedFlags ) {}; +#endif }; class SDKHooks : diff --git a/extensions/sdktools/AMBuilder b/extensions/sdktools/AMBuilder index 9f024b5dce..0b5dca0164 100644 --- a/extensions/sdktools/AMBuilder +++ b/extensions/sdktools/AMBuilder @@ -49,6 +49,18 @@ for sdk_name in SM.sdks: os.path.join(builder.sourcePath, 'public', 'jit'), os.path.join(builder.sourcePath, 'public', 'jit', 'x86'), ] + + if sdk['name'] in ('episode1', 'darkm'): + binary.compiler.cxxincludes += [os.path.join(builder.options.hl2sdk_root, sdk['path'], 'game_shared')] + binary.compiler.cxxincludes += [os.path.join(builder.options.hl2sdk_root, sdk['path'], 'dlls')] + else: + binary.compiler.cxxincludes += [ + os.path.join(builder.options.hl2sdk_root, sdk['path'], 'game', 'shared'), + os.path.join(builder.options.hl2sdk_root, sdk['path'], 'game', 'server'), + ] + + #binary.sources += [os.path.join(builder.options.hl2sdk_root, sdk['path'], 'game', 'server', 'variant_t.cpp')] + binary.compiler.defines += ['HAVE_STRING_H'] if sdk['name'] != 'episode1': diff --git a/extensions/sdktools/output.cpp b/extensions/sdktools/output.cpp index 25e44dbca9..0daee96922 100644 --- a/extensions/sdktools/output.cpp +++ b/extensions/sdktools/output.cpp @@ -73,7 +73,7 @@ bool EntityOutputManager::IsEnabled() return enabled; } -#ifdef PLATFORM_WINDOWS +#if defined PLATFORM_WINDOWS && defined PLATFORM_X86 DETOUR_DECL_MEMBER8(FireOutput, void, int, what, int, the, int, hell, int, msvc, void *, variant_t, CBaseEntity *, pActivator, CBaseEntity *, pCaller, float, fDelay) { bool fireOutput = g_OutputManager.FireEventDetour((void *)this, pActivator, pCaller, fDelay); diff --git a/extensions/sdktools/outputnatives.cpp b/extensions/sdktools/outputnatives.cpp index 823cdfc250..fb16deed23 100644 --- a/extensions/sdktools/outputnatives.cpp +++ b/extensions/sdktools/outputnatives.cpp @@ -311,7 +311,7 @@ static cell_t FireEntityOutput(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"FireEntityOutput\" not supported by this mod"); } -#ifdef PLATFORM_WINDOWS +#if defined PLATFORM_WINDOWS && defined PLATFORM_X86 int iMaxParam = 8; //Instead of being one param, MSVC broke variant_t param into 5 params.. PassInfo pass[8]; diff --git a/extensions/sdktools/variant-t.cpp b/extensions/sdktools/variant-t.cpp index 5c9aecab45..adb8b0f8cf 100644 --- a/extensions/sdktools/variant-t.cpp +++ b/extensions/sdktools/variant-t.cpp @@ -33,7 +33,14 @@ #include "variant-t.h" #include -unsigned char g_Variant_t[SIZEOF_VARIANT_T] = {0}; +variant_t g_Variant_t; + +// copy this definition as the original file includes cbase.h which explodes in a shower of compile errors +void variant_t::SetEntity( CBaseEntity *val ) +{ + eVal = val; + fieldType = FIELD_EHANDLE; +} #define ENTINDEX_TO_CBASEENTITY(ref, buffer) \ buffer = gamehelpers->ReferenceToEntity(ref); \ @@ -42,132 +49,66 @@ unsigned char g_Variant_t[SIZEOF_VARIANT_T] = {0}; return pContext->ThrowNativeError("Entity %d (%d) is not a CBaseEntity", gamehelpers->ReferenceToIndex(ref), ref); \ } -/* Hack to init the variant_t object for the first time */ -class VariantFirstTimeInit -{ -public: - VariantFirstTimeInit() - { - *(unsigned int *)(&g_Variant_t[12]) = INVALID_EHANDLE_INDEX; - } -} g_VariantFirstTimeInit; - static cell_t SetVariantBool(IPluginContext *pContext, const cell_t *params) { - unsigned char *vptr = g_Variant_t; - - *(bool *)vptr = (params[1]) ? true : false; - vptr += sizeof(int)*3 + sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_BOOLEAN; - + g_Variant_t.SetBool((params[1]) ? true : false); return 1; } static cell_t SetVariantString(IPluginContext *pContext, const cell_t *params) { char *str; - unsigned char *vptr = g_Variant_t; - pContext->LocalToString(params[1], &str); - - *(string_t *)vptr = MAKE_STRING(str); - vptr += sizeof(int)*3 + sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_STRING; - + g_Variant_t.SetString(MAKE_STRING(str)); return 1; } static cell_t SetVariantInt(IPluginContext *pContext, const cell_t *params) { - unsigned char *vptr = g_Variant_t; - - *(int *)vptr = params[1]; - vptr += sizeof(int)*3 + sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_INTEGER; - + g_Variant_t.SetInt(params[1]); return 1; } static cell_t SetVariantFloat(IPluginContext *pContext, const cell_t *params) { - unsigned char *vptr = g_Variant_t; - - *(float *)vptr = sp_ctof(params[1]); - vptr += sizeof(int)*3 + sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_FLOAT; - + g_Variant_t.SetFloat(sp_ctof(params[1])); return 1; } static cell_t SetVariantVector3D(IPluginContext *pContext, const cell_t *params) { cell_t *val; - unsigned char *vptr = g_Variant_t; - pContext->LocalToPhysAddr(params[1], &val); - *(float *)vptr = sp_ctof(val[0]); - vptr += sizeof(float); - *(float *)vptr = sp_ctof(val[1]); - vptr += sizeof(float); - *(float *)vptr = sp_ctof(val[2]); - vptr += sizeof(float) + sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_VECTOR; - + Vector v(sp_ctof(val[0]), sp_ctof(val[1]), sp_ctof(val[2])); + g_Variant_t.SetVector3D(v); return 1; } static cell_t SetVariantPosVector3D(IPluginContext *pContext, const cell_t *params) { cell_t *val; - unsigned char *vptr = g_Variant_t; - pContext->LocalToPhysAddr(params[1], &val); - *(float *)vptr = sp_ctof(val[0]); - vptr += sizeof(float); - *(float *)vptr = sp_ctof(val[1]); - vptr += sizeof(float); - *(float *)vptr = sp_ctof(val[2]); - vptr += sizeof(float) + sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_POSITION_VECTOR; - + Vector v(sp_ctof(val[0]), sp_ctof(val[1]), sp_ctof(val[2])); + g_Variant_t.SetPositionVector3D(v); return 1; } static cell_t SetVariantColor(IPluginContext *pContext, const cell_t *params) { cell_t *val; - unsigned char *vptr = g_Variant_t; - pContext->LocalToPhysAddr(params[1], &val); - *(unsigned char *)vptr = val[0]; - vptr += sizeof(unsigned char); - *(unsigned char *)vptr = val[1]; - vptr += sizeof(unsigned char); - *(unsigned char *)vptr = val[2]; - vptr += sizeof(unsigned char); - *(unsigned char *)vptr = val[3]; - vptr += sizeof(unsigned char) + sizeof(int)*2 + sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_COLOR32; - + g_Variant_t.SetColor32(val[0], val[1], val[2], val[3]); return 1; } static cell_t SetVariantEntity(IPluginContext *pContext, const cell_t *params) { CBaseEntity *pEntity; - unsigned char *vptr = g_Variant_t; - CBaseHandle bHandle; - ENTINDEX_TO_CBASEENTITY(params[1], pEntity); - bHandle = reinterpret_cast(pEntity)->GetRefEHandle(); - - vptr += sizeof(int)*3; - *(unsigned long *)vptr = (unsigned long)(bHandle.ToInt()); - vptr += sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_EHANDLE; + g_Variant_t.SetEntity(pEntity); return 1; } @@ -183,4 +124,4 @@ sp_nativeinfo_t g_VariantTNatives[] = {"SetVariantColor", SetVariantColor}, {"SetVariantEntity", SetVariantEntity}, {NULL, NULL}, -}; \ No newline at end of file +}; diff --git a/extensions/sdktools/variant-t.h b/extensions/sdktools/variant-t.h index 3e5f174914..4ce759dc59 100644 --- a/extensions/sdktools/variant-t.h +++ b/extensions/sdktools/variant-t.h @@ -32,26 +32,22 @@ #ifndef _INCLUDE_SOURCEMOD_EXTENSION_VARIANT_T_H_ #define _INCLUDE_SOURCEMOD_EXTENSION_VARIANT_T_H_ -#define SIZEOF_VARIANT_T 20 +#include "variant_t.h" + +#define SIZEOF_VARIANT_T sizeof(variant_t) /** * @file variant-t.h * @brief SDK Tools extension gamerules natives header. */ -extern unsigned char g_Variant_t[SIZEOF_VARIANT_T]; +extern variant_t g_Variant_t; extern sp_nativeinfo_t g_VariantTNatives[]; inline void _init_variant_t() { - unsigned char *vptr = g_Variant_t; - - *(int *)vptr = 0; - vptr += sizeof(int)*3; - *(unsigned long *)vptr = INVALID_EHANDLE_INDEX; - vptr += sizeof(unsigned long); - *(fieldtype_t *)vptr = FIELD_VOID; + memset(&g_Variant_t, 0, sizeof(g_Variant_t)); } #endif //_INCLUDE_SOURCEMOD_EXTENSION_VARIANT_T_H_ \ No newline at end of file diff --git a/extensions/topmenus/TopMenu.cpp b/extensions/topmenus/TopMenu.cpp index 28a173913e..db5ead6f23 100644 --- a/extensions/topmenus/TopMenu.cpp +++ b/extensions/topmenus/TopMenu.cpp @@ -1179,6 +1179,11 @@ SMCResult TopMenu::ReadSMC_NewSection(const SMCStates *states, const char *name) } } } + else if (current_parse_state == PARSE_STATE_CATEGORY) + { + cur_cat->commands.push_back(m_Config.strings.AddString(name)); + ignore_parse_level++; + } else { ignore_parse_level = 1; diff --git a/gamedata/core.games/engine.ep2valve.txt b/gamedata/core.games/engine.ep2valve.txt index 2c92e9a4d5..8d745c4266 100644 --- a/gamedata/core.games/engine.ep2valve.txt +++ b/gamedata/core.games/engine.ep2valve.txt @@ -20,13 +20,15 @@ "gEntList" { "windows" "11" + "windows64" "81" } "EntInfo" { "windows" "4" + "windows64" "8" "linux" "4" - "mac" "4" + "linux64" "8" } } @@ -34,14 +36,21 @@ { "LevelShutdown" { + /* not confirmed to be : CServerGameDLL:: LevelShutdown */ + /* This comment is for 64xBit */ + /* if you know the exact level shutdown function, please comment.*/ + /* String : "VDebugOverlay003" -> one call up.*/ + /* it only needs to know when the server shuts down, not the absolute correct signature.*/ + /* incase it needs the exact function, please notify.*/ "library" "server" "windows" "\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8" + "windows64" "\x40\x53\x48\x83\xEC\x20\xE8\x2A\x2A\x2A\x2A\x48\x8B\x05\x1E\x04\x9E\x00" } "gEntList" { "library" "server" "linux" "@gEntList" - "mac" "@gEntList" + "linux64" "@gEntList" } } diff --git a/gamedata/core.games/engine.l4d2.txt b/gamedata/core.games/engine.l4d2.txt index 59579a3f3b..8f2a1d3919 100644 --- a/gamedata/core.games/engine.l4d2.txt +++ b/gamedata/core.games/engine.l4d2.txt @@ -25,14 +25,14 @@ /* Offset into LevelShutdown */ "gEntList" { - "windows" "11" + "windows" "40" } "EntInfo" { "windows" "4" "linux" "4" - "mac" "4" + "mac" "4" } } @@ -41,13 +41,13 @@ "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" + "windows" "\x56\x8B\x35\x2A\x2A\x2A\x2A\x8B\x06\x8B\x50\x68\x8B\xCE\xFF\xD2\x68\x2A\x2A\x2A\x2A" } "gEntList" { "library" "server" "linux" "@gEntList" - "mac" "@gEntList" + "mac" "@gEntList" } } } diff --git a/gamedata/sdkhooks.games/engine.ep2v.txt b/gamedata/sdkhooks.games/engine.ep2v.txt index 0a9e4de596..9a764cf4bb 100644 --- a/gamedata/sdkhooks.games/engine.ep2v.txt +++ b/gamedata/sdkhooks.games/engine.ep2v.txt @@ -5,161 +5,188 @@ { "Offsets" { + //This sucks, this comment HAS to stay, if you remove it, sourcemod WILl crash, why? Ask god. "EntityListeners" { "windows" "131108" + "windows64" "262200" "linux" "131108" - "mac" "131108" + "linux64" "262200" } "CanBeAutobalanced" { "windows" "473" + "windows64" "473" "linux" "474" - "mac" "474" + "linux64" "474" } "EndTouch" { "windows" "105" + "windows64" "105" "linux" "106" - "mac" "106" + "linux64" "106" } "FireBullets" { "windows" "117" + "windows64" "117" "linux" "118" - "mac" "118" + "linux64" "118" } "GetMaxHealth" { "windows" "122" + "windows64" "123" "linux" "123" - "mac" "123" + "linux64" "123" } "GroundEntChanged" { "windows" "183" + "windows64" "183" "linux" "185" - "mac" "185" + "linux64" "185" } "OnTakeDamage" { "windows" "64" + "windows64" "64" "linux" "65" - "mac" "65" + "linux64" "65" } "OnTakeDamage_Alive" { "windows" "282" + "windows64" "282" "linux" "283" - "mac" "283" + "linux64" "283" } "PreThink" { "windows" "343" + "windows64" "343" "linux" "344" - "mac" "344" + "linux64" "344" } "PostThink" { "windows" "344" + "windows64" "344" "linux" "345" - "mac" "345" + "linux64" "345" } "Reload" { "windows" "283" + "windows64" "283" "linux" "289" - "mac" "289" + "linux64" "289" } "SetTransmit" { "windows" "22" + "windows64" "22" "linux" "23" - "mac" "23" + "linux64" "23" } "ShouldCollide" { "windows" "17" + "windows64" "17" "linux" "18" - "mac" "18" + "linux64" "18" } "Spawn" { "windows" "24" + "windows64" "24" "linux" "25" - "mac" "25" + "linux64" "25" } "StartTouch" { "windows" "103" + "windows64" "103" "linux" "104" - "mac" "104" + "linux64" "104" } "Think" { "windows" "49" + "windows64" "49" "linux" "50" - "mac" "50" + "linux64" "50" } "Touch" { "windows" "104" + "windows64" "104" "linux" "105" - "mac" "105" + "linux64" "105" } "TraceAttack" { "windows" "62" + "windows64" "62" "linux" "63" - "mac" "63" + "linux64" "63" } "Use" { "windows" "102" + "windows64" "102" "linux" "103" - "mac" "103" + "linux64" "103" } "VPhysicsUpdate" { "windows" "163" + "windows64" "163" "linux" "164" - "mac" "164" + "linux64" "164" } "Blocked" { "windows" "107" + "windows64" "107" "linux" "108" - "mac" "108" + "linux64" "108" } "Weapon_CanSwitchTo" { "windows" "276" + "windows64" "276" "linux" "277" - "mac" "277" + "linux64" "277" } "Weapon_CanUse" { "windows" "270" + "windows64" "270" "linux" "271" - "mac" "271" + "linux64" "271" } "Weapon_Drop" { "windows" "273" + "windows64" "273" "linux" "274" - "mac" "274" + "linux64" "274" } "Weapon_Equip" { "windows" "271" + "windows64" "271" "linux" "272" - "mac" "272" + "linux64" "272" } "Weapon_Switch" { "windows" "274" + "windows64" "274" "linux" "275" - "mac" "275" + "linux64" "275" } } } diff --git a/gamedata/sdktools.games/engine.ep2valve.txt b/gamedata/sdktools.games/engine.ep2valve.txt index 8f9ad8d777..721f56c25d 100644 --- a/gamedata/sdktools.games/engine.ep2valve.txt +++ b/gamedata/sdktools.games/engine.ep2valve.txt @@ -19,20 +19,23 @@ "GetTEName" { "windows" "4" + "windows64" "8" "linux" "4" - "mac" "4" + "linux64" "8" } "GetTENext" { "windows" "8" + "windows64" "16" "linux" "8" - "mac" "8" + "linux64" "16" } "TE_GetServerClass" { "windows" "0" + "windows64" "0" "linux" "0" - "mac" "0" + "linux64" "0" } } } @@ -59,6 +62,7 @@ "sv" { "windows" "7" + "windows64" "7" } } @@ -69,7 +73,7 @@ { "library" "engine" "linux" "@sv" - "mac" "@sv" + "linux64" "@sv" } } } @@ -87,10 +91,12 @@ { "FireOutput" { + /* String: "(%0.2f) output: (%s,%s) -> (%s,%s)(%s)" */ "library" "server" "windows" "\x55\x8B\xEC\x81\xEC\x2A\x2A\x2A\x2A\x53\x8B\xC1" + "windows64" "\x48\x8B\xC4\x48\x89\x50\x10\x48\x89\x48\x08\x41\x54" "linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" - "mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" + "linux64" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" } } } @@ -116,8 +122,9 @@ "SetUserCvar" { "windows" "18" + "windows64" "18" "linux" "58" - "mac" "58" + "linux64" "58" } /** * CBaseClient::SetName(char const*); @@ -127,8 +134,9 @@ "SetClientName" { "windows" "17" + "windows64" "17" "linux" "57" - "mac" "57" + "linux64" "57" } /** * Offset into CBaseClient - Used by CBaseServer::UpdateUserSettings to determine when changes have been made. @@ -139,8 +147,9 @@ "InfoChanged" { "windows" "140" + "windows64" "140" "linux" "140" - "mac" "140" + "linux64" "160" } } } diff --git a/gamedata/sdktools.games/engine.l4d2.txt b/gamedata/sdktools.games/engine.l4d2.txt index d3a28af8d4..5db7896893 100644 --- a/gamedata/sdktools.games/engine.l4d2.txt +++ b/gamedata/sdktools.games/engine.l4d2.txt @@ -81,9 +81,9 @@ */ "InfoChanged" { - "windows" "176" - "linux" "176" - "mac" "176" + "windows" "180" + "linux" "180" + "mac" "180" } } } diff --git a/gamedata/sdktools.games/game.neotokyo.txt b/gamedata/sdktools.games/game.neotokyo.txt index 947975e4c5..cdab578b01 100644 --- a/gamedata/sdktools.games/game.neotokyo.txt +++ b/gamedata/sdktools.games/game.neotokyo.txt @@ -76,6 +76,10 @@ { "windows" "185" } + "SetOwnerEntity" + { + "windows" "18" + } } "Signatures" { diff --git a/gamedata/sdktools.games/game.nucleardawn.txt b/gamedata/sdktools.games/game.nucleardawn.txt index 719b14015e..8d5f5e8da4 100644 --- a/gamedata/sdktools.games/game.nucleardawn.txt +++ b/gamedata/sdktools.games/game.nucleardawn.txt @@ -102,19 +102,19 @@ } /* CBaseAnimating::LookupAttachment */ - "#default" - { - "Signatures" - { - "LookupAttachment" - { - "library" "server" - "windows" "\x55\x8B\xEC\x56\x8B\xF1\x83\xBE\x2A\x2A\x2A\x2A\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\x86\x2A\x2A\x2A\x2A\x5E\x85\xC0\x74\x2A\x83\x38\x00\x74\x2A\xFF\x75" - "linux" "@_ZN14CBaseAnimating16LookupAttachmentEPKc" - "mac" "@_ZN14CBaseAnimating16LookupAttachmentEPKc" - } - } - } + "#default" + { + "Signatures" + { + "LookupAttachment" + { + "library" "server" + "windows" "\x55\x8B\xEC\x56\x8B\xF1\x83\xBE\x2A\x2A\x2A\x2A\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\x86\x2A\x2A\x2A\x2A\x5E\x85\xC0\x74\x2A\x83\x38\x00\x74\x2A\xFF\x75" + "linux" "@_ZN14CBaseAnimating16LookupAttachmentEPKc" + "mac" "@_ZN14CBaseAnimating16LookupAttachmentEPKc" + } + } + } /* SetUserInfo data */ "#default" @@ -250,6 +250,12 @@ "linux" "467" "mac" "467" } + "GetAttachment" + { + "windows" "230" + "linux" "231" + "mac" "231" + } } "Keys" diff --git a/gamedata/sdktools.games/game.tf.txt b/gamedata/sdktools.games/game.tf.txt index 9cb2a7c476..5eec1ad615 100644 --- a/gamedata/sdktools.games/game.tf.txt +++ b/gamedata/sdktools.games/game.tf.txt @@ -19,104 +19,121 @@ "SetOwnerEntity" { "windows" "18" + "windows64" "18" "linux" "19" - "mac" "19" + "linux64" "19" } "GiveNamedItem" { "windows" "412" + "windows64" "412" "linux" "413" - "mac" "413" + "linux64" "413" } "RemovePlayerItem" { "windows" "280" + "windows64" "280" "linux" "281" - "mac" "281" + "linux64" "281" } "Weapon_GetSlot" { "windows" "278" + "windows64" "278" "linux" "279" - "mac" "279" + "linux64" "279" } "Ignite" { "windows" "219" + "windows64" "219" "linux" "220" - "mac" "220" + "linux64" "220" } "Extinguish" { "windows" "223" + "windows64" "223" "linux" "224" - "mac" "224" + "linux64" "224" } "Teleport" { "windows" "113" + "windows64" "113" "linux" "114" - "mac" "114" + "linux64" "114" } "CommitSuicide" { "windows" "453" + "windows64" "453" "linux" "453" - "mac" "453" + "linux64" "453" } "GetVelocity" { "windows" "146" + "windows64" "146" "linux" "147" - "mac" "147" + "linux64" "147" } "EyeAngles" { "windows" "137" + "windows64" "137" "linux" "138" - "mac" "138" + "linux64" "138" } "SetEntityModel" { "windows" "26" + "windows64" "26" "linux" "27" - "mac" "27" + "linux64" "27" } "AcceptInput" { "windows" "38" + "windows64" "38" "linux" "39" - "mac" "39" + "linux64" "39" } "WeaponEquip" { "windows" "271" + "windows64" "271" "linux" "272" - "mac" "272" + "linux64" "272" } "Activate" { "windows" "35" + "windows64" "35" "linux" "36" - "mac" "36" + "linux64" "36" } "PlayerRunCmd" { "windows" "430" + "windows64" "430" "linux" "431" - "mac" "431" + "linux64" "431" } "GiveAmmo" { "windows" "262" + "windows64" "262" "linux" "263" - "mac" "263" + "linux64" "263" } "GetAttachment" { "windows" "215" + "windows64" "215" "linux" "216" - "mac" "216" + "linux64" "216" } } @@ -127,32 +144,36 @@ } } - /* CBaseEntityOutput::FireOutput */ "#default" { "Signatures" { "FireOutput" { + /* CBaseEntityOutput::FireOutput */ + /* String: "(%0.2f) output: (%s,%s) -> (%s,%s,%.1f)" */ "library" "server" - "windows" "\x55\x8B\xEC\x81\xEC\x24\x01\x00\x00\x53\x8B\xC1" + "windows" "\x55\x8B\xEC\x81\xEC\x40\x01\x00\x00\x8B\xC1" + "windows64" "\x48\x8B\xC4\x48\x89\x50\x10\x48\x89\x48\x08\x41\x54" "linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" - "mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" + "linux64" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" } } } - /* CBaseAnimating::LookupAttachment */ "#default" { "Signatures" { "LookupAttachment" { + /* CBaseAnimating::LookupAttachment */ + /* String: "vehicle_driver_eyes", middle length top function, with 4 calls, pick the first one. */ "library" "server" "windows" "\x55\x8B\xEC\x56\x8B\xF1\x80\xBE\x2A\x03\x00\x00\x00\x75\x2A\x83\xBE\x2A\x04\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\x86\x2A\x04\x00\x00\x85\xC0\x74\x2A\x83\x38\x00\x74\x2A\xFF\x75\x08\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x08\x40" + "windows64" "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x80\xB9\x65\x04\x00\x00\x00\x48\x8B\xFA\x48\x8B\xD9\x75\x2A\x48\x83\xB9\xC0\x05\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x48\x85\xC0\x74\x2A\x48\x8B\xCB\xE8\x2A\x2A\x2A\x2A\x48\x8B\x8B\xC0\x05\x00\x00\x48\x85\xC9\x74\x2A\x48\x83\x39\x00\x74\x2A\x48\x8B\xD7\xE8\x2A\x2A\x2A\x2A" "linux" "@_ZN14CBaseAnimating16LookupAttachmentEPKc" - "mac" "@_ZN14CBaseAnimating16LookupAttachmentEPKc" + "linux64" "@_ZN14CBaseAnimating16LookupAttachmentEPKc" } } } diff --git a/gamedata/sm-tf2.games.txt b/gamedata/sm-tf2.games.txt index 695e3b05a3..0bd44aee22 100644 --- a/gamedata/sm-tf2.games.txt +++ b/gamedata/sm-tf2.games.txt @@ -17,87 +17,123 @@ { "Burn" { + /* CTFPlayerShared::Burn (No clone.)*/ + /* String : -> "afterburn_immunity"*/ "library" "server" "windows" "\x55\x8B\xEC\x83\xEC\x08\x56\x8B\xF1\x8B\x8E\x8C\x01\x00\x00\x8B\x01" + "windows64" "\x40\x53\x41\x54\x41\x56\x48\x83\xEC\x60" "linux" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBasef" - "mac" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBasef" + "linux64" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBasef" } "RemoveDisguise" { + /* CTFPlayerShared::RemoveDisguise*/ + /* String : "reveal_disguised_victim_on_hit", follow the xref, RemoveDisguise is the subroutine that's called if the return value of CALL_ATTRIB_HOOK_INT( iRevealDisguisedSpyOnHit, reveal_disguised_victim_on_hit ); was true */ + "library" "server" "windows" "\x55\x8B\xEC\x51\x56\x8B\xF1\x57\xF7\x86\xD0\x00\x00\x00\x00\x00\x02\x00" + "windows64" "\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x20\x48\x8B\xD9\xBA\x03\x00\x00\x00" "linux" "@_ZN15CTFPlayerShared14RemoveDisguiseEv" - "mac" "@_ZN15CTFPlayerShared14RemoveDisguiseEv" + "linux64" "@_ZN15CTFPlayerShared14RemoveDisguiseEv" } "Disguise" { + /* CTFPlayerShared::Disguise */ + /* String : "disguise", follow the xref to function that involves a lot of other commands "uncloak", "taunt", "despawn"... CTFPlayerShared::Disguise is the only subroutine that is called with the return value of RandomInt */ "library" "server" "windows" "\x55\x8B\xEC\x83\xEC\x24\x56\x57\x8B\xF9\x8B\x8F\x8C\x01\x00\x00" + "windows64" "\x40\x53\x55\x56\x57\x41\x54\x48\x81\xEC\x90\x00\x00\x00" "linux" "@_ZN15CTFPlayerShared8DisguiseEiiP9CTFPlayerb" - "mac" "@_ZN15CTFPlayerShared8DisguiseEiiP9CTFPlayerb" + "linux64" "@_ZN15CTFPlayerShared8DisguiseEiiP9CTFPlayerb" } "Regenerate" { + /* CTFPlayer::Regenerate */ + /* String : "item_meter_resupply_denied" -> guessing game on which one, should be the one with "player_regenerate"*/ "library" "server" - "windows" "\x55\x8B\xEC\x83\xEC\x24\x53\x56\x57\x8B\xF9\x8B\x07\xFF\x90" + "windows" "\x55\x8B\xEC\x83\xEC\x5C\x53\x56\x57\x8B\xF9\x8B\x07" + "windows64" "\x48\x8B\xC4\x88\x50\x10\x48\x81\xEC\xE8\x00\x00\x00" "linux" "@_ZN9CTFPlayer10RegenerateEb" - "mac" "@_ZN9CTFPlayer10RegenerateEb" + "linux64" "@_ZN9CTFPlayer10RegenerateEb" } "AddCondition" { + /* CTFPlayerShared::AddCond */ + /* String: "mult_medigun_overheal_decay" -> most bottom function, its called twice in the same "cube" of function*/ "library" "server" "windows" "\x55\x8B\xEC\x83\xEC\x08\x56\x8B\xF1\x8B\x8E\x2A\x2A\x2A\x2A\x85\xC9\x0F\x84\x2A\x2A\x2A\x2A\x8B\x01\x8B" + "windows64" "\x48\x89\x5C\x24\x18\x48\x89\x7C\x24\x20\x41\x56\x48\x83\xEC\x40" "linux" "@_ZN15CTFPlayerShared7AddCondE7ETFCondfP11CBaseEntity" - "mac" "@_ZN15CTFPlayerShared7AddCondE7ETFCondfP11CBaseEntity" + "linux64" "@_ZN15CTFPlayerShared7AddCondE7ETFCondfP11CBaseEntity" } "RemoveCondition" { + /* CTFPlayerShared::RemoveCond */ + /* String: "damage_prevented" */ "library" "server" "windows" "\x55\x8B\xEC\x83\xEC\x08\x53\x8B\x5D\x08\x56\x53" + "windows64" "\x40\x53\x57\x41\x56\x48\x83\xEC\x20" "linux" "@_ZN15CTFPlayerShared10RemoveCondE7ETFCondb" - "mac" "@_ZN15CTFPlayerShared10RemoveCondE7ETFCondb" + "linux64" "@_ZN15CTFPlayerShared10RemoveCondE7ETFCondb" } "SetPowerplayEnabled" { + /* CTFPlayer::SetPowerplayEnabled */ + /* String: "scenes/player/pyro/low/1485.vcd" -> Main fuction -> That main function again.*/ "library" "server" - "windows" "\x55\x8B\xEC\x80\x7D\x08\x00\x56\x57\x8B\xF9" + "windows" "\x55\x8B\xEC\x51\x80\x7D\x08\x00\x56\x57" + "windows64" "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x8D\x99\x60\x28\x00\x00" "linux" "@_ZN9CTFPlayer19SetPowerplayEnabledEb" - "mac" "@_ZN9CTFPlayer19SetPowerplayEnabledEb" + "linux64" "@_ZN9CTFPlayer19SetPowerplayEnabledEb" } "SetInWaitingForPlayers" { + /* CTeamplayRoundBasedRules::SetInWaitingForPlayers */ + /* String: "teamplay_restart_round" -> first call on the most bottom "cube" of function */ "library" "server" - "windows" "\x55\x8B\xEC\x56\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x84\xC0\x0F\x85\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A" + "windows" "\x55\x8B\xEC\x51\x56\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x84\xC0\x0F\x85\x2A\x2A\x2A\x2A" + "windows64" "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x0F\xB6\xFA\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A\x84\xC0\x0F\x85\x2A\x2A\x2A\x2A" "linux" "@_ZN24CTeamplayRoundBasedRules22SetInWaitingForPlayersEb" - "mac" "@_ZN24CTeamplayRoundBasedRules22SetInWaitingForPlayersEb" + "linux64" "@_ZN24CTeamplayRoundBasedRules22SetInWaitingForPlayersEb" } "StunPlayer" { + /* CTFPlayerShared::StunPlayer */ + /* String: "player_stunned" */ "library" "server" - "windows" "\x55\x8B\xEC\x83\xEC\x20\x57\x8B\xF9\x8B\x87\xDC\x04\x00\x00" + "windows" "\x55\x8B\xEC\x83\xEC\x24\x57\x8B\xF9\x8B\x87\xDC\x04\x00\x00" + "windows64" "\x40\x57\x41\x57\x48\x81\xEC\x98\x00\x00\x00" "linux" "@_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer" - "mac" "@_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer" + "linux64" "@_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer" } "MakeBleed" { + /* CTFPlayerShared::MakeBleed */ + /* String: "spell_batball_red" follow the xref to the function that also has "spell_batball_blue", in graph view, pick the node that validates the dynamic cast, MakeBleed is the only subroutine called in that node.*/ "library" "server" - "windows" "\x55\x8B\xEC\x83\xEC\x2C\x57\x8B\xF9\x89\x7D\xF0" + "windows" "\x55\x8B\xEC\x83\xEC\x10\x53\x8B\xD9\x89\x5D\xF8\x8B\x8B\x8C\x01\x00\x00" + "windows64" "\x40\x56\x41\x55\x41\x57" "linux" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasefibi" - "mac" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasefibi" + "linux64" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasefibi" } "IsPlayerInDuel" { + /* DuelMiniGame_IsInDuel */ + /* String: "CTFPlayer::ForceChangeTeam( %d ) - invalid team index.\n", follow the xref, go back to the top of the subroutine, DuelMiniGame_IsInDuel is the subroutine that is called with 3 arguments and a constant value of 1.*/ "library" "server" "windows" "\x55\x8B\xEC\x83\xEC\x08\x81\x65\x2A\x2A\x2A\x2A\x2A\x8D\x45\xF8\x8B\x4D\x08\xC6\x45\xFF\x00\x81\x65\x2A\x2A\x2A\x2A\x2A\x50\xC7\x45\x2A\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x84\xC0\x75\x04" + "windows64" "\x48\x83\xEC\x28\x81\x64\x24\x3C\xFF\xFF\x0F\xFF" "linux" "@_Z21DuelMiniGame_IsInDuelP9CTFPlayer" - "mac" "@_Z21DuelMiniGame_IsInDuelP9CTFPlayer" + "linux64" "@_Z21DuelMiniGame_IsInDuelP9CTFPlayer" } "CanPlayerTeleport" { + /* String: "bidirectional_teleport" follow the xref, pick the function that doesn't involve another attribute, follow the graph view after 2 virtual function call, the first subroutine call is CanPlayerTeleport*/ "library" "server" - "windows" "\x55\x8B\xEC\x53\x57\x8B\x7D\x08\x8B\xD9\x85\xFF\x75\x2A\x5F\x32\xC0\x5B\x5D\xC2\x04\x00" + "windows" "\x55\x8B\xEC\x53\x56\x57\x8B\x7D\x08\x8B\xD9\x85\xFF\x0F\x84\x2A\x2A\x2A\x2A" + "windows64" "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x48\x8B\xFA\x48\x8B\xF1\x48\x85\xD2\x0F\x84\x2A\x2A\x2A\x2A\x45\x33\xC0" "linux" "@_ZN17CObjectTeleporter21PlayerCanBeTeleportedEP9CTFPlayer" - "mac" "@_ZN17CObjectTeleporter21PlayerCanBeTeleportedEP9CTFPlayer" + "linux64" "@_ZN17CObjectTeleporter21PlayerCanBeTeleportedEP9CTFPlayer" } // Obsolete @@ -106,7 +142,7 @@ "library" "server" "windows" "\x55\x8B\xEC\xA1\x2A\x2A\x2A\x2A\x83\x78\x30\x00\x74\x04\x32\xC0" "linux" "@_Z18TF_IsHolidayActivei" - "mac" "@_Z18TF_IsHolidayActivei" + "linux64" "@_Z18TF_IsHolidayActivei" } } "Offsets" @@ -114,35 +150,40 @@ "ForceRespawn" { "windows" "336" + "windows64" "336" "linux" "337" - "mac" "337" + "linux64" "337" } "CalcIsAttackCriticalHelper" { "windows" "398" + "windows64" "398" "linux" "405" - "mac" "405" + "linux64" "405" } "CalcIsAttackCriticalHelperNoCrits" { "windows" "399" + "windows64" "399" "linux" "406" - "mac" "406" + "linux64" "406" } // CTFGameRules::IsHolidayActive "IsHolidayActive" { "windows" "139" + "windows64" "139" "linux" "140" - "mac" "140" + "linux64" "140" } "RemoveWearable" { "windows" "439" + "windows64" "439" "linux" "440" - "mac" "440" + "linux64" "440" } } } diff --git a/hl2sdk-manifests b/hl2sdk-manifests index fb0d3ed7ba..a57b3095a6 160000 --- a/hl2sdk-manifests +++ b/hl2sdk-manifests @@ -1 +1 @@ -Subproject commit fb0d3ed7ba27fb27abd4a44c058f5c3c2c33be15 +Subproject commit a57b3095a6fc31a98b13e2d73ebb668dac4f1300 diff --git a/plugins/include/clients.inc b/plugins/include/clients.inc index d88262f1c1..51ed0bb1ef 100644 --- a/plugins/include/clients.inc +++ b/plugins/include/clients.inc @@ -215,6 +215,18 @@ forward Action OnClientPreAdminCheck(int client); */ forward void OnClientPostAdminFilter(int client); +/** + * Called directly before the server enters hibernation. + * This is your last chance to do anything in the plugin before + * hibernation occurs, as SV_Frame will no longer be called. + */ +forward void OnServerEnterHibernation(); + +/** + * Called directly before the server leaves hibernation. + */ +forward void OnServerExitHibernation(); + /** * Called once a client is authorized and fully in-game, and * after all post-connection authorizations have been performed. diff --git a/plugins/include/files.inc b/plugins/include/files.inc index 1d8fd3b309..78efd65cc2 100644 --- a/plugins/include/files.inc +++ b/plugins/include/files.inc @@ -112,6 +112,11 @@ methodmap File < Handle CloseHandle(this); } + // Get the file size in bytes. + // + // @return File size in bytes, -1 on error. + public native int Size(); + // Reads a line of text from a file. // // @param buffer String buffer to hold the line. diff --git a/plugins/include/halflife.inc b/plugins/include/halflife.inc index ccb5bf9086..38626f2342 100644 --- a/plugins/include/halflife.inc +++ b/plugins/include/halflife.inc @@ -667,10 +667,11 @@ stock void DisplayAskConnectBox(int client, float time, const char[] ip, const c native int EntIndexToEntRef(int entity); /** - * Retrieves the entity index from a reference. + * Retrieves the entity index from a reference or validates an entity index. + * The input ref is checked that it is still valid and refers to the same entity. * - * @param ref Entity reference. - * @return Entity index or -1 on invalid reference. + * @param ref Entity reference or index. + * @return Entity index or returns INVALID_ENT_REFERENCE if ref is invalid. */ native int EntRefToEntIndex(int ref); diff --git a/plugins/reservedslots.sp b/plugins/reservedslots.sp index 077c45adb7..fb43fdd19f 100644 --- a/plugins/reservedslots.sp +++ b/plugins/reservedslots.sp @@ -82,7 +82,7 @@ public void OnPluginStart() LoadTranslations("reservedslots.phrases"); sm_reserved_slots = CreateConVar("sm_reserved_slots", "0", "Number of reserved player slots", 0, true, 0.0); - sm_hide_slots = CreateConVar("sm_hide_slots", "0", "If set to 1, reserved slots will hidden (subtracted from the max slot count)", 0, true, 0.0, true, 1.0); + sm_hide_slots = CreateConVar("sm_hide_slots", "0", "If set to 1, reserved slots will be hidden (subtracted from the max slot count)", 0, true, 0.0, true, 1.0); sm_reserve_type = CreateConVar("sm_reserve_type", "0", "Method of reserving slots", 0, true, 0.0, true, 2.0); sm_reserve_maxadmins = CreateConVar("sm_reserve_maxadmins", "1", "Maximum amount of admins to let in the server with reserve type 2", 0, true, 0.0); sm_reserve_kicktype = CreateConVar("sm_reserve_kicktype", "0", "How to select a client to kick (if appropriate)", 0, true, 0.0, true, 2.0); diff --git a/pushbuild.txt b/pushbuild.txt index 5f22b0b1e6..356be3572b 100644 --- a/pushbuild.txt +++ b/pushbuild.txt @@ -77,3 +77,4 @@ well, ok rude travis stole my shoe, once. I love my anime wife. Make the world your clam +you guys ever have gay thoughts diff --git a/tools/checkout-deps.ps1 b/tools/checkout-deps.ps1 index 9e608ab71b..f2d720aa93 100644 --- a/tools/checkout-deps.ps1 +++ b/tools/checkout-deps.ps1 @@ -92,6 +92,8 @@ $SDKS | ForEach-Object { Get-Repository -Name "hl2sdk-$_" -Branch $_ -Repo "hl2sdk-proxy-repo" "https://github.com/alliedmodders/hl2sdk.git" } +Get-Repository -Name "hl2sdk-mock" -Branch "master" -Repo "https://github.com/alliedmodders/hl2sdk-mock.git" + # Find a suitable installation of Python $PYTHON_CMD = Get-Command 'python3' -ErrorAction SilentlyContinue if ($NULL -eq $PYTHON_CMD) diff --git a/tools/checkout-deps.sh b/tools/checkout-deps.sh index 42c30996dc..059bd1776d 100755 --- a/tools/checkout-deps.sh +++ b/tools/checkout-deps.sh @@ -153,6 +153,12 @@ do checkout done +name=hl2sdk-mock +branch=master +repo="https://github.com/alliedmodders/hl2sdk-mock" +origin= +checkout + python_cmd=`command -v python3` if [ -z "$python_cmd" ]; then python_cmd=`command -v python` diff --git a/translations/cze/basetriggers.phrases.txt b/translations/cze/basetriggers.phrases.txt index 54bc1650e8..8cf191685f 100644 --- a/translations/cze/basetriggers.phrases.txt +++ b/translations/cze/basetriggers.phrases.txt @@ -20,6 +20,11 @@ "cze" "Friendly Fire je vypnut." } + "Friendly Fire Percent" + { + "cze" "Friendly Fire je {1}%." + } + "Current Map" { "cze" "Aktualni mapa je {1}." diff --git a/translations/cze/nominations.phrases.txt b/translations/cze/nominations.phrases.txt index a107970a28..e951a8e50f 100644 --- a/translations/cze/nominations.phrases.txt +++ b/translations/cze/nominations.phrases.txt @@ -65,4 +65,9 @@ "cze" "Nominovana" } + "Map Not In Pool" + { + "cze" "Mapa '{1}' není v bazénu" + } + }