├── .gitignore
├── configure.py
├── PackageScript
├── natives.h
├── AMBuilder
├── smsdk_config.h
├── PTaH.games.txt
├── extension.cpp
├── .github
└── workflows
│ └── compile.yml
├── extension.h
├── smsdk_ext.cpp
├── forwards.h
├── classes.h
├── classes.cpp
├── AMBuildScript
├── LICENSE
├── PTaH.inc
└── forwards.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Precompiled Headers
8 | *.gch
9 | *.pch
10 |
11 | # Compiled Dynamic libraries
12 | *.so
13 | *.dylib
14 | *.dll
15 |
16 | # Fortran module files
17 | *.mod
18 | *.smod
19 |
20 | # Compiled Static libraries
21 | *.lai
22 | *.la
23 | *.a
24 | *.lib
25 |
26 | # Executables
27 | *.exe
28 | *.out
29 | *.app
30 |
31 | # Dir
32 | build
33 | *vs
--------------------------------------------------------------------------------
/configure.py:
--------------------------------------------------------------------------------
1 | # vim: set sts=2 ts=8 sw=2 tw=99 et:
2 | import sys
3 | from ambuild2 import run
4 |
5 | # Simple extensions do not need to modify this file.
6 |
7 | builder = run.PrepareBuild(sourcePath = sys.path[0])
8 |
9 | builder.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
10 | help='Root search folder for HL2SDKs')
11 | builder.options.add_option('--mms-path', type=str, dest='mms_path', default=None,
12 | help='Path to Metamod:Source')
13 | builder.options.add_option('--sm-path', type=str, dest='sm_path', default=None,
14 | help='Path to SourceMod')
15 | builder.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
16 | help='Enable debugging symbols')
17 | builder.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
18 | help='Enable optimization')
19 | builder.options.add_option('--enable-lto', action='store_const', const='1', dest='lto',
20 | help='Enable link time optimization')
21 | builder.options.add_option('--build-id', type=str, dest='build_id', default=None,
22 | help='Build ID')
23 |
24 | builder.Configure()
25 |
--------------------------------------------------------------------------------
/PackageScript:
--------------------------------------------------------------------------------
1 | # vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
2 | import os
3 |
4 | # This is where the files will be output to
5 | # package is the default
6 | builder.SetBuildFolder('package')
7 |
8 | # Add any folders you need to this list
9 | folder_list = [
10 | 'addons/sourcemod/extensions',
11 | 'addons/sourcemod/scripting/include',
12 | 'addons/sourcemod/gamedata',
13 | #'addons/sourcemod/configs',
14 | ]
15 |
16 | # Create the distribution folder hierarchy.
17 | folder_map = {}
18 | for folder in folder_list:
19 | norm_folder = os.path.normpath(folder)
20 | folder_map[folder] = builder.AddFolder(norm_folder)
21 |
22 | # Do all straight-up file copies from the source tree.
23 | def CopyFiles(src, dest, files):
24 | if not dest:
25 | dest = src
26 | dest_entry = folder_map[dest]
27 | for source_file in files:
28 | source_path = os.path.join(builder.sourcePath, src, source_file)
29 | builder.AddCopy(source_path, dest_entry)
30 |
31 | # Include files
32 | CopyFiles('', 'addons/sourcemod/scripting/include',
33 | [ 'PTaH.inc', ]
34 | )
35 |
36 | # GameData files
37 | CopyFiles('', 'addons/sourcemod/gamedata',
38 | [ 'PTaH.games.txt' ]
39 | )
40 |
41 | # Config Files
42 | #CopyFiles('configs', 'addons/sourcemod/configs',
43 | # [ 'configfile.cfg',
44 | # 'otherconfig.cfg,
45 | # ]
46 | #)
47 |
48 | # Copy binaries.
49 | for cxx_task in Extension.extensions:
50 | builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions'])
51 |
--------------------------------------------------------------------------------
/natives.h:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 :
3 | * =============================================================================
4 | * SourceMod P Tools and Hooks Extension
5 | * Copyright (C) 2016-2023 Phoenix (˙·٠●Феникс●٠·˙). All rights reserved.
6 | * =============================================================================
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License, version 3.0, as published by the
10 | * Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful, but WITHOUT
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 | * details.
16 | *
17 | * You should have received a copy of the GNU General Public License along with
18 | * this program. If not, see .
19 | */
20 |
21 | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_NATIVES_H_
22 | #define _INCLUDE_SOURCEMOD_EXTENSION_NATIVES_H_
23 |
24 | enum PTaH_HookEvent
25 | {
26 | PTaH_GiveNamedItemPre = 10,
27 | PTaH_GiveNamedItemPost,
28 | PTaH_WeaponCanUsePre,
29 | PTaH_WeaponCanUsePost,
30 | PTaH_SetPlayerModelPre,
31 | PTaH_SetPlayerModelPost,
32 | PTaH_ClientVoiceToPre,
33 | PTaH_ClientVoiceToPost,
34 | PTaH_ConsolePrintPre,
35 | PTaH_ConsolePrintPost,
36 | PTaH_ExecuteStringCommandPre,
37 | PTaH_ExecuteStringCommandPost,
38 | PTaH_ClientConnectPre,
39 | PTaH_ClientConnectPost,
40 | PTaH_InventoryUpdatePost = 25,
41 |
42 | PTaH_MAXHOOKS
43 | };
44 |
45 | enum PTaH_ModelType
46 | {
47 | ViewModel = 0,
48 | WorldModel,
49 | DroppedModel
50 | };
51 |
52 | extern const sp_nativeinfo_t g_ExtensionNatives[];
53 |
54 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_NATIVES_H_
--------------------------------------------------------------------------------
/AMBuilder:
--------------------------------------------------------------------------------
1 | # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
2 | import os, sys
3 |
4 | projectName = 'PTaH'
5 |
6 | sourceFiles = [
7 | 'extension.cpp',
8 | 'forwards.cpp',
9 | 'natives.cpp',
10 | 'classes.cpp',
11 | 'smsdk_ext.cpp'
12 | ]
13 |
14 | ###############
15 | # Make sure to edit PackageScript, which copies your files to their appropriate locations
16 | # Simple extensions do not need to modify past this point.
17 |
18 | project = Extension.HL2Project(builder, projectName + '.ext')
19 |
20 | project.sources += sourceFiles
21 |
22 | binary = Extension.HL2Config(project, projectName + '.ext.' + Extension.sdk.ext, Extension.sdk)
23 | compiler = binary.compiler
24 |
25 | binary.sources += [
26 | # Memory management via g_pMemAlloc
27 | os.path.join(Extension.sdk.path, 'public', 'tier0', 'memoverride.cpp'),
28 |
29 | os.path.join(Extension.sm_root, 'public', 'CDetour', 'detours.cpp'),
30 | os.path.join(Extension.sm_root, 'public', 'asm', 'asm.c'),
31 | os.path.join(Extension.sm_root, 'public', 'libudis86', 'decode.c'),
32 | os.path.join(Extension.sm_root, 'public', 'libudis86', 'itab.c'),
33 | os.path.join(Extension.sm_root, 'public', 'libudis86', 'syn-att.c'),
34 | os.path.join(Extension.sm_root, 'public', 'libudis86', 'syn-intel.c'),
35 | os.path.join(Extension.sm_root, 'public', 'libudis86', 'syn.c'),
36 | os.path.join(Extension.sm_root, 'public', 'libudis86', 'udis86.c'),
37 |
38 | os.path.join(Extension.sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
39 | os.path.join(Extension.sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
40 | os.path.join(Extension.sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
41 | ]
42 |
43 | compiler.cxxincludes += [
44 | os.path.join(Extension.sdk.path, 'common', 'protobuf-2.5.0', 'src'),
45 | os.path.join(Extension.sdk.path, 'public', 'engine', 'protobuf'),
46 | os.path.join(Extension.sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf'),
47 | os.path.join(Extension.sdk.path, 'public', 'steam'),
48 | os.path.join(Extension.sdk.path, 'game', 'server')
49 | ]
50 |
51 | if builder.target_platform == 'linux':
52 | lib_path = os.path.join(Extension.sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
53 | elif builder.target_platform == 'windows':
54 | lib_path = os.path.join(Extension.sdk.path, 'lib', 'win32', 'release', 'vs2017', 'libprotobuf.lib')
55 | compiler.linkflags.insert(0, binary.Dep(lib_path))
56 |
57 | Extension.extensions = builder.Add(project)
58 |
--------------------------------------------------------------------------------
/smsdk_config.h:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 :
3 | * =============================================================================
4 | * SourceMod P Tools and Hooks Extension
5 | * Copyright (C) 2016-2023 Phoenix (˙·٠●Феникс●٠·˙). All rights reserved.
6 | * =============================================================================
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License, version 3.0, as published by the
10 | * Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful, but WITHOUT
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 | * details.
16 | *
17 | * You should have received a copy of the GNU General Public License along with
18 | * this program. If not, see .
19 | */
20 |
21 | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
22 | #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
23 |
24 | /**
25 | * @file smsdk_config.h
26 | * @brief Contains macros for configuring basic extension information.
27 | */
28 |
29 | /* Basic information exposed publicly */
30 | #define SMEXT_CONF_NAME "PTaH"
31 | #define SMEXT_CONF_DESCRIPTION "Additional CS:GO Hooks and Natives"
32 | #define SMEXT_CONF_VERSION "1.1.4"
33 | #define PTaH_VERSION 101040
34 | #define SMEXT_CONF_AUTHOR "Phoenix (˙·٠●Феникс●٠·˙)"
35 | #define SMEXT_CONF_URL "https://github.com/komashchenko/PTaH"
36 | #define SMEXT_CONF_LOGTAG "PTaH"
37 | #define SMEXT_CONF_LICENSE "GPL"
38 | #define SMEXT_CONF_DATESTRING __DATE__
39 |
40 | /**
41 | * @brief Exposes plugin's main interface.
42 | */
43 | #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name;
44 |
45 | /**
46 | * @brief Sets whether or not this plugin required Metamod.
47 | * NOTE: Uncomment to enable, comment to disable.
48 | */
49 | #define SMEXT_CONF_METAMOD
50 |
51 | /** Enable interfaces you want to use here by uncommenting lines */
52 | #define SMEXT_ENABLE_FORWARDSYS
53 | //#define SMEXT_ENABLE_HANDLESYS
54 | #define SMEXT_ENABLE_PLAYERHELPERS
55 | //#define SMEXT_ENABLE_DBMANAGER
56 | #define SMEXT_ENABLE_GAMECONF
57 | //#define SMEXT_ENABLE_MEMUTILS
58 | #define SMEXT_ENABLE_GAMEHELPERS
59 | //#define SMEXT_ENABLE_TIMERSYS
60 | //#define SMEXT_ENABLE_THREADER
61 | //#define SMEXT_ENABLE_LIBSYS
62 | //#define SMEXT_ENABLE_MENUS
63 | //#define SMEXT_ENABLE_ADTFACTORY
64 | #define SMEXT_ENABLE_PLUGINSYS
65 | //#define SMEXT_ENABLE_ADMINSYS
66 | //#define SMEXT_ENABLE_TEXTPARSERS
67 | //#define SMEXT_ENABLE_USERMSGS
68 | //#define SMEXT_ENABLE_TRANSLATOR
69 | //#define SMEXT_ENABLE_ROOTCONSOLEMENU
70 |
71 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
72 |
--------------------------------------------------------------------------------
/PTaH.games.txt:
--------------------------------------------------------------------------------
1 | "Games"
2 | {
3 | "csgo"
4 | {
5 | "Addresses"
6 | {
7 | "g_CPlayerVoiceListener"
8 | {
9 | "signature" "g_CPlayerVoiceListener"
10 | "windows"
11 | {
12 | "read" "0x3"
13 | }
14 | "linux"
15 | {
16 | "read" "0xE7"
17 | }
18 | }
19 | }
20 | "Signatures"
21 | {
22 | "CCStrike15ItemDefinition::GetLoadoutSlot"
23 | {
24 | "library" "server"
25 | "windows" "\x55\x8B\xEC\x8B\x45\x08\x8D\x50\xFF"
26 | "linux" "\x55\x89\xE5\x8B\x45\x0C\x8B\x55\x08\x8D\x48\xFF"
27 | }
28 | "CCSPlayer::FindMatchingWeaponsForTeamLoadout"
29 | {
30 | "library" "server"
31 | "windows" "\x55\x8B\xEC\x83\xEC\x08\x53\x56\x57\x89\x4D\xF8"
32 | "linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\x8B\x45\x14\x8B\x75\x10\x89\x45\xCC"
33 | }
34 | "CItemGeneration::SpawnItem"
35 | {
36 | "library" "server"
37 | "windows" "\x55\x8B\xEC\x51\x53\x56\x57\xE8\x2A\x2A\x2A\x2A\x8B\x5D\x08"
38 | "linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\x8B\x45\x08\x8B\x75\x0C\x8B\x5D\x20"
39 | }
40 | "FX_FireBullets"
41 | {
42 | "library" "server"
43 | "windows" "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\xE0\x01\x00\x00"
44 | "linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\xEC\x02\x00\x00\x8B\x45\x0C"
45 | }
46 | "g_CPlayerVoiceListener"
47 | {
48 | "library" "server"
49 | "windows" "\x6A\x00\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x6A\x40"
50 | "linux" "\x55\x89\xE5\x53\x83\xEC\x04\x68\x00\x40\x00\x00"
51 | }
52 | }
53 | "Offsets"
54 | {
55 | "CBaseServer::ConnectClient"
56 | {
57 | "windows" "54"
58 | "linux" "55"
59 | }
60 | "CBaseServer::RejectConnection"
61 | {
62 | "windows" "52"
63 | "linux" "53"
64 | }
65 | "CEconItemSchema::m_mapItems"
66 | {
67 | "windows" "0xAC"
68 | "linux" "0xAC"
69 | }
70 | "CEconItemSchema::m_mapAttributesContainer"
71 | {
72 | "windows" "0x11C"
73 | "linux" "0x11C"
74 | }
75 | "CCStrike15ItemDefinition::m_vbClassUsability"
76 | {
77 | "windows" "0x288"
78 | "linux" "0x288"
79 | }
80 | "CEconItemDefinition::GetNumSupportedStickerSlots"
81 | {
82 | "windows" "44"
83 | "linux" "45"
84 | }
85 | "CEconItemDefinition::GetInventoryImage"
86 | {
87 | "windows" "5"
88 | "linux" "5"
89 | }
90 | "CEconItemDefinition::GetBasePlayerDisplayModel"
91 | {
92 | "windows" "6"
93 | "linux" "6"
94 | }
95 | "CEconItemDefinition::GetWorldDisplayModel"
96 | {
97 | "windows" "7"
98 | "linux" "7"
99 | }
100 | "CEconItemDefinition::GetWorldDroppedModel"
101 | {
102 | "windows" "33"
103 | "linux" "34"
104 | }
105 | "CEconItemDefinition::m_pszDefinitionName"
106 | {
107 | "windows" "0x1DC"
108 | "linux" "0x1DC"
109 | }
110 | "CGameClient::UpdateAcknowledgedFramecount"
111 | {
112 | "windows" "17"
113 | "linux" "55"
114 | }
115 | "CPlayerInventory::SendInventoryUpdateEvent"
116 | {
117 | "windows" "16"
118 | "linux" "17"
119 | }
120 | "CPlayerInventory::m_vecInventoryItems"
121 | {
122 | "windows" "0x2C"
123 | "linux" "0x2C"
124 | }
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/extension.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 :
3 | * =============================================================================
4 | * SourceMod P Tools and Hooks Extension
5 | * Copyright (C) 2016-2023 Phoenix (˙·٠●Феникс●٠·˙). All rights reserved.
6 | * =============================================================================
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License, version 3.0, as published by the
10 | * Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful, but WITHOUT
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 | * details.
16 | *
17 | * You should have received a copy of the GNU General Public License along with
18 | * this program. If not, see .
19 | */
20 |
21 | #include "extension.h"
22 | #include "forwards.h"
23 | #include "natives.h"
24 | #include "classes.h"
25 |
26 |
27 | /**
28 | * @file extension.cpp
29 | * @brief Implement extension code here.
30 | */
31 |
32 | PTaH g_PTaH; /**< Global singleton for extension's main interface */
33 |
34 | SMEXT_LINK(&g_PTaH);
35 |
36 | IGameConfig* g_pGameConf[4];
37 |
38 | ISDKTools* sdktools = nullptr;
39 | IServer* iserver = nullptr;
40 | IVoiceServer* voiceserver = nullptr;
41 | CGlobalVars* gpGlobals = nullptr;
42 | IServerGameClients* serverClients = nullptr;
43 |
44 | CEconItemSchema* g_pCEconItemSchema = nullptr;
45 | CPlayerVoiceListener* g_pCPlayerVoiceListener = nullptr;
46 |
47 |
48 | bool PTaH::SDK_OnLoad(char* error, size_t maxlength, bool late)
49 | {
50 | char conf_error[255];
51 |
52 | if (!gameconfs->LoadGameConfigFile("sdktools.games", &g_pGameConf[GameConf_SDKT], conf_error, sizeof(conf_error)))
53 | {
54 | snprintf(error, maxlength, "Could not read sdktools.games: %s", conf_error);
55 |
56 | return false;
57 | }
58 |
59 | if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf[GameConf_SDKH], conf_error, sizeof(conf_error)))
60 | {
61 | snprintf(error, maxlength, "Could not read sdkhooks.games: %s", conf_error);
62 |
63 | return false;
64 | }
65 |
66 | if (!gameconfs->LoadGameConfigFile("PTaH.games", &g_pGameConf[GameConf_PTaH], conf_error, sizeof(conf_error)))
67 | {
68 | snprintf(error, maxlength, "Could not read PTaH.games: %s", conf_error);
69 |
70 | return false;
71 | }
72 |
73 | if (!gameconfs->LoadGameConfigFile("sm-cstrike.games", &g_pGameConf[GameConf_CSST], conf_error, sizeof(conf_error)))
74 | {
75 | snprintf(error, maxlength, "Could not read sm-cstrike.games: %s", conf_error);
76 |
77 | return false;
78 | }
79 |
80 | CDetourManager::Init(smutils->GetScriptingEngine(), g_pGameConf[GameConf_PTaH]);
81 |
82 | sharesys->AddDependency(myself, "sdktools.ext", true, true);
83 |
84 | sharesys->AddNatives(myself, g_ExtensionNatives);
85 | sharesys->RegisterLibrary(myself, "PTaH");
86 |
87 | return true;
88 | }
89 |
90 | void PTaH::SDK_OnAllLoaded()
91 | {
92 | SM_GET_LATE_IFACE(SDKTOOLS, sdktools);
93 |
94 | iserver = sdktools->GetIServer();
95 | g_pCEconItemSchema = CEconItemSchema::GetEconItemSchema();
96 | g_pCPlayerVoiceListener = CPlayerVoiceListener::GetPlayerVoiceListener();
97 |
98 | g_ForwardManager.Init();
99 | }
100 |
101 | void PTaH::SDK_OnUnload()
102 | {
103 | g_ForwardManager.Shutdown();
104 |
105 | gameconfs->CloseGameConfigFile(g_pGameConf[GameConf_SDKT]);
106 | gameconfs->CloseGameConfigFile(g_pGameConf[GameConf_SDKH]);
107 | gameconfs->CloseGameConfigFile(g_pGameConf[GameConf_PTaH]);
108 | gameconfs->CloseGameConfigFile(g_pGameConf[GameConf_CSST]);
109 | }
110 |
111 | bool PTaH::SDK_OnMetamodLoad(ISmmAPI* ismm, char* error, size_t maxlen, bool late)
112 | {
113 | GET_V_IFACE_ANY(GetEngineFactory, voiceserver, IVoiceServer, INTERFACEVERSION_VOICESERVER);
114 | GET_V_IFACE_ANY(GetServerFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
115 |
116 | gpGlobals = ismm->GetCGlobals();
117 |
118 | return true;
119 | }
--------------------------------------------------------------------------------
/.github/workflows/compile.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - LICENSE
7 | - README.md
8 |
9 | pull_request:
10 | paths-ignore:
11 | - LICENSE
12 | - README.md
13 |
14 | workflow_dispatch:
15 |
16 | jobs:
17 | build:
18 | name: Build on ${{ matrix.os_short }}
19 | runs-on: ${{ matrix.os }}
20 | strategy:
21 | fail-fast: false
22 | matrix:
23 | # Compile on Linux & Windows.
24 | os:
25 | - ubuntu-20.04
26 | - windows-latest
27 |
28 | include:
29 | - os: ubuntu-20.04
30 | os_short: linux
31 | - os: windows-latest
32 | os_short: win
33 | steps:
34 | - name: Short SHA
35 | shell: bash
36 | run: |
37 | echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
38 |
39 | # Setup Python for AMBuild.
40 | - name: Setup Python 3.8
41 | uses: actions/setup-python@v4
42 | with:
43 | python-version: 3.8
44 |
45 | # Install dependencies
46 | - name: Install AMBuild
47 | run: |
48 | python -m pip install --upgrade pip setuptools wheel
49 | pip install git+https://github.com/alliedmodders/ambuild
50 |
51 | - name: Install dependencies
52 | if: runner.os == 'Linux'
53 | run: |
54 | sudo dpkg --add-architecture i386
55 | sudo apt-get update
56 | sudo apt-get install -y clang g++-multilib
57 |
58 | - name: Select clang compiler
59 | if: runner.os == 'Linux'
60 | run: |
61 | echo "CC=clang" >> $GITHUB_ENV
62 | echo "CXX=clang++" >> $GITHUB_ENV
63 | clang --version
64 | clang++ --version
65 |
66 | - name: Find Visual C++ compilers and make all environment variables global (W)
67 | if: runner.os == 'Windows'
68 | shell: cmd
69 | run: |
70 | :: See https://github.com/microsoft/vswhere/wiki/Find-VC
71 | for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
72 | call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x86 -host_arch=x64
73 | )
74 |
75 | :: Loop over all environment variables and make them global.
76 | for /f "delims== tokens=1,2" %%a in ('set') do (
77 | echo>>"%GITHUB_ENV%" %%a=%%b
78 | )
79 |
80 | # Checkout repos
81 | - name: Checkout Metamod:Source
82 | uses: actions/checkout@v3
83 | with:
84 | repository: alliedmodders/metamod-source
85 | ref: 1.11-dev
86 | path: metamod-source
87 |
88 | - name: Checkout SourceMod
89 | uses: actions/checkout@v3
90 | with:
91 | repository: alliedmodders/sourcemod
92 | ref: 1.11-dev
93 | path: sourcemod
94 | submodules: true
95 |
96 | - name: Checkout hl2sdk-csgo
97 | uses: actions/checkout@v3
98 | with:
99 | repository: Wend4r/hl2sdk
100 | ref: csgo
101 | path: hl2sdk-csgo
102 |
103 | - name: Checkout
104 | uses: actions/checkout@v3
105 | with:
106 | path: project
107 |
108 | # Build
109 | - name: Use lto
110 | if: startsWith(github.ref, 'refs/tags/')
111 | run: echo "BUILD_LTO=--enable-lto" >> $GITHUB_ENV
112 |
113 | - name: Build
114 | shell: bash
115 | run: |
116 | cd project && mkdir build && cd build
117 | python ../configure.py --enable-optimize --build-id ${{ env.GITHUB_SHA_SHORT }} ${{ env.BUILD_LTO }}
118 | ambuild
119 |
120 | - name: Copy pdb
121 | if: runner.os == 'Windows'
122 | working-directory: project/build
123 | run: cp PTaH.ext.2.csgo/PTaH.ext.2.csgo.pdb package/addons/sourcemod/extensions
124 |
125 | - name: Upload artifact
126 | uses: actions/upload-artifact@v3
127 | with:
128 | name: ${{ runner.os }}
129 | path: project/build/package
130 |
131 | release:
132 | name: Release
133 | if: startsWith(github.ref, 'refs/tags/')
134 | needs: build
135 | runs-on: ubuntu-latest
136 |
137 | steps:
138 | - name: Download artifacts
139 | uses: actions/download-artifact@v3
140 |
141 | - name: Package
142 | run: |
143 | 7z a -mx9 linux.zip ./Linux/*
144 | 7z a -mx9 -xr!*.pdb windows.zip ./Windows/*
145 | - name: Release
146 | uses: svenstaro/upload-release-action@v2
147 | with:
148 | repo_token: ${{ secrets.GITHUB_TOKEN }}
149 | file: '*.zip'
150 | tag: ${{ github.ref }}
151 | file_glob: true
152 |
--------------------------------------------------------------------------------
/extension.h:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 :
3 | * =============================================================================
4 | * SourceMod P Tools and Hooks Extension
5 | * Copyright (C) 2016-2023 Phoenix (˙·٠●Феникс●٠·˙). All rights reserved.
6 | * =============================================================================
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License, version 3.0, as published by the
10 | * Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful, but WITHOUT
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 | * details.
16 | *
17 | * You should have received a copy of the GNU General Public License along with
18 | * this program. If not, see .
19 | */
20 |
21 | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
22 | #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
23 |
24 | /**
25 | * @file extension.h
26 | * @brief Sample extension code header.
27 | */
28 |
29 |
30 | // networkvar.h must be included before smsdk_ext.h !!!
31 | #include "networkvar.h"
32 | #include "smsdk_ext.h"
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 |
42 | #ifdef PLATFORM_WINDOWS
43 | #define WIN_LINUX(win, linux) win
44 | #else
45 | #define WIN_LINUX(win, linux) linux
46 | #endif
47 |
48 | template
49 | constexpr T CallVFunc(size_t index, void* pThis, Args... args) noexcept
50 | {
51 | return reinterpret_cast(reinterpret_cast(pThis)[0][index])(pThis, args...);
52 | }
53 |
54 | template
55 | constexpr T CallVFMTFunc(size_t index, void* pThis, Args... args, const char* fmt, Va... va) noexcept
56 | {
57 | return reinterpret_cast(reinterpret_cast(pThis)[0][index])(pThis, args..., fmt, va...);
58 | }
59 |
60 |
61 | /**
62 | * @brief Sample implementation of the SDK Extension.
63 | * Note: Uncomment one of the pre-defined virtual functions in order to use it.
64 | */
65 | class PTaH : public SDKExtension
66 | {
67 | public:
68 | /**
69 | * @brief This is called after the initial loading sequence has been processed.
70 | *
71 | * @param error Error message buffer.
72 | * @param maxlength Size of error message buffer.
73 | * @param late Whether or not the module was loaded after map load.
74 | * @return True to succeed loading, false to fail.
75 | */
76 | virtual bool SDK_OnLoad(char* error, size_t maxlength, bool late);
77 |
78 | /**
79 | * @brief This is called right before the extension is unloaded.
80 | */
81 | virtual void SDK_OnUnload();
82 |
83 | /**
84 | * @brief This is called once all known extensions have been loaded.
85 | * Note: It is is a good idea to add natives here, if any are provided.
86 | */
87 | virtual void SDK_OnAllLoaded();
88 |
89 | /**
90 | * @brief Called when the pause state is changed.
91 | */
92 | //virtual void SDK_OnPauseChange(bool paused);
93 |
94 | /**
95 | * @brief this is called when Core wants to know if your extension is working.
96 | *
97 | * @param error Error message buffer.
98 | * @param maxlength Size of error message buffer.
99 | * @return True if working, false otherwise.
100 | */
101 | //virtual bool QueryRunning(char *error, size_t maxlength);
102 | public:
103 | #if defined SMEXT_CONF_METAMOD
104 | /**
105 | * @brief Called when Metamod is attached, before the extension version is called.
106 | *
107 | * @param error Error buffer.
108 | * @param maxlength Maximum size of error buffer.
109 | * @param late Whether or not Metamod considers this a late load.
110 | * @return True to succeed, false to fail.
111 | */
112 | virtual bool SDK_OnMetamodLoad(ISmmAPI* ismm, char* error, size_t maxlength, bool late);
113 |
114 | /**
115 | * @brief Called when Metamod is detaching, after the extension version is called.
116 | * NOTE: By default this is blocked unless sent from SourceMod.
117 | *
118 | * @param error Error buffer.
119 | * @param maxlength Maximum size of error buffer.
120 | * @return True to succeed, false to fail.
121 | */
122 | //virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
123 |
124 | /**
125 | * @brief Called when Metamod's pause state is changing.
126 | * NOTE: By default this is blocked unless sent from SourceMod.
127 | *
128 | * @param paused Pause state being set.
129 | * @param error Error buffer.
130 | * @param maxlength Maximum size of error buffer.
131 | * @return True to succeed, false to fail.
132 | */
133 | //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
134 | #endif
135 | };
136 |
137 | /* Interfaces from SourceMod */
138 | #define GameConf_SDKT 0
139 | #define GameConf_SDKH 1
140 | #define GameConf_PTaH 2
141 | #define GameConf_CSST 3
142 |
143 | extern IGameConfig* g_pGameConf[4];
144 | extern ISDKTools* sdktools;
145 | extern IServer* iserver;
146 | extern IVoiceServer* voiceserver;
147 | extern CGlobalVars* gpGlobals;
148 | extern IServerGameClients* serverClients;
149 |
150 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
--------------------------------------------------------------------------------
/smsdk_ext.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 sw=4 tw=99 noet:
3 | * =============================================================================
4 | * SourceMod Base Extension Code
5 | * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
6 | * =============================================================================
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License, version 3.0, as published by the
10 | * Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful, but WITHOUT
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 | * details.
16 | *
17 | * You should have received a copy of the GNU General Public License along with
18 | * this program. If not, see .
19 | *
20 | * As a special exception, AlliedModders LLC gives you permission to link the
21 | * code of this program (as well as its derivative works) to "Half-Life 2," the
22 | * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 | * by the Valve Corporation. You must obey the GNU General Public License in
24 | * all respects for all other code used. Additionally, AlliedModders LLC grants
25 | * this exception to all derivative works. AlliedModders LLC defines further
26 | * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 | * or .
28 | *
29 | * Version: $Id$
30 | */
31 |
32 | #include
33 | #include
34 | #include "smsdk_ext.h"
35 | #include "am-string.h"
36 |
37 | /**
38 | * @file smsdk_ext.cpp
39 | * @brief Contains wrappers for making Extensions easier to write.
40 | */
41 |
42 | IExtension *myself = NULL; /**< Ourself */
43 | IShareSys *g_pShareSys = NULL; /**< Share system */
44 | IShareSys *sharesys = NULL; /**< Share system */
45 | ISourceMod *g_pSM = NULL; /**< SourceMod helpers */
46 | ISourceMod *smutils = NULL; /**< SourceMod helpers */
47 |
48 | #if defined SMEXT_ENABLE_FORWARDSYS
49 | IForwardManager *g_pForwards = NULL; /**< Forward system */
50 | IForwardManager *forwards = NULL; /**< Forward system */
51 | #endif
52 | #if defined SMEXT_ENABLE_HANDLESYS
53 | IHandleSys *g_pHandleSys = NULL; /**< Handle system */
54 | IHandleSys *handlesys = NULL; /**< Handle system */
55 | #endif
56 | #if defined SMEXT_ENABLE_PLAYERHELPERS
57 | IPlayerManager *playerhelpers = NULL; /**< Player helpers */
58 | #endif //SMEXT_ENABLE_PLAYERHELPERS
59 | #if defined SMEXT_ENABLE_DBMANAGER
60 | IDBManager *dbi = NULL; /**< DB Manager */
61 | #endif //SMEXT_ENABLE_DBMANAGER
62 | #if defined SMEXT_ENABLE_GAMECONF
63 | IGameConfigManager *gameconfs = NULL; /**< Game config manager */
64 | #endif //SMEXT_ENABLE_DBMANAGER
65 | #if defined SMEXT_ENABLE_MEMUTILS
66 | IMemoryUtils *memutils = NULL;
67 | #endif //SMEXT_ENABLE_DBMANAGER
68 | #if defined SMEXT_ENABLE_GAMEHELPERS
69 | IGameHelpers *gamehelpers = NULL;
70 | #endif
71 | #if defined SMEXT_ENABLE_TIMERSYS
72 | ITimerSystem *timersys = NULL;
73 | #endif
74 | #if defined SMEXT_ENABLE_ADTFACTORY
75 | IADTFactory *adtfactory = NULL;
76 | #endif
77 | #if defined SMEXT_ENABLE_THREADER
78 | IThreader *threader = NULL;
79 | #endif
80 | #if defined SMEXT_ENABLE_LIBSYS
81 | ILibrarySys *libsys = NULL;
82 | #endif
83 | #if defined SMEXT_ENABLE_PLUGINSYS
84 | SourceMod::IPluginManager *plsys;
85 | #endif
86 | #if defined SMEXT_ENABLE_MENUS
87 | IMenuManager *menus = NULL;
88 | #endif
89 | #if defined SMEXT_ENABLE_ADMINSYS
90 | IAdminSystem *adminsys = NULL;
91 | #endif
92 | #if defined SMEXT_ENABLE_TEXTPARSERS
93 | ITextParsers *textparsers = NULL;
94 | #endif
95 | #if defined SMEXT_ENABLE_USERMSGS
96 | IUserMessages *usermsgs = NULL;
97 | #endif
98 | #if defined SMEXT_ENABLE_TRANSLATOR
99 | ITranslator *translator = NULL;
100 | #endif
101 | #if defined SMEXT_ENABLE_ROOTCONSOLEMENU
102 | IRootConsole *rootconsole = NULL;
103 | #endif
104 |
105 | /** Exports the main interface */
106 | PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
107 | {
108 | return g_pExtensionIface;
109 | }
110 |
111 | SDKExtension::SDKExtension()
112 | {
113 | #if defined SMEXT_CONF_METAMOD
114 | m_SourceMMLoaded = false;
115 | m_WeAreUnloaded = false;
116 | m_WeGotPauseChange = false;
117 | #endif
118 | }
119 |
120 | bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late)
121 | {
122 | g_pShareSys = sharesys = sys;
123 | myself = me;
124 |
125 | #if defined SMEXT_CONF_METAMOD
126 | m_WeAreUnloaded = true;
127 |
128 | if (!m_SourceMMLoaded)
129 | {
130 | if (error)
131 | {
132 | ke::SafeStrcpy(error, maxlength, "Metamod attach failed");
133 | }
134 | return false;
135 | }
136 | #endif
137 | SM_GET_IFACE(SOURCEMOD, g_pSM);
138 | smutils = g_pSM;
139 | #if defined SMEXT_ENABLE_HANDLESYS
140 | SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys);
141 | handlesys = g_pHandleSys;
142 | #endif
143 | #if defined SMEXT_ENABLE_FORWARDSYS
144 | SM_GET_IFACE(FORWARDMANAGER, g_pForwards);
145 | forwards = g_pForwards;
146 | #endif
147 | #if defined SMEXT_ENABLE_PLAYERHELPERS
148 | SM_GET_IFACE(PLAYERMANAGER, playerhelpers);
149 | #endif
150 | #if defined SMEXT_ENABLE_DBMANAGER
151 | SM_GET_IFACE(DBI, dbi);
152 | #endif
153 | #if defined SMEXT_ENABLE_GAMECONF
154 | SM_GET_IFACE(GAMECONFIG, gameconfs);
155 | #endif
156 | #if defined SMEXT_ENABLE_MEMUTILS
157 | SM_GET_IFACE(MEMORYUTILS, memutils);
158 | #endif
159 | #if defined SMEXT_ENABLE_GAMEHELPERS
160 | SM_GET_IFACE(GAMEHELPERS, gamehelpers);
161 | #endif
162 | #if defined SMEXT_ENABLE_TIMERSYS
163 | SM_GET_IFACE(TIMERSYS, timersys);
164 | #endif
165 | #if defined SMEXT_ENABLE_ADTFACTORY
166 | SM_GET_IFACE(ADTFACTORY, adtfactory);
167 | #endif
168 | #if defined SMEXT_ENABLE_THREADER
169 | SM_GET_IFACE(THREADER, threader);
170 | #endif
171 | #if defined SMEXT_ENABLE_LIBSYS
172 | SM_GET_IFACE(LIBRARYSYS, libsys);
173 | #endif
174 | #if defined SMEXT_ENABLE_PLUGINSYS
175 | SM_GET_IFACE(PLUGINSYSTEM, plsys);
176 | #endif
177 | #if defined SMEXT_ENABLE_MENUS
178 | SM_GET_IFACE(MENUMANAGER, menus);
179 | #endif
180 | #if defined SMEXT_ENABLE_ADMINSYS
181 | SM_GET_IFACE(ADMINSYS, adminsys);
182 | #endif
183 | #if defined SMEXT_ENABLE_TEXTPARSERS
184 | SM_GET_IFACE(TEXTPARSERS, textparsers);
185 | #endif
186 | #if defined SMEXT_ENABLE_USERMSGS
187 | SM_GET_IFACE(USERMSGS, usermsgs);
188 | #endif
189 | #if defined SMEXT_ENABLE_TRANSLATOR
190 | SM_GET_IFACE(TRANSLATOR, translator);
191 | #endif
192 | #if defined SMEXT_ENABLE_ROOTCONSOLEMENU
193 | SM_GET_IFACE(ROOTCONSOLE, rootconsole);
194 | #endif
195 |
196 | if (SDK_OnLoad(error, maxlength, late))
197 | {
198 | #if defined SMEXT_CONF_METAMOD
199 | m_WeAreUnloaded = true;
200 | #endif
201 | return true;
202 | }
203 |
204 | return false;
205 | }
206 |
207 | bool SDKExtension::IsMetamodExtension()
208 | {
209 | #if defined SMEXT_CONF_METAMOD
210 | return true;
211 | #else
212 | return false;
213 | #endif
214 | }
215 |
216 | void SDKExtension::OnExtensionPauseChange(bool state)
217 | {
218 | #if defined SMEXT_CONF_METAMOD
219 | m_WeGotPauseChange = true;
220 | #endif
221 | SDK_OnPauseChange(state);
222 | }
223 |
224 | void SDKExtension::OnExtensionsAllLoaded()
225 | {
226 | SDK_OnAllLoaded();
227 | }
228 |
229 | void SDKExtension::OnExtensionUnload()
230 | {
231 | #if defined SMEXT_CONF_METAMOD
232 | m_WeAreUnloaded = true;
233 | #endif
234 | SDK_OnUnload();
235 | }
236 |
237 | void SDKExtension::OnDependenciesDropped()
238 | {
239 | SDK_OnDependenciesDropped();
240 | }
241 |
242 | const char *SDKExtension::GetExtensionAuthor()
243 | {
244 | return SMEXT_CONF_AUTHOR;
245 | }
246 |
247 | const char *SDKExtension::GetExtensionDateString()
248 | {
249 | return SMEXT_CONF_DATESTRING;
250 | }
251 |
252 | const char *SDKExtension::GetExtensionDescription()
253 | {
254 | return SMEXT_CONF_DESCRIPTION;
255 | }
256 |
257 | const char *SDKExtension::GetExtensionVerString()
258 | {
259 | return SMEXT_CONF_VERSION BUILD_ID;
260 | }
261 |
262 | const char *SDKExtension::GetExtensionName()
263 | {
264 | return SMEXT_CONF_NAME;
265 | }
266 |
267 | const char *SDKExtension::GetExtensionTag()
268 | {
269 | return SMEXT_CONF_LOGTAG;
270 | }
271 |
272 | const char *SDKExtension::GetExtensionURL()
273 | {
274 | return SMEXT_CONF_URL;
275 | }
276 |
277 | bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late)
278 | {
279 | return true;
280 | }
281 |
282 | void SDKExtension::SDK_OnUnload()
283 | {
284 | }
285 |
286 | void SDKExtension::SDK_OnPauseChange(bool paused)
287 | {
288 | }
289 |
290 | void SDKExtension::SDK_OnAllLoaded()
291 | {
292 | }
293 |
294 | void SDKExtension::SDK_OnDependenciesDropped()
295 | {
296 | }
297 |
298 | #if defined SMEXT_CONF_METAMOD
299 |
300 | PluginId g_PLID = 0; /**< Metamod plugin ID */
301 | ISmmPlugin *g_PLAPI = NULL; /**< Metamod plugin API */
302 | SourceHook::ISourceHook *g_SHPtr = NULL; /**< SourceHook pointer */
303 | ISmmAPI *g_SMAPI = NULL; /**< SourceMM API pointer */
304 |
305 | #ifndef META_NO_HL2SDK
306 | IVEngineServer *engine = NULL; /**< IVEngineServer pointer */
307 | IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
308 | #endif
309 |
310 | /** Exposes the extension to Metamod */
311 | SMM_API void *PL_EXPOSURE(const char *name, int *code)
312 | {
313 | #if defined METAMOD_PLAPI_VERSION
314 | if (name && !strcmp(name, METAMOD_PLAPI_NAME))
315 | #else
316 | if (name && !strcmp(name, PLAPI_NAME))
317 | #endif
318 | {
319 | if (code)
320 | {
321 | *code = META_IFACE_OK;
322 | }
323 | return static_cast(g_pExtensionIface);
324 | }
325 |
326 | if (code)
327 | {
328 | *code = META_IFACE_FAILED;
329 | }
330 |
331 | return NULL;
332 | }
333 |
334 | bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
335 | {
336 | PLUGIN_SAVEVARS();
337 |
338 | #ifndef META_NO_HL2SDK
339 | #if !defined METAMOD_PLAPI_VERSION
340 | GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
341 | GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
342 | #else
343 | GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
344 | #if SOURCE_ENGINE == SE_SDK2013
345 | // Shim to avoid hooking shims
346 | engine = (IVEngineServer *) ismm->GetEngineFactory()("VEngineServer023", nullptr);
347 | if (!engine)
348 | {
349 | engine = (IVEngineServer *) ismm->GetEngineFactory()("VEngineServer022", nullptr);
350 | if (!engine)
351 | {
352 | engine = (IVEngineServer *) ismm->GetEngineFactory()("VEngineServer021", nullptr);
353 | if (!engine)
354 | {
355 | if (error && maxlen)
356 | {
357 | ismm->Format(error, maxlen, "Could not find interface: VEngineServer023 or VEngineServer022");
358 | }
359 | return false;
360 | }
361 | }
362 | }
363 | #else
364 | GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
365 | #endif // TF2 / CSS / DODS / HL2DM / SDK2013
366 | #endif // !METAMOD_PLAPI_VERSION
367 | #endif //META_NO_HL2SDK
368 |
369 | m_SourceMMLoaded = true;
370 |
371 | return SDK_OnMetamodLoad(ismm, error, maxlen, late);
372 | }
373 |
374 | bool SDKExtension::Unload(char *error, size_t maxlen)
375 | {
376 | if (!m_WeAreUnloaded)
377 | {
378 | if (error)
379 | {
380 | ke::SafeStrcpy(error, maxlen, "This extension must be unloaded by SourceMod.");
381 | }
382 | return false;
383 | }
384 |
385 | return SDK_OnMetamodUnload(error, maxlen);
386 | }
387 |
388 | bool SDKExtension::Pause(char *error, size_t maxlen)
389 | {
390 | if (!m_WeGotPauseChange)
391 | {
392 | if (error)
393 | {
394 | ke::SafeStrcpy(error, maxlen, "This extension must be paused by SourceMod.");
395 | }
396 | return false;
397 | }
398 |
399 | m_WeGotPauseChange = false;
400 |
401 | return SDK_OnMetamodPauseChange(true, error, maxlen);
402 | }
403 |
404 | bool SDKExtension::Unpause(char *error, size_t maxlen)
405 | {
406 | if (!m_WeGotPauseChange)
407 | {
408 | if (error)
409 | {
410 | ke::SafeStrcpy(error, maxlen, "This extension must be unpaused by SourceMod.");
411 | }
412 | return false;
413 | }
414 |
415 | m_WeGotPauseChange = false;
416 |
417 | return SDK_OnMetamodPauseChange(false, error, maxlen);
418 | }
419 |
420 | const char *SDKExtension::GetAuthor()
421 | {
422 | return GetExtensionAuthor();
423 | }
424 |
425 | const char *SDKExtension::GetDate()
426 | {
427 | return GetExtensionDateString();
428 | }
429 |
430 | const char *SDKExtension::GetDescription()
431 | {
432 | return GetExtensionDescription();
433 | }
434 |
435 | const char *SDKExtension::GetLicense()
436 | {
437 | return SMEXT_CONF_LICENSE;
438 | }
439 |
440 | const char *SDKExtension::GetLogTag()
441 | {
442 | return GetExtensionTag();
443 | }
444 |
445 | const char *SDKExtension::GetName()
446 | {
447 | return GetExtensionName();
448 | }
449 |
450 | const char *SDKExtension::GetURL()
451 | {
452 | return GetExtensionURL();
453 | }
454 |
455 | const char *SDKExtension::GetVersion()
456 | {
457 | return GetExtensionVerString();
458 | }
459 |
460 | bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late)
461 | {
462 | return true;
463 | }
464 |
465 | bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength)
466 | {
467 | return true;
468 | }
469 |
470 | bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength)
471 | {
472 | return true;
473 | }
474 |
475 | #endif
476 |
477 |
--------------------------------------------------------------------------------
/forwards.h:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 :
3 | * =============================================================================
4 | * SourceMod P Tools and Hooks Extension
5 | * Copyright (C) 2016-2023 Phoenix (˙·٠●Феникс●٠·˙). All rights reserved.
6 | * =============================================================================
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License, version 3.0, as published by the
10 | * Free Software Foundation.
11 | *
12 | * This program is distributed in the hope that it will be useful, but WITHOUT
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 | * details.
16 | *
17 | * You should have received a copy of the GNU General Public License along with
18 | * this program. If not, see .
19 | */
20 |
21 | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_FORWARDS_H_
22 | #define _INCLUDE_SOURCEMOD_EXTENSION_FORWARDS_H_
23 |
24 | #include "extension.h"
25 | #include "natives.h"
26 | #include "classes.h"
27 | #include "netmessages.pb.h"
28 | #include
29 | #include