Compare commits
112
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb356f2ffe | ||
|
|
d1b4821ab3 | ||
|
|
ce117a8295 | ||
|
|
ad4309b512 | ||
|
|
81a83fa7ce | ||
|
|
37bfc28011 | ||
|
|
4e308c40ba | ||
|
|
47b597c3ef | ||
|
|
b038670c50 | ||
|
|
79744d0de6 | ||
|
|
dac57ecbec | ||
|
|
6d40705a76 | ||
|
|
b0513dce63 | ||
|
|
3a2f04d2bc | ||
|
|
5539f2e8bf | ||
|
|
477d56b0fe | ||
|
|
f967ffaf76 | ||
|
|
3a1c518ed8 | ||
|
|
0b407a19f1 | ||
|
|
bb681c9c69 | ||
|
|
7a6382d636 | ||
|
|
ee5fa32851 | ||
|
|
5d4d0cf106 | ||
|
|
40149ba650 | ||
|
|
6608766829 | ||
|
|
7d6ef266fb | ||
|
|
54ff5fed60 | ||
|
|
3fdf350f7b | ||
|
|
cb08a96836 | ||
|
|
e3e2b8291a | ||
|
|
f7ed81d3ab | ||
|
|
1c1e9cda7c | ||
|
|
3f17137086 | ||
|
|
3d353d8ae9 | ||
|
|
482ee315b7 | ||
|
|
9e24d6e53f | ||
|
|
f248f474e7 | ||
|
|
a4512141a9 | ||
|
|
e94234ae73 | ||
|
|
54a7aa1116 | ||
|
|
6e264b6eea | ||
|
|
debfaebda8 | ||
|
|
8a633363a2 | ||
|
|
fa6f2f7e64 | ||
|
|
20eae5e394 | ||
|
|
4bce2a8a44 | ||
|
|
7eced94651 | ||
|
|
0869fde119 | ||
|
|
8e6166fa37 | ||
|
|
669b4cc69f | ||
|
|
22622ccafe | ||
|
|
d25c68f0a6 | ||
|
|
ff38e3ded2 | ||
|
|
4f43f43297 | ||
|
|
60fccfface | ||
|
|
98690df815 | ||
|
|
52c537b2ab | ||
|
|
bbec55d5f6 | ||
|
|
0abdcb58cf | ||
|
|
902672aa58 | ||
|
|
aed47ac13d | ||
|
|
6928d046f4 | ||
|
|
6c396dfbef | ||
|
|
4b66ca079d | ||
|
|
ea2e448dd6 | ||
|
|
d7fe14221b | ||
|
|
e89d3e5616 | ||
|
|
253ed583e6 | ||
|
|
58cb84d0bf | ||
|
|
65d34bdb55 | ||
|
|
19fd09c102 | ||
|
|
434d458a54 | ||
|
|
aaae36dbd3 | ||
|
|
4427ec3a65 | ||
|
|
5f6c5cb4fb | ||
|
|
6425484608 | ||
|
|
8e897f62a3 | ||
|
|
d40423569a | ||
|
|
7f28a15a5c | ||
|
|
669f1aefa6 | ||
|
|
a65dfc4888 | ||
|
|
60292fa424 | ||
|
|
0303377f92 | ||
|
|
bfd9b061f4 | ||
|
|
b1bf2dece1 | ||
|
|
b9e2d2b690 | ||
|
|
15fe086e7a | ||
|
|
26eae4e396 | ||
|
|
72eeebb59f | ||
|
|
1c5a684f1c | ||
|
|
3f5cd0e0e7 | ||
|
|
536ef2c019 | ||
|
|
9320d4b378 | ||
|
|
5b6970561e | ||
|
|
83f374561c | ||
|
|
d914a6b982 | ||
|
|
9b14101586 | ||
|
|
46c87f509b | ||
|
|
4df1d19cf2 | ||
|
|
c1af9081c6 | ||
|
|
ae538916b6 | ||
|
|
1efea1fd82 | ||
|
|
ef255c9a3e | ||
|
|
0909a1ffae | ||
|
|
d725178405 | ||
|
|
148271c5ea | ||
|
|
6252676e57 | ||
|
|
d4709704ea | ||
|
|
e6d418c04e | ||
|
|
752f7bdefc | ||
|
|
ced6add9ea | ||
|
|
e9834a33b1 |
@@ -13,10 +13,3 @@
|
||||
/CrazyDebug.*
|
||||
/Debug.*
|
||||
/Release.*
|
||||
|
||||
# Files generated by Mac OS X Finder
|
||||
(^|/)\.DS_Store$
|
||||
|
||||
# Files generated by Windows Explorer
|
||||
(^|/)[dD]esktop\.ini$
|
||||
(^|/)[tT]humbs\.db$
|
||||
|
||||
@@ -3,5 +3,6 @@ e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
|
||||
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
|
||||
b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2
|
||||
3a73bbf60f34befa9b66be03fa5974b394bb3411 sourcemod-1.2.0
|
||||
a71318396392e3c6d0ff31e069a60fbde59e0cea sourcemod-1.3.0
|
||||
3f33d01fcc28b509bed30f7be07ed215cc000538 sourcemod-1.3.1
|
||||
3c30a59c2296a13284a9f4eb42863b47db645adf sourcemod-1.2.1
|
||||
f55c735efeefe68863b96713fcd55a7774d8ceab sourcemod-1.2.2
|
||||
236a032c2a4da8f0af24b56b0539b1c574379be8 sourcemod-1.2.3
|
||||
|
||||
+14
-37
@@ -17,8 +17,6 @@ class SM:
|
||||
'name': 'ORANGEBOXVALVE'}
|
||||
self.sdkInfo['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '5',
|
||||
'name': 'LEFT4DEAD'}
|
||||
self.sdkInfo['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '6',
|
||||
'name': 'LEFT4DEAD2'}
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
||||
'name': 'DARKMESSIAH'}
|
||||
@@ -28,12 +26,11 @@ class SM:
|
||||
self.compiler.DetectAll(AMBuild)
|
||||
|
||||
#Detect variables
|
||||
envvars = { 'MMSOURCE18': 'mmsource-1.8',
|
||||
envvars = { 'MMSOURCE17': 'mmsource-1.7',
|
||||
'HL2SDK': 'hl2sdk',
|
||||
'HL2SDKOB': 'hl2sdk-ob',
|
||||
'HL2SDKL4D': 'hl2sdk-l4d',
|
||||
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
|
||||
'HL2SDKL4D2': 'hl2sdk-l4d2',
|
||||
'MYSQL5': 'mysql-5.0'
|
||||
}
|
||||
|
||||
@@ -49,14 +46,12 @@ class SM:
|
||||
raise Exception('Path for {0} was not found: {1}'.format(i, path))
|
||||
else:
|
||||
head = os.getcwd()
|
||||
oldhead = None
|
||||
while head != None and head != oldhead:
|
||||
while head != None and head != '/':
|
||||
path = os.path.join(head, envvars[i])
|
||||
if os.path.isdir(path):
|
||||
break
|
||||
oldhead = head
|
||||
head, tail = os.path.split(head)
|
||||
if head == None or head == oldhead:
|
||||
if head == None or head == '/':
|
||||
raise Exception('Could not find a valid path for {0}'.format(i))
|
||||
AMBuild.cache.CacheVariable(i, path)
|
||||
|
||||
@@ -159,9 +154,7 @@ class SM:
|
||||
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
|
||||
self.compiler.AddToListVar('RCINCLUDES',
|
||||
os.path.join(AMBuild.outputFolder, 'includes'))
|
||||
self.mmsPath = AMBuild.cache['MMSOURCE18']
|
||||
self.mmsPath = AMBuild.cache['MMSOURCE17']
|
||||
|
||||
def DefaultCompiler(self):
|
||||
return self.compiler.Clone()
|
||||
@@ -188,7 +181,7 @@ class SM:
|
||||
def AutoVersion(self, folder, binary):
|
||||
if AMBuild.target['platform'] != 'windows':
|
||||
return
|
||||
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
|
||||
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"']}
|
||||
binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
|
||||
|
||||
def PreSetupHL2Job(self, job, builder, sdk):
|
||||
@@ -200,22 +193,13 @@ class SM:
|
||||
else:
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
|
||||
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
|
||||
if sdk == 'ep2v' or sdk == 'l4d2':
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
else:
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
for lib in ['tier0', 'tier1', 'vstdlib', 'mathlib']:
|
||||
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
|
||||
@@ -244,10 +228,8 @@ class SM:
|
||||
['public', 'tier0'], ['public', 'tier1']]
|
||||
if sdk == 'ep1' or sdk == 'darkm':
|
||||
paths.append(['public', 'dlls'])
|
||||
paths.append(['game_shared'])
|
||||
else:
|
||||
paths.append(['public', 'game', 'server'])
|
||||
paths.append(['game', 'shared'])
|
||||
paths.append(['common'])
|
||||
|
||||
info = self.sdkInfo[sdk]
|
||||
@@ -268,12 +250,8 @@ class SM:
|
||||
if not noLink:
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['-lm']
|
||||
if sdk == 'ep2v' or sdk == 'l4d2':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
|
||||
else:
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
|
||||
|
||||
return compiler
|
||||
|
||||
@@ -287,7 +265,6 @@ AMBuild.Include(os.path.join('tools', 'buildbot', 'Versioning'), globals)
|
||||
FileList = [
|
||||
['loader', 'AMBuilder'],
|
||||
['core', 'AMBuilder'],
|
||||
['core', 'logic', 'AMBuilder'],
|
||||
['extensions', 'bintools', 'AMBuilder'],
|
||||
['extensions', 'clientprefs', 'AMBuilder'],
|
||||
['extensions', 'cstrike', 'AMBuilder'],
|
||||
|
||||
@@ -2,94 +2,6 @@ SourceMod Changelog
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.2 [2010-05-02]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.2_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Support for recent TF, DoD, and L4D2 updates (bug 4356, bug 4361, bug 4371, bug 4374, bug 4375).
|
||||
- Fixed rare crash when replicating cvars to clients (bug 4315).
|
||||
- Lots of extra game support for Insurgency, ZPS, CSProMod, PVKII, and FortressForever (thanks
|
||||
Nicholas "psychonic" hastings).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added TF functions for stunning, conditions, regeneration, and power play (bug 4166, bug 4331).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.1 [2010-02-09]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.1_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added extended support for CSProMod (bug 4255).
|
||||
- Fixed client disconnect crash on many third party games (bug 4231).
|
||||
- Improved support for Battlegrounds 2 (bug 4146).
|
||||
- Improved support for Insurgency (bug 4180).
|
||||
- Improved support for Garry's Mod (bug 4230, bug 4268).
|
||||
- Improved support for Synergy (bug 4235).
|
||||
- Updated Day of Defeat support for 20010123 update (bug 4262).
|
||||
- Fixed Webternet extension not loading on Windows 2000 (bug 4234).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Fixed compiler complaints when using |any| tag on array arguments (bug 4274).
|
||||
- Fixed GetClientCookieTime not being exported (bug 4237).
|
||||
- Fixed potential crash in entity handling code (bug 4249).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.0 [2010-01-15]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.0_Release_Notes
|
||||
|
||||
Major Features:
|
||||
* Left 4 Dead 2 support
|
||||
* Non-networked entity support
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added Left 4 Dead 2 support (bug 4075).
|
||||
- Added much richer voting progress feedback (bug 1997).
|
||||
- Improved support for various third-party games (Nicholas "psychonic" Hastings).
|
||||
- Added @spec target (bug 2718).
|
||||
- Added sm_resetcvar command (bug 3636).
|
||||
- Added "motd" chat trigger (bug 2694).
|
||||
- Updated GeoIP to OCT-2009.
|
||||
- Fixed rare map vote error (bug 3905).
|
||||
- Fixed small leak in the nominations plugin (bug 4104).
|
||||
- Fixed last client being excluded from some command effects (bug 3984).
|
||||
- Fixed crashes in plugin [|un|re]loading (bug 4034, bug 4038, bug 4044, bug 4153).
|
||||
- Special target "@me" is now filtered for certain statuses properly (bug 4000).
|
||||
- Improved non-admin to admin chat (bug 3844).
|
||||
- Removed "auto.*" extension folders (bug 3949).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added non-networked entity support (bug 2459).
|
||||
- Added improved random number generator (bug 3831).
|
||||
- Added GetClientCookieTime native (bug 3736).
|
||||
- Added AskPluginLoad2 callback (bug 3716).
|
||||
- Added PlayerRunCmd callback (bug 3289).
|
||||
- Added PointOutsideWorld native (bug 3906).
|
||||
- Added API for "blanket" command hooks (bug 4015).
|
||||
- Added ability to test for SourceMod features (bug 4021).
|
||||
- Added ability to change broadcast status on hooked events (bug 3886).
|
||||
- OnClientCommand no longer receives unconnected clients (bug 3732).
|
||||
- Fixed various bugs in client listening API (bug 3818).
|
||||
- Fixed crash in BanClient (bug 3912).
|
||||
- Fixed various crashes in self-removing callbacks (bug 4059).
|
||||
- Fixed rare HUD text crash on TF (bug 4016).
|
||||
- Fixed OnConfigsExecuted not running on EP1 games with large configs (bug 3828).
|
||||
- Fixed entity output hooks not working (bug 3988).
|
||||
- Gamedata folder matches are now case-insensitive (bug 3913).
|
||||
- Blocked plugins from hooking "sm" command (bug 4013).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.2.4 [2009-10-03]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.2.4_Release_Notes
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//This file unloads all plugins, re-loads a few "safe" ones, and then prevents
|
||||
//any more plugins from being loaded.
|
||||
sm plugins unload_all
|
||||
sm plugins load_unlock
|
||||
sm plugins load basebans.smx
|
||||
sm plugins load basecommands.smx
|
||||
sm plugins load admin-flatfile.smx
|
||||
|
||||
@@ -80,21 +80,21 @@ sm_reserve_type 0
|
||||
sm_reserved_slots 0
|
||||
|
||||
// Specifies whether or not reserved slots will be hidden (subtracted from max
|
||||
// slot count). Valid values are 0 (Visible) or 1 (Hidden).
|
||||
// slot count). Valid values are 0 (visible) or 1 (hidden).
|
||||
// --
|
||||
// Requires: reservedslots.smx
|
||||
// Default: 0
|
||||
sm_hide_slots 0
|
||||
|
||||
// Specifies whether or not non-admins can send messages to admins using
|
||||
// say_team @<message>. Valid values are 0 (Disabled) or 1 (Enabled)
|
||||
// say_team @<message>. Valid values are 0 (disabled) or 1 (enabled)
|
||||
// --
|
||||
// Requires: basechat.smx
|
||||
// Default: 1
|
||||
sm_chat_mode 1
|
||||
|
||||
// Specifies whether or not "timeleft" will automaticly be triggered every
|
||||
// x seconds. Valid values are 0 (Disabled) to 1800 seconds.
|
||||
// x seconds. Valid values are 0 (disabled) to 1800 seconds.
|
||||
// --
|
||||
// Requires: basetriggers.smx
|
||||
// Default: 0
|
||||
@@ -107,28 +107,3 @@ sm_timeleft_interval 0
|
||||
// Requires: basetriggers.smx
|
||||
// Default: 1
|
||||
sm_trigger_show 1
|
||||
|
||||
// Specifies whether or not to display vote progress to clients in the
|
||||
// "hint" box (near the bottom of the screen in most games).
|
||||
// Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_hintbox 0
|
||||
|
||||
// Specifies whether or not to display vote progress to clients in the
|
||||
// chat area. Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_chat 0
|
||||
|
||||
// Specifies whether or not to display vote progress in the server console.
|
||||
// Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_console 0
|
||||
|
||||
// Specifies whether or not to display vote progress to clients in the
|
||||
// client console. Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_client_console 0
|
||||
|
||||
+20
-2
@@ -6,6 +6,9 @@ for i in SM.sdkInfo:
|
||||
name = 'sourcemod.' + sdk['ext']
|
||||
|
||||
compiler = SM.DefaultHL2Compiler('core', i)
|
||||
compiler['CDEFINES'].append('SM_DEFAULT_THREADER')
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
compiler['POSTLINKFLAGS'].append('-lpthread')
|
||||
|
||||
extension = AMBuild.AddJob(name)
|
||||
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
|
||||
@@ -15,8 +18,8 @@ for i in SM.sdkInfo:
|
||||
'ExtensionSys.cpp',
|
||||
'MenuStyle_Valve.cpp',
|
||||
'sm_crc32.cpp',
|
||||
'logic_bridge.cpp',
|
||||
'smn_entities.cpp',
|
||||
'smn_maplists.cpp',
|
||||
'sm_stringutil.cpp',
|
||||
'ADTFactory.cpp',
|
||||
'ForwardSys.cpp',
|
||||
@@ -35,16 +38,24 @@ for i in SM.sdkInfo:
|
||||
'ChatTriggers.cpp',
|
||||
'GameConfigs.cpp',
|
||||
'NativeOwner.cpp',
|
||||
'smn_adt_array.cpp',
|
||||
'smn_filesystem.cpp',
|
||||
'smn_player.cpp',
|
||||
'sourcemod.cpp',
|
||||
'concmd_cleaner.cpp',
|
||||
'HalfLife2.cpp',
|
||||
'NextMap.cpp',
|
||||
'smn_adt_stack.cpp',
|
||||
'smn_float.cpp',
|
||||
'smn_profiler.cpp',
|
||||
'TextParsers.cpp',
|
||||
'ConCmdManager.cpp',
|
||||
'HandleSys.cpp',
|
||||
'PhraseCollection.cpp',
|
||||
'smn_adt_trie.cpp',
|
||||
'smn_functions.cpp',
|
||||
'smn_sorting.cpp',
|
||||
'ThreadSupport.cpp',
|
||||
'ConVarManager.cpp',
|
||||
'LibrarySys.cpp',
|
||||
'PlayerManager.cpp',
|
||||
@@ -57,6 +68,7 @@ for i in SM.sdkInfo:
|
||||
'PluginInfoDatabase.cpp',
|
||||
'smn_bitbuffer.cpp',
|
||||
'smn_halflife.cpp',
|
||||
'smn_textparse.cpp',
|
||||
'Translator.cpp',
|
||||
'MemoryUtils.cpp',
|
||||
'PluginSys.cpp',
|
||||
@@ -66,6 +78,7 @@ for i in SM.sdkInfo:
|
||||
'UserMessages.cpp',
|
||||
'Database.cpp',
|
||||
'MenuManager.cpp',
|
||||
'Profiler.cpp',
|
||||
'smn_core.cpp',
|
||||
'smn_hudtext.cpp',
|
||||
'smn_usermsgs.cpp',
|
||||
@@ -81,8 +94,13 @@ for i in SM.sdkInfo:
|
||||
'smn_datapacks.cpp',
|
||||
'smn_lang.cpp',
|
||||
'sm_srvcmds.cpp',
|
||||
'ConsoleDetours.cpp'
|
||||
'thread/ThreadWorker.cpp',
|
||||
'thread/BaseWorker.cpp'
|
||||
]
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
files.append('thread/WinThreads.cpp')
|
||||
else:
|
||||
files.append('thread/PosixThreads.cpp')
|
||||
binary.AddSourceFiles('core', files)
|
||||
SM.PostSetupHL2Job(extension, binary, i)
|
||||
SM.AutoVersion('core', binary)
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_CELLARRAY_H_
|
||||
#define _INCLUDE_SOURCEMOD_CELLARRAY_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -207,6 +204,3 @@ private:
|
||||
size_t m_AllocSize;
|
||||
size_t m_Size;
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_CELLARRAY_H_ */
|
||||
|
||||
@@ -159,4 +159,3 @@ private:
|
||||
extern ConCmdManager g_ConCmds;
|
||||
|
||||
#endif // _INCLUDE_SOURCEMOD_CONCMDMANAGER_H_
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
#ifndef _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
#define _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
|
||||
class ConCommandBaseIterator
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
ICvarIteratorInternal *cvarIter;
|
||||
#else
|
||||
ConCommandBase *cvarIter;
|
||||
#endif
|
||||
|
||||
public:
|
||||
ConCommandBaseIterator()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
cvarIter = icvar->FactoryInternalIterator();
|
||||
cvarIter->SetFirst();
|
||||
#else
|
||||
cvarIter = icvar->GetCommands();
|
||||
#endif
|
||||
}
|
||||
|
||||
~ConCommandBaseIterator()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
g_pMemAlloc->Free(cvarIter);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool IsValid()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
return cvarIter->IsValid();
|
||||
#else
|
||||
return cvarIter != NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void Next()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
cvarIter->Next();
|
||||
#else
|
||||
cvarIter = const_cast<ConCommandBase*>(cvarIter->GetNext());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline ConCommandBase *Get()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
return cvarIter->Get();
|
||||
#else
|
||||
return cvarIter;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ */
|
||||
|
||||
+7
-57
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,6 +25,8 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "ConVarManager.h"
|
||||
@@ -58,40 +60,6 @@ const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String}
|
||||
typedef List<const ConVar *> ConVarList;
|
||||
KTrie<ConVarInfo *> convar_cache;
|
||||
|
||||
class ConVarReentrancyGuard
|
||||
{
|
||||
ConVar *cvar;
|
||||
ConVarReentrancyGuard *up;
|
||||
public:
|
||||
static ConVarReentrancyGuard *chain;
|
||||
|
||||
ConVarReentrancyGuard(ConVar *cvar)
|
||||
: cvar(cvar), up(chain)
|
||||
{
|
||||
chain = this;
|
||||
}
|
||||
|
||||
~ConVarReentrancyGuard()
|
||||
{
|
||||
assert(chain == this);
|
||||
chain = up;
|
||||
}
|
||||
|
||||
static bool IsCvarInChain(ConVar *cvar)
|
||||
{
|
||||
ConVarReentrancyGuard *guard = chain;
|
||||
while (guard != NULL)
|
||||
{
|
||||
if (guard->cvar == cvar)
|
||||
return true;
|
||||
guard = guard->up;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
ConVarReentrancyGuard *ConVarReentrancyGuard::chain = NULL;
|
||||
|
||||
ConVarManager::ConVarManager() : m_ConVarType(0), m_bIsDLLQueryHooked(false), m_bIsVSPQueryHooked(false)
|
||||
{
|
||||
}
|
||||
@@ -128,8 +96,6 @@ void ConVarManager::OnSourceModAllInitialized()
|
||||
|
||||
SH_ADD_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
|
||||
|
||||
g_PluginSys.AddPluginsListener(this);
|
||||
|
||||
/* Add the 'convars' option to the 'sm' console command */
|
||||
g_RootMenu.AddRootConsoleCommand("cvars", "View convars created by a plugin", this);
|
||||
}
|
||||
@@ -196,8 +162,6 @@ void ConVarManager::OnSourceModShutdown()
|
||||
/* Remove the 'convars' option from the 'sm' console command */
|
||||
g_RootMenu.RemoveRootConsoleCommand("cvars", this);
|
||||
|
||||
g_PluginSys.RemovePluginsListener(this);
|
||||
|
||||
/* Remove the 'ConVar' handle type */
|
||||
g_HandleSys.RemoveType(m_ConVarType, g_pCoreIdent);
|
||||
}
|
||||
@@ -216,7 +180,7 @@ void ConVarManager::OnSourceModVSPReceived()
|
||||
}
|
||||
|
||||
/* For later MM:S versions, use the updated API, since it's cleaner. */
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
int engine = g_SMAPI->GetSourceEngineBuild();
|
||||
if (engine == SOURCE_ENGINE_ORIGINAL || vsp_version < 2)
|
||||
{
|
||||
@@ -288,23 +252,12 @@ void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
|
||||
void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
|
||||
{
|
||||
ConVarList *pConVarList;
|
||||
List<ConVarQuery>::iterator iter;
|
||||
|
||||
/* If plugin has a convar list, free its memory */
|
||||
if (plugin->GetProperty("ConVarList", (void **)&pConVarList, true))
|
||||
{
|
||||
delete pConVarList;
|
||||
}
|
||||
|
||||
/* Remove convar queries for this plugin that haven't returned results yet */
|
||||
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
|
||||
{
|
||||
ConVarQuery &query = (*iter);
|
||||
if (query.pCallback->GetParentRuntime() == plugin->GetRuntime())
|
||||
{
|
||||
m_ConVarQueries.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConVarManager::OnHandleDestroy(HandleType_t type, void *object)
|
||||
@@ -362,7 +315,7 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
|
||||
}
|
||||
|
||||
/* Display usage of subcommand */
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm cvars <plugin #>");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm convars <plugin #>");
|
||||
}
|
||||
|
||||
Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *description, int flags, bool hasMin, float min, bool hasMax, float max)
|
||||
@@ -570,8 +523,7 @@ void ConVarManager::UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFuncti
|
||||
}
|
||||
|
||||
/* If the forward now has 0 functions in it... */
|
||||
if (pForward->GetFunctionCount() == 0 &&
|
||||
!ConVarReentrancyGuard::IsCvarInChain(pConVar))
|
||||
if (pForward->GetFunctionCount() == 0)
|
||||
{
|
||||
/* Free this forward */
|
||||
g_Forwards.ReleaseForward(pForward);
|
||||
@@ -682,8 +634,6 @@ void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
||||
|
||||
if (pForward != NULL)
|
||||
{
|
||||
ConVarReentrancyGuard guard(pConVar);
|
||||
|
||||
/* Now call forwards in plugins that have hooked this */
|
||||
pForward->PushCell(pInfo->handle);
|
||||
pForward->PushString(oldValue);
|
||||
|
||||
@@ -1,742 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* On SourceHook v4.3 or lower, there are no DVP hooks. Very sad, right?
|
||||
* Only do this on newer versions. For the older code, we'll do an incredibly
|
||||
* hacky detour.
|
||||
*
|
||||
* The idea of the "non-hacky" (yeah... no) code is that every unique
|
||||
* ConCommand vtable gets its own DVP hook. We watch for unloading and
|
||||
* loading commands to remove stale hooks from SH.
|
||||
*/
|
||||
|
||||
#include "sourcemod.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "Logger.h"
|
||||
#include "compat_wrappers.h"
|
||||
#include "ConsoleDetours.h"
|
||||
#include "GameConfigs.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "ConCmdManager.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "ConCommandBaseIterator.h"
|
||||
#include "ShareSys.h"
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
# include <dlfcn.h>
|
||||
# include <sys/mman.h>
|
||||
# include <stdint.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if SH_IMPL_VERSION >= 5
|
||||
# if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||
# else
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
# endif
|
||||
#else
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHVPAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>,bool);
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||
# endif
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
|
||||
#if SH_IMPL_VERSION >= 4
|
||||
|
||||
class GenericCommandHooker : public IConCommandLinkListener
|
||||
{
|
||||
struct HackInfo
|
||||
{
|
||||
void **vtable;
|
||||
int hook;
|
||||
unsigned int refcount;
|
||||
};
|
||||
CVector<HackInfo> vtables;
|
||||
bool enabled;
|
||||
SourceHook::MemFuncInfo dispatch;
|
||||
|
||||
inline void **GetVirtualTable(ConCommandBase *pBase)
|
||||
{
|
||||
return *reinterpret_cast<void***>(reinterpret_cast<char*>(pBase) +
|
||||
dispatch.thisptroffs +
|
||||
dispatch.vtbloffs);
|
||||
}
|
||||
|
||||
inline bool FindVtable(void **ptr, size_t& index)
|
||||
{
|
||||
for (size_t i = 0; i < vtables.size(); i++)
|
||||
{
|
||||
if (vtables[i].vtable == ptr)
|
||||
{
|
||||
index = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MakeHookable(ConCommandBase *pBase)
|
||||
{
|
||||
if (!pBase->IsCommand())
|
||||
return;
|
||||
|
||||
ConCommand *cmd = (ConCommand*)pBase;
|
||||
void **vtable = GetVirtualTable(cmd);
|
||||
|
||||
size_t index;
|
||||
if (!FindVtable(vtable, index))
|
||||
{
|
||||
HackInfo hack;
|
||||
hack.vtable = vtable;
|
||||
hack.hook = SH_ADD_VPHOOK(ConCommand, Dispatch, cmd, SH_MEMBER(this, &GenericCommandHooker::Dispatch), false);
|
||||
hack.refcount = 1;
|
||||
vtables.push_back(hack);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtables[index].refcount++;
|
||||
}
|
||||
}
|
||||
|
||||
# if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void Dispatch(const CCommand& args)
|
||||
# else
|
||||
void Dispatch()
|
||||
# endif
|
||||
{
|
||||
cell_t res = ConsoleDetours::Dispatch(META_IFACEPTR(ConCommand)
|
||||
# if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
, args
|
||||
# endif
|
||||
);
|
||||
if (res >= Pl_Handled)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
|
||||
void ReparseCommandList()
|
||||
{
|
||||
for (size_t i = 0; i < vtables.size(); i++)
|
||||
vtables[i].refcount = 0;
|
||||
for (ConCommandBaseIterator iter; iter.IsValid(); iter.Next())
|
||||
MakeHookable(iter.Get());
|
||||
CVector<HackInfo>::iterator iter = vtables.begin();
|
||||
while (iter != vtables.end())
|
||||
{
|
||||
if ((*iter).refcount)
|
||||
{
|
||||
iter++;
|
||||
continue;
|
||||
}
|
||||
/* Damn it. This event happens AFTER the plugin has unloaded!
|
||||
* There's two options. Remove the hook now and hope SH's memory
|
||||
* protection will prevent a crash. Otherwise, we can wait until
|
||||
* the server shuts down and more likely crash then.
|
||||
*
|
||||
* This situation only arises if:
|
||||
* 1) Someone has used AddCommandFilter()
|
||||
* 2) ... on a Dark Messiah server (mm:s new api)
|
||||
* 3) ... and another MM:S plugin that uses ConCommands has unloaded.
|
||||
*
|
||||
* Even though the impact is really small, we'll wait until the
|
||||
* server shuts down, so normal operation isn't interrupted.
|
||||
*
|
||||
* See bug 4018.
|
||||
*/
|
||||
iter = vtables.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void UnhookCommand(ConCommandBase *pBase)
|
||||
{
|
||||
if (!pBase->IsCommand())
|
||||
return;
|
||||
|
||||
ConCommand *cmd = (ConCommand*)pBase;
|
||||
void **vtable = GetVirtualTable(cmd);
|
||||
|
||||
size_t index;
|
||||
if (!FindVtable(vtable, index))
|
||||
{
|
||||
g_Logger.LogError("Console detour tried to unhook command \"%s\" but it wasn't found", pBase->GetName());
|
||||
return;
|
||||
}
|
||||
|
||||
assert(vtables[index].refcount > 0);
|
||||
vtables[index].refcount--;
|
||||
if (vtables[index].refcount == 0)
|
||||
{
|
||||
SH_REMOVE_HOOK_ID(vtables[index].hook);
|
||||
vtables.erase(vtables.iterAt(index));
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
GenericCommandHooker() : enabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool Enable()
|
||||
{
|
||||
SourceHook::GetFuncInfo(&ConCommand::Dispatch, dispatch);
|
||||
|
||||
if (dispatch.thisptroffs < 0)
|
||||
{
|
||||
g_Logger.LogError("Command filter could not determine ConCommand layout");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ConCommandBaseIterator iter; iter.IsValid(); iter.Next())
|
||||
MakeHookable(iter.Get());
|
||||
|
||||
if (!vtables.size())
|
||||
{
|
||||
g_Logger.LogError("Command filter could not find any cvars!");
|
||||
return false;
|
||||
}
|
||||
|
||||
enabled = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Disable()
|
||||
{
|
||||
for (size_t i = 0; i < vtables.size(); i++)
|
||||
SH_REMOVE_HOOK_ID(vtables[i].hook);
|
||||
vtables.clear();
|
||||
}
|
||||
|
||||
virtual void OnLinkConCommand(ConCommandBase *pBase)
|
||||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
MakeHookable(pBase);
|
||||
}
|
||||
|
||||
virtual void OnUnlinkConCommand(ConCommandBase *pBase)
|
||||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
if (pBase == NULL)
|
||||
ReparseCommandList();
|
||||
else
|
||||
UnhookCommand(pBase);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* END DVP HOOK VERSION
|
||||
*/
|
||||
|
||||
#else /* SH_IMPL_VERSION >= 4 */
|
||||
|
||||
/**
|
||||
* BEGIN ENGINE DETOUR VERSION
|
||||
*/
|
||||
|
||||
# include <jit/jit_helpers.h>
|
||||
# include <jit/x86/x86_macros.h>
|
||||
|
||||
class GenericCommandHooker
|
||||
{
|
||||
struct Patch
|
||||
{
|
||||
Patch() : applied(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool applied;
|
||||
void *base;
|
||||
unsigned char search[16];
|
||||
size_t search_len;
|
||||
size_t offset;
|
||||
size_t saveat;
|
||||
int regparam;
|
||||
void *detour;
|
||||
};
|
||||
|
||||
Patch ces;
|
||||
Patch cgc;
|
||||
|
||||
public:
|
||||
static void DelayedActivation(void *inparam)
|
||||
{
|
||||
GenericCommandHooker *cdtrs = reinterpret_cast<GenericCommandHooker*>(inparam);
|
||||
/* Safe to re-enter because the frame queue is lock+swapped. */
|
||||
if ((!cdtrs->ces.applied || !cdtrs->cgc.applied) &&
|
||||
g_HL2.PeekCommandStack() != NULL)
|
||||
{
|
||||
g_SourceMod.AddFrameAction(GenericCommandHooker::DelayedActivation, cdtrs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cdtrs->ces.applied)
|
||||
cdtrs->ApplyPatch(&cdtrs->ces);
|
||||
if (!cdtrs->cgc.applied)
|
||||
cdtrs->ApplyPatch(&cdtrs->cgc);
|
||||
}
|
||||
|
||||
bool Enable()
|
||||
{
|
||||
const char *platform = NULL;
|
||||
# if defined(PLATFORM_WINDOWS)
|
||||
platform = "Windows";
|
||||
# else
|
||||
void *addrInBase = (void *)g_SMAPI->GetEngineFactory(false);
|
||||
Dl_info info;
|
||||
if (!dladdr(addrInBase, &info))
|
||||
{
|
||||
g_Logger.LogError("Command filter could not find engine name");
|
||||
return false;
|
||||
}
|
||||
if (strstr(info.dli_fname, "engine_i486"))
|
||||
{
|
||||
platform = "Linux_486";
|
||||
}
|
||||
else if (strstr(info.dli_fname, "engine_i686"))
|
||||
{
|
||||
platform = "Linux_686";
|
||||
}
|
||||
else if (strstr(info.dli_fname, "engine_amd"))
|
||||
{
|
||||
platform = "Linux_AMD";
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Logger.LogError("Command filter could not determine engine (%s)", info.dli_fname);
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
|
||||
if (!PrepPatch("Cmd_ExecuteString", "CES", platform, &ces))
|
||||
return false;
|
||||
if (!PrepPatch("CGameClient::ExecuteString", "CGC", platform, &cgc))
|
||||
return false;
|
||||
|
||||
if (g_HL2.PeekCommandStack() != NULL)
|
||||
{
|
||||
g_SourceMod.AddFrameAction(GenericCommandHooker::DelayedActivation, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
ApplyPatch(&ces);
|
||||
ApplyPatch(&cgc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Disable()
|
||||
{
|
||||
UndoPatch(&ces);
|
||||
UndoPatch(&cgc);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
# if !defined PLATFORM_WINDOWS
|
||||
# define PAGE_READWRITE PROT_READ|PROT_WRITE
|
||||
# define PAGE_EXECUTE_READ PROT_READ|PROT_EXEC
|
||||
|
||||
static inline uintptr_t AddrToPage(uintptr_t address)
|
||||
{
|
||||
return (address & ~(uintptr_t(sysconf(_SC_PAGE_SIZE) - 1)));
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
void Protect(void *addr, size_t length, int prot)
|
||||
{
|
||||
# if defined PLATFORM_WINDOWS
|
||||
DWORD ignore;
|
||||
VirtualProtect(addr, length, prot, &ignore);
|
||||
# else
|
||||
uintptr_t startPage = AddrToPage(uintptr_t(addr));
|
||||
length += (uintptr_t(addr) - startPage);
|
||||
mprotect((void*)startPage, length, prot);
|
||||
# endif
|
||||
}
|
||||
|
||||
void UndoPatch(Patch *patch)
|
||||
{
|
||||
if (!patch->applied || patch->detour == NULL)
|
||||
return;
|
||||
|
||||
g_pSourcePawn->FreePageMemory(patch->detour);
|
||||
|
||||
unsigned char *source = (unsigned char *)patch->base + patch->offset;
|
||||
Protect(source, patch->search_len, PAGE_READWRITE);
|
||||
for (size_t i = 0; i < patch->search_len; i++)
|
||||
source[i] = patch->search[i];
|
||||
Protect(source, patch->search_len, PAGE_EXECUTE_READ);
|
||||
}
|
||||
|
||||
void ApplyPatch(Patch *patch)
|
||||
{
|
||||
assert(!patch->applied);
|
||||
|
||||
size_t length = 0;
|
||||
void *callback = (void*)&ConsoleDetours::Dispatch;
|
||||
|
||||
/* Bogus assignment to make compiler is doing the right thing. */
|
||||
patch->detour = callback;
|
||||
|
||||
/* Assemgle the detour. */
|
||||
JitWriter writer;
|
||||
writer.outbase = NULL;
|
||||
writer.outptr = NULL;
|
||||
do
|
||||
{
|
||||
/* Need a specific register, or value on stack? */
|
||||
if (patch->regparam != -1)
|
||||
IA32_Push_Reg(&writer, patch->regparam);
|
||||
/* Call real function. */
|
||||
IA32_Write_Jump32_Abs(&writer, IA32_Call_Imm32(&writer, 0), callback);
|
||||
/* Restore stack. */
|
||||
if (patch->regparam != -1)
|
||||
IA32_Pop_Reg(&writer, patch->regparam);
|
||||
/* Copy any saved bytes */
|
||||
if (patch->saveat)
|
||||
{
|
||||
for (size_t i = patch->saveat; i < patch->search_len; i++)
|
||||
{
|
||||
writer.write_ubyte(patch->search[i]);
|
||||
}
|
||||
}
|
||||
/* Jump back to the caller. */
|
||||
unsigned char *target = (unsigned char *)patch->base + patch->offset + patch->search_len;
|
||||
IA32_Jump_Imm32_Abs(&writer, target);
|
||||
/* Assemble, if we can. */
|
||||
if (writer.outbase == NULL)
|
||||
{
|
||||
length = writer.outptr - writer.outbase;
|
||||
patch->detour = g_pSourcePawn->AllocatePageMemory(length);
|
||||
if (patch->detour == NULL)
|
||||
{
|
||||
g_Logger.LogError("Ran out of memory!");
|
||||
return;
|
||||
}
|
||||
g_pSourcePawn->SetReadWrite(patch->detour);
|
||||
writer.outbase = (jitcode_t)patch->detour;
|
||||
writer.outptr = writer.outbase;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
g_pSourcePawn->SetReadExecute(patch->detour);
|
||||
|
||||
unsigned char *source = (unsigned char *)patch->base + patch->offset;
|
||||
Protect(source, 6, PAGE_READWRITE);
|
||||
source[0] = 0xFF;
|
||||
source[1] = 0x25;
|
||||
*(void **)&source[2] = &patch->detour;
|
||||
Protect(source, 6, PAGE_EXECUTE_READ);
|
||||
|
||||
patch->applied = true;
|
||||
}
|
||||
|
||||
bool PrepPatch(const char *signature, const char *name, const char *platform, Patch *patch)
|
||||
{
|
||||
/* Get the base address of the function. */
|
||||
if (!g_pGameConf->GetMemSig(signature, &patch->base) || patch->base == NULL)
|
||||
{
|
||||
g_Logger.LogError("Command filter could not find signature: %s", signature);
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *value;
|
||||
char keyname[255];
|
||||
|
||||
/* Get the verification bytes that will be written over. */
|
||||
UTIL_Format(keyname, sizeof(keyname), "%s_Patch_%s", name, platform);
|
||||
if ((value = g_pGameConf->GetKeyValue(keyname)) == NULL)
|
||||
{
|
||||
g_Logger.LogError("Command filter could not find key: %s", keyname);
|
||||
return false;
|
||||
}
|
||||
patch->search_len = UTIL_DecodeHexString(patch->search, sizeof(patch->search), value);
|
||||
if (patch->search_len < 6)
|
||||
{
|
||||
g_Logger.LogError("Error decoding %s value, or not long enough", keyname);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get the offset into the function. */
|
||||
UTIL_Format(keyname, sizeof(keyname), "%s_Offset_%s", name, platform);
|
||||
if ((value = g_pGameConf->GetKeyValue(keyname)) == NULL)
|
||||
{
|
||||
g_Logger.LogError("Command filter could not find key: %s", keyname);
|
||||
return false;
|
||||
}
|
||||
patch->offset = atoi(value);
|
||||
if (patch->offset > 20000)
|
||||
{
|
||||
g_Logger.LogError("Command filter %s value is bogus", keyname);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get the number of bytes to save from what was written over. */
|
||||
patch->saveat = 0;
|
||||
UTIL_Format(keyname, sizeof(keyname), "%s_Save_%s", name, platform);
|
||||
if ((value = g_pGameConf->GetKeyValue(keyname)) != NULL)
|
||||
{
|
||||
patch->saveat = atoi(value);
|
||||
if (patch->saveat >= patch->search_len)
|
||||
{
|
||||
g_Logger.LogError("Command filter %s value is too large", keyname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get register for parameter, if any. */
|
||||
patch->regparam = -1;
|
||||
UTIL_Format(keyname, sizeof(keyname), "%s_Reg_%s", name, platform);
|
||||
if ((value = g_pGameConf->GetKeyValue(keyname)) != NULL)
|
||||
{
|
||||
patch->regparam = atoi(value);
|
||||
}
|
||||
|
||||
/* Everything loaded from gamedata, make sure the patch will succeed. */
|
||||
unsigned char *address = (unsigned char *)patch->base + patch->offset;
|
||||
for (size_t i = 0; i < patch->search_len; i++)
|
||||
{
|
||||
if (address[i] != patch->search[i])
|
||||
{
|
||||
g_Logger.LogError("Command filter %s has changed (byte %x is not %x sub-offset %d)",
|
||||
name, address[i], patch->search[i], i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
static bool dummy_hook_set = false;
|
||||
void DummyHook()
|
||||
{
|
||||
if (dummy_hook_set)
|
||||
{
|
||||
dummy_hook_set = false;
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* BEGIN THE ACTUALLY GENERIC CODE.
|
||||
*/
|
||||
|
||||
#define FEATURECAP_COMMANDLISTENER "command listener"
|
||||
|
||||
static GenericCommandHooker s_GenericHooker;
|
||||
ConsoleDetours g_ConsoleDetours;
|
||||
|
||||
ConsoleDetours::ConsoleDetours() : status(FeatureStatus_Unknown)
|
||||
{
|
||||
}
|
||||
|
||||
void ConsoleDetours::OnSourceModAllInitialized()
|
||||
{
|
||||
m_pForward = g_Forwards.CreateForwardEx("OnAnyCommand", ET_Hook, 3, NULL, Param_Cell,
|
||||
Param_String, Param_Cell);
|
||||
g_ShareSys.AddCapabilityProvider(NULL, this, FEATURECAP_COMMANDLISTENER);
|
||||
}
|
||||
|
||||
void ConsoleDetours::OnSourceModShutdown()
|
||||
{
|
||||
List<Listener*>::iterator iter = m_Listeners.begin();
|
||||
while (iter != m_Listeners.end())
|
||||
{
|
||||
Listener *listener = (*iter);
|
||||
g_Forwards.ReleaseForward(listener->forward);
|
||||
delete listener;
|
||||
iter = m_Listeners.erase(iter);
|
||||
}
|
||||
|
||||
g_Forwards.ReleaseForward(m_pForward);
|
||||
s_GenericHooker.Disable();
|
||||
}
|
||||
|
||||
FeatureStatus ConsoleDetours::GetFeatureStatus(FeatureType type, const char *name)
|
||||
{
|
||||
return GetStatus();
|
||||
}
|
||||
|
||||
FeatureStatus ConsoleDetours::GetStatus()
|
||||
{
|
||||
if (status == FeatureStatus_Unknown)
|
||||
{
|
||||
status = s_GenericHooker.Enable() ? FeatureStatus_Available : FeatureStatus_Unavailable;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
bool ConsoleDetours::AddListener(IPluginFunction *fun, const char *command)
|
||||
{
|
||||
if (GetStatus() != FeatureStatus_Available)
|
||||
return false;
|
||||
|
||||
if (command == NULL)
|
||||
{
|
||||
m_pForward->AddFunction(fun);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *str = UTIL_ToLowerCase(command);
|
||||
Listener *listener;
|
||||
Listener **plistener = m_CmdLookup.retrieve(str);
|
||||
if (plistener == NULL)
|
||||
{
|
||||
listener = new Listener;
|
||||
listener->forward = g_Forwards.CreateForwardEx(NULL, ET_Hook, 3, NULL, Param_Cell,
|
||||
Param_String, Param_Cell);
|
||||
m_CmdLookup.insert(str, listener);
|
||||
}
|
||||
else
|
||||
{
|
||||
listener = *plistener;
|
||||
}
|
||||
listener->forward->AddFunction(fun);
|
||||
delete [] str;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConsoleDetours::RemoveListener(IPluginFunction *fun, const char *command)
|
||||
{
|
||||
if (command == NULL)
|
||||
{
|
||||
return m_pForward->RemoveFunction(fun);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *str = UTIL_ToLowerCase(command);
|
||||
Listener *listener;
|
||||
Listener **plistener = m_CmdLookup.retrieve(str);
|
||||
delete [] str;
|
||||
if (plistener == NULL)
|
||||
return false;
|
||||
listener = *plistener;
|
||||
return listener->forward->RemoveFunction(fun);
|
||||
}
|
||||
}
|
||||
|
||||
cell_t ConsoleDetours::InternalDispatch(int client, const CCommand& args)
|
||||
{
|
||||
char name[255];
|
||||
const char *realname = args.Arg(0);
|
||||
size_t len = strlen(realname);
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
if (realname[i] >= 'A' && realname[i] <= 'Z')
|
||||
name[i] = tolower(realname[i]);
|
||||
else
|
||||
name[i] = realname[i];
|
||||
}
|
||||
name[len] = '\0';
|
||||
|
||||
cell_t result = Pl_Continue;
|
||||
m_pForward->PushCell(client);
|
||||
m_pForward->PushString(name);
|
||||
m_pForward->PushCell(args.ArgC() - 1);
|
||||
m_pForward->Execute(&result, NULL);
|
||||
|
||||
/* Don't let plugins block this. */
|
||||
if (strcmp(name, "sm") == 0)
|
||||
result = Pl_Continue;
|
||||
|
||||
if (result >= Pl_Stop)
|
||||
return result;
|
||||
|
||||
Listener **plistener = m_CmdLookup.retrieve(name);
|
||||
if (plistener == NULL)
|
||||
return result;
|
||||
Listener *listener = *plistener;
|
||||
if (listener->forward->GetFunctionCount() == 0)
|
||||
return result;
|
||||
|
||||
cell_t result2 = Pl_Continue;
|
||||
listener->forward->PushCell(client);
|
||||
listener->forward->PushString(name);
|
||||
listener->forward->PushCell(args.ArgC() - 1);
|
||||
listener->forward->Execute(&result2, NULL);
|
||||
|
||||
if (result2 > result)
|
||||
result = result2;
|
||||
|
||||
/* "sm" should not have flown through the above. */
|
||||
assert(strcmp(name, "sm") != 0 || result == Pl_Continue);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
cell_t ConsoleDetours::Dispatch(ConCommand *pBase, const CCommand& args)
|
||||
{
|
||||
#else
|
||||
cell_t ConsoleDetours::Dispatch(ConCommand *pBase)
|
||||
{
|
||||
CCommand args;
|
||||
#endif
|
||||
g_HL2.PushCommandStack(&args);
|
||||
cell_t res = g_ConsoleDetours.InternalDispatch(g_ConCmds.GetCommandClient(), args);
|
||||
g_HL2.PopCommandStack();
|
||||
|
||||
#if SH_IMPL_VERSION < 4
|
||||
if (res >= Pl_Handled)
|
||||
{
|
||||
/* See bug 4020 - we can't optimize this because looking at the vtable
|
||||
* is probably more expensive, since there's no SH_GET_ORIG_VFNPTR_ENTRY.
|
||||
*/
|
||||
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pBase, DummyHook, false);
|
||||
dummy_hook_set = true;
|
||||
pBase->Dispatch();
|
||||
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, pBase, DummyHook, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure the command gets invoked. See bug 4019 on making this better. */
|
||||
pBase->Dispatch();
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
#ifndef _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_
|
||||
#define _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "ForwardSys.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
|
||||
class ConsoleDetours :
|
||||
public SMGlobalClass,
|
||||
public IFeatureProvider
|
||||
{
|
||||
friend class PlayerManager;
|
||||
friend class GenericCommandHooker;
|
||||
|
||||
struct Listener
|
||||
{
|
||||
IChangeableForward *forward;
|
||||
};
|
||||
public:
|
||||
ConsoleDetours();
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
void OnSourceModShutdown();
|
||||
public: //IFeatureProvider
|
||||
FeatureStatus GetFeatureStatus(FeatureType type, const char *name);
|
||||
public:
|
||||
bool AddListener(IPluginFunction *fun, const char *command);
|
||||
bool RemoveListener(IPluginFunction *fun, const char *command);
|
||||
private:
|
||||
cell_t InternalDispatch(int client, const CCommand& args);
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
static cell_t Dispatch(ConCommand *pBase, const CCommand& args);
|
||||
#else
|
||||
static cell_t Dispatch(ConCommand *pBase);
|
||||
#endif
|
||||
public:
|
||||
FeatureStatus GetStatus();
|
||||
bool IsEnabled()
|
||||
{
|
||||
return status == FeatureStatus_Available;
|
||||
}
|
||||
private:
|
||||
FeatureStatus status;
|
||||
IChangeableForward *m_pForward;
|
||||
KTrie<Listener*> m_CmdLookup;
|
||||
List<Listener*> m_Listeners;
|
||||
};
|
||||
|
||||
extern ConsoleDetours g_ConsoleDetours;
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_ */
|
||||
|
||||
+10
-24
@@ -68,11 +68,7 @@ void Hook_ExecDispatchPre(const CCommand &cmd)
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
void Hook_ExecDispatchPre()
|
||||
#else
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# endif
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
void Hook_ExecDispatchPre()
|
||||
#endif
|
||||
@@ -107,7 +103,11 @@ void CheckAndFinalizeConfigs()
|
||||
{
|
||||
if ((g_bServerExecd || g_ServerCfgFile == NULL) && g_bGotServerStart)
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
g_PendingInternalPush = true;
|
||||
#else
|
||||
SM_InternalCmdTrigger();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,28 +214,14 @@ void CoreConfig::Initialize()
|
||||
/* Try to get command line value of core config convar */
|
||||
const char *corecfg = icvar->GetCommandLineValue("sm_corecfgfile");
|
||||
|
||||
/* If sm_corecfgfile is on the command line, use that
|
||||
* If sm_corecfgfile isn't there, check sm_basepath on the command line and build the path off that
|
||||
* If sm_basepath isn't there, just use the default path for the cfg
|
||||
*/
|
||||
if (corecfg)
|
||||
/* If sm_corecfgfile not specified on command line, use default value */
|
||||
if (!corecfg)
|
||||
{
|
||||
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
|
||||
corecfg = sm_corecfgfile.GetDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *basepath = icvar->GetCommandLineValue("sm_basepath");
|
||||
|
||||
/* Format path to config file */
|
||||
if (basepath)
|
||||
{
|
||||
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s/%s", g_SourceMod.GetGamePath(), basepath, "configs/core.cfg");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), sm_corecfgfile.GetDefault());
|
||||
}
|
||||
}
|
||||
/* Format path to config file */
|
||||
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
|
||||
|
||||
/* Reset cached key values */
|
||||
m_KeyValues.clear();
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
#include "Logger.h"
|
||||
#include "ExtensionSys.h"
|
||||
#include <stdlib.h>
|
||||
#include <IThreader.h>
|
||||
#include "ThreadSupport.h"
|
||||
|
||||
#define DBPARSE_LEVEL_NONE 0
|
||||
#define DBPARSE_LEVEL_MAIN 1
|
||||
|
||||
+2
-28
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
@@ -42,20 +42,6 @@ SH_DECL_HOOK2(IGameEventManager2, FireEvent, SH_NOATTRIB, 0, bool, IGameEvent *,
|
||||
const ParamType GAMEEVENT_PARAMS[] = {Param_Cell, Param_String, Param_Cell};
|
||||
typedef List<EventHook *> EventHookList;
|
||||
|
||||
class EventForwardFilter : public IForwardFilter
|
||||
{
|
||||
EventInfo *pEventInfo;
|
||||
public:
|
||||
EventForwardFilter(EventInfo *pEventInfo) : pEventInfo(pEventInfo)
|
||||
{
|
||||
}
|
||||
|
||||
void Preprocess(IPluginFunction *fun, FwdParamInfo *params)
|
||||
{
|
||||
params[2].val = pEventInfo->bDontBroadcast ? 1 : 0;
|
||||
}
|
||||
};
|
||||
|
||||
EventManager::EventManager() : m_EventType(0)
|
||||
{
|
||||
/* Create an event lookup trie */
|
||||
@@ -341,7 +327,6 @@ EventInfo *EventManager::CreateEvent(IPluginContext *pContext, const char *name,
|
||||
|
||||
pInfo->pEvent = pEvent;
|
||||
pInfo->pOwner = pContext->GetIdentity();
|
||||
pInfo->bDontBroadcast = false;
|
||||
|
||||
return pInfo;
|
||||
}
|
||||
@@ -380,7 +365,6 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
IChangeableForward *pForward;
|
||||
const char *name;
|
||||
cell_t res = Pl_Continue;
|
||||
bool broadcast = bDontBroadcast;
|
||||
|
||||
/* The engine accepts NULL without crashing, so to prevent a crash in SM we ignore these */
|
||||
if (!pEvent)
|
||||
@@ -406,16 +390,10 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
HandleSecurity sec(NULL, g_pCoreIdent);
|
||||
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||
|
||||
info.bDontBroadcast = bDontBroadcast;
|
||||
|
||||
EventForwardFilter filter(&info);
|
||||
|
||||
pForward->PushCell(hndl);
|
||||
pForward->PushString(name);
|
||||
pForward->PushCell(bDontBroadcast);
|
||||
pForward->Execute(&res, &filter);
|
||||
|
||||
broadcast = info.bDontBroadcast;
|
||||
pForward->Execute(&res, NULL);
|
||||
|
||||
g_HandleSys.FreeHandle(hndl, &sec);
|
||||
}
|
||||
@@ -436,9 +414,6 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
m_EventStack.push(NULL);
|
||||
}
|
||||
|
||||
if (broadcast != bDontBroadcast)
|
||||
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, true, &IGameEventManager2::FireEvent, (pEvent, broadcast));
|
||||
|
||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||
}
|
||||
|
||||
@@ -466,7 +441,6 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
{
|
||||
if (pHook->postCopy)
|
||||
{
|
||||
info.bDontBroadcast = bDontBroadcast;
|
||||
info.pEvent = m_EventCopies.front();
|
||||
info.pOwner = NULL;
|
||||
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||
|
||||
@@ -53,7 +53,6 @@ struct EventInfo
|
||||
}
|
||||
IGameEvent *pEvent;
|
||||
IdentityToken_t *pOwner;
|
||||
bool bDontBroadcast;
|
||||
};
|
||||
|
||||
struct EventHook
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -63,8 +63,6 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#define GAMEFIX "2.l4d"
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
#define GAMEFIX "2.l4d2"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||
#define GAMEFIX "2.ep2"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
@@ -73,7 +71,7 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
|
||||
#define GAMEFIX "2.darkm"
|
||||
#else
|
||||
#define GAMEFIX "2.ep1"
|
||||
#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#endif //SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#else //METAMOD_PLAPI_VERSION
|
||||
#define GAMEFIX "1.ep1"
|
||||
#endif //METAMOD_PLAPI_VERSION
|
||||
|
||||
+8
-14
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
@@ -255,7 +255,6 @@ CForward *CForward::CreateForward(const char *name, ExecType et, unsigned int nu
|
||||
}
|
||||
|
||||
CForward *pForward = g_Forwards.ForwardMake();
|
||||
pForward->m_IterGuard = NULL;
|
||||
pForward->m_curparam = 0;
|
||||
pForward->m_ExecType = et;
|
||||
snprintf(pForward->m_name, FORWARDS_NAME_MAX, "%s", name ? name : "");
|
||||
@@ -295,7 +294,7 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
cell_t high_result = 0;
|
||||
cell_t low_result = 0;
|
||||
int err;
|
||||
unsigned int success=0;
|
||||
unsigned int failed=0, success=0;
|
||||
unsigned int num_params = m_curparam;
|
||||
FwdParamInfo temp_info[SP_MAX_EXEC_PARAMS];
|
||||
FwdParamInfo *param;
|
||||
@@ -305,15 +304,10 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
memcpy(temp_info, m_params, sizeof(m_params));
|
||||
m_curparam = 0;
|
||||
|
||||
FuncIteratorGuard guard(&m_IterGuard, &iter);
|
||||
|
||||
while (iter != m_functions.end())
|
||||
for (iter=m_functions.begin(); iter!=m_functions.end(); iter++)
|
||||
{
|
||||
func = (*iter);
|
||||
|
||||
if (filter)
|
||||
filter->Preprocess(func, temp_info);
|
||||
|
||||
for (unsigned int i=0; i<num_params; i++)
|
||||
{
|
||||
int err = SP_ERROR_PARAM;
|
||||
@@ -365,7 +359,11 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
}
|
||||
|
||||
/* Call the function and deal with the return value. */
|
||||
if ((err=func->Execute(&cur_result)) == SP_ERROR_NONE)
|
||||
if ((err=func->Execute(&cur_result)) != SP_ERROR_NONE)
|
||||
{
|
||||
failed++;
|
||||
}
|
||||
else
|
||||
{
|
||||
success++;
|
||||
switch (m_ExecType)
|
||||
@@ -405,9 +403,6 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!guard.Triggered())
|
||||
iter++;
|
||||
}
|
||||
|
||||
done:
|
||||
@@ -687,7 +682,6 @@ bool CForward::RemoveFunction(IPluginFunction *func)
|
||||
{
|
||||
if ((*iter) == func)
|
||||
{
|
||||
m_IterGuard->FixIteratorChain(iter);
|
||||
found = true;
|
||||
lst->erase(iter);
|
||||
break;
|
||||
|
||||
@@ -61,58 +61,6 @@ struct FwdParamInfo
|
||||
ParamType pushedas;
|
||||
};
|
||||
|
||||
class SourceMod::IForwardFilter
|
||||
{
|
||||
public:
|
||||
virtual void Preprocess(IPluginFunction *fun, FwdParamInfo *params)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class FuncIteratorGuard
|
||||
{
|
||||
bool triggered;
|
||||
FuncIteratorGuard **pprev;
|
||||
FuncIter *iter;
|
||||
FuncIteratorGuard *next;
|
||||
public:
|
||||
FuncIteratorGuard(FuncIteratorGuard **pprev, FuncIter *iter)
|
||||
: triggered(false), pprev(pprev), iter(iter), next(*pprev)
|
||||
{
|
||||
*pprev = this;
|
||||
}
|
||||
|
||||
~FuncIteratorGuard()
|
||||
{
|
||||
*pprev = next;
|
||||
}
|
||||
|
||||
inline bool Triggered()
|
||||
{
|
||||
bool t = triggered;
|
||||
triggered = false;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* This should not read from |this| before the NULL check, because FwdSys
|
||||
* can call (NULL)->FixIteratorChain().
|
||||
*/
|
||||
void FixIteratorChain(FuncIter &other)
|
||||
{
|
||||
FuncIteratorGuard *guard = this;
|
||||
while (guard != NULL)
|
||||
{
|
||||
if (*guard->iter == other)
|
||||
{
|
||||
*(guard->iter) = ++(*(guard->iter));
|
||||
guard->triggered = true;
|
||||
}
|
||||
guard = guard->next;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CForward : public IChangeableForward
|
||||
{
|
||||
public: //ICallable
|
||||
@@ -155,7 +103,6 @@ protected:
|
||||
*/
|
||||
mutable List<IPluginFunction *> m_functions;
|
||||
mutable List<IPluginFunction *> m_paused;
|
||||
FuncIteratorGuard *m_IterGuard;
|
||||
|
||||
/* Type and name information */
|
||||
FwdParamInfo m_params[SP_MAX_EXEC_PARAMS];
|
||||
|
||||
+34
-15
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,6 +25,8 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -90,11 +92,7 @@ bool s_ServerBinCRC_Ok = false;
|
||||
|
||||
static bool DoesGameMatch(const char *value)
|
||||
{
|
||||
#if defined PLATFORM_WINDOWS
|
||||
if (strcasecmp(value, g_Game) == 0 ||
|
||||
#else
|
||||
if (strcmp(value, g_Game) == 0 ||
|
||||
#endif
|
||||
strcmp(value, g_GameDesc) == 0 ||
|
||||
strcmp(value, g_GameName) == 0)
|
||||
{
|
||||
@@ -115,8 +113,6 @@ static bool DoesEngineMatch(const char *value)
|
||||
if (strcmp(value, "orangebox_valve") == 0)
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
if (strcmp(value, "left4dead") == 0)
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
if (strcmp(value, "left4dead2") == 0)
|
||||
#else
|
||||
#error "Unknown engine type"
|
||||
#endif
|
||||
@@ -504,11 +500,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
void *handle = dlopen(info.dli_fname, RTLD_NOW);
|
||||
if (handle)
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
final_addr = g_MemUtils.ResolveSymbol(handle, &s_TempSig.sig[1]);
|
||||
#else
|
||||
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
||||
#endif
|
||||
dlclose(handle);
|
||||
} else {
|
||||
g_Logger.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
||||
@@ -527,18 +519,45 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
}
|
||||
#endif
|
||||
/* First, preprocess the signature */
|
||||
unsigned char real_sig[511];
|
||||
char real_sig[511];
|
||||
size_t real_bytes;
|
||||
size_t length;
|
||||
|
||||
real_bytes = 0;
|
||||
length = strlen(s_TempSig.sig);
|
||||
|
||||
real_bytes = UTIL_DecodeHexString(real_sig, sizeof(real_sig), s_TempSig.sig);
|
||||
for (size_t i=0; i<length; i++)
|
||||
{
|
||||
if (real_bytes >= sizeof(real_sig))
|
||||
{
|
||||
break;
|
||||
}
|
||||
real_sig[real_bytes++] = s_TempSig.sig[i];
|
||||
if (s_TempSig.sig[i] == '\\'
|
||||
&& s_TempSig.sig[i+1] == 'x')
|
||||
{
|
||||
if (i + 3 >= length)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* Get the hex part */
|
||||
char s_byte[3];
|
||||
int r_byte;
|
||||
s_byte[0] = s_TempSig.sig[i+2];
|
||||
s_byte[1] = s_TempSig.sig[i+3];
|
||||
s_byte[2] = '\0';
|
||||
/* Read it as an integer */
|
||||
sscanf(s_byte, "%x", &r_byte);
|
||||
/* Save the value */
|
||||
real_sig[real_bytes-1] = r_byte;
|
||||
/* Adjust index */
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (real_bytes >= 1)
|
||||
{
|
||||
final_addr = g_MemUtils.FindPattern(addrInBase, (char*)real_sig, real_bytes);
|
||||
final_addr = g_MemUtils.FindPattern(addrInBase, real_sig, real_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "sm_globals.h"
|
||||
#include "sm_memtable.h"
|
||||
#include "sm_trie_tpl.h"
|
||||
#include "ThreadSupport.h"
|
||||
|
||||
using namespace SourceMod;
|
||||
using namespace SourceHook;
|
||||
|
||||
+4
-250
@@ -37,14 +37,10 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "GameConfigs.h"
|
||||
#include <compat_wrappers.h>
|
||||
#include <Logger.h>
|
||||
|
||||
CHalfLife2 g_HL2;
|
||||
ConVar *sv_lan = NULL;
|
||||
|
||||
static void *g_EntList = NULL;
|
||||
static int entInfoOffset = -1;
|
||||
|
||||
namespace SourceHook
|
||||
{
|
||||
template<>
|
||||
@@ -96,16 +92,14 @@ CHalfLife2::~CHalfLife2()
|
||||
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
||||
#endif
|
||||
|
||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
||||
bool is_original_engine = false;
|
||||
#endif
|
||||
|
||||
void CHalfLife2::OnSourceModStartup(bool late)
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
|
||||
/* The Ship currently is the only known game to use an older version of the engine */
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
||||
#else
|
||||
if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
|
||||
@@ -129,52 +123,7 @@ void CHalfLife2::OnSourceModAllInitialized()
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void CHalfLife2::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
char *addr = NULL;
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
int offset;
|
||||
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
if (!addr)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
if (!g_pGameConf->GetOffset("gEntList", &offset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
#elif defined PLATFORM_LINUX
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
if (!addr)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of gEntList - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
g_EntList = reinterpret_cast<void *>(addr);
|
||||
#endif
|
||||
|
||||
if (!g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (EntInfo) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
||||
#if !defined METAMOD_PLAPI_VERSION
|
||||
bool CHalfLife2::IsOriginalEngine()
|
||||
{
|
||||
return is_original_engine;
|
||||
@@ -359,13 +308,11 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
if (g_pSharedChangeInfo != NULL)
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_LEFT4DEAD2
|
||||
if (offset)
|
||||
{
|
||||
pEdict->StateChanged(offset);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pEdict->StateChanged();
|
||||
}
|
||||
@@ -441,26 +388,6 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
|
||||
{
|
||||
bf_write *pBitBuf = NULL;
|
||||
|
||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *pre_byte = g_pGameConf->GetKeyValue("HintTextPreByte");
|
||||
if (pre_byte != NULL && strcmp(pre_byte, "yes") == 0)
|
||||
{
|
||||
pBitBuf->WriteByte(1);
|
||||
}
|
||||
pBitBuf->WriteString(msg);
|
||||
g_UserMsgs.EndMessage();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show)
|
||||
{
|
||||
bf_write *pBitBuf = NULL;
|
||||
@@ -547,7 +474,7 @@ bool CHalfLife2::IsLANServer()
|
||||
|
||||
bool CHalfLife2::KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID)
|
||||
{
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
||||
#else
|
||||
if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
|
||||
@@ -672,10 +599,7 @@ edict_t *CHalfLife2::GetHandleEntity(CBaseHandle &hndl)
|
||||
edict_t *pStoredEdict;
|
||||
CBaseEntity *pStoredEntity;
|
||||
|
||||
if (!IndexToAThings(index, &pStoredEntity, &pStoredEdict))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
pStoredEdict = GetEntity(index, &pStoredEntity);
|
||||
|
||||
if (pStoredEdict == NULL || pStoredEntity == NULL)
|
||||
{
|
||||
@@ -718,173 +642,3 @@ void CHalfLife2::ServerCommand(const char *buffer)
|
||||
{
|
||||
engine->ServerCommand(buffer);
|
||||
}
|
||||
|
||||
cell_t CHalfLife2::EntityToReference(CBaseEntity *pEntity)
|
||||
{
|
||||
IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
|
||||
CBaseHandle hndl = pUnknown->GetRefEHandle();
|
||||
return (hndl.ToInt() | (1<<31));
|
||||
}
|
||||
|
||||
CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
|
||||
{
|
||||
CEntInfo *pInfo = NULL;
|
||||
|
||||
if (entRef & (1<<31))
|
||||
{
|
||||
/* Proper ent reference */
|
||||
int hndlValue = entRef & ~(1<<31);
|
||||
CBaseHandle hndl(hndlValue);
|
||||
|
||||
pInfo = LookupEntity(hndl.GetEntryIndex());
|
||||
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Old style index only */
|
||||
pInfo = LookupEntity(entRef);
|
||||
}
|
||||
|
||||
if (!pInfo)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IServerUnknown *pUnk = static_cast<IServerUnknown *>(pInfo->m_pEntity);
|
||||
if (pUnk)
|
||||
{
|
||||
return pUnk->GetBaseEntity();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the CEntInfo pointer from g_EntList for a given entity index
|
||||
*/
|
||||
CEntInfo *CHalfLife2::LookupEntity(int entIndex)
|
||||
{
|
||||
if (!g_EntList || entInfoOffset == -1)
|
||||
{
|
||||
/* Attempt to use engine interface instead */
|
||||
static CEntInfo tempInfo;
|
||||
tempInfo.m_pNext = NULL;
|
||||
tempInfo.m_pPrev = NULL;
|
||||
|
||||
edict_t *pEdict = PEntityOfEntIndex(entIndex);
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IServerUnknown *pUnk = pEdict->GetUnknown();
|
||||
|
||||
if (!pUnk)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tempInfo.m_pEntity = pUnk;
|
||||
tempInfo.m_SerialNumber = pUnk->GetRefEHandle().GetSerialNumber();
|
||||
|
||||
return &tempInfo;
|
||||
}
|
||||
|
||||
CEntInfo *pArray = (CEntInfo *)(((unsigned char *)g_EntList) + entInfoOffset);
|
||||
return &pArray[entIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
SERIAL_MASK = 0x7fff (15 bits)
|
||||
|
||||
#define MAX_EDICT_BITS 11
|
||||
#define NUM_ENT_ENTRY_BITS (MAX_EDICT_BITS + 1)
|
||||
m_Index = iEntry | (iSerialNumber << NUM_ENT_ENTRY_BITS);
|
||||
|
||||
Top 5 bits of a handle are unused.
|
||||
Bit 31 - Our 'reference' flag indicator
|
||||
*/
|
||||
|
||||
cell_t CHalfLife2::IndexToReference(int entIndex)
|
||||
{
|
||||
CBaseEntity *pEnt = ReferenceToEntity(entIndex);
|
||||
if (!pEnt)
|
||||
{
|
||||
return INVALID_EHANDLE_INDEX;
|
||||
}
|
||||
|
||||
return EntityToReference(pEnt);
|
||||
}
|
||||
|
||||
int CHalfLife2::ReferenceToIndex(cell_t entRef)
|
||||
{
|
||||
if ((unsigned)entRef == INVALID_EHANDLE_INDEX)
|
||||
{
|
||||
return INVALID_EHANDLE_INDEX;
|
||||
}
|
||||
|
||||
if (entRef & (1<<31))
|
||||
{
|
||||
/* Proper ent reference */
|
||||
int hndlValue = entRef & ~(1<<31);
|
||||
CBaseHandle hndl(hndlValue);
|
||||
|
||||
CEntInfo *pInfo = LookupEntity(hndl.GetEntryIndex());
|
||||
|
||||
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
|
||||
{
|
||||
return INVALID_EHANDLE_INDEX;
|
||||
}
|
||||
|
||||
return hndl.GetEntryIndex();
|
||||
}
|
||||
|
||||
return entRef;
|
||||
}
|
||||
|
||||
cell_t CHalfLife2::EntityToBCompatRef(CBaseEntity *pEntity)
|
||||
{
|
||||
if (pEntity == NULL)
|
||||
{
|
||||
return INVALID_EHANDLE_INDEX;
|
||||
}
|
||||
|
||||
IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
|
||||
CBaseHandle hndl = pUnknown->GetRefEHandle();
|
||||
|
||||
if (hndl.GetEntryIndex() >= MAX_EDICTS)
|
||||
{
|
||||
return (hndl.ToInt() | (1<<31));
|
||||
}
|
||||
else
|
||||
{
|
||||
return hndl.GetEntryIndex();
|
||||
}
|
||||
}
|
||||
|
||||
cell_t CHalfLife2::ReferenceToBCompatRef(cell_t entRef)
|
||||
{
|
||||
if ((unsigned)entRef == INVALID_EHANDLE_INDEX)
|
||||
{
|
||||
return INVALID_EHANDLE_INDEX;
|
||||
}
|
||||
|
||||
int hndlValue = entRef & ~(1<<31);
|
||||
CBaseHandle hndl(hndlValue);
|
||||
|
||||
if (hndl.GetEntryIndex() < MAX_EDICTS)
|
||||
{
|
||||
return hndl.GetEntryIndex();
|
||||
}
|
||||
|
||||
return entRef;
|
||||
}
|
||||
|
||||
void *CHalfLife2::GetGlobalEntityList()
|
||||
{
|
||||
return g_EntList;
|
||||
}
|
||||
|
||||
+2
-22
@@ -43,7 +43,6 @@
|
||||
#include <KeyValues.h>
|
||||
#include <server_class.h>
|
||||
#include <datamap.h>
|
||||
#include <ihandleentity.h>
|
||||
|
||||
class CCommand;
|
||||
|
||||
@@ -87,15 +86,6 @@ struct DelayedKickInfo
|
||||
char buffer[384];
|
||||
};
|
||||
|
||||
class CEntInfo
|
||||
{
|
||||
public:
|
||||
IHandleEntity *m_pEntity;
|
||||
int m_SerialNumber;
|
||||
CEntInfo *m_pPrev;
|
||||
CEntInfo *m_pNext;
|
||||
};
|
||||
|
||||
class CHalfLife2 :
|
||||
public SMGlobalClass,
|
||||
public IGameHelpers
|
||||
@@ -106,7 +96,6 @@ public:
|
||||
public:
|
||||
void OnSourceModStartup(bool late);
|
||||
void OnSourceModAllInitialized();
|
||||
void OnSourceModAllInitialized_Post();
|
||||
/*void OnSourceModAllShutdown();*/
|
||||
public: //IGameHelpers
|
||||
SendProp *FindInSendTable(const char *classname, const char *offset);
|
||||
@@ -117,7 +106,6 @@ public: //IGameHelpers
|
||||
void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
|
||||
bool TextMsg(int client, int dest, const char *msg);
|
||||
bool HintTextMsg(int client, const char *msg);
|
||||
bool HintTextMsg(cell_t *players, int count, const char *msg);
|
||||
bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
|
||||
bool IsLANServer();
|
||||
bool KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL);
|
||||
@@ -127,14 +115,6 @@ public: //IGameHelpers
|
||||
void SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt);
|
||||
const char *GetCurrentMap();
|
||||
void ServerCommand(const char *buffer);
|
||||
CBaseEntity *ReferenceToEntity(cell_t entRef);
|
||||
cell_t EntityToReference(CBaseEntity *pEntity);
|
||||
cell_t IndexToReference(int entIndex);
|
||||
int ReferenceToIndex(cell_t entRef);
|
||||
cell_t ReferenceToBCompatRef(cell_t entRef);
|
||||
CEntInfo *LookupEntity(int entIndex);
|
||||
cell_t EntityToBCompatRef(CBaseEntity *pEntity);
|
||||
void *GetGlobalEntityList();
|
||||
public:
|
||||
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
||||
void ProcessFakeCliCmdQueue();
|
||||
@@ -145,7 +125,7 @@ public:
|
||||
const char *CurrentCommandName();
|
||||
void AddDelayedKick(int client, int userid, const char *msg);
|
||||
void ProcessDelayedKicks();
|
||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
||||
#if !defined METAMOD_PLAPI_VERSION
|
||||
bool IsOriginalEngine();
|
||||
#endif
|
||||
private:
|
||||
@@ -166,6 +146,6 @@ private:
|
||||
|
||||
extern CHalfLife2 g_HL2;
|
||||
|
||||
bool IndexToAThings(cell_t, CBaseEntity **pEntData, edict_t **pEdictData);
|
||||
edict_t *GetEntity(cell_t num, CBaseEntity **pData);
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_
|
||||
|
||||
+5
-10
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -378,14 +378,6 @@ print_error:
|
||||
}
|
||||
|
||||
void Logger::LogError(const char *vafmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, vafmt);
|
||||
LogErrorEx(vafmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void Logger::LogErrorEx(const char *vafmt, va_list ap)
|
||||
{
|
||||
if (!m_Active)
|
||||
{
|
||||
@@ -416,7 +408,10 @@ void Logger::LogErrorEx(const char *vafmt, va_list ap)
|
||||
fprintf(fp, "L %s: Info (map \"%s\") (file \"errors_%04d%02d%02d.log\")\n", date, m_CurMapName.c_str(), curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
|
||||
m_ErrMapStart = true;
|
||||
}
|
||||
va_list ap;
|
||||
va_start(ap, vafmt);
|
||||
LogToOpenFileEx(fp, vafmt, ap);
|
||||
va_end(ap);
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -75,7 +75,6 @@ public:
|
||||
void DisableLogging();
|
||||
void LogMessage(const char *msg, ...);
|
||||
void LogError(const char *msg, ...);
|
||||
void LogErrorEx(const char *msg, va_list ap);
|
||||
void LogFatal(const char *msg, ...);
|
||||
void LogToOpenFile(FILE *fp, const char *msg, ...);
|
||||
void LogToOpenFileEx(FILE *fp, const char *msg, va_list ap);
|
||||
|
||||
+17
-35
@@ -7,8 +7,7 @@ HL2SDK_ORIG = ../../hl2sdk
|
||||
HL2SDK_OB = ../../hl2sdk-ob
|
||||
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
|
||||
HL2SDK_L4D = ../../hl2sdk-l4d
|
||||
HL2SDK_L4D2 = ../../hl2sdk-l4d2
|
||||
MMSOURCE17 = ../../mmsource-central
|
||||
MMSOURCE17 = ../../mmsource-1.7
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
@@ -16,19 +15,19 @@ MMSOURCE17 = ../../mmsource-central
|
||||
|
||||
OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreConfig.cpp \
|
||||
Database.cpp DebugReporter.cpp EventManager.cpp GameConfigs.cpp HalfLife2.cpp Logger.cpp \
|
||||
MemoryUtils.cpp PlayerManager.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
|
||||
MemoryUtils.cpp PlayerManager.cpp TextParsers.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
|
||||
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
|
||||
frame_hooks.cpp concmd_cleaner.cpp PhraseCollection.cpp NextMap.cpp \
|
||||
NativeOwner.cpp logic_bridge.cpp ConsoleDetours.cpp
|
||||
frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp PhraseCollection.cpp NextMap.cpp \
|
||||
NativeOwner.cpp
|
||||
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||
smn_filesystem.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
||||
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp \
|
||||
smn_lang.cpp smn_player.cpp smn_string.cpp smn_timers.cpp \
|
||||
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp \
|
||||
smn_hudtext.cpp smn_nextmap.cpp
|
||||
smn_filesystem.cpp smn_float.cpp smn_functions.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
||||
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp smn_maplists.cpp \
|
||||
smn_lang.cpp smn_player.cpp smn_string.cpp smn_sorting.cpp smn_textparse.cpp smn_timers.cpp \
|
||||
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp smn_adt_array.cpp \
|
||||
smn_adt_trie.cpp smn_hudtext.cpp smn_adt_stack.cpp smn_nextmap.cpp
|
||||
OBJECTS += ExtensionSys.cpp \
|
||||
ForwardSys.cpp \
|
||||
HandleSys.cpp \
|
||||
@@ -37,6 +36,7 @@ OBJECTS += ExtensionSys.cpp \
|
||||
PluginSys.cpp \
|
||||
ShareSys.cpp \
|
||||
NativeInvoker.cpp
|
||||
OBJECTS += thread/ThreadWorker.cpp thread/BaseWorker.cpp thread/PosixThreads.cpp ThreadSupport.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
@@ -77,7 +77,7 @@ ifeq "$(ENGINE)" "orangeboxvalve"
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=4
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/orangebox
|
||||
BINARY = sourcemod.2.ep2v.so
|
||||
override ENGSET = true
|
||||
@@ -93,27 +93,11 @@ ifeq "$(ENGINE)" "left4dead"
|
||||
BINARY = sourcemod.2.l4d.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
HL2SDK = $(HL2SDK_L4D2)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=6
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/left4dead2
|
||||
BINARY = sourcemod.2.l4d2.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5
|
||||
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a libvstdlib.so \
|
||||
libtier0.so -static-libgcc
|
||||
else
|
||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
|
||||
tier0_i486.so -static-libgcc
|
||||
endif
|
||||
tier0_i486.so -lpthread -static-libgcc
|
||||
|
||||
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
|
||||
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
|
||||
@@ -152,14 +136,10 @@ $(BIN_DIR)/%.o: %.c
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
all: check
|
||||
mkdir -p $(BIN_DIR)
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
ln -sf $(SRCDS)/bin/libvstdlib.so libvstdlib.so;
|
||||
ln -sf $(SRCDS)/bin/libtier0.so libtier0.so;
|
||||
else
|
||||
mkdir -p $(BIN_DIR)/systems
|
||||
mkdir -p $(BIN_DIR)/thread
|
||||
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so;
|
||||
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so;
|
||||
endif
|
||||
$(MAKE) -f Makefile sourcemod
|
||||
|
||||
check:
|
||||
@@ -178,4 +158,6 @@ default: all
|
||||
|
||||
clean: check
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/systems/*.o
|
||||
rm -rf $(BIN_DIR)/thread/*.o
|
||||
rm -rf $(BIN_DIR)/$(BINARY)
|
||||
|
||||
+6
-159
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,14 +25,15 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "MemoryUtils.h"
|
||||
#include "ShareSys.h"
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <fcntl.h>
|
||||
#include <link.h>
|
||||
#include <sys/mman.h>
|
||||
#include <string.h>
|
||||
#include <elf.h>
|
||||
#endif
|
||||
|
||||
MemoryUtils g_MemUtils;
|
||||
@@ -55,17 +56,6 @@ MemoryUtils::MemoryUtils()
|
||||
}
|
||||
#endif
|
||||
|
||||
MemoryUtils::~MemoryUtils()
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
delete m_SymTables[i];
|
||||
}
|
||||
m_SymTables.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MemoryUtils::OnSourceModAllInitialized()
|
||||
{
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
@@ -108,149 +98,6 @@ void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t l
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
return GetProcAddress((HMODULE)handle, symbol);
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
|
||||
struct link_map *dlmap;
|
||||
struct stat dlstat;
|
||||
int dlfile;
|
||||
uintptr_t map_base;
|
||||
Elf32_Ehdr *file_hdr;
|
||||
Elf32_Shdr *sections, *shstrtab_hdr, *symtab_hdr, *strtab_hdr;
|
||||
Elf32_Sym *symtab;
|
||||
const char *shstrtab, *strtab;
|
||||
uint16_t section_count;
|
||||
uint32_t symbol_count;
|
||||
LibSymbolTable *libtable;
|
||||
SymbolTable *table;
|
||||
Symbol *symbol_entry;
|
||||
|
||||
dlmap = (struct link_map *)handle;
|
||||
symtab_hdr = NULL;
|
||||
strtab_hdr = NULL;
|
||||
table = NULL;
|
||||
|
||||
/* See if we already have a symbol table for this library */
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
libtable = m_SymTables[i];
|
||||
if (libtable->lib_base == dlmap->l_addr)
|
||||
{
|
||||
table = &libtable->table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a symbol table for this library, then create one */
|
||||
if (table == NULL)
|
||||
{
|
||||
libtable = new LibSymbolTable();
|
||||
libtable->table.Initialize();
|
||||
libtable->lib_base = dlmap->l_addr;
|
||||
libtable->last_pos = 0;
|
||||
table = &libtable->table;
|
||||
m_SymTables.push_back(libtable);
|
||||
}
|
||||
|
||||
/* See if the symbol is already cached in our table */
|
||||
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
|
||||
if (symbol_entry != NULL)
|
||||
{
|
||||
return symbol_entry->address;
|
||||
}
|
||||
|
||||
/* If symbol isn't in our table, then we have open the actual library */
|
||||
dlfile = open(dlmap->l_name, O_RDONLY);
|
||||
if (dlfile == -1 || fstat(dlfile, &dlstat) == -1)
|
||||
{
|
||||
close(dlfile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Map library file into memory */
|
||||
file_hdr = (Elf32_Ehdr *)mmap(NULL, dlstat.st_size, PROT_READ, MAP_PRIVATE, dlfile, 0);
|
||||
map_base = (uintptr_t)file_hdr;
|
||||
if (file_hdr == MAP_FAILED)
|
||||
{
|
||||
close(dlfile);
|
||||
return NULL;
|
||||
}
|
||||
close(dlfile);
|
||||
|
||||
if (file_hdr->e_shoff == 0 || file_hdr->e_shstrndx == SHN_UNDEF)
|
||||
{
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sections = (Elf32_Shdr *)(map_base + file_hdr->e_shoff);
|
||||
section_count = file_hdr->e_shnum;
|
||||
/* Get ELF section header string table */
|
||||
shstrtab_hdr = §ions[file_hdr->e_shstrndx];
|
||||
shstrtab = (const char *)(map_base + shstrtab_hdr->sh_offset);
|
||||
|
||||
/* Iterate sections while looking for ELF symbol table and string table */
|
||||
for (uint16_t i = 0; i < section_count; i++)
|
||||
{
|
||||
Elf32_Shdr &hdr = sections[i];
|
||||
const char *section_name = shstrtab + hdr.sh_name;
|
||||
|
||||
if (strcmp(section_name, ".symtab") == 0)
|
||||
{
|
||||
symtab_hdr = &hdr;
|
||||
}
|
||||
else if (strcmp(section_name, ".strtab") == 0)
|
||||
{
|
||||
strtab_hdr = &hdr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Uh oh, we don't have a symbol table or a string table */
|
||||
if (symtab_hdr == NULL || strtab_hdr == NULL)
|
||||
{
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
symtab = (Elf32_Sym *)(map_base + symtab_hdr->sh_offset);
|
||||
strtab = (const char *)(map_base + strtab_hdr->sh_offset);
|
||||
symbol_count = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
|
||||
|
||||
/* Iterate symbol table starting from the position we were at last time */
|
||||
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
|
||||
{
|
||||
Elf32_Sym &sym = symtab[i];
|
||||
unsigned char sym_type = ELF32_ST_TYPE(sym.st_info);
|
||||
const char *sym_name = strtab + sym.st_name;
|
||||
Symbol *cur_sym;
|
||||
|
||||
/* Skip symbols that are undefined or do not refer to functions or objects */
|
||||
if (sym.st_shndx == SHN_UNDEF || (sym_type != STT_FUNC && sym_type != STT_OBJECT))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Caching symbols as we go along */
|
||||
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlmap->l_addr + sym.st_value));
|
||||
if (strcmp(symbol, sym_name) == 0)
|
||||
{
|
||||
symbol_entry = cur_sym;
|
||||
libtable->last_pos = ++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return symbol_entry ? symbol_entry->address : NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
{
|
||||
unsigned long baseAddr;
|
||||
|
||||
+5
-27
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2000 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,6 +25,8 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||
@@ -32,12 +34,6 @@
|
||||
|
||||
#include <IMemoryUtils.h>
|
||||
#include "sm_globals.h"
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <sh_vector.h>
|
||||
#include "sm_symtable.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
#endif
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
@@ -47,34 +43,16 @@ struct DynLibInfo
|
||||
size_t memorySize;
|
||||
};
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
typedef uint32_t Elf32_Addr;
|
||||
|
||||
struct LibSymbolTable
|
||||
{
|
||||
SymbolTable table;
|
||||
Elf32_Addr lib_base;
|
||||
uint32_t last_pos;
|
||||
};
|
||||
#endif
|
||||
|
||||
class MemoryUtils :
|
||||
public IMemoryUtils,
|
||||
public SMGlobalClass
|
||||
{
|
||||
public:
|
||||
~MemoryUtils();
|
||||
public: // SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
public: // IMemoryUtils
|
||||
void *FindPattern(const void *libPtr, const char *pattern, size_t len);
|
||||
void *ResolveSymbol(void *handle, const char *symbol);
|
||||
public:
|
||||
bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib);
|
||||
#ifdef PLATFORM_LINUX
|
||||
private:
|
||||
CVector<LibSymbolTable *> m_SymTables;
|
||||
#endif
|
||||
bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib);
|
||||
};
|
||||
|
||||
extern MemoryUtils g_MemUtils;
|
||||
|
||||
+8
-200
@@ -34,55 +34,9 @@
|
||||
#include "MenuVoting.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include <sourcemod.h>
|
||||
#include <Logger.h>
|
||||
#include <HalfLife2.h>
|
||||
#include <mathlib.h>
|
||||
#include <const.h>
|
||||
#include <Translator.h>
|
||||
|
||||
float g_next_vote = 0.0f;
|
||||
|
||||
#define VOTE_NOT_VOTING -2
|
||||
#define VOTE_PENDING -1
|
||||
|
||||
ConVar sm_vote_hintbox("sm_vote_progress_hintbox",
|
||||
"0",
|
||||
0,
|
||||
"Show current vote progress in a hint box",
|
||||
true,
|
||||
0.0,
|
||||
true,
|
||||
1.0);
|
||||
|
||||
ConVar sm_vote_chat("sm_vote_progress_chat",
|
||||
"0",
|
||||
0,
|
||||
"Show current vote progress as chat messages",
|
||||
true,
|
||||
0.0,
|
||||
true,
|
||||
1.0);
|
||||
|
||||
ConVar sm_vote_console("sm_vote_progress_console",
|
||||
"0",
|
||||
0,
|
||||
"Show current vote progress as console messages",
|
||||
true,
|
||||
0.0,
|
||||
true,
|
||||
1.0);
|
||||
|
||||
ConVar sm_vote_client_console("sm_vote_progress_client_console",
|
||||
"0",
|
||||
0,
|
||||
"Show current vote progress as console messages to clients",
|
||||
true,
|
||||
0.0,
|
||||
true,
|
||||
1.0);
|
||||
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue);
|
||||
#else
|
||||
@@ -163,7 +117,7 @@ void VoteMenuHandler::OnClientDisconnected(int client)
|
||||
* newly connected client is not allowed to vote.
|
||||
*/
|
||||
int item;
|
||||
if ((item = m_ClientVotes[client]) >= VOTE_PENDING)
|
||||
if ((item = m_ClientVotes[client]) >= -1)
|
||||
{
|
||||
if (item >= 0)
|
||||
{
|
||||
@@ -171,7 +125,7 @@ void VoteMenuHandler::OnClientDisconnected(int client)
|
||||
assert(m_Votes[item] > 0);
|
||||
m_Votes[item]--;
|
||||
}
|
||||
m_ClientVotes[client] = VOTE_NOT_VOTING;
|
||||
m_ClientVotes[client] = -2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,13 +189,13 @@ bool VoteMenuHandler::IsClientInVotePool(int client)
|
||||
return false;
|
||||
}
|
||||
|
||||
return (m_ClientVotes[client] > VOTE_NOT_VOTING);
|
||||
return (m_ClientVotes[client] > -2);
|
||||
}
|
||||
|
||||
bool VoteMenuHandler::GetClientVoteChoice(int client, unsigned int *pItem)
|
||||
{
|
||||
if (!IsClientInVotePool(client)
|
||||
|| m_ClientVotes[client] == VOTE_PENDING)
|
||||
|| m_ClientVotes[client] == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -269,9 +223,7 @@ bool VoteMenuHandler::RedrawToClient(int client, bool revotes)
|
||||
assert((unsigned)m_ClientVotes[client] < m_Items);
|
||||
assert(m_Votes[m_ClientVotes[client]] > 0);
|
||||
m_Votes[m_ClientVotes[client]]--;
|
||||
m_ClientVotes[client] = VOTE_PENDING;
|
||||
m_Revoting[client] = true;
|
||||
m_NumVotes--;
|
||||
m_ClientVotes[client] = -1;
|
||||
}
|
||||
|
||||
if (m_nMenuTime == MENU_TIME_FOREVER)
|
||||
@@ -307,8 +259,7 @@ bool VoteMenuHandler::InitializeVoting(IBaseMenu *menu,
|
||||
/* Mark all clients as not voting */
|
||||
for (int i=1; i<=gpGlobals->maxClients; i++)
|
||||
{
|
||||
m_ClientVotes[i] = VOTE_NOT_VOTING;
|
||||
m_Revoting[i] = false;
|
||||
m_ClientVotes[i] = -2;
|
||||
}
|
||||
|
||||
m_Items = menu->GetItemCount();
|
||||
@@ -352,8 +303,6 @@ void VoteMenuHandler::StartVoting()
|
||||
|
||||
m_pHandler->OnMenuVoteStart(m_pCurMenu);
|
||||
|
||||
m_displayTimer = g_Timers.CreateTimer(this, 1.0, NULL, TIMER_FLAG_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
|
||||
/* By now we know how many clients were set.
|
||||
* If there are none, we should end IMMEDIATELY.
|
||||
*/
|
||||
@@ -361,8 +310,6 @@ void VoteMenuHandler::StartVoting()
|
||||
{
|
||||
EndVoting();
|
||||
}
|
||||
|
||||
m_TotalClients = m_Clients;
|
||||
}
|
||||
|
||||
void VoteMenuHandler::DecrementPlayerCount()
|
||||
@@ -399,11 +346,6 @@ void VoteMenuHandler::EndVoting()
|
||||
g_next_vote = gpGlobals->curtime + fVoteDelay;
|
||||
}
|
||||
|
||||
if (m_displayTimer)
|
||||
{
|
||||
g_Timers.KillTimer(m_displayTimer);
|
||||
}
|
||||
|
||||
if (m_bCancelled)
|
||||
{
|
||||
/* If we were cancelled, don't bother tabulating anything.
|
||||
@@ -450,7 +392,7 @@ void VoteMenuHandler::EndVoting()
|
||||
/* Build the client list */
|
||||
for (int i=1; i<=gpGlobals->maxClients; i++)
|
||||
{
|
||||
if (m_ClientVotes[i] >= VOTE_PENDING)
|
||||
if (m_ClientVotes[i] >= -1)
|
||||
{
|
||||
client_vote[vote.num_clients].client = i;
|
||||
client_vote[vote.num_clients].item = m_ClientVotes[i];
|
||||
@@ -494,7 +436,7 @@ void VoteMenuHandler::OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReason
|
||||
|
||||
void VoteMenuHandler::OnMenuDisplay(IBaseMenu *menu, int client, IMenuPanel *display)
|
||||
{
|
||||
m_ClientVotes[client] = VOTE_PENDING;
|
||||
m_ClientVotes[client] = -1;
|
||||
m_pHandler->OnMenuDisplay(menu, client, display);
|
||||
}
|
||||
|
||||
@@ -516,55 +458,6 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
|
||||
m_ClientVotes[client] = item;
|
||||
m_Votes[item]++;
|
||||
m_NumVotes++;
|
||||
|
||||
if (sm_vote_chat.GetBool() || sm_vote_console.GetBool())
|
||||
{
|
||||
static char buffer[1024];
|
||||
ItemDrawInfo dr;
|
||||
menu->GetItemInfo(item, &dr);
|
||||
|
||||
if (sm_vote_console.GetBool())
|
||||
{
|
||||
int target = SOURCEMOD_SERVER_LANGUAGE;
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &target, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
Engine_LogPrintWrapper(buffer);
|
||||
}
|
||||
|
||||
if (sm_vote_chat.GetBool() || sm_vote_client_console.GetBool())
|
||||
{
|
||||
int maxclients = g_Players.GetMaxClients();
|
||||
for (int i=1; i<=maxclients; i++)
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
|
||||
assert(pPlayer);
|
||||
|
||||
if (pPlayer->IsInGame())
|
||||
{
|
||||
if (m_Revoting[client])
|
||||
{
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Changed Vote", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
}
|
||||
else
|
||||
{
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
}
|
||||
|
||||
if (sm_vote_chat.GetBool())
|
||||
{
|
||||
g_HL2.TextMsg(i, HUD_PRINTTALK, buffer);
|
||||
}
|
||||
|
||||
if (sm_vote_client_console.GetBool())
|
||||
{
|
||||
engine->ClientPrintf(pPlayer->GetEdict(), buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BuildVoteLeaders();
|
||||
DrawHintProgress();
|
||||
}
|
||||
|
||||
m_pHandler->OnMenuSelect(menu, client, item);
|
||||
@@ -587,9 +480,6 @@ void VoteMenuHandler::InternalReset()
|
||||
m_NumVotes = 0;
|
||||
m_bCancelled = false;
|
||||
m_pHandler = NULL;
|
||||
m_leaderList[0] = '\0';
|
||||
m_displayTimer = NULL;
|
||||
m_TotalClients = 0;
|
||||
}
|
||||
|
||||
void VoteMenuHandler::CancelVoting()
|
||||
@@ -612,85 +502,3 @@ bool VoteMenuHandler::IsCancelling()
|
||||
return m_bCancelled;
|
||||
}
|
||||
|
||||
void VoteMenuHandler::DrawHintProgress()
|
||||
{
|
||||
if (!sm_vote_hintbox.GetBool())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static char buffer[1024];
|
||||
|
||||
float timeRemaining = (m_fStartTime + m_nMenuTime) - gpGlobals->curtime;
|
||||
if (timeRemaining < 0)
|
||||
{
|
||||
timeRemaining = 0.0;
|
||||
}
|
||||
|
||||
int iTimeRemaining = RoundFloatToInt(timeRemaining);
|
||||
|
||||
int maxclients = g_Players.GetMaxClients();
|
||||
for (int i=1; i<=maxclients; i++)
|
||||
{
|
||||
if (g_Players.GetPlayerByIndex(i)->IsInGame())
|
||||
{
|
||||
CoreTranslate(buffer, sizeof(buffer), "%T%s", 6, NULL, "Vote Count", &i, &m_NumVotes, &m_TotalClients, &iTimeRemaining, &m_leaderList);
|
||||
g_HL2.HintTextMsg(i, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VoteMenuHandler::BuildVoteLeaders()
|
||||
{
|
||||
if (m_NumVotes == 0 || !sm_vote_hintbox.GetBool())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
menu_vote_result_t vote;
|
||||
menu_vote_result_t::menu_item_vote_t item_vote[256];
|
||||
|
||||
memset(&vote, 0, sizeof(vote));
|
||||
|
||||
/* Build the item list */
|
||||
for (unsigned int i=0; i<m_Items; i++)
|
||||
{
|
||||
if (m_Votes[i] > 0)
|
||||
{
|
||||
item_vote[vote.num_items].count = m_Votes[i];
|
||||
item_vote[vote.num_items].item = i;
|
||||
vote.num_votes += m_Votes[i];
|
||||
vote.num_items++;
|
||||
}
|
||||
}
|
||||
vote.item_list = item_vote;
|
||||
assert(vote.num_votes);
|
||||
|
||||
/* Sort the item list descending */
|
||||
qsort(item_vote,
|
||||
vote.num_items,
|
||||
sizeof(menu_vote_result_t::menu_item_vote_t),
|
||||
SortVoteItems);
|
||||
|
||||
/* Take the top 3 (if applicable) and draw them */
|
||||
int len = 0;
|
||||
for (unsigned int i=0; i<vote.num_items && i<3; i++)
|
||||
{
|
||||
int curItem = vote.item_list[i].item;
|
||||
ItemDrawInfo dr;
|
||||
m_pCurMenu->GetItemInfo(curItem, &dr);
|
||||
len += g_SourceMod.Format(m_leaderList + len, sizeof(m_leaderList) - len, "\n%i. %s: (%i)", i+1, dr.display, vote.item_list[i].count);
|
||||
}
|
||||
}
|
||||
|
||||
SourceMod::ResultType VoteMenuHandler::OnTimer(ITimer *pTimer, void *pData)
|
||||
{
|
||||
DrawHintProgress();
|
||||
|
||||
return Pl_Continue;
|
||||
}
|
||||
|
||||
void VoteMenuHandler::OnTimerEnd(ITimer *pTimer, void *pData)
|
||||
{
|
||||
m_displayTimer = NULL;
|
||||
}
|
||||
|
||||
+1
-12
@@ -36,7 +36,6 @@
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <sh_vector.h>
|
||||
#include "sm_globals.h"
|
||||
#include <TimerSys.h>
|
||||
|
||||
using namespace SourceHook;
|
||||
using namespace SourceMod;
|
||||
@@ -44,8 +43,7 @@ using namespace SourceMod;
|
||||
class VoteMenuHandler :
|
||||
public IMenuHandler,
|
||||
public SMGlobalClass,
|
||||
public IClientListener,
|
||||
public ITimedEvent
|
||||
public IClientListener
|
||||
{
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
@@ -63,9 +61,6 @@ public: //IMenuHandler
|
||||
void OnMenuEnd(IBaseMenu *menu, MenuEndReason reason);
|
||||
void OnMenuDrawItem(IBaseMenu *menu, int client, unsigned int item, unsigned int &style);
|
||||
unsigned int OnMenuDisplayItem(IBaseMenu *menu, int client, IMenuPanel *panel, unsigned int item, const ItemDrawInfo &dr);
|
||||
public: //ITimedEvent
|
||||
ResultType OnTimer(ITimer *pTimer, void *pData);
|
||||
void OnTimerEnd(ITimer *pTimer, void *pData);
|
||||
public:
|
||||
bool StartVote(IBaseMenu *menu,
|
||||
unsigned int num_clients,
|
||||
@@ -90,12 +85,9 @@ private:
|
||||
unsigned int time,
|
||||
unsigned int flags);
|
||||
void StartVoting();
|
||||
void DrawHintProgress();
|
||||
void BuildVoteLeaders();
|
||||
private:
|
||||
IMenuHandler *m_pHandler;
|
||||
unsigned int m_Clients;
|
||||
unsigned int m_TotalClients;
|
||||
unsigned int m_Items;
|
||||
CVector<unsigned int> m_Votes;
|
||||
IBaseMenu *m_pCurMenu;
|
||||
@@ -107,9 +99,6 @@ private:
|
||||
float m_fStartTime;
|
||||
unsigned int m_nMenuTime;
|
||||
int m_ClientVotes[256+1];
|
||||
bool m_Revoting[256+1];
|
||||
char m_leaderList[1024];
|
||||
ITimer *m_displayTimer;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_MENUVOTING_H_
|
||||
|
||||
+1
-5
@@ -49,11 +49,7 @@ SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &)
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
#else
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
|
||||
|
||||
+13
-58
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -48,7 +48,6 @@
|
||||
#include "GameConfigs.h"
|
||||
#include "ExtensionSys.h"
|
||||
#include <sourcemod_version.h>
|
||||
#include "ConsoleDetours.h"
|
||||
|
||||
PlayerManager g_Players;
|
||||
bool g_OnMapStarted = false;
|
||||
@@ -76,11 +75,7 @@ SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &)
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
#else
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# endif
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
|
||||
@@ -694,7 +689,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
ClientConsolePrint(pEntity,
|
||||
" David \"BAILOPAN\" Anderson, Borja \"faluco\" Ferrer");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Scott \"DS\" Ehlert, Matt \"pRED\" Woodrow");
|
||||
" Scott \"Damaged Soul\" Ehlert, Matt \"pRED\" Woodrow");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Michael \"ferret\" McKoy, Pavol \"PM OnoTo\" Marko");
|
||||
ClientConsolePrint(pEntity,
|
||||
@@ -730,27 +725,10 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ConsoleDetours.IsEnabled())
|
||||
{
|
||||
cell_t res2 = g_ConsoleDetours.InternalDispatch(client, args);
|
||||
if (res2 >= Pl_Stop)
|
||||
{
|
||||
g_HL2.PopCommandStack();
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
else if (res2 > res)
|
||||
{
|
||||
res = res2;
|
||||
}
|
||||
}
|
||||
|
||||
cell_t res2 = Pl_Continue;
|
||||
if (pPlayer->IsInGame())
|
||||
{
|
||||
m_clcommand->PushCell(client);
|
||||
m_clcommand->PushCell(argcount);
|
||||
m_clcommand->Execute(&res2, NULL);
|
||||
}
|
||||
m_clcommand->PushCell(client);
|
||||
m_clcommand->PushCell(argcount);
|
||||
m_clcommand->Execute(&res2, NULL);
|
||||
|
||||
if (res2 > res)
|
||||
{
|
||||
@@ -1175,18 +1153,10 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
||||
|
||||
if (strcmp(info->pattern, "@me") == 0 && info->admin != 0)
|
||||
{
|
||||
info->reason = FilterCommandTarget(pAdmin, pAdmin, info->flags);
|
||||
if (info->reason == COMMAND_TARGET_VALID)
|
||||
{
|
||||
info->targets[0] = info->admin;
|
||||
info->num_targets = 1;
|
||||
strncopy(info->target_name, pAdmin->GetName(), info->target_name_maxlength);
|
||||
info->target_name_style = COMMAND_TARGETNAME_RAW;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->num_targets = 0;
|
||||
}
|
||||
info->targets[0] = info->admin;
|
||||
info->num_targets = 1;
|
||||
strncopy(info->target_name, pAdmin->GetName(), info->target_name_maxlength);
|
||||
info->target_name_style = COMMAND_TARGETNAME_RAW;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1441,7 +1411,6 @@ CPlayer::CPlayer()
|
||||
m_TempAdmin = false;
|
||||
m_Info = NULL;
|
||||
m_bAdminCheckSignalled = false;
|
||||
m_UserId = -1;
|
||||
m_bIsInKickQueue = false;
|
||||
m_LastPassword.clear();
|
||||
m_LangId = SOURCEMOD_LANGUAGE_ENGLISH;
|
||||
@@ -1619,22 +1588,8 @@ void CPlayer::Kick(const char *str)
|
||||
{
|
||||
MarkAsBeingKicked();
|
||||
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(m_iIndex));
|
||||
if (pNetChan == NULL)
|
||||
{
|
||||
/* What does this even mean? Hell if I know. */
|
||||
int userid = GetUserId();
|
||||
if (userid > 0)
|
||||
{
|
||||
char buffer[255];
|
||||
UTIL_Format(buffer, sizeof(buffer), "kickid %d %s\n", userid, str);
|
||||
engine->ServerCommand(buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IClient *pClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
|
||||
pClient->Disconnect("%s", str);
|
||||
}
|
||||
IClient *pClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
|
||||
pClient->Disconnect("%s", str);
|
||||
}
|
||||
|
||||
void CPlayer::Authorize_Post()
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
void SetAdminId(AdminId id, bool temporary);
|
||||
AdminId GetAdminId();
|
||||
void Kick(const char *str);
|
||||
bool IsInKickQueue();
|
||||
IPlayerInfo *GetPlayerInfo();
|
||||
unsigned int GetLanguageId();
|
||||
int GetUserId();
|
||||
@@ -88,6 +87,7 @@ public:
|
||||
unsigned int GetSerial();
|
||||
public:
|
||||
void DoBasicAdminChecks();
|
||||
bool IsInKickQueue();
|
||||
void MarkAsBeingKicked();
|
||||
int GetLifeState();
|
||||
private:
|
||||
|
||||
+25
-62
@@ -37,6 +37,7 @@
|
||||
#include "ForwardSys.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "sourcemod.h"
|
||||
#include "TextParsers.h"
|
||||
#include "Logger.h"
|
||||
#include "ExtensionSys.h"
|
||||
#include "sm_srvcmds.h"
|
||||
@@ -56,10 +57,9 @@ CPlugin::CPlugin(const char *file)
|
||||
|
||||
m_type = PluginType_Private;
|
||||
m_status = Plugin_Uncompiled;
|
||||
m_bSilentlyFailed = false;
|
||||
m_serial = ++MySerial;
|
||||
m_pRuntime = NULL;
|
||||
m_errormsg[sizeof(m_errormsg) - 1] = '\0';
|
||||
m_errormsg[256] = '\0';
|
||||
UTIL_Format(m_filename, sizeof(m_filename), "%s", file);
|
||||
m_handle = 0;
|
||||
m_ident = NULL;
|
||||
@@ -386,27 +386,22 @@ void CPlugin::Call_OnAllPluginsLoaded()
|
||||
}
|
||||
}
|
||||
|
||||
APLRes CPlugin::Call_AskPluginLoad(char *error, size_t maxlength)
|
||||
bool CPlugin::Call_AskPluginLoad(char *error, size_t maxlength)
|
||||
{
|
||||
if (m_status != Plugin_Created)
|
||||
{
|
||||
return APLRes_Failure;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_status = Plugin_Loaded;
|
||||
|
||||
int err;
|
||||
cell_t result;
|
||||
bool haveNewAPL = false;
|
||||
IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("AskPluginLoad2");
|
||||
IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("AskPluginLoad");
|
||||
|
||||
if (pFunction)
|
||||
if (!pFunction)
|
||||
{
|
||||
haveNewAPL = true;
|
||||
}
|
||||
else if (!(pFunction = m_pRuntime->GetFunctionByName("AskPluginLoad")))
|
||||
{
|
||||
return APLRes_Success;
|
||||
return true;
|
||||
}
|
||||
|
||||
pFunction->PushCell(m_handle);
|
||||
@@ -415,21 +410,15 @@ APLRes CPlugin::Call_AskPluginLoad(char *error, size_t maxlength)
|
||||
pFunction->PushCell(maxlength);
|
||||
if ((err=pFunction->Execute(&result)) != SP_ERROR_NONE)
|
||||
{
|
||||
return APLRes_Failure;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (haveNewAPL)
|
||||
if (!result || m_status != Plugin_Loaded)
|
||||
{
|
||||
return (APLRes)result;
|
||||
}
|
||||
else if (result)
|
||||
{
|
||||
return APLRes_Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
return APLRes_Failure;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void *CPlugin::GetPluginStructure()
|
||||
@@ -481,11 +470,6 @@ PluginStatus CPlugin::GetStatus()
|
||||
return m_status;
|
||||
}
|
||||
|
||||
bool CPlugin::IsSilentlyFailed()
|
||||
{
|
||||
return m_bSilentlyFailed;
|
||||
}
|
||||
|
||||
bool CPlugin::IsDebugging()
|
||||
{
|
||||
if (m_pRuntime == NULL)
|
||||
@@ -496,11 +480,6 @@ bool CPlugin::IsDebugging()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPlugin::SetSilentlyFailed(bool sf)
|
||||
{
|
||||
m_bSilentlyFailed = sf;
|
||||
}
|
||||
|
||||
void CPlugin::LibraryActions(bool dropping)
|
||||
{
|
||||
List<String>::iterator iter;
|
||||
@@ -1025,31 +1004,20 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
}
|
||||
}
|
||||
|
||||
LoadRes loadFailure = LoadRes_Failure;
|
||||
/* Get the status */
|
||||
if (pPlugin->GetStatus() == Plugin_Created)
|
||||
{
|
||||
/* First native pass - add anything from Core */
|
||||
g_ShareSys.BindNativesToPlugin(pPlugin, true);
|
||||
pPlugin->InitIdentity();
|
||||
APLRes result = pPlugin->Call_AskPluginLoad(error, maxlength);
|
||||
switch (result)
|
||||
if (pPlugin->Call_AskPluginLoad(error, maxlength))
|
||||
{
|
||||
case APLRes_Success:
|
||||
/* Autoload any modules */
|
||||
LoadOrRequireExtensions(pPlugin, 1, error, maxlength);
|
||||
break;
|
||||
case APLRes_Failure:
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlugin->SetErrorState(Plugin_Failed, "%s", error);
|
||||
loadFailure = LoadRes_Failure;
|
||||
break;
|
||||
case APLRes_SilentFailure:
|
||||
pPlugin->SetErrorState(Plugin_Failed, "%s", error);
|
||||
loadFailure = LoadRes_SilentFailure;
|
||||
pPlugin->SetSilentlyFailed(true);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,7 +1030,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
*_plugin = pPlugin;
|
||||
}
|
||||
|
||||
return (pPlugin->GetStatus() == Plugin_Loaded) ? LoadRes_Successful : loadFailure;
|
||||
return (pPlugin->GetStatus() == Plugin_Loaded) ? LoadRes_Successful : LoadRes_Failure;
|
||||
}
|
||||
|
||||
IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType type, char error[], size_t maxlength, bool *wasloaded)
|
||||
@@ -1125,12 +1093,12 @@ void CPluginManager::LoadAutoPlugin(const char *plugin)
|
||||
{
|
||||
g_Logger.LogError("[SM] Failed to load plugin \"%s\": %s", plugin, error);
|
||||
pl->SetErrorState(
|
||||
pl->GetStatus() <= Plugin_Created ? Plugin_BadLoad : pl->GetStatus(),
|
||||
pl->GetStatus() == Plugin_BadLoad ? Plugin_BadLoad : Plugin_Failed,
|
||||
"%s",
|
||||
error);
|
||||
}
|
||||
|
||||
if (res == LoadRes_Successful || res == LoadRes_Failure || res == LoadRes_SilentFailure)
|
||||
if (res == LoadRes_Successful || res == LoadRes_Failure)
|
||||
{
|
||||
AddPlugin(pl);
|
||||
}
|
||||
@@ -1986,7 +1954,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
assert(pl->GetStatus() != Plugin_Created);
|
||||
int len = 0;
|
||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||
if (pl->GetStatus() != Plugin_Running && !pl->IsSilentlyFailed())
|
||||
if (pl->GetStatus() != Plugin_Running)
|
||||
{
|
||||
len += UTIL_Format(buffer, sizeof(buffer), " %02d <%s>", id, GetStatusText(pl->GetStatus()));
|
||||
|
||||
@@ -2002,8 +1970,6 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
}
|
||||
if (pl->GetStatus() < Plugin_Created)
|
||||
{
|
||||
if (pl->IsSilentlyFailed())
|
||||
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " Disabled:");
|
||||
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
||||
if (IS_STR_FILLED(info->version))
|
||||
{
|
||||
@@ -2052,7 +2018,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(filename) ? "" : ".smx";
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", filename, ext);
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", filename, ext);
|
||||
|
||||
IPlugin *pl = LoadPlugin(pluginfile, false, PluginType_MapUpdated, error, sizeof(error), &wasloaded);
|
||||
|
||||
@@ -2099,7 +2065,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
{
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx";
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
|
||||
if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl))
|
||||
{
|
||||
@@ -2189,7 +2155,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
{
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx";
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
|
||||
if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl))
|
||||
{
|
||||
@@ -2310,7 +2276,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
{
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx";
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
|
||||
if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl))
|
||||
{
|
||||
@@ -2321,10 +2287,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
char name[PLATFORM_MAX_PATH];
|
||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||
if (pl->GetStatus() <= Plugin_Paused)
|
||||
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
||||
else
|
||||
strcpy(name, pl->GetFilename());
|
||||
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
||||
|
||||
if (ReloadPlugin(pl))
|
||||
{
|
||||
|
||||
+2
-13
@@ -47,7 +47,7 @@
|
||||
#include "sm_trie.h"
|
||||
#include "sourcemod.h"
|
||||
#include <IRootConsoleMenu.h>
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#include "convar_sm_l4d.h"
|
||||
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||
#include "convar_sm_ob.h"
|
||||
@@ -117,17 +117,9 @@ enum LoadRes
|
||||
LoadRes_Successful,
|
||||
LoadRes_AlreadyLoaded,
|
||||
LoadRes_Failure,
|
||||
LoadRes_SilentFailure,
|
||||
LoadRes_NeverLoad
|
||||
};
|
||||
|
||||
enum APLRes
|
||||
{
|
||||
APLRes_Success,
|
||||
APLRes_Failure,
|
||||
APLRes_SilentFailure
|
||||
};
|
||||
|
||||
struct AutoConfig
|
||||
{
|
||||
String autocfg;
|
||||
@@ -154,8 +146,6 @@ public:
|
||||
const char *GetFilename();
|
||||
bool IsDebugging();
|
||||
PluginStatus GetStatus();
|
||||
bool IsSilentlyFailed();
|
||||
void SetSilentlyFailed(bool sf);
|
||||
const sm_plugininfo_t *GetPublicInfo();
|
||||
bool SetPauseState(bool paused);
|
||||
unsigned int GetSerial();
|
||||
@@ -193,7 +183,7 @@ public:
|
||||
*
|
||||
* If the error buffer is NULL, the error message is cached locally.
|
||||
*/
|
||||
APLRes Call_AskPluginLoad(char *error, size_t maxlength);
|
||||
bool Call_AskPluginLoad(char *error, size_t maxlength);
|
||||
|
||||
/**
|
||||
* Calls the OnPluginStart function.
|
||||
@@ -257,7 +247,6 @@ private:
|
||||
PluginType m_type;
|
||||
char m_filename[PLATFORM_MAX_PATH];
|
||||
PluginStatus m_status;
|
||||
bool m_bSilentlyFailed;
|
||||
unsigned int m_serial;
|
||||
sm_plugininfo_t m_info;
|
||||
char m_errormsg[256];
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
*/
|
||||
|
||||
#include "Profiler.h"
|
||||
#include <ISourceMod.h>
|
||||
#include "PluginSys.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "Logger.h"
|
||||
#if defined PLATFORM_POSIX
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <IPluginSys.h>
|
||||
|
||||
ProfileEngine g_Profiler;
|
||||
IProfiler *sm_profiler = &g_Profiler;
|
||||
@@ -313,28 +314,28 @@ void ProfileEngine::Clear()
|
||||
|
||||
void ProfileEngine::OnSourceModAllInitialized()
|
||||
{
|
||||
rootmenu->AddRootConsoleCommand2("profiler", "Profiler commands", this);
|
||||
g_RootMenu.AddRootConsoleCommand("profiler", "Profiler commands", this);
|
||||
}
|
||||
|
||||
void ProfileEngine::OnSourceModShutdown()
|
||||
{
|
||||
rootmenu->RemoveRootConsoleCommand("profiler", this);
|
||||
g_RootMenu.RemoveRootConsoleCommand("profiler", this);
|
||||
}
|
||||
|
||||
void ProfileEngine::OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *command)
|
||||
void ProfileEngine::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
{
|
||||
if (command->ArgC() >= 3)
|
||||
if (command.ArgC() >= 3)
|
||||
{
|
||||
if (strcmp(command->Arg(2), "flush") == 0)
|
||||
if (strcmp(command.Arg(2), "flush") == 0)
|
||||
{
|
||||
FILE *fp;
|
||||
char path[256];
|
||||
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "logs/profile_%d.xml", (int)time(NULL));
|
||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "logs/profile_%d.xml", (int)time(NULL));
|
||||
|
||||
if ((fp = fopen(path, "wt")) == NULL)
|
||||
{
|
||||
rootmenu->ConsolePrint("Failed, could not open file for writing: %s", path);
|
||||
g_RootMenu.ConsolePrint("Failed, could not open file for writing: %s", path);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -342,14 +343,14 @@ void ProfileEngine::OnRootConsoleCommand2(const char *cmdname, const ICommandArg
|
||||
|
||||
fclose(fp);
|
||||
|
||||
rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
|
||||
g_RootMenu.ConsolePrint("Profiler report generated as: %s\n", path);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rootmenu->ConsolePrint("Profiler commands:");
|
||||
rootmenu->DrawGenericOption("flush", "Flushes statistics to disk and starts over");
|
||||
g_RootMenu.ConsolePrint("Profiler commands:");
|
||||
g_RootMenu.DrawGenericOption("flush", "Flushes statistics to disk and starts over");
|
||||
}
|
||||
|
||||
bool ProfileEngine::GenerateReport(FILE *fp)
|
||||
@@ -386,9 +387,9 @@ void ProfileEngine::WriteReport(FILE *fp, ProfileReport *report, const char *nam
|
||||
{
|
||||
ar = report->GetReport(i);
|
||||
|
||||
smcore.strncopy(new_name, ar->atom_name, sizeof(new_name));
|
||||
smcore.ReplaceAll(new_name, sizeof(new_name), "<", "<", true);
|
||||
smcore.ReplaceAll(new_name, sizeof(new_name), ">", ">", true);
|
||||
strncopy(new_name, ar->atom_name, sizeof(new_name));
|
||||
UTIL_ReplaceAll(new_name, sizeof(new_name), "<", "<");
|
||||
UTIL_ReplaceAll(new_name, sizeof(new_name), ">", ">");
|
||||
|
||||
fprintf(fp, " <item name=\"%s\" numcalls=\"%d\" mintime=\"%f\" maxtime=\"%f\" totaltime=\"%f\"/>\n",
|
||||
new_name,
|
||||
@@ -437,20 +438,20 @@ void ProfileReport::SaveAtom(const prof_atom_t &atom)
|
||||
|
||||
if (atom.atom_type == SP_PROF_NATIVES)
|
||||
{
|
||||
smcore.strncopy(full_name, atom.name, sizeof(full_name));
|
||||
strncopy(full_name, atom.name, sizeof(full_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
IPlugin *pl;
|
||||
CPlugin *pl;
|
||||
const char *file;
|
||||
|
||||
file = "unknown";
|
||||
if ((pl = pluginsys->FindPluginByContext(atom.ctx)) != NULL)
|
||||
if ((pl = g_PluginSys.GetPluginByCtx(atom.ctx)) != NULL)
|
||||
{
|
||||
file = pl->GetFilename();
|
||||
}
|
||||
|
||||
smcore.Format(full_name, sizeof(full_name), "%s!%s", file, atom.name);
|
||||
UTIL_Format(full_name, sizeof(full_name), "%s!%s", file, atom.name);
|
||||
}
|
||||
|
||||
atom_time = CalcAtomTime(atom);
|
||||
@@ -459,7 +460,7 @@ void ProfileReport::SaveAtom(const prof_atom_t &atom)
|
||||
{
|
||||
report = new prof_atom_report_t;
|
||||
|
||||
smcore.strncopy(report->atom_name, full_name, sizeof(report->atom_name));
|
||||
strncopy(report->atom_name, full_name, sizeof(report->atom_name));
|
||||
report->max_time = atom_time;
|
||||
report->min_time = atom_time;
|
||||
report->num_calls = 1;
|
||||
@@ -38,8 +38,8 @@
|
||||
#include <sh_vector.h>
|
||||
#include <sh_stack.h>
|
||||
#include <stdio.h>
|
||||
#include "common_logic.h"
|
||||
#include <IRootConsoleMenu.h>
|
||||
#include "sm_globals.h"
|
||||
#include "sm_srvcmds.h"
|
||||
|
||||
using namespace SourcePawn;
|
||||
using namespace SourceHook;
|
||||
@@ -103,7 +103,7 @@ public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
void OnSourceModShutdown();
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *command);
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
public: //IProfiler
|
||||
void OnNativeBegin(IPluginContext *pContext, sp_native_t *native);
|
||||
void OnNativeEnd() ;
|
||||
@@ -126,6 +126,6 @@ private:
|
||||
prof_point_t m_ProfStart;
|
||||
};
|
||||
|
||||
extern IProfiler *sm_profiler;
|
||||
extern ProfileEngine g_Profiler;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_PLUGIN_PROFILER_H_
|
||||
@@ -527,85 +527,3 @@ NativeEntry *ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name
|
||||
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
void ShareSystem::AddCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name)
|
||||
{
|
||||
if (m_caps.retrieve(name) != NULL)
|
||||
return;
|
||||
|
||||
Capability cap;
|
||||
cap.ext = myself;
|
||||
cap.provider = provider;
|
||||
|
||||
m_caps.insert(name, cap);
|
||||
}
|
||||
|
||||
void ShareSystem::DropCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name)
|
||||
{
|
||||
Capability *pCap = m_caps.retrieve(name);
|
||||
if (pCap == NULL)
|
||||
return;
|
||||
|
||||
if (pCap->ext != myself || pCap->provider != provider)
|
||||
return;
|
||||
|
||||
m_caps.remove(name);
|
||||
}
|
||||
|
||||
FeatureStatus ShareSystem::TestFeature(IPluginRuntime *pRuntime, FeatureType feature,
|
||||
const char *name)
|
||||
{
|
||||
switch (feature)
|
||||
{
|
||||
case FeatureType_Native:
|
||||
return TestNative(pRuntime, name);
|
||||
case FeatureType_Capability:
|
||||
return TestCap(name);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FeatureStatus_Unknown;
|
||||
}
|
||||
|
||||
FeatureStatus ShareSystem::TestNative(IPluginRuntime *pRuntime, const char *name)
|
||||
{
|
||||
uint32_t index;
|
||||
|
||||
if (pRuntime->FindNativeByName(name, &index) == SP_ERROR_NONE)
|
||||
{
|
||||
sp_native_t *native;
|
||||
if (pRuntime->GetNativeByIndex(index, &native) == SP_ERROR_NONE)
|
||||
{
|
||||
if (native->status == SP_NATIVE_BOUND)
|
||||
return FeatureStatus_Available;
|
||||
else
|
||||
return FeatureStatus_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
NativeEntry *entry = FindNative(name);
|
||||
if (entry == NULL)
|
||||
return FeatureStatus_Unknown;
|
||||
|
||||
if ((entry->replacement.owner != NULL || entry->owner != NULL) &&
|
||||
(entry->replacement.func != NULL || entry->func != NULL))
|
||||
{
|
||||
return FeatureStatus_Available;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FeatureStatus_Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
FeatureStatus ShareSystem::TestCap(const char *name)
|
||||
{
|
||||
Capability *cap = m_caps.retrieve(name);
|
||||
if (cap == NULL)
|
||||
return FeatureStatus_Unknown;
|
||||
|
||||
return cap->provider->GetFeatureStatus(FeatureType_Capability, name);
|
||||
}
|
||||
|
||||
+1
-15
@@ -87,13 +87,7 @@ struct NativeEntry
|
||||
FakeNative *fake;
|
||||
};
|
||||
|
||||
struct Capability
|
||||
{
|
||||
IExtension *ext;
|
||||
IFeatureProvider *provider;
|
||||
};
|
||||
|
||||
class ShareSystem :
|
||||
class ShareSystem :
|
||||
public IShareSys,
|
||||
public SMGlobalClass,
|
||||
public IHandleTypeDispatch
|
||||
@@ -116,10 +110,6 @@ public: //IShareSys
|
||||
void AddDependency(IExtension *myself, const char *filename, bool require, bool autoload);
|
||||
void RegisterLibrary(IExtension *myself, const char *name);
|
||||
void OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives);
|
||||
void AddCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name);
|
||||
void DropCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name);
|
||||
public: //SMGlobalClass
|
||||
/* Pre-empt in case anything tries to register idents early */
|
||||
void Initialize();
|
||||
@@ -129,9 +119,6 @@ public: //IHandleTypeDispatch
|
||||
public:
|
||||
IdentityToken_t *CreateCoreIdentity();
|
||||
void RemoveInterfaces(IExtension *pExtension);
|
||||
FeatureStatus TestFeature(IPluginRuntime *pRuntime, FeatureType feature, const char *name);
|
||||
FeatureStatus TestNative(IPluginRuntime *pRuntime, const char *name);
|
||||
FeatureStatus TestCap(const char *name);
|
||||
public:
|
||||
inline IdentityToken_t *GetIdentRoot()
|
||||
{
|
||||
@@ -156,7 +143,6 @@ private:
|
||||
HandleType_t m_IfaceType;
|
||||
IdentityType_t m_CoreType;
|
||||
KTrie<NativeEntry *> m_NtvCache;
|
||||
KTrie<Capability> m_caps;
|
||||
};
|
||||
|
||||
extern ShareSystem g_ShareSys;
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "TextParsers.h"
|
||||
#include <ILibrarySys.h>
|
||||
#include "ShareSys.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "LibrarySys.h"
|
||||
|
||||
TextParsers g_TextParser;
|
||||
ITextParsers *textparsers = &g_TextParser;
|
||||
@@ -69,7 +71,7 @@ TextParsers::TextParsers()
|
||||
|
||||
void TextParsers::OnSourceModAllInitialized()
|
||||
{
|
||||
sharesys->AddInterface(NULL, this);
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
unsigned int TextParsers::GetUTF8CharBytes(const char *stream)
|
||||
@@ -133,8 +135,8 @@ SMCError TextParsers::ParseSMCFile(const char *file,
|
||||
states->line = 0;
|
||||
states->col = 0;
|
||||
}
|
||||
libsys->GetPlatformError(error, sizeof(error));
|
||||
smcore.Format(buffer, maxsize, "File could not be opened: %s", error);
|
||||
g_LibSys.GetPlatformError(error, sizeof(error));
|
||||
UTIL_Format(buffer, maxsize, "File could not be opened: %s", error);
|
||||
return SMCError_StreamOpen;
|
||||
}
|
||||
|
||||
@@ -143,7 +145,7 @@ SMCError TextParsers::ParseSMCFile(const char *file,
|
||||
fclose(fp);
|
||||
|
||||
errstr = GetSMCErrorString(result);
|
||||
smcore.Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error");
|
||||
UTIL_Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error");
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -194,7 +196,7 @@ SMCError TextParsers::ParseSMCStream(const char *stream,
|
||||
result = ParseStream_SMC(&rs, RawStreamReader, smc_listener, states);
|
||||
|
||||
const char *errstr = GetSMCErrorString(result);
|
||||
smcore.Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error");
|
||||
UTIL_Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error");
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -33,7 +33,7 @@
|
||||
#define _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
|
||||
|
||||
#include <ITextParsers.h>
|
||||
#include "common_logic.h"
|
||||
#include "sm_globals.h"
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -28,9 +28,10 @@
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
#include <sm_platform.h>
|
||||
|
||||
#include "ThreadSupport.h"
|
||||
#include "common_logic.h"
|
||||
#include "sm_globals.h"
|
||||
#include "ShareSys.h"
|
||||
|
||||
#if defined PLATFORM_POSIX
|
||||
#include "thread/PosixThreads.h"
|
||||
@@ -46,7 +47,6 @@ class RegThreadStuff : public SMGlobalClass
|
||||
public:
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
sharesys->AddInterface(NULL, g_pThreader);
|
||||
g_ShareSys.AddInterface(NULL, g_pThreader);
|
||||
}
|
||||
} s_RegThreadStuff;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
UserMessages g_UserMsgs;
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
SH_DECL_HOOK3(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int, const char *);
|
||||
#else
|
||||
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
|
||||
@@ -168,13 +168,13 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
|
||||
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||
#else
|
||||
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||
#endif
|
||||
} else {
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||
#else
|
||||
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||
@@ -316,7 +316,7 @@ void UserMessages::_DecRefCounter()
|
||||
}
|
||||
}
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#else
|
||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
|
||||
@@ -346,7 +346,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#else
|
||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
|
||||
@@ -500,7 +500,7 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
{
|
||||
bf_write *engine_bfw;
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId, g_SMAPI->GetUserMessage(m_CurId));
|
||||
#else
|
||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public: //IUserMessages
|
||||
IUserMessageListener *pListener,
|
||||
bool intercept=false);
|
||||
public:
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
#else
|
||||
|
||||
+2
-31
@@ -39,9 +39,6 @@
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
||||
SH_DECL_HOOK1_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
||||
#else
|
||||
SH_DECL_HOOK1_void(ICvar, RegisterConCommandBase, SH_NOATTRIB, 0, ConCommandBase *);
|
||||
#endif
|
||||
|
||||
using namespace SourceHook;
|
||||
@@ -54,55 +51,29 @@ struct ConCommandInfo
|
||||
};
|
||||
|
||||
List<ConCommandInfo *> tracked_bases;
|
||||
IConCommandLinkListener *IConCommandLinkListener::head = NULL;
|
||||
|
||||
ConCommandBase *FindConCommandBase(const char *name);
|
||||
|
||||
class ConCommandCleaner : public SMGlobalClass
|
||||
{
|
||||
public:
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_ADD_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
|
||||
SH_ADD_HOOK_MEMFUNC(ICvar, RegisterConCommand, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
|
||||
#else
|
||||
SH_ADD_HOOK_MEMFUNC(ICvar, RegisterConCommandBase, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_REMOVE_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(ICvar, RegisterConCommand, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
|
||||
#else
|
||||
SH_REMOVE_HOOK_MEMFUNC(ICvar, RegisterConCommandBase, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LinkConCommandBase(ConCommandBase *pBase)
|
||||
{
|
||||
IConCommandLinkListener *listener = IConCommandLinkListener::head;
|
||||
while (listener)
|
||||
{
|
||||
listener->OnLinkConCommand(pBase);
|
||||
listener = listener->next;
|
||||
}
|
||||
}
|
||||
|
||||
void UnlinkConCommandBase(ConCommandBase *pBase)
|
||||
{
|
||||
ConCommandInfo *pInfo;
|
||||
List<ConCommandInfo *>::iterator iter = tracked_bases.begin();
|
||||
|
||||
IConCommandLinkListener *listener = IConCommandLinkListener::head;
|
||||
while (listener)
|
||||
{
|
||||
listener->OnUnlinkConCommand(pBase);
|
||||
listener = listener->next;
|
||||
}
|
||||
|
||||
if (pBase)
|
||||
{
|
||||
while (iter != tracked_bases.end())
|
||||
|
||||
@@ -42,26 +42,4 @@ void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
||||
void UntrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
||||
void Global_OnUnlinkConCommandBase(ConCommandBase *pBase);
|
||||
|
||||
class IConCommandLinkListener
|
||||
{
|
||||
friend class ConCommandCleaner;
|
||||
|
||||
static IConCommandLinkListener *head;
|
||||
IConCommandLinkListener *next;
|
||||
public:
|
||||
IConCommandLinkListener()
|
||||
{
|
||||
next = head;
|
||||
head = this;
|
||||
}
|
||||
|
||||
virtual void OnLinkConCommand(ConCommandBase *pBase)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void OnUnlinkConCommand(ConCommandBase *pBase)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_CONCMD_TRACKER_H_
|
||||
|
||||
@@ -386,9 +386,6 @@ public:
|
||||
virtual void SetValue( const char *value );
|
||||
virtual void SetValue( float value );
|
||||
virtual void SetValue( int value );
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
virtual void SetValue( Color value );
|
||||
#endif
|
||||
|
||||
// Reset to default value
|
||||
void Revert( void );
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "PlayerManager.h"
|
||||
#include "CoreConfig.h"
|
||||
#include <sm_queue.h>
|
||||
#include <IThreader.h>
|
||||
#include "ThreadSupport.h"
|
||||
|
||||
static IMutex *frame_mutex;
|
||||
static Queue<FrameAction> *frame_queue;
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
|
||||
compiler = SM.DefaultCompiler()
|
||||
base = AMBuild.sourceFolder
|
||||
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(base, 'core', 'logic'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(base, 'public'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'sourcepawn'))
|
||||
compiler['CDEFINES'].append('SM_DEFAULT_THREADER')
|
||||
compiler['CDEFINES'].append('SM_LOGIC')
|
||||
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
compiler['POSTLINKFLAGS'].append('-lpthread')
|
||||
|
||||
extension = AMBuild.AddJob('sourcemod.logic')
|
||||
binary = Cpp.LibraryBuilder('sourcemod.logic', AMBuild, extension, compiler)
|
||||
files = [
|
||||
'common_logic.cpp',
|
||||
'smn_adt_array.cpp',
|
||||
'smn_sorting.cpp',
|
||||
'smn_maplists.cpp',
|
||||
'smn_adt_stack.cpp',
|
||||
'thread/ThreadWorker.cpp',
|
||||
'thread/BaseWorker.cpp',
|
||||
'ThreadSupport.cpp',
|
||||
'smn_float.cpp',
|
||||
'TextParsers.cpp',
|
||||
'smn_textparse.cpp',
|
||||
'smn_adt_trie.cpp',
|
||||
'Profiler.cpp',
|
||||
'smn_functions.cpp'
|
||||
]
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
files.append('thread/WinThreads.cpp')
|
||||
else:
|
||||
files.append('thread/PosixThreads.cpp')
|
||||
binary.AddSourceFiles('core/logic', files)
|
||||
SM.AutoVersion('core/logic', binary)
|
||||
binary.SendToJob()
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
# (C)2004-2008 SourceMod Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
SMSDK = ../..
|
||||
MMSOURCE17 = ../../../mmsource-1.7
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
BINARY = sourcemod.logic.so
|
||||
|
||||
OBJECTS = \
|
||||
common_logic.cpp \
|
||||
smn_adt_array.cpp \
|
||||
smn_sorting.cpp \
|
||||
smn_maplists.cpp \
|
||||
smn_adt_stack.cpp \
|
||||
thread/ThreadWorker.cpp \
|
||||
thread/BaseWorker.cpp \
|
||||
thread/PosixThreads.cpp \
|
||||
ThreadSupport.cpp \
|
||||
smn_float.cpp \
|
||||
TextParsers.cpp \
|
||||
smn_textparse.cpp \
|
||||
smn_adt_trie.cpp \
|
||||
Profiler.cpp \
|
||||
smn_functions.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
|
||||
LINK += -lpthread -static-libgcc
|
||||
|
||||
INCLUDE += -I. -I$(MMSOURCE17)/core/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||
|
||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
|
||||
-Wno-uninitialized -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -DSM_DEFAULT_THREADER -m32 \
|
||||
-DSM_LOGIC
|
||||
CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
endif
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
$(BIN_DIR)/%.o: %.c
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)/thread
|
||||
$(MAKE) -f Makefile sourcemod
|
||||
|
||||
sourcemod: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) -f Makefile all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/thread/*.o
|
||||
rm -rf $(BIN_DIR)/$(BINARY)
|
||||
@@ -1,399 +0,0 @@
|
||||
// MersenneTwister.h
|
||||
// Mersenne Twister random number generator -- a C++ class MTRand
|
||||
// Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
|
||||
// Richard J. Wagner v1.0 15 May 2003 [email protected]
|
||||
|
||||
// The Mersenne Twister is an algorithm for generating random numbers. It
|
||||
// was designed with consideration of the flaws in various other generators.
|
||||
// The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
|
||||
// are far greater. The generator is also fast; it avoids multiplication and
|
||||
// division, and it benefits from caches and pipelines. For more information
|
||||
// see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
|
||||
|
||||
// Reference
|
||||
// M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
|
||||
// Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
|
||||
// Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
|
||||
|
||||
// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
||||
// Copyright (C) 2000 - 2003, Richard J. Wagner
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The names of its contributors may not be used to endorse or promote
|
||||
// products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// The original code included the following notice:
|
||||
//
|
||||
// When you use this, send an email to: [email protected]
|
||||
// with an appropriate reference to your work.
|
||||
//
|
||||
// It would be nice to CC: [email protected] and [email protected]
|
||||
// when you write.
|
||||
|
||||
#ifndef MERSENNETWISTER_H
|
||||
#define MERSENNETWISTER_H
|
||||
|
||||
// Not thread safe (unless auto-initialization is avoided and each thread has
|
||||
// its own MTRand object)
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
|
||||
class MTRand {
|
||||
// Data
|
||||
public:
|
||||
typedef unsigned long uint32; // unsigned integer type, at least 32 bits
|
||||
|
||||
enum { N = 624 }; // length of state vector
|
||||
enum { SAVE = N + 1 }; // length of array for save()
|
||||
|
||||
protected:
|
||||
enum { M = 397 }; // period parameter
|
||||
|
||||
uint32 state[N]; // internal state
|
||||
uint32 *pNext; // next value to get from state
|
||||
int left; // number of values left before reload needed
|
||||
|
||||
|
||||
//Methods
|
||||
public:
|
||||
MTRand( const uint32& oneSeed ); // initialize with a simple uint32
|
||||
MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array
|
||||
MTRand(); // auto-initialize with /dev/urandom or time() and clock()
|
||||
|
||||
// Do NOT use for CRYPTOGRAPHY without securely hashing several returned
|
||||
// values together, otherwise the generator state can be learned after
|
||||
// reading 624 consecutive values.
|
||||
|
||||
// Access to 32-bit random numbers
|
||||
double rand(); // real number in [0,1]
|
||||
double rand( const double& n ); // real number in [0,n]
|
||||
double randExc(); // real number in [0,1)
|
||||
double randExc( const double& n ); // real number in [0,n)
|
||||
double randDblExc(); // real number in (0,1)
|
||||
double randDblExc( const double& n ); // real number in (0,n)
|
||||
uint32 randInt(); // integer in [0,2^32-1]
|
||||
uint32 randInt( const uint32& n ); // integer in [0,n] for n < 2^32
|
||||
double operator()() { return rand(); } // same as rand()
|
||||
|
||||
// Access to 53-bit random numbers (capacity of IEEE double precision)
|
||||
double rand53(); // real number in [0,1)
|
||||
|
||||
// Access to nonuniform random number distributions
|
||||
double randNorm( const double& mean = 0.0, const double& variance = 0.0 );
|
||||
|
||||
// Re-seeding functions with same behavior as initializers
|
||||
void seed( const uint32 oneSeed );
|
||||
void seed( uint32 *const bigSeed, const uint32 seedLength = N );
|
||||
void seed();
|
||||
|
||||
// Saving and loading generator state
|
||||
void save( uint32* saveArray ) const; // to array of size SAVE
|
||||
void load( uint32 *const loadArray ); // from such array
|
||||
protected:
|
||||
void initialize( const uint32 oneSeed );
|
||||
void reload();
|
||||
uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; }
|
||||
uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; }
|
||||
uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; }
|
||||
uint32 mixBits( const uint32& u, const uint32& v ) const
|
||||
{ return hiBit(u) | loBits(v); }
|
||||
uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const
|
||||
{ return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); }
|
||||
static uint32 hash( time_t t, clock_t c );
|
||||
};
|
||||
|
||||
|
||||
inline MTRand::MTRand( const uint32& oneSeed )
|
||||
{ seed(oneSeed); }
|
||||
|
||||
inline MTRand::MTRand( uint32 *const bigSeed, const uint32 seedLength )
|
||||
{ seed(bigSeed,seedLength); }
|
||||
|
||||
inline MTRand::MTRand()
|
||||
{ seed(); }
|
||||
|
||||
inline double MTRand::rand()
|
||||
{ return double(randInt()) * (1.0/4294967295.0); }
|
||||
|
||||
inline double MTRand::rand( const double& n )
|
||||
{ return rand() * n; }
|
||||
|
||||
inline double MTRand::randExc()
|
||||
{ return double(randInt()) * (1.0/4294967296.0); }
|
||||
|
||||
inline double MTRand::randExc( const double& n )
|
||||
{ return randExc() * n; }
|
||||
|
||||
inline double MTRand::randDblExc()
|
||||
{ return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); }
|
||||
|
||||
inline double MTRand::randDblExc( const double& n )
|
||||
{ return randDblExc() * n; }
|
||||
|
||||
inline double MTRand::rand53()
|
||||
{
|
||||
uint32 a = randInt() >> 5, b = randInt() >> 6;
|
||||
return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0); // by Isaku Wada
|
||||
}
|
||||
|
||||
inline double MTRand::randNorm( const double& mean, const double& variance )
|
||||
{
|
||||
// Return a real number from a normal (Gaussian) distribution with given
|
||||
// mean and variance by Box-Muller method
|
||||
double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance;
|
||||
double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
|
||||
return mean + r * cos(phi);
|
||||
}
|
||||
|
||||
inline MTRand::uint32 MTRand::randInt()
|
||||
{
|
||||
// Pull a 32-bit integer from the generator state
|
||||
// Every other access function simply transforms the numbers extracted here
|
||||
|
||||
if( left == 0 ) reload();
|
||||
--left;
|
||||
|
||||
register uint32 s1;
|
||||
s1 = *pNext++;
|
||||
s1 ^= (s1 >> 11);
|
||||
s1 ^= (s1 << 7) & 0x9d2c5680UL;
|
||||
s1 ^= (s1 << 15) & 0xefc60000UL;
|
||||
return ( s1 ^ (s1 >> 18) );
|
||||
}
|
||||
|
||||
inline MTRand::uint32 MTRand::randInt( const uint32& n )
|
||||
{
|
||||
// Find which bits are used in n
|
||||
// Optimized by Magnus Jonsson ([email protected])
|
||||
uint32 used = n;
|
||||
used |= used >> 1;
|
||||
used |= used >> 2;
|
||||
used |= used >> 4;
|
||||
used |= used >> 8;
|
||||
used |= used >> 16;
|
||||
|
||||
// Draw numbers until one is found in [0,n]
|
||||
uint32 i;
|
||||
do
|
||||
i = randInt() & used; // toss unused bits to shorten search
|
||||
while( i > n );
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
inline void MTRand::seed( const uint32 oneSeed )
|
||||
{
|
||||
// Seed the generator with a simple uint32
|
||||
initialize(oneSeed);
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength )
|
||||
{
|
||||
// Seed the generator with an array of uint32's
|
||||
// There are 2^19937-1 possible initial states. This function allows
|
||||
// all of those to be accessed by providing at least 19937 bits (with a
|
||||
// default seed length of N = 624 uint32's). Any bits above the lower 32
|
||||
// in each element are discarded.
|
||||
// Just call seed() if you want to get array from /dev/urandom
|
||||
initialize(19650218UL);
|
||||
register int i = 1;
|
||||
register uint32 j = 0;
|
||||
register int k = ( N > seedLength ? N : seedLength );
|
||||
for( ; k; --k )
|
||||
{
|
||||
state[i] =
|
||||
state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL );
|
||||
state[i] += ( bigSeed[j] & 0xffffffffUL ) + j;
|
||||
state[i] &= 0xffffffffUL;
|
||||
++i; ++j;
|
||||
if( i >= N ) { state[0] = state[N-1]; i = 1; }
|
||||
if( j >= seedLength ) j = 0;
|
||||
}
|
||||
for( k = N - 1; k; --k )
|
||||
{
|
||||
state[i] =
|
||||
state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL );
|
||||
state[i] -= i;
|
||||
state[i] &= 0xffffffffUL;
|
||||
++i;
|
||||
if( i >= N ) { state[0] = state[N-1]; i = 1; }
|
||||
}
|
||||
state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
inline void MTRand::seed()
|
||||
{
|
||||
// Seed the generator with an array from /dev/urandom if available
|
||||
// Otherwise use a hash of time() and clock() values
|
||||
|
||||
// First try getting an array from /dev/urandom
|
||||
FILE* urandom = fopen( "/dev/urandom", "rb" );
|
||||
if( urandom )
|
||||
{
|
||||
uint32 bigSeed[N];
|
||||
register uint32 *s = bigSeed;
|
||||
register int i = N;
|
||||
register bool success = true;
|
||||
while( success && i-- )
|
||||
success = fread( s++, sizeof(uint32), 1, urandom );
|
||||
fclose(urandom);
|
||||
if( success ) { seed( bigSeed, N ); return; }
|
||||
}
|
||||
|
||||
// Was not successful, so use time() and clock() instead
|
||||
seed( hash( time(NULL), clock() ) );
|
||||
}
|
||||
|
||||
|
||||
inline void MTRand::initialize( const uint32 seed )
|
||||
{
|
||||
// Initialize generator state with seed
|
||||
// See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
|
||||
// In previous versions, most significant bits (MSBs) of the seed affect
|
||||
// only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto.
|
||||
register uint32 *s = state;
|
||||
register uint32 *r = state;
|
||||
register int i = 1;
|
||||
*s++ = seed & 0xffffffffUL;
|
||||
for( ; i < N; ++i )
|
||||
{
|
||||
*s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL;
|
||||
r++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void MTRand::reload()
|
||||
{
|
||||
// Generate N new values in state
|
||||
// Made clearer and faster by Matthew Bellew ([email protected])
|
||||
register uint32 *p = state;
|
||||
register int i;
|
||||
for( i = N - M; i--; ++p )
|
||||
*p = twist( p[M], p[0], p[1] );
|
||||
for( i = M; --i; ++p )
|
||||
*p = twist( p[M-N], p[0], p[1] );
|
||||
*p = twist( p[M-N], p[0], state[0] );
|
||||
|
||||
left = N, pNext = state;
|
||||
}
|
||||
|
||||
|
||||
inline MTRand::uint32 MTRand::hash( time_t t, clock_t c )
|
||||
{
|
||||
// Get a uint32 from t and c
|
||||
// Better than uint32(x) in case x is floating point in [0,1]
|
||||
// Based on code by Lawrence Kirby ([email protected])
|
||||
|
||||
static uint32 differ = 0; // guarantee time-based seeds will change
|
||||
|
||||
uint32 h1 = 0;
|
||||
unsigned char *p = (unsigned char *) &t;
|
||||
for( size_t i = 0; i < sizeof(t); ++i )
|
||||
{
|
||||
h1 *= UCHAR_MAX + 2U;
|
||||
h1 += p[i];
|
||||
}
|
||||
uint32 h2 = 0;
|
||||
p = (unsigned char *) &c;
|
||||
for( size_t j = 0; j < sizeof(c); ++j )
|
||||
{
|
||||
h2 *= UCHAR_MAX + 2U;
|
||||
h2 += p[j];
|
||||
}
|
||||
return ( h1 + differ++ ) ^ h2;
|
||||
}
|
||||
|
||||
|
||||
inline void MTRand::save( uint32* saveArray ) const
|
||||
{
|
||||
register uint32 *sa = saveArray;
|
||||
register const uint32 *s = state;
|
||||
register int i = N;
|
||||
for( ; i--; *sa++ = *s++ ) {}
|
||||
*sa = left;
|
||||
}
|
||||
|
||||
|
||||
inline void MTRand::load( uint32 *const loadArray )
|
||||
{
|
||||
register uint32 *s = state;
|
||||
register uint32 *la = loadArray;
|
||||
register int i = N;
|
||||
for( ; i--; *s++ = *la++ ) {}
|
||||
left = *la;
|
||||
pNext = &state[N-left];
|
||||
}
|
||||
|
||||
#endif // MERSENNETWISTER_H
|
||||
|
||||
// Change log:
|
||||
//
|
||||
// v0.1 - First release on 15 May 2000
|
||||
// - Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
|
||||
// - Translated from C to C++
|
||||
// - Made completely ANSI compliant
|
||||
// - Designed convenient interface for initialization, seeding, and
|
||||
// obtaining numbers in default or user-defined ranges
|
||||
// - Added automatic seeding from /dev/urandom or time() and clock()
|
||||
// - Provided functions for saving and loading generator state
|
||||
//
|
||||
// v0.2 - Fixed bug which reloaded generator one step too late
|
||||
//
|
||||
// v0.3 - Switched to clearer, faster reload() code from Matthew Bellew
|
||||
//
|
||||
// v0.4 - Removed trailing newline in saved generator format to be consistent
|
||||
// with output format of built-in types
|
||||
//
|
||||
// v0.5 - Improved portability by replacing static const int's with enum's and
|
||||
// clarifying return values in seed(); suggested by Eric Heimburg
|
||||
// - Removed MAXINT constant; use 0xffffffffUL instead
|
||||
//
|
||||
// v0.6 - Eliminated seed overflow when uint32 is larger than 32 bits
|
||||
// - Changed integer [0,n] generator to give better uniformity
|
||||
//
|
||||
// v0.7 - Fixed operator precedence ambiguity in reload()
|
||||
// - Added access for real numbers in (0,1) and (0,n)
|
||||
//
|
||||
// v0.8 - Included time.h header to properly support time_t and clock_t
|
||||
//
|
||||
// v1.0 - Revised seeding to match 26 Jan 2002 update of Nishimura and Matsumoto
|
||||
// - Allowed for seeding with arrays of any length
|
||||
// - Added access for real numbers in [0,1) with 53-bit resolution
|
||||
// - Added access for real numbers from normal (Gaussian) distributions
|
||||
// - Increased overall speed by optimizing twist()
|
||||
// - Doubled speed of integer [0,n] generation
|
||||
// - Fixed out-of-range number generation on 64-bit machines
|
||||
// - Improved portability by substituting literal constants for long enum's
|
||||
// - Changed license from GNU LGPL to BSD
|
||||
@@ -1,124 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
#include <new>
|
||||
#include <stdlib.h>
|
||||
#include <sm_platform.h>
|
||||
#include <string.h>
|
||||
#include "common_logic.h"
|
||||
#include "ThreadSupport.h"
|
||||
#include "TextParsers.h"
|
||||
#include "Profiler.h"
|
||||
|
||||
sm_core_t smcore;
|
||||
IHandleSys *handlesys;
|
||||
IdentityToken_t *g_pCoreIdent;
|
||||
SMGlobalClass *SMGlobalClass::head = NULL;
|
||||
ISourceMod *g_pSM;
|
||||
ILibrarySys *libsys;
|
||||
ITextParsers *textparser = &g_TextParser;
|
||||
IVEngineServer *engine;
|
||||
IShareSys *sharesys;
|
||||
IRootConsole *rootmenu;
|
||||
IPluginManager *pluginsys;
|
||||
IForwardManager *forwardsys;
|
||||
|
||||
static sm_logic_t logic =
|
||||
{
|
||||
NULL,
|
||||
g_pThreader,
|
||||
sm_profiler
|
||||
};
|
||||
|
||||
static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
||||
{
|
||||
logic.head = SMGlobalClass::head;
|
||||
|
||||
memcpy(&smcore, core, sizeof(sm_core_t));
|
||||
memcpy(_logic, &logic, sizeof(sm_logic_t));
|
||||
|
||||
handlesys = core->handlesys;
|
||||
libsys = core->libsys;
|
||||
engine = core->engine;
|
||||
g_pCoreIdent = core->core_ident;
|
||||
g_pSM = core->sm;
|
||||
sharesys = core->sharesys;
|
||||
rootmenu = core->rootmenu;
|
||||
pluginsys = core->pluginsys;
|
||||
forwardsys = core->forwardsys;
|
||||
}
|
||||
|
||||
PLATFORM_EXTERN_C ITextParsers *get_textparsers()
|
||||
{
|
||||
return &g_TextParser;
|
||||
}
|
||||
|
||||
PLATFORM_EXTERN_C LogicInitFunction logic_load(uint32_t magic)
|
||||
{
|
||||
if (magic != SM_LOGIC_MAGIC)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return logic_init;
|
||||
}
|
||||
|
||||
void CoreNativesToAdd::OnSourceModAllInitialized()
|
||||
{
|
||||
smcore.AddNatives(m_NativeList);
|
||||
}
|
||||
|
||||
/* Overload a few things to prevent libstdc++ linking */
|
||||
#if defined __linux__ || defined __APPLE__
|
||||
extern "C" void __cxa_pure_virtual(void)
|
||||
{
|
||||
}
|
||||
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void *operator new[](size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void operator delete(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void * ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_COMMON_LOGIC_H_
|
||||
#define _INCLUDE_SOURCEMOD_COMMON_LOGIC_H_
|
||||
|
||||
#include <IHandleSys.h>
|
||||
|
||||
#include "../sm_globals.h"
|
||||
#include "intercom.h"
|
||||
|
||||
extern sm_core_t smcore;
|
||||
extern IHandleSys *handlesys;
|
||||
extern ISourceMod *g_pSM;
|
||||
extern ILibrarySys *libsys;
|
||||
extern ITextParsers *textparser;
|
||||
extern IVEngineServer *engine;
|
||||
extern IShareSys *sharesys;
|
||||
extern IRootConsole *rootmenu;
|
||||
extern IPluginManager *pluginsys;
|
||||
extern IForwardManager *forwardsys;
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_COMMON_LOGIC_H_ */
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include <sp_vm_api.h>
|
||||
#include <IHandleSys.h>
|
||||
#include <IShareSys.h>
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_INTERCOM_H_
|
||||
#define _INCLUDE_SOURCEMOD_INTERCOM_H_
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
/**
|
||||
* Add 1 to the RHS of this expression to bump the intercom file
|
||||
* This is to prevent mismatching core/logic binaries
|
||||
*/
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 2)
|
||||
|
||||
#if defined SM_LOGIC
|
||||
class IVEngineServer
|
||||
#else
|
||||
class IVEngineServer_Logic
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
virtual bool IsMapValid(const char *map) = 0;
|
||||
};
|
||||
|
||||
namespace SourceMod
|
||||
{
|
||||
class ISourceMod;
|
||||
class ILibrarySys;
|
||||
class ITextParsers;
|
||||
class IThreader;
|
||||
class IRootConsole;
|
||||
class IPluginManager;
|
||||
class IForwardManager;
|
||||
}
|
||||
|
||||
class IVEngineServer;
|
||||
class ConVar;
|
||||
|
||||
struct sm_core_t
|
||||
{
|
||||
/* Objects */
|
||||
IHandleSys *handlesys;
|
||||
IdentityToken_t *core_ident;
|
||||
ISourceMod *sm;
|
||||
ILibrarySys *libsys;
|
||||
IVEngineServer *engine;
|
||||
IShareSys *sharesys;
|
||||
IRootConsole *rootmenu;
|
||||
IPluginManager *pluginsys;
|
||||
IForwardManager *forwardsys;
|
||||
/* Functions */
|
||||
void (*AddNatives)(sp_nativeinfo_t* nlist);
|
||||
ConVar * (*FindConVar)(const char*);
|
||||
unsigned int (*strncopy)(char*, const char*, size_t);
|
||||
char * (*TrimWhitespace)(char *, size_t &);
|
||||
void (*LogError)(const char*, ...);
|
||||
const char * (*GetCvarString)(ConVar*);
|
||||
size_t (*Format)(char*, size_t, const char*, ...);
|
||||
unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
|
||||
};
|
||||
|
||||
struct sm_logic_t
|
||||
{
|
||||
SMGlobalClass *head;
|
||||
IThreader *threader;
|
||||
IProfiler *profiler;
|
||||
};
|
||||
|
||||
typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
|
||||
typedef LogicInitFunction (*LogicLoadFunction)(uint32_t magic);
|
||||
typedef ITextParsers *(*GetITextParsers)();
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_INTERCOM_H_ */
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logic", "logic.vcproj", "{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,323 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="logic"
|
||||
ProjectGUID="{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}"
|
||||
RootNamespace="jitx86"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..;"$(MMSOURCE17)\core\sourcehook";..\..\..\public;..\..\..\public\sourcepawn"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\sourcepawn.jit.x86.dll"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..;"$(MMSOURCE17)\core\sourcehook";..\..\..\public;..\..\..\public\sourcepawn"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_LOGIC;SM_DEFAULT_THREADER"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\sourcemod.logic.dll"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\smn_functions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_trie.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common_logic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_array.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_stack.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_float.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_maplists.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_sorting.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_textparse.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TextParsers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ThreadSupport.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\CellArray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common_logic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\intercom.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\svn_version.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TextParsers.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ThreadSupport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\svn_version.tpl"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\version.rc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Threads"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\thread\BaseWorker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\ThreadWorker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\WinThreads.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\thread\BaseWorker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\ThreadWorker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\WinThreads.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,104 +0,0 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
//#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
#include <sourcemod_version.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION SM_FILE_VERSION
|
||||
PRODUCTVERSION SM_FILE_VERSION
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "SourceMod"
|
||||
VALUE "FileDescription", "SourceMod Core Logic"
|
||||
VALUE "FileVersion", SM_FULL_VERSION
|
||||
VALUE "InternalName", "sourcemod"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2004-2009, AlliedModders LLC"
|
||||
VALUE "OriginalFilename", "sourcemod.logic.dll"
|
||||
VALUE "ProductName", "SourceMod"
|
||||
VALUE "ProductVersion", SM_FULL_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "sourcemod.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "sm_globals.h"
|
||||
#include "NativeOwner.h"
|
||||
#include "sm_autonatives.h"
|
||||
#include "logic/intercom.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "HandleSys.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "Logger.h"
|
||||
#include "ShareSys.h"
|
||||
#include "sm_srvcmds.h"
|
||||
#include "ForwardSys.h"
|
||||
|
||||
static ILibrary *g_pLogic = NULL;
|
||||
static LogicInitFunction logic_init_fn;
|
||||
|
||||
IThreader *g_pThreader;
|
||||
ITextParsers *textparsers;
|
||||
|
||||
class VEngineServer_Logic : public IVEngineServer_Logic
|
||||
{
|
||||
public:
|
||||
virtual bool IsMapValid(const char *map)
|
||||
{
|
||||
return engine->IsMapValid(map);
|
||||
}
|
||||
};
|
||||
|
||||
static VEngineServer_Logic logic_engine;
|
||||
|
||||
static void add_natives(sp_nativeinfo_t *natives)
|
||||
{
|
||||
g_pCoreNatives->AddNatives(natives);
|
||||
}
|
||||
|
||||
static ConVar *find_convar(const char *name)
|
||||
{
|
||||
return icvar->FindVar(name);
|
||||
}
|
||||
|
||||
static void log_error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
g_Logger.LogErrorEx(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static const char *get_cvar_string(ConVar* cvar)
|
||||
{
|
||||
return cvar->GetString();
|
||||
}
|
||||
|
||||
static sm_core_t core_bridge =
|
||||
{
|
||||
/* Objects */
|
||||
&g_HandleSys,
|
||||
NULL,
|
||||
&g_SourceMod,
|
||||
&g_LibSys,
|
||||
reinterpret_cast<IVEngineServer*>(&logic_engine),
|
||||
&g_ShareSys,
|
||||
&g_RootMenu,
|
||||
&g_PluginSys,
|
||||
&g_Forwards,
|
||||
/* Functions */
|
||||
add_natives,
|
||||
find_convar,
|
||||
strncopy,
|
||||
UTIL_TrimWhitespace,
|
||||
log_error,
|
||||
get_cvar_string,
|
||||
UTIL_Format,
|
||||
UTIL_ReplaceAll
|
||||
};
|
||||
|
||||
void InitLogicBridge()
|
||||
{
|
||||
sm_logic_t logic;
|
||||
|
||||
core_bridge.core_ident = g_pCoreIdent;
|
||||
logic_init_fn(&core_bridge, &logic);
|
||||
|
||||
/* Add SMGlobalClass instances */
|
||||
SMGlobalClass* glob = SMGlobalClass::head;
|
||||
while (glob->m_pGlobalClassNext != NULL)
|
||||
{
|
||||
glob = glob->m_pGlobalClassNext;
|
||||
}
|
||||
assert(glob->m_pGlobalClassNext == NULL);
|
||||
glob->m_pGlobalClassNext = logic.head;
|
||||
|
||||
g_pThreader = logic.threader;
|
||||
g_pSourcePawn2->SetProfiler(logic.profiler);
|
||||
}
|
||||
|
||||
bool StartLogicBridge(char *error, size_t maxlength)
|
||||
{
|
||||
char file[PLATFORM_MAX_PATH];
|
||||
|
||||
/* Now it's time to load the logic binary */
|
||||
g_SMAPI->PathFormat(file,
|
||||
sizeof(file),
|
||||
"%s/bin/sourcemod.logic." PLATFORM_LIB_EXT,
|
||||
g_SourceMod.GetSourceModPath());
|
||||
|
||||
char myerror[255];
|
||||
g_pLogic = g_LibSys.OpenLibrary(file, myerror, sizeof(myerror));
|
||||
|
||||
if (!g_pLogic)
|
||||
{
|
||||
if (error && maxlength)
|
||||
{
|
||||
UTIL_Format(error, maxlength, "failed to load %s: %s", file, myerror);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
LogicLoadFunction llf = (LogicLoadFunction)g_pLogic->GetSymbolAddress("logic_load");
|
||||
if (llf == NULL)
|
||||
{
|
||||
g_pLogic->CloseLibrary();
|
||||
if (error && maxlength)
|
||||
{
|
||||
UTIL_Format(error, maxlength, "could not find logic_load function");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
GetITextParsers getitxt = (GetITextParsers)g_pLogic->GetSymbolAddress("get_textparsers");
|
||||
textparsers = getitxt();
|
||||
|
||||
logic_init_fn = llf(SM_LOGIC_MAGIC);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShutdownLogicBridge()
|
||||
{
|
||||
g_pLogic->CloseLibrary();
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
#ifndef _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
|
||||
#define _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
|
||||
|
||||
void InitLogicBridge();
|
||||
bool StartLogicBridge(char *error, size_t maxlength);
|
||||
void ShutdownLogicBridge();
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_ */
|
||||
|
||||
@@ -7,21 +7,18 @@ Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CrazyDebug - Dark Messiah|Win32 = CrazyDebug - Dark Messiah|Win32
|
||||
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
|
||||
CrazyDebug - Left 4 Dead 2|Win32 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
|
||||
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
|
||||
CrazyDebug - Orange Box Valve|Win32 = CrazyDebug - Orange Box Valve|Win32
|
||||
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
|
||||
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
|
||||
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||
Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32
|
||||
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
|
||||
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
|
||||
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||
Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32
|
||||
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
|
||||
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
|
||||
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
|
||||
@@ -32,8 +29,6 @@ Global
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.Build.0 = CrazyDebug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.ActiveCfg = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.Build.0 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.ActiveCfg = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.Build.0 = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
|
||||
@@ -46,8 +41,6 @@ Global
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
|
||||
@@ -60,8 +53,6 @@ Global
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
|
||||
|
||||
+92
-309
@@ -60,7 +60,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -143,7 +142,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -225,7 +223,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -310,7 +307,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -393,7 +389,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -475,7 +470,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -560,7 +554,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -643,7 +636,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -725,7 +717,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -810,7 +801,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -893,7 +883,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -975,7 +964,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1060,7 +1048,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1143,7 +1130,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1225,7 +1211,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1310,7 +1295,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1393,7 +1377,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1465,7 +1448,6 @@
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
AssemblerOutput="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
@@ -1476,7 +1458,6 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1517,256 +1498,6 @@
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="CrazyDebug - Left 4 Dead 2|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5 /D SE_LEFT4DEAD2=6"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""$(HL2SDKL4D2)\lib\public\tier0.lib" "$(HL2SDKL4D2)\lib\public\tier1.lib" "$(HL2SDKL4D2)\lib\public\vstdlib.lib" "$(HL2SDKL4D2)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||
OutputFile="$(OutDir)\sourcemod.2.l4d2.dll"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug - Left 4 Dead 2|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5 /D SE_LEFT4DEAD2=6"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""$(HL2SDKL4D2)\lib\public\tier0.lib" "$(HL2SDKL4D2)\lib\public\tier1.lib" "$(HL2SDKL4D2)\lib\public\vstdlib.lib" "$(HL2SDKL4D2)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||
OutputFile="$(OutDir)\sourcemod.2.l4d2.dll"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release - Left 4 Dead 2|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5 /D SE_LEFT4DEAD2=6"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""$(HL2SDKL4D2)\lib\public\tier0.lib" "$(HL2SDKL4D2)\lib\public\tier1.lib" "$(HL2SDKL4D2)\lib\public\vstdlib.lib" "$(HL2SDKL4D2)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||
OutputFile="$(OutDir)\sourcemod.2.l4d2.dll"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
@@ -1800,10 +1531,6 @@
|
||||
RelativePath="..\ConCmdManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ConsoleDetours.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ConVarManager.cpp"
|
||||
>
|
||||
@@ -1911,22 +1638,6 @@
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug - Left 4 Dead 2|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release - Left 4 Dead 2|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Database.cpp"
|
||||
@@ -1972,10 +1683,6 @@
|
||||
RelativePath="..\Logger.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\logic_bridge.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MemoryUtils.cpp"
|
||||
>
|
||||
@@ -2028,6 +1735,10 @@
|
||||
RelativePath="..\PluginSys.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ShareSys.cpp"
|
||||
>
|
||||
@@ -2064,6 +1775,14 @@
|
||||
RelativePath="..\sourcemod.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TextParsers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ThreadSupport.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TimerSys.cpp"
|
||||
>
|
||||
@@ -2118,14 +1837,6 @@
|
||||
RelativePath="..\ConCmdManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ConCommandBaseIterator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ConsoleDetours.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ConVarManager.h"
|
||||
>
|
||||
@@ -2178,10 +1889,6 @@
|
||||
RelativePath="..\Logger.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\logic_bridge.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MemoryUtils.h"
|
||||
>
|
||||
@@ -2234,6 +1941,10 @@
|
||||
RelativePath="..\PluginSys.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ShareSys.h"
|
||||
>
|
||||
@@ -2278,10 +1989,6 @@
|
||||
RelativePath="..\sm_stringutil.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_symtable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_trie.h"
|
||||
>
|
||||
@@ -2306,6 +2013,14 @@
|
||||
RelativePath="..\sourcemod.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TextParsers.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ThreadSupport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TimerSys.h"
|
||||
>
|
||||
@@ -2454,6 +2169,18 @@
|
||||
RelativePath="..\smn_admin.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_array.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_stack.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_trie.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_banning.cpp"
|
||||
>
|
||||
@@ -2494,6 +2221,14 @@
|
||||
RelativePath="..\smn_filesystem.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_float.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_functions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_gameconfigs.cpp"
|
||||
>
|
||||
@@ -2518,6 +2253,10 @@
|
||||
RelativePath="..\smn_lang.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_maplists.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_menus.cpp"
|
||||
>
|
||||
@@ -2534,10 +2273,18 @@
|
||||
RelativePath="..\smn_profiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_sorting.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_string.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_textparse.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_timers.cpp"
|
||||
>
|
||||
@@ -2561,6 +2308,42 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Threader"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\thread\BaseWorker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\ThreadWorker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\WinThreads.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\thread\BaseWorker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\ThreadWorker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\thread\WinThreads.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
||||
+4
-18
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -76,11 +76,7 @@ class SMGlobalClass
|
||||
friend class CExtensionManager;
|
||||
friend class PlayerManager;
|
||||
public:
|
||||
SMGlobalClass()
|
||||
{
|
||||
m_pGlobalClassNext = SMGlobalClass::head;
|
||||
SMGlobalClass::head = this;
|
||||
}
|
||||
SMGlobalClass();
|
||||
public:
|
||||
/**
|
||||
* @brief Called when SourceMod is initially loading
|
||||
@@ -188,7 +184,7 @@ public:
|
||||
virtual void OnSourceModMaxPlayersChanged(int newvalue)
|
||||
{
|
||||
}
|
||||
public:
|
||||
private:
|
||||
SMGlobalClass *m_pGlobalClassNext;
|
||||
static SMGlobalClass *head;
|
||||
};
|
||||
@@ -197,16 +193,6 @@ extern ISourcePawnEngine *g_pSourcePawn;
|
||||
extern ISourcePawnEngine2 *g_pSourcePawn2;
|
||||
extern IdentityToken_t *g_pCoreIdent;
|
||||
|
||||
namespace SourceMod
|
||||
{
|
||||
class IThreader;
|
||||
class ITextParsers;
|
||||
}
|
||||
|
||||
extern IThreader *g_pThreader;
|
||||
extern ITextParsers *textparsers;
|
||||
|
||||
#include "sm_autonatives.h"
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_GLOBALS_H_
|
||||
|
||||
|
||||
+27
-85
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -116,25 +116,14 @@ void RootConsoleMenu::ConsolePrint(const char *fmt, ...)
|
||||
}
|
||||
|
||||
bool RootConsoleMenu::AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler)
|
||||
{
|
||||
return _AddRootConsoleCommand(cmd, text, pHandler, false);
|
||||
}
|
||||
|
||||
bool RootConsoleMenu::AddRootConsoleCommand2(const char *cmd, const char *text, IRootConsoleCommand *pHandler)
|
||||
{
|
||||
return _AddRootConsoleCommand(cmd, text, pHandler, true);
|
||||
}
|
||||
|
||||
bool RootConsoleMenu::_AddRootConsoleCommand(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler,
|
||||
bool version2)
|
||||
{
|
||||
if (sm_trie_retrieve(m_pCommands, cmd, NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
sm_trie_insert(m_pCommands, cmd, pHandler);
|
||||
|
||||
/* Sort this into the menu */
|
||||
List<ConsoleEntry *>::iterator iter = m_Menu.begin();
|
||||
ConsoleEntry *pEntry;
|
||||
@@ -147,9 +136,6 @@ bool RootConsoleMenu::_AddRootConsoleCommand(const char *cmd,
|
||||
ConsoleEntry *pNew = new ConsoleEntry;
|
||||
pNew->command.assign(cmd);
|
||||
pNew->description.assign(text);
|
||||
pNew->version2 = version2;
|
||||
pNew->cmd = pHandler;
|
||||
sm_trie_insert(m_pCommands, cmd, pNew);
|
||||
m_Menu.insert(iter, pNew);
|
||||
inserted = true;
|
||||
break;
|
||||
@@ -162,9 +148,6 @@ bool RootConsoleMenu::_AddRootConsoleCommand(const char *cmd,
|
||||
ConsoleEntry *pNew = new ConsoleEntry;
|
||||
pNew->command.assign(cmd);
|
||||
pNew->description.assign(text);
|
||||
pNew->version2 = version2;
|
||||
pNew->cmd = pHandler;
|
||||
sm_trie_insert(m_pCommands, cmd, pNew);
|
||||
m_Menu.push_back(pNew);
|
||||
}
|
||||
|
||||
@@ -173,6 +156,18 @@ bool RootConsoleMenu::_AddRootConsoleCommand(const char *cmd,
|
||||
|
||||
bool RootConsoleMenu::RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler)
|
||||
{
|
||||
/* Sanity tests */
|
||||
IRootConsoleCommand *object;
|
||||
if (sm_trie_retrieve(m_pCommands, cmd, (void **)&object))
|
||||
{
|
||||
if (object != pHandler)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
sm_trie_delete(m_pCommands, cmd);
|
||||
|
||||
List<ConsoleEntry *>::iterator iter;
|
||||
@@ -219,49 +214,6 @@ unsigned int RootConsoleMenu::GetInterfaceVersion()
|
||||
return SMINTERFACE_ROOTCONSOLE_VERSION;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE==SE_EPISODEONE || SOURCE_ENGINE==SE_DARKMESSIAH
|
||||
class CCommandArgs : public ICommandArgs
|
||||
{
|
||||
public:
|
||||
CCommandArgs(const CCommand& _cmd)
|
||||
{
|
||||
}
|
||||
const char *Arg(int n) const
|
||||
{
|
||||
return engine->Cmd_Argv(n);
|
||||
}
|
||||
int ArgC() const
|
||||
{
|
||||
return engine->Cmd_Argc();
|
||||
}
|
||||
const char *ArgS() const
|
||||
{
|
||||
return engine->Cmd_Args();
|
||||
}
|
||||
};
|
||||
#else
|
||||
class CCommandArgs : public ICommandArgs
|
||||
{
|
||||
const CCommand *cmd;
|
||||
public:
|
||||
CCommandArgs(const CCommand& _cmd) : cmd(&_cmd)
|
||||
{
|
||||
}
|
||||
const char *Arg(int n) const
|
||||
{
|
||||
return cmd->Arg(n);
|
||||
}
|
||||
int ArgC() const
|
||||
{
|
||||
return cmd->ArgC();
|
||||
}
|
||||
const char *ArgS() const
|
||||
{
|
||||
return cmd->ArgS();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
void RootConsoleMenu::GotRootCmd(const CCommand &cmd)
|
||||
{
|
||||
unsigned int argnum = cmd.ArgC();
|
||||
@@ -289,19 +241,10 @@ void RootConsoleMenu::GotRootCmd(const CCommand &cmd)
|
||||
return;
|
||||
}
|
||||
|
||||
CCommandArgs ocmd(cmd);
|
||||
|
||||
ConsoleEntry *entry;
|
||||
if (sm_trie_retrieve(m_pCommands, cmdname, (void **)&entry))
|
||||
IRootConsoleCommand *pHandler;
|
||||
if (sm_trie_retrieve(m_pCommands, cmdname, (void **)&pHandler))
|
||||
{
|
||||
if (entry->version2)
|
||||
{
|
||||
entry->cmd->OnRootConsoleCommand2(cmdname, &ocmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->cmd->OnRootConsoleCommand(cmdname, cmd);
|
||||
}
|
||||
pHandler->OnRootConsoleCommand(cmdname, cmd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -324,14 +267,14 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
|
||||
{
|
||||
ConsolePrint(" SourceMod was developed by AlliedModders, LLC.");
|
||||
ConsolePrint(" Development would not have been possible without the following people:");
|
||||
ConsolePrint(" David \"BAILOPAN\" Anderson");
|
||||
ConsolePrint(" Matt \"pRED\" Woodrow");
|
||||
ConsolePrint(" Scott \"DS\" Ehlert");
|
||||
ConsolePrint(" Fyren");
|
||||
ConsolePrint(" Borja \"faluco\" Ferrer");
|
||||
ConsolePrint(" Pavol \"PM OnoTo\" Marko");
|
||||
ConsolePrint(" Special thanks to Liam, psychonic, ferret, and Mani");
|
||||
ConsolePrint(" Special thanks to Viper and SteamFriends");
|
||||
ConsolePrint(" David \"BAILOPAN\" Anderson, lead developer");
|
||||
ConsolePrint(" Borja \"faluco\" Ferrer, core developer");
|
||||
ConsolePrint(" Scott \"Damaged Soul\" Ehlert, core developer");
|
||||
ConsolePrint(" Matt \"pRED\" Woodrow, core developer");
|
||||
ConsolePrint(" Michael \"ferret\" McKoy, plugin developer");
|
||||
ConsolePrint(" Pavol \"PM OnoTo\" Marko, SourceHook developer");
|
||||
ConsolePrint(" Special thanks to Viper of GameConnect");
|
||||
ConsolePrint(" Special thanks to Mani of Mani-Admin-Plugin");
|
||||
ConsolePrint(" http://www.sourcemod.net/");
|
||||
}
|
||||
else if (strcmp(cmdname, "version") == 0)
|
||||
@@ -414,4 +357,3 @@ CON_COMMAND(sm_dump_handles, "Dumps Handle usage to a file for finding Handle le
|
||||
g_HandleSys.Dump(write_handles_to_game);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-11
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -48,8 +48,6 @@ struct ConsoleEntry
|
||||
{
|
||||
String command;
|
||||
String description;
|
||||
bool version2;
|
||||
IRootConsoleCommand *cmd;
|
||||
};
|
||||
|
||||
class RootConsoleMenu :
|
||||
@@ -77,13 +75,6 @@ public: //IRootConsole
|
||||
bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler);
|
||||
void ConsolePrint(const char *fmt, ...);
|
||||
void DrawGenericOption(const char *cmd, const char *text);
|
||||
bool AddRootConsoleCommand2(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler);
|
||||
bool _AddRootConsoleCommand(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler,
|
||||
bool version2);
|
||||
public:
|
||||
void GotRootCmd(const CCommand &cmd);
|
||||
private:
|
||||
|
||||
@@ -1580,50 +1580,3 @@ char *UTIL_TrimWhitespace(char *str, size_t &len)
|
||||
return str;
|
||||
}
|
||||
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr)
|
||||
{
|
||||
size_t written = 0;
|
||||
size_t length = strlen(hexstr);
|
||||
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
if (written >= maxlength)
|
||||
break;
|
||||
buffer[written++] = hexstr[i];
|
||||
if (hexstr[i] == '\\' && hexstr[i + 1] == 'x')
|
||||
{
|
||||
if (i + 3 >= length)
|
||||
continue;
|
||||
/* Get the hex part. */
|
||||
char s_byte[3];
|
||||
int r_byte;
|
||||
s_byte[0] = hexstr[i + 2];
|
||||
s_byte[1] = hexstr[i + 3];
|
||||
s_byte[2] = '\0';
|
||||
/* Read it as an integer */
|
||||
sscanf(s_byte, "%x", &r_byte);
|
||||
/* Save the value */
|
||||
buffer[written - 1] = r_byte;
|
||||
/* Adjust index */
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
char *UTIL_ToLowerCase(const char *str)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
char *buffer = new char[len + 1];
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
if (str[i] >= 'A' && str[i] <= 'Z')
|
||||
buffer[i] = tolower(str[i]);
|
||||
else
|
||||
buffer[i] = str[i];
|
||||
}
|
||||
buffer[len] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,5 @@ char *sm_strdup(const char *str);
|
||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive = true);
|
||||
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive = true);
|
||||
char *UTIL_TrimWhitespace(char *str, size_t &len);
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);
|
||||
char *UTIL_ToLowerCase(const char *str);
|
||||
|
||||
#endif // _INCLUDE_SOURCEMOD_STRINGUTIL_H_
|
||||
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_CORE_SYMBOLTABLE_H_
|
||||
#define _INCLUDE_SOURCEMOD_CORE_SYMBOLTABLE_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define KESTRING_TABLE_START_SIZE 65536
|
||||
|
||||
struct Symbol
|
||||
{
|
||||
size_t length;
|
||||
uint32_t hash;
|
||||
void *address;
|
||||
Symbol *tbl_next;
|
||||
|
||||
inline char *buffer()
|
||||
{
|
||||
return reinterpret_cast<char *>(this + 1);
|
||||
}
|
||||
};
|
||||
|
||||
class SymbolTable
|
||||
{
|
||||
public:
|
||||
~SymbolTable()
|
||||
{
|
||||
for (uint32_t i = 0; i < nbuckets; i++)
|
||||
{
|
||||
Symbol *sym = buckets[i];
|
||||
while (sym != NULL)
|
||||
{
|
||||
Symbol *next = sym->tbl_next;
|
||||
free(sym);
|
||||
sym = next;
|
||||
}
|
||||
}
|
||||
free(buckets);
|
||||
}
|
||||
|
||||
bool Initialize()
|
||||
{
|
||||
buckets = (Symbol **)malloc(sizeof(Symbol *) * KESTRING_TABLE_START_SIZE);
|
||||
if (buckets == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
memset(buckets, 0, sizeof(Symbol *) * KESTRING_TABLE_START_SIZE);
|
||||
|
||||
nbuckets = KESTRING_TABLE_START_SIZE;
|
||||
nused = 0;
|
||||
bucketmask = KESTRING_TABLE_START_SIZE - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline uint32_t HashString(const char *data, size_t len)
|
||||
{
|
||||
#undef get16bits
|
||||
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|
||||
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
|
||||
#define get16bits(d) (*((const uint16_t *) (d)))
|
||||
#endif
|
||||
#if !defined (get16bits)
|
||||
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
|
||||
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
||||
#endif
|
||||
uint32_t hash = len, tmp;
|
||||
int rem;
|
||||
|
||||
if (len <= 0 || data == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
rem = len & 3;
|
||||
len >>= 2;
|
||||
|
||||
/* Main loop */
|
||||
for (;len > 0; len--) {
|
||||
hash += get16bits (data);
|
||||
tmp = (get16bits (data+2) << 11) ^ hash;
|
||||
hash = (hash << 16) ^ tmp;
|
||||
data += 2 * sizeof (uint16_t);
|
||||
hash += hash >> 11;
|
||||
}
|
||||
|
||||
/* Handle end cases */
|
||||
switch (rem) {
|
||||
case 3: hash += get16bits (data);
|
||||
hash ^= hash << 16;
|
||||
hash ^= data[sizeof (uint16_t)] << 18;
|
||||
hash += hash >> 11;
|
||||
break;
|
||||
case 2: hash += get16bits (data);
|
||||
hash ^= hash << 11;
|
||||
hash += hash >> 17;
|
||||
break;
|
||||
case 1: hash += *data;
|
||||
hash ^= hash << 10;
|
||||
hash += hash >> 1;
|
||||
}
|
||||
|
||||
/* Force "avalanching" of final 127 bits */
|
||||
hash ^= hash << 3;
|
||||
hash += hash >> 5;
|
||||
hash ^= hash << 4;
|
||||
hash += hash >> 17;
|
||||
hash ^= hash << 25;
|
||||
hash += hash >> 6;
|
||||
|
||||
return hash;
|
||||
|
||||
#undef get16bits
|
||||
}
|
||||
|
||||
Symbol **FindSymbolBucket(const char *str, size_t len, uint32_t hash)
|
||||
{
|
||||
uint32_t bucket = hash & bucketmask;
|
||||
Symbol **pkvs = &buckets[bucket];
|
||||
|
||||
Symbol *kvs = *pkvs;
|
||||
while (kvs != NULL)
|
||||
{
|
||||
if (len == kvs->length && memcmp(str, kvs->buffer(), len * sizeof(char)) == 0)
|
||||
{
|
||||
return pkvs;
|
||||
}
|
||||
pkvs = &kvs->tbl_next;
|
||||
kvs = *pkvs;
|
||||
}
|
||||
|
||||
return pkvs;
|
||||
}
|
||||
|
||||
void ResizeSymbolTable()
|
||||
{
|
||||
uint32_t xnbuckets = nbuckets * 2;
|
||||
Symbol **xbuckets = (Symbol **)malloc(sizeof(Symbol *) * xnbuckets);
|
||||
if (xbuckets == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
memset(xbuckets, 0, sizeof(Symbol *) * xnbuckets);
|
||||
uint32_t xbucketmask = xnbuckets - 1;
|
||||
for (uint32_t i = 0; i < nbuckets; i++)
|
||||
{
|
||||
Symbol *sym = buckets[i];
|
||||
while (sym != NULL)
|
||||
{
|
||||
Symbol *next = sym->tbl_next;
|
||||
uint32_t bucket = sym->hash & xbucketmask;
|
||||
sym->tbl_next = xbuckets[bucket];
|
||||
xbuckets[bucket] = sym;
|
||||
sym = next;
|
||||
}
|
||||
}
|
||||
free(buckets);
|
||||
buckets = xbuckets;
|
||||
nbuckets = xnbuckets;
|
||||
bucketmask = xbucketmask;
|
||||
}
|
||||
|
||||
Symbol *FindSymbol(const char *str, size_t len)
|
||||
{
|
||||
uint32_t hash = HashString(str, len);
|
||||
Symbol **pkvs = FindSymbolBucket(str, len, hash);
|
||||
return *pkvs;
|
||||
}
|
||||
|
||||
Symbol *InternSymbol(const char* str, size_t len, void *address)
|
||||
{
|
||||
uint32_t hash = HashString(str, len);
|
||||
Symbol **pkvs = FindSymbolBucket(str, len, hash);
|
||||
if (*pkvs != NULL)
|
||||
{
|
||||
return *pkvs;
|
||||
}
|
||||
|
||||
Symbol *kvs = (Symbol *)malloc(sizeof(Symbol) + sizeof(char) * (len + 1));
|
||||
kvs->length = len;
|
||||
kvs->hash = hash;
|
||||
kvs->address = address;
|
||||
kvs->tbl_next = NULL;
|
||||
memcpy(kvs + 1, str, sizeof(char) * (len + 1));
|
||||
*pkvs = kvs;
|
||||
nused++;
|
||||
|
||||
if (nused > nbuckets && nbuckets <= INT_MAX / 2)
|
||||
{
|
||||
ResizeSymbolTable();
|
||||
}
|
||||
|
||||
return kvs;
|
||||
}
|
||||
private:
|
||||
uint32_t nbuckets;
|
||||
uint32_t nused;
|
||||
uint32_t bucketmask;
|
||||
Symbol **buckets;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CORE_SYMBOLTABLE_H_
|
||||
@@ -30,8 +30,10 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "common_logic.h"
|
||||
#include "sm_globals.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "CellArray.h"
|
||||
#include "HandleSys.h"
|
||||
|
||||
HandleType_t htCellArray;
|
||||
|
||||
@@ -42,11 +44,11 @@ class CellArrayHelpers :
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
htCellArray = handlesys->CreateType("CellArray", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
htCellArray = g_HandleSys.CreateType("CellArray", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
handlesys->RemoveType(htCellArray, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(htCellArray, g_pCoreIdent);
|
||||
}
|
||||
public: //IHandleTypeDispatch
|
||||
void OnHandleDestroy(HandleType_t type, void *object)
|
||||
@@ -76,7 +78,7 @@ static cell_t CreateArray(IPluginContext *pContext, const cell_t *params)
|
||||
array->resize(params[2]);
|
||||
}
|
||||
|
||||
Handle_t hndl = handlesys->CreateHandle(htCellArray, array, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
Handle_t hndl = g_HandleSys.CreateHandle(htCellArray, array, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
if (!hndl)
|
||||
{
|
||||
delete array;
|
||||
@@ -91,7 +93,7 @@ static cell_t ClearArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -108,7 +110,7 @@ static cell_t ResizeArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -128,7 +130,7 @@ static cell_t GetArraySize(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -143,7 +145,7 @@ static cell_t PushArrayCell(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -166,7 +168,7 @@ static cell_t PushArrayString(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -181,7 +183,7 @@ static cell_t PushArrayString(IPluginContext *pContext, const cell_t *params)
|
||||
char *str;
|
||||
pContext->LocalToString(params[2], &str);
|
||||
|
||||
smcore.strncopy((char *)blk, str, array->blocksize() * sizeof(cell_t));
|
||||
strncopy((char *)blk, str, array->blocksize() * sizeof(cell_t));
|
||||
|
||||
return (cell_t)(array->size() - 1);
|
||||
}
|
||||
@@ -192,7 +194,7 @@ static cell_t PushArrayArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -224,7 +226,7 @@ static cell_t GetArrayCell(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -263,7 +265,7 @@ static cell_t GetArrayString(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -289,7 +291,7 @@ static cell_t GetArrayArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -322,7 +324,7 @@ static cell_t SetArrayCell(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -361,7 +363,7 @@ static cell_t SetArrayString(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -378,7 +380,7 @@ static cell_t SetArrayString(IPluginContext *pContext, const cell_t *params)
|
||||
char *str;
|
||||
pContext->LocalToString(params[3], &str);
|
||||
|
||||
return smcore.strncopy((char *)blk, str, array->blocksize() * sizeof(cell_t));
|
||||
return strncopy((char *)blk, str, array->blocksize() * sizeof(cell_t));
|
||||
}
|
||||
|
||||
static cell_t SetArrayArray(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -387,7 +389,7 @@ static cell_t SetArrayArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -420,7 +422,7 @@ static cell_t ShiftArrayUp(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -443,7 +445,7 @@ static cell_t RemoveFromArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -466,7 +468,7 @@ static cell_t SwapArrayItems(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -494,7 +496,7 @@ static cell_t CloneArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&oldArray))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&oldArray))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -502,7 +504,7 @@ static cell_t CloneArray(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
CellArray *array = oldArray->clone();
|
||||
|
||||
Handle_t hndl = handlesys->CreateHandle(htCellArray, array, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
Handle_t hndl = g_HandleSys.CreateHandle(htCellArray, array, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
if (!hndl)
|
||||
{
|
||||
delete array;
|
||||
@@ -517,7 +519,7 @@ static cell_t FindStringInArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -544,7 +546,7 @@ static cell_t FindValueInArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -30,8 +30,10 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "common_logic.h"
|
||||
#include "sm_globals.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "CellArray.h"
|
||||
#include "HandleSys.h"
|
||||
|
||||
HandleType_t htCellStack;
|
||||
|
||||
@@ -42,11 +44,11 @@ class CellStackHelpers :
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
htCellStack = handlesys->CreateType("CellStack", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
htCellStack = g_HandleSys.CreateType("CellStack", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
handlesys->RemoveType(htCellStack, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(htCellStack, g_pCoreIdent);
|
||||
}
|
||||
public: //IHandleTypeDispatch
|
||||
void OnHandleDestroy(HandleType_t type, void *object)
|
||||
@@ -71,7 +73,7 @@ static cell_t CreateStack(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
CellArray *array = new CellArray(params[1]);
|
||||
|
||||
Handle_t hndl = handlesys->CreateHandle(htCellStack, array, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
Handle_t hndl = g_HandleSys.CreateHandle(htCellStack, array, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
if (!hndl)
|
||||
{
|
||||
delete array;
|
||||
@@ -86,7 +88,7 @@ static cell_t PushStackCell(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -109,7 +111,7 @@ static cell_t PushStackString(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -124,7 +126,7 @@ static cell_t PushStackString(IPluginContext *pContext, const cell_t *params)
|
||||
char *str;
|
||||
pContext->LocalToString(params[2], &str);
|
||||
|
||||
smcore.strncopy((char *)blk, str, array->blocksize() * sizeof(cell_t));
|
||||
strncopy((char *)blk, str, array->blocksize() * sizeof(cell_t));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -135,7 +137,7 @@ static cell_t PushStackArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -169,7 +171,7 @@ static cell_t PopStackCell(IPluginContext *pContext, const cell_t *params)
|
||||
cell_t *blk, *buffer;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -215,7 +217,7 @@ static cell_t PopStackString(IPluginContext *pContext, const cell_t *params)
|
||||
cell_t *blk, *pWritten;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -246,7 +248,7 @@ static cell_t PopStackArray(IPluginContext *pContext, const cell_t *params)
|
||||
CellArray *array;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -279,7 +281,7 @@ static cell_t IsStackEmpty(IPluginContext *pContext, const cell_t *params)
|
||||
CellArray *array;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellStack, &sec, (void **)&array))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -30,8 +30,10 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "common_logic.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "sm_globals.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "HandleSys.h"
|
||||
#include "sm_trie_tpl.h"
|
||||
|
||||
HandleType_t htCellTrie;
|
||||
|
||||
@@ -83,11 +85,11 @@ class TrieHelpers :
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
htCellTrie = handlesys->CreateType("Trie", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
htCellTrie = g_HandleSys.CreateType("Trie", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
handlesys->RemoveType(htCellTrie, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(htCellTrie, g_pCoreIdent);
|
||||
}
|
||||
public: //IHandleTypeDispatch
|
||||
static void DestroySmartTrieNode(SmartTrieNode *pNode)
|
||||
@@ -117,7 +119,7 @@ static cell_t CreateTrie(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pTrie->mem_usage = 0;
|
||||
|
||||
if ((hndl = handlesys->CreateHandle(htCellTrie, pTrie, pContext->GetIdentity(), g_pCoreIdent, NULL))
|
||||
if ((hndl = g_HandleSys.CreateHandle(htCellTrie, pTrie, pContext->GetIdentity(), g_pCoreIdent, NULL))
|
||||
== BAD_HANDLE)
|
||||
{
|
||||
delete pTrie;
|
||||
@@ -189,7 +191,7 @@ static cell_t SetTrieValue(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -225,7 +227,7 @@ static cell_t SetTrieArray(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -273,7 +275,7 @@ static cell_t SetTrieString(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -315,7 +317,7 @@ static cell_t RemoveFromTrie(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -345,7 +347,7 @@ static cell_t ClearTrie(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -366,7 +368,7 @@ static cell_t GetTrieValue(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -401,7 +403,7 @@ static cell_t GetTrieArray(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -458,7 +460,7 @@ static cell_t GetTrieString(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -505,7 +507,7 @@ static cell_t GetTrieSize(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
hndl = params[1];
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellTrie, &sec, (void **)&pTrie))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -248,7 +248,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
char *ban_reason, *ban_cmd;
|
||||
int client, ban_flags, ban_source, ban_time;
|
||||
|
||||
client = g_HL2.ReferenceToIndex(params[1]);
|
||||
client = params[1];
|
||||
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
if (!pPlayer || !pPlayer->IsConnected())
|
||||
@@ -377,7 +377,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
/* Kick, then ban */
|
||||
if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK)
|
||||
{
|
||||
g_HL2.AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
|
||||
pPlayer->Kick(kick_message);
|
||||
}
|
||||
engine->ServerCommand(command);
|
||||
|
||||
@@ -390,7 +390,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
else if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK)
|
||||
{
|
||||
g_HL2.AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
|
||||
pPlayer->Kick(kick_message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-12
@@ -33,7 +33,6 @@
|
||||
#include "HandleSys.h"
|
||||
#include <bitbuf.h>
|
||||
#include <vector.h>
|
||||
#include <HalfLife2.h>
|
||||
|
||||
static cell_t smn_BfWriteBool(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
@@ -227,14 +226,7 @@ static cell_t smn_BfWriteEntity(IPluginContext *pCtx, const cell_t *params)
|
||||
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
|
||||
}
|
||||
|
||||
int index = g_HL2.ReferenceToIndex(params[2]);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pBitBuf->WriteShort(index);
|
||||
pBitBuf->WriteShort(params[2]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -531,9 +523,7 @@ static cell_t smn_BfReadEntity(IPluginContext *pCtx, const cell_t *params)
|
||||
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
|
||||
}
|
||||
|
||||
int ref = g_HL2.IndexToReference(pBitBuf->ReadShort());
|
||||
|
||||
return g_HL2.ReferenceToBCompatRef(ref);
|
||||
return pBitBuf->ReadShort();
|
||||
}
|
||||
|
||||
static cell_t smn_BfReadAngle(IPluginContext *pCtx, const cell_t *params)
|
||||
|
||||
+8
-60
@@ -43,10 +43,8 @@
|
||||
#include <inetchannel.h>
|
||||
#include <bitbuf.h>
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "Logger.h"
|
||||
#include "ConsoleDetours.h"
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#define NET_SETCONVAR 6
|
||||
#else
|
||||
#define NET_SETCONVAR 5
|
||||
@@ -69,7 +67,7 @@ struct GlobCmdIter
|
||||
|
||||
struct ConCmdIter
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
ICvarIteratorInternal *pLast;
|
||||
#else
|
||||
const ConCommandBase *pLast;
|
||||
@@ -103,7 +101,7 @@ public:
|
||||
else if (type == htConCmdIter)
|
||||
{
|
||||
ConCmdIter *iter = (ConCmdIter * )object;
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
// ICvarIteratorInternal has no virtual destructor
|
||||
g_pMemAlloc->Free(iter->pLast);
|
||||
#endif
|
||||
@@ -200,8 +198,8 @@ static void ReplicateConVar(ConVar *pConVar)
|
||||
|
||||
if (pPlayer && pPlayer->IsInGame() && !pPlayer->IsFakeClient())
|
||||
{
|
||||
if (INetChannel *netchan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(i)))
|
||||
netchan->SendData(buffer);
|
||||
INetChannel *netchan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(i));
|
||||
netchan->SendData(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -670,7 +668,6 @@ static cell_t sm_RegServerCmd(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (strcasecmp(name, "sm") == 0)
|
||||
{
|
||||
g_Logger.LogError("Request to register \"sm\" command denied.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -699,7 +696,6 @@ static cell_t sm_RegConsoleCmd(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (strcasecmp(name, "sm") == 0)
|
||||
{
|
||||
g_Logger.LogError("Request to register \"sm\" command denied.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -731,7 +727,6 @@ static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (strcasecmp(name, "sm") == 0)
|
||||
{
|
||||
g_Logger.LogError("Request to register \"sm\" command denied.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1186,7 +1181,7 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
|
||||
pContext->LocalToPhysAddr(params[3], &pIsCmd);
|
||||
pContext->LocalToPhysAddr(params[4], &pFlags);
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
ICvarIteratorInternal *cvarIter = icvar->FactoryInternalIterator();
|
||||
cvarIter->SetFirst();
|
||||
if (!cvarIter->IsValid())
|
||||
@@ -1213,7 +1208,7 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
|
||||
}
|
||||
|
||||
pIter = new ConCmdIter;
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
pIter->pLast = cvarIter;
|
||||
#else
|
||||
pIter->pLast = pConCmd;
|
||||
@@ -1248,7 +1243,7 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
ICvarIteratorInternal *cvarIter = pIter->pLast;
|
||||
cvarIter->Next();
|
||||
if (!cvarIter->IsValid())
|
||||
@@ -1322,11 +1317,6 @@ static cell_t SendConVarValue(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannel *netchan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(params[1]));
|
||||
if (netchan == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
netchan->SendData(buffer);
|
||||
|
||||
return 1;
|
||||
@@ -1342,46 +1332,6 @@ static cell_t RemoveServerTag(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell_t AddCommandListener(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *name;
|
||||
IPluginFunction *pFunction;
|
||||
|
||||
pContext->LocalToString(params[2], &name);
|
||||
|
||||
if (strcasecmp(name, "sm") == 0)
|
||||
{
|
||||
g_Logger.LogError("Request to register \"sm\" command denied.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pFunction = pContext->GetFunctionById(params[1]);
|
||||
|
||||
if (!pFunction)
|
||||
return pContext->ThrowNativeError("Invalid function id (%X)", params[1]);
|
||||
|
||||
if (!g_ConsoleDetours.AddListener(pFunction, name[0] == '\0' ? NULL : name))
|
||||
return pContext->ThrowNativeError("This game does not support command listeners");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t RemoveCommandListener(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *name;
|
||||
IPluginFunction *pFunction;
|
||||
|
||||
pContext->LocalToString(params[2], &name);
|
||||
pFunction = pContext->GetFunctionById(params[1]);
|
||||
if (!pFunction)
|
||||
return pContext->ThrowNativeError("Invalid function id (%X)", params[1]);
|
||||
|
||||
if (!g_ConsoleDetours.RemoveListener(pFunction, name[0] == '\0' ? NULL : name))
|
||||
return pContext->ThrowNativeError("No matching callback was registered");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(consoleNatives)
|
||||
{
|
||||
{"CreateConVar", sm_CreateConVar},
|
||||
@@ -1431,7 +1381,5 @@ REGISTER_NATIVES(consoleNatives)
|
||||
{"SendConVarValue", SendConVarValue},
|
||||
{"AddServerTag", AddServerTag},
|
||||
{"RemoveServerTag", RemoveServerTag},
|
||||
{"AddCommandListener", AddCommandListener},
|
||||
{"RemoveCommandListener", RemoveCommandListener},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "ForwardSys.h"
|
||||
#include "Logger.h"
|
||||
#include "ExtensionSys.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
|
||||
#if defined PLATFORM_WINDOWS
|
||||
#include <windows.h>
|
||||
@@ -492,11 +491,6 @@ static cell_t LibraryExists(IPluginContext *pContext, const cell_t *params)
|
||||
char *str;
|
||||
pContext->LocalToString(params[1], &str);
|
||||
|
||||
if (strcmp(str, "__CanTestFeatures__") == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (g_PluginSys.LibraryExists(str))
|
||||
{
|
||||
return 1;
|
||||
@@ -636,43 +630,6 @@ static cell_t VerifyCoreVersion(IPluginContext *pContext, const cell_t *params)
|
||||
return 4;
|
||||
}
|
||||
|
||||
static cell_t GetFeatureStatus(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
FeatureType type = (FeatureType)params[1];
|
||||
char *name;
|
||||
|
||||
pContext->LocalToString(params[2], &name);
|
||||
|
||||
return g_ShareSys.TestFeature(pContext->GetRuntime(),type, name);
|
||||
}
|
||||
|
||||
static cell_t RequireFeature(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
FeatureType type = (FeatureType)params[1];
|
||||
char *name;
|
||||
|
||||
pContext->LocalToString(params[2], &name);
|
||||
|
||||
if (g_ShareSys.TestFeature(pContext->GetRuntime(),type, name) != FeatureStatus_Available)
|
||||
{
|
||||
char buffer[255];
|
||||
char *msg = buffer;
|
||||
char default_message[255];
|
||||
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
|
||||
|
||||
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 3);
|
||||
if (pContext->GetLastNativeError() != SP_ERROR_NONE || buffer[0] == '\0')
|
||||
{
|
||||
UTIL_Format(default_message, sizeof(default_message), "Feature \"%s\" not available", name);
|
||||
msg = default_message;
|
||||
}
|
||||
pPlugin->SetErrorState(Plugin_Error, "%s", msg);
|
||||
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", msg);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(coreNatives)
|
||||
{
|
||||
{"AutoExecConfig", AutoExecConfig},
|
||||
@@ -697,8 +654,6 @@ REGISTER_NATIVES(coreNatives)
|
||||
{"GetExtensionFileStatus", GetExtensionFileStatus},
|
||||
{"FindPluginByNumber", FindPluginByNumber},
|
||||
{"VerifyCoreVersion", VerifyCoreVersion},
|
||||
{"GetFeatureStatus", GetFeatureStatus},
|
||||
{"RequireFeature", RequireFeature},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
||||
+171
-191
@@ -54,88 +54,47 @@ enum PropFieldType
|
||||
PropField_String_T, /**< Valid for Data fields. Read only! */
|
||||
};
|
||||
|
||||
inline edict_t *BaseEntityToEdict(CBaseEntity *pEntity)
|
||||
{
|
||||
IServerUnknown *pUnk = (IServerUnknown *)pEntity;
|
||||
IServerNetworkable *pNet = pUnk->GetNetworkable();
|
||||
|
||||
if (!pNet)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pNet->GetEdict();
|
||||
}
|
||||
|
||||
inline edict_t *GetEdict(cell_t num)
|
||||
{
|
||||
edict_t *pEdict;
|
||||
if (!IndexToAThings(num, NULL, &pEdict))
|
||||
edict_t *pEdict = PEntityOfEntIndex(num);
|
||||
if (!pEdict || pEdict->IsFree())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (num > 0 && num <= g_Players.GetMaxClients())
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(num);
|
||||
if (!pPlayer || !pPlayer->IsConnected())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return pEdict;
|
||||
}
|
||||
|
||||
inline CBaseEntity *GetEntity(cell_t num)
|
||||
edict_t *GetEntity(cell_t num, CBaseEntity **pData)
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
if (!IndexToAThings(num, &pEntity, NULL))
|
||||
edict_t *pEdict = PEntityOfEntIndex(num);
|
||||
if (!pEdict || pEdict->IsFree())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pEntity;
|
||||
}
|
||||
|
||||
/* Given an entity reference or index, fill out a CBaseEntity and/or edict.
|
||||
If lookup is successful, returns true and writes back the two parameters.
|
||||
If lookup fails, returns false and doesn't touch the params. */
|
||||
bool IndexToAThings(cell_t num, CBaseEntity **pEntData, edict_t **pEdictData)
|
||||
{
|
||||
CBaseEntity *pEntity = g_HL2.ReferenceToEntity(num);
|
||||
|
||||
if (!pEntity)
|
||||
if (num > 0 && num <= g_Players.GetMaxClients())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int index = g_HL2.ReferenceToIndex(num);
|
||||
if (index > 0 && index <= g_Players.GetMaxClients())
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(num);
|
||||
if (!pPlayer || !pPlayer->IsConnected())
|
||||
{
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (pEntData)
|
||||
IServerUnknown *pUnk;
|
||||
if ((pUnk=pEdict->GetUnknown()) == NULL)
|
||||
{
|
||||
*pEntData = pEntity;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pEdictData)
|
||||
{
|
||||
edict_t *pEdict = ::BaseEntityToEdict(pEntity);
|
||||
if (!pEdict || pEdict->IsFree())
|
||||
{
|
||||
pEdict = NULL;
|
||||
}
|
||||
|
||||
*pEdictData = pEdict;
|
||||
}
|
||||
|
||||
return true;
|
||||
*pData = pUnk->GetBaseEntity();
|
||||
return pEdict;
|
||||
}
|
||||
/*
|
||||
<predcrab> AThings is like guaranteed r+ by dvander though
|
||||
<predcrab> he wont even read the rest of the patch to nit stuff
|
||||
<Fyren> Like I wasn't going to r? you anyway!
|
||||
<predcrab> he still sees!
|
||||
<predcrab> he's everywhere
|
||||
*/
|
||||
|
||||
class VEmptyClass {};
|
||||
datamap_t *VGetDataDescMap(CBaseEntity *pThisPtr, int offset)
|
||||
@@ -202,11 +161,11 @@ static cell_t CreateEdict(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t RemoveEdict(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
edict_t *pEdict = GetEdict(params[1]);
|
||||
edict_t *pEdict = PEntityOfEntIndex(params[1]);
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Edict %d (%d) is not a valid edict", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Edict %d is not a valid edict", params[1]);
|
||||
}
|
||||
|
||||
engine->RemoveEdict(pEdict);
|
||||
@@ -229,8 +188,20 @@ static cell_t IsValidEdict(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t IsValidEntity(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = g_HL2.ReferenceToEntity(params[1]);
|
||||
edict_t *pEdict = GetEdict(params[1]);
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IServerUnknown *pUnknown = pEdict->GetUnknown();
|
||||
if (!pUnknown)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
CBaseEntity *pEntity = pUnknown->GetBaseEntity();
|
||||
return (pEntity != NULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
@@ -257,7 +228,7 @@ static cell_t GetEdictFlags(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid edict (%d - %d)", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Invalid edict (%d)", params[1]);
|
||||
}
|
||||
|
||||
return pEdict->m_fStateFlags;
|
||||
@@ -269,7 +240,7 @@ static cell_t SetEdictFlags(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid edict (%d - %d)", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Invalid edict (%d)", params[1]);
|
||||
}
|
||||
|
||||
pEdict->m_fStateFlags = params[2];
|
||||
@@ -283,7 +254,7 @@ static cell_t GetEdictClassname(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid edict (%d - %d)", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Invalid edict (%d)", params[1]);
|
||||
}
|
||||
|
||||
const char *cls = pEdict->GetClassName();
|
||||
@@ -300,16 +271,14 @@ static cell_t GetEdictClassname(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t GetEntityNetClass(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = g_HL2.ReferenceToEntity(params[1]);
|
||||
edict_t *pEdict = GetEdict(params[1]);
|
||||
|
||||
IServerUnknown *pUnk = (IServerUnknown *)pEntity;
|
||||
|
||||
if (!pEntity)
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid entity (%d - %d)", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Invalid edict (%d)", params[1]);
|
||||
}
|
||||
|
||||
IServerNetworkable *pNet = pUnk->GetNetworkable();
|
||||
IServerNetworkable *pNet = pEdict->GetNetworkable();
|
||||
if (!pNet)
|
||||
{
|
||||
return 0;
|
||||
@@ -324,11 +293,12 @@ static cell_t GetEntityNetClass(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t GetEntData(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = GetEntity(params[1]);
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEntity)
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -353,11 +323,11 @@ static cell_t GetEntData(IPluginContext *pContext, const cell_t *params)
|
||||
static cell_t SetEntData(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -366,7 +336,7 @@ static cell_t SetEntData(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("Offset %d is invalid", offset);
|
||||
}
|
||||
|
||||
if (params[5] && (pEdict != NULL))
|
||||
if (params[5])
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -397,11 +367,12 @@ static cell_t SetEntData(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t GetEntDataFloat(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = GetEntity(params[1]);
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEntity)
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -418,11 +389,11 @@ static cell_t GetEntDataFloat(IPluginContext *pContext, const cell_t *params)
|
||||
static cell_t SetEntDataFloat(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -433,7 +404,7 @@ static cell_t SetEntDataFloat(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
*(float *)((uint8_t *)pEntity + offset) = sp_ctof(params[3]);
|
||||
|
||||
if (params[4] && (pEdict != NULL))
|
||||
if (params[4])
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -443,11 +414,12 @@ static cell_t SetEntDataFloat(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t GetEntDataVector(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = GetEntity(params[1]);
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEntity)
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -471,11 +443,11 @@ static cell_t GetEntDataVector(IPluginContext *pContext, const cell_t *params)
|
||||
static cell_t SetEntDataVector(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -493,7 +465,7 @@ static cell_t SetEntDataVector(IPluginContext *pContext, const cell_t *params)
|
||||
v->y = sp_ctof(vec[1]);
|
||||
v->z = sp_ctof(vec[2]);
|
||||
|
||||
if (params[4] && (pEdict != NULL))
|
||||
if (params[4])
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -504,11 +476,12 @@ static cell_t SetEntDataVector(IPluginContext *pContext, const cell_t *params)
|
||||
/* THIS GUY IS DEPRECATED. */
|
||||
static cell_t GetEntDataEnt(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = GetEntity(params[1]);
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEntity)
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -524,8 +497,7 @@ static cell_t GetEntDataEnt(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ref = g_HL2.IndexToReference(hndl.GetEntryIndex());
|
||||
return g_HL2.ReferenceToBCompatRef(ref);
|
||||
return hndl.GetEntryIndex();
|
||||
}
|
||||
|
||||
int CheckBaseHandle(CBaseHandle &hndl)
|
||||
@@ -540,10 +512,7 @@ int CheckBaseHandle(CBaseHandle &hndl)
|
||||
edict_t *pStoredEdict;
|
||||
CBaseEntity *pStoredEntity;
|
||||
|
||||
if (!IndexToAThings(index, &pStoredEntity, &pStoredEdict))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
pStoredEdict = GetEntity(index, &pStoredEntity);
|
||||
|
||||
if (pStoredEdict == NULL || pStoredEntity == NULL)
|
||||
{
|
||||
@@ -567,11 +536,12 @@ int CheckBaseHandle(CBaseHandle &hndl)
|
||||
|
||||
static cell_t GetEntDataEnt2(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = GetEntity(params[1]);
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (pEntity == NULL)
|
||||
if (pEdict == NULL || pEntity == NULL)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -582,19 +552,18 @@ static cell_t GetEntDataEnt2(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
|
||||
|
||||
int ref = g_HL2.IndexToReference(hndl.GetEntryIndex());
|
||||
return g_HL2.ReferenceToBCompatRef(ref);
|
||||
return CheckBaseHandle(hndl);
|
||||
}
|
||||
|
||||
/* THIS GUY IS DEPRECATED. */
|
||||
static cell_t SetEntDataEnt(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -605,22 +574,20 @@ static cell_t SetEntDataEnt(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
|
||||
|
||||
if (params[3] == 0 || (unsigned)params[3] == INVALID_EHANDLE_INDEX)
|
||||
if (params[3] == 0)
|
||||
{
|
||||
hndl.Set(NULL);
|
||||
} else {
|
||||
CBaseEntity *pOther = GetEntity(params[3]);
|
||||
|
||||
if (!pOther)
|
||||
edict_t *pEdict = GetEdict(params[3]);
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[3]), params[3]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[3]);
|
||||
}
|
||||
|
||||
IHandleEntity *pHandleEnt = (IHandleEntity *)pOther;
|
||||
hndl.Set(pHandleEnt);
|
||||
IServerEntity *pEntOther = pEdict->GetIServerEntity();
|
||||
hndl.Set(pEntOther);
|
||||
}
|
||||
|
||||
if (params[4] && (pEdict != NULL))
|
||||
if (params[4])
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -631,11 +598,11 @@ static cell_t SetEntDataEnt(IPluginContext *pContext, const cell_t *params)
|
||||
static cell_t SetEntDataEnt2(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -646,24 +613,22 @@ static cell_t SetEntDataEnt2(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
|
||||
|
||||
if ((unsigned)params[3] == INVALID_EHANDLE_INDEX)
|
||||
if (params[3] == -1)
|
||||
{
|
||||
hndl.Set(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseEntity *pOther = GetEntity(params[3]);
|
||||
|
||||
if (!pOther)
|
||||
edict_t *pEdict = GetEdict(params[3]);
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[3]), params[3]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[3]);
|
||||
}
|
||||
|
||||
IHandleEntity *pHandleEnt = (IHandleEntity *)pOther;
|
||||
hndl.Set(pHandleEnt);
|
||||
IServerEntity *pEntOther = pEdict->GetIServerEntity();
|
||||
hndl.Set(pEntOther);
|
||||
}
|
||||
|
||||
if (params[4] && (pEdict != NULL))
|
||||
if (params[4])
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -677,7 +642,7 @@ static cell_t ChangeEdictState(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Edict %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Edict %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
g_HL2.SetEdictStateChanged(pEdict, params[2]);
|
||||
@@ -760,11 +725,11 @@ static cell_t FindDataMapOffs(IPluginContext *pContext, const cell_t *params)
|
||||
datamap_t *pMap;
|
||||
typedescription_t *td;
|
||||
char *offset;
|
||||
pEntity = GetEntity(params[1]);
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEntity)
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if ((pMap=CBaseEntity_GetDataDescMap(pEntity)) == NULL)
|
||||
@@ -864,11 +829,12 @@ static cell_t FindDataMapOffs(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t GetEntDataString(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity = GetEntity(params[1]);
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEntity)
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -887,11 +853,11 @@ static cell_t GetEntDataString(IPluginContext *pContext, const cell_t *params)
|
||||
static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
edict_t *pEdict;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
int offset = params[2];
|
||||
@@ -906,7 +872,7 @@ static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToString(params[3], &src);
|
||||
size_t len = strncopy(dest, src, params[4]);
|
||||
|
||||
if (params[5] && (pEdict != NULL))
|
||||
if (params[5])
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -929,11 +895,10 @@ static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
#define FIND_PROP_SEND(pProp) \
|
||||
IServerUnknown *pUnk = (IServerUnknown *)pEntity; \
|
||||
IServerNetworkable *pNet = pUnk->GetNetworkable(); \
|
||||
IServerNetworkable *pNet = pEdict->GetNetworkable(); \
|
||||
if (!pNet) \
|
||||
{ \
|
||||
return pContext->ThrowNativeError("Edict %d (%d) is not networkable", g_HL2.ReferenceToIndex(params[1]), params[1]); \
|
||||
return pContext->ThrowNativeError("Edict %d is not networkable", params[1]); \
|
||||
} \
|
||||
if (!g_HL2.FindSendPropInfo(pNet->GetServerClass()->GetName(), prop, pProp)) \
|
||||
{ \
|
||||
@@ -975,13 +940,14 @@ static cell_t GetEntProp(IPluginContext *pContext, const cell_t *params)
|
||||
edict_t *pEdict;
|
||||
int bit_count;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
/* TODO: Find a way to lookup classname without having an edict - Is this a guaranteed prop? */
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1065,12 +1031,14 @@ static cell_t SetEntProp(IPluginContext *pContext, const cell_t *params)
|
||||
edict_t *pEdict;
|
||||
int bit_count;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1153,12 +1121,14 @@ static cell_t GetEntPropFloat(IPluginContext *pContext, const cell_t *params)
|
||||
const char *class_name;
|
||||
edict_t *pEdict;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1222,12 +1192,14 @@ static cell_t SetEntPropFloat(IPluginContext *pContext, const cell_t *params)
|
||||
const char *class_name;
|
||||
edict_t *pEdict;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1280,7 +1252,7 @@ static cell_t SetEntPropFloat(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
*(float *)((uint8_t *)pEntity + offset) = sp_ctof(params[4]);
|
||||
|
||||
if (params[2] == Prop_Send && (pEdict != NULL))
|
||||
if (params[2] == Prop_Send)
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -1296,12 +1268,14 @@ static cell_t GetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
const char *class_name;
|
||||
edict_t *pEdict;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1352,8 +1326,7 @@ static cell_t GetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
|
||||
|
||||
int ref = g_HL2.IndexToReference(hndl.GetEntryIndex());
|
||||
return g_HL2.ReferenceToBCompatRef(ref);
|
||||
return CheckBaseHandle(hndl);
|
||||
}
|
||||
|
||||
static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -1364,12 +1337,14 @@ static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
const char *class_name;
|
||||
edict_t *pEdict;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1426,18 +1401,18 @@ static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseEntity *pOther = GetEntity(params[4]);
|
||||
edict_t *pOther;
|
||||
CBaseEntity *pOtherEnt;
|
||||
|
||||
if (!pOther)
|
||||
if ((pOther = GetEntity(params[4], &pOtherEnt)) == NULL)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[4]), params[4]);
|
||||
return pContext->ThrowNativeError("Invalid entity %d", params[4]);
|
||||
}
|
||||
|
||||
IHandleEntity *pHandleEnt = (IHandleEntity *)pOther;
|
||||
hndl.Set(pHandleEnt);
|
||||
hndl.Set(pOther->GetIServerEntity());
|
||||
}
|
||||
|
||||
if (params[2] == Prop_Send && (pEdict != NULL))
|
||||
if (params[2] == Prop_Send)
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -1453,12 +1428,14 @@ static cell_t GetEntPropVector(IPluginContext *pContext, const cell_t *params)
|
||||
const char *class_name;
|
||||
edict_t *pEdict;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1529,12 +1506,14 @@ static cell_t SetEntPropVector(IPluginContext *pContext, const cell_t *params)
|
||||
const char *class_name;
|
||||
edict_t *pEdict;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1594,7 +1573,7 @@ static cell_t SetEntPropVector(IPluginContext *pContext, const cell_t *params)
|
||||
v->y = sp_ctof(vec[1]);
|
||||
v->z = sp_ctof(vec[2]);
|
||||
|
||||
if (params[2] == Prop_Send && (pEdict != NULL))
|
||||
if (params[2] == Prop_Send)
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
@@ -1611,12 +1590,14 @@ static cell_t GetEntPropString(IPluginContext *pContext, const cell_t *params)
|
||||
edict_t *pEdict;
|
||||
bool bIsStringIndex;
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!pEdict || (class_name = pEdict->GetClassName()) == NULL)
|
||||
if ((class_name = pEdict->GetClassName()) == NULL)
|
||||
{
|
||||
class_name = "";
|
||||
}
|
||||
@@ -1699,11 +1680,11 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params)
|
||||
char *prop;
|
||||
int offset;
|
||||
int maxlen;
|
||||
edict_t *pEdict;
|
||||
edict_t *pEdict = GetEntity(params[1], &pEntity);
|
||||
|
||||
if (!IndexToAThings(params[1], &pEntity, &pEdict))
|
||||
if (!pEdict || !pEntity)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
|
||||
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
switch (params[2])
|
||||
@@ -1732,8 +1713,7 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params)
|
||||
case Prop_Send:
|
||||
{
|
||||
char *prop;
|
||||
IServerUnknown *pUnk = (IServerUnknown *)pEntity;
|
||||
IServerNetworkable *pNet = pUnk->GetNetworkable();
|
||||
IServerNetworkable *pNet = pEdict->GetNetworkable();
|
||||
if (!pNet)
|
||||
{
|
||||
return pContext->ThrowNativeError("The edict is not networkable");
|
||||
@@ -1764,7 +1744,7 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToString(params[4], &src);
|
||||
size_t len = strncopy(dest, src, maxlen);
|
||||
|
||||
if (params[2] == Prop_Send && (pEdict != NULL))
|
||||
if (params[2] == Prop_Send)
|
||||
{
|
||||
g_HL2.SetEdictStateChanged(pEdict, offset);
|
||||
}
|
||||
|
||||
@@ -348,23 +348,6 @@ static cell_t sm_SetEventString(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_SetEventBroadcast(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError err;
|
||||
EventInfo *pInfo;
|
||||
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
|
||||
}
|
||||
|
||||
pInfo->bDontBroadcast = params[2] ? true : false;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(gameEventNatives)
|
||||
{
|
||||
{"HookEvent", sm_HookEvent},
|
||||
@@ -382,7 +365,5 @@ REGISTER_NATIVES(gameEventNatives)
|
||||
{"SetEventInt", sm_SetEventInt},
|
||||
{"SetEventFloat", sm_SetEventFloat},
|
||||
{"SetEventString", sm_SetEventString},
|
||||
{"SetEventBroadcast", sm_SetEventBroadcast},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
@@ -32,9 +32,7 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "common_logic.h"
|
||||
#include "MersenneTwister.h"
|
||||
#include <IPluginSys.h>
|
||||
#include "sm_globals.h"
|
||||
|
||||
/****************************************
|
||||
* *
|
||||
@@ -287,68 +285,6 @@ static cell_t sm_FloatRound(IPluginContext *pCtx, const cell_t *params)
|
||||
}
|
||||
#endif
|
||||
|
||||
class RandomHelpers :
|
||||
public SMGlobalClass,
|
||||
public IPluginsListener
|
||||
{
|
||||
public:
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
pluginsys->AddPluginsListener(this);
|
||||
}
|
||||
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
pluginsys->RemovePluginsListener(this);
|
||||
}
|
||||
|
||||
void OnPluginDestroyed(IPlugin *plugin)
|
||||
{
|
||||
MTRand *mtrand;
|
||||
if (plugin->GetProperty("core.logic.mtrand", (void**)&mtrand, true))
|
||||
{
|
||||
delete mtrand;
|
||||
}
|
||||
}
|
||||
|
||||
MTRand *RandObjForPlugin(IPluginContext *ctx)
|
||||
{
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(ctx->GetContext());
|
||||
MTRand *mtrand;
|
||||
if (!plugin->GetProperty("core.logic.mtrand", (void**)&mtrand))
|
||||
{
|
||||
mtrand = new MTRand();
|
||||
plugin->SetProperty("core.logic.mtrand", mtrand);
|
||||
}
|
||||
return mtrand;
|
||||
}
|
||||
} s_RandHelpers;
|
||||
|
||||
static cell_t GetURandomInt(IPluginContext *ctx, const cell_t *params)
|
||||
{
|
||||
MTRand *randobj = s_RandHelpers.RandObjForPlugin(ctx);
|
||||
/* Note the sign bit must be stripped off because cell_t is signed,
|
||||
* and this guarantees a range of [0,max_int]
|
||||
*/
|
||||
return randobj->randInt() & 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
static cell_t GetURandomFloat(IPluginContext *ctx, const cell_t *params)
|
||||
{
|
||||
MTRand *randobj = s_RandHelpers.RandObjForPlugin(ctx);
|
||||
return sp_ftoc((float)randobj->rand());
|
||||
}
|
||||
|
||||
static cell_t SetURandomSeed(IPluginContext *ctx, const cell_t *params)
|
||||
{
|
||||
MTRand *randobj = s_RandHelpers.RandObjForPlugin(ctx);
|
||||
cell_t *addr;
|
||||
ctx->LocalToPhysAddr(params[1], &addr);
|
||||
/* We're 32-bit only. */
|
||||
randobj->seed((MTRand::uint32*)addr, params[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(floatnatives)
|
||||
{
|
||||
{"float", sm_float},
|
||||
@@ -374,9 +310,5 @@ REGISTER_NATIVES(floatnatives)
|
||||
{"ArcCosine", sm_ArcCosine},
|
||||
{"ArcSine", sm_ArcSine},
|
||||
{"ArcTangent2", sm_ArcTangent2},
|
||||
{"GetURandomInt", GetURandomInt},
|
||||
{"GetURandomFloat", GetURandomFloat},
|
||||
{"SetURandomSeed", SetURandomSeed},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IPluginSys.h>
|
||||
#include <IHandleSys.h>
|
||||
#include <IForwardSys.h>
|
||||
#include "sm_globals.h"
|
||||
#include "PluginSys.h"
|
||||
#include "ForwardSys.h"
|
||||
#include "HandleSys.h"
|
||||
|
||||
HandleType_t g_GlobalFwdType = 0;
|
||||
HandleType_t g_PrivateFwdType = 0;
|
||||
@@ -52,36 +52,36 @@ public:
|
||||
HandleAccess sec;
|
||||
|
||||
/* Set GlobalFwd handle access security */
|
||||
handlesys->InitAccessDefaults(NULL, &sec);
|
||||
g_HandleSys.InitAccessDefaults(NULL, &sec);
|
||||
sec.access[HandleAccess_Read] = 0;
|
||||
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY | HANDLE_RESTRICT_OWNER;
|
||||
|
||||
/* Create 'GlobalFwd' handle type */
|
||||
g_GlobalFwdType = handlesys->CreateType("GlobalFwd", this, 0, NULL, &sec, g_pCoreIdent, NULL);
|
||||
g_GlobalFwdType = g_HandleSys.CreateType("GlobalFwd", this, 0, NULL, &sec, g_pCoreIdent, NULL);
|
||||
|
||||
/* Private forwards are cloneable */
|
||||
sec.access[HandleAccess_Clone] = 0;
|
||||
|
||||
/* Create 'PrivateFwd' handle type */
|
||||
g_PrivateFwdType = handlesys->CreateType("PrivateFwd", this, g_GlobalFwdType, NULL, &sec, g_pCoreIdent, NULL);
|
||||
g_PrivateFwdType = g_HandleSys.CreateType("PrivateFwd", this, g_GlobalFwdType, NULL, &sec, g_pCoreIdent, NULL);
|
||||
}
|
||||
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
handlesys->RemoveType(g_PrivateFwdType, g_pCoreIdent);
|
||||
handlesys->RemoveType(g_GlobalFwdType, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(g_PrivateFwdType, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(g_GlobalFwdType, g_pCoreIdent);
|
||||
}
|
||||
|
||||
void OnHandleDestroy(HandleType_t type, void *object)
|
||||
{
|
||||
IForward *pForward = static_cast<IForward *>(object);
|
||||
|
||||
forwardsys->ReleaseForward(pForward);
|
||||
g_Forwards.ReleaseForward(pForward);
|
||||
}
|
||||
|
||||
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize)
|
||||
{
|
||||
*pSize = sizeof(IForward*) + (((IForward *)object)->GetFunctionCount() * 12);
|
||||
*pSize = sizeof(CForward) + (((IForward *)object)->GetFunctionCount() * 12);
|
||||
return true;
|
||||
}
|
||||
} g_ForwardNativeHelpers;
|
||||
@@ -112,9 +112,9 @@ static cell_t sm_GetFunctionByName(IPluginContext *pContext, const cell_t *param
|
||||
|
||||
if (hndl == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(hndl, &err);
|
||||
pPlugin = g_PluginSys.PluginFromHandle(hndl, &err);
|
||||
|
||||
if (!pPlugin)
|
||||
{
|
||||
@@ -155,9 +155,9 @@ static cell_t sm_CreateGlobalForward(IPluginContext *pContext, const cell_t *par
|
||||
forwardParams[i - 3] = static_cast<ParamType>(*addr);
|
||||
}
|
||||
|
||||
IForward *pForward = forwardsys->CreateForward(name, static_cast<ExecType>(params[2]), count - 2, forwardParams);
|
||||
IForward *pForward = g_Forwards.CreateForward(name, static_cast<ExecType>(params[2]), count - 2, forwardParams);
|
||||
|
||||
return handlesys->CreateHandle(g_GlobalFwdType, pForward, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
return g_HandleSys.CreateHandle(g_GlobalFwdType, pForward, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
}
|
||||
|
||||
static cell_t sm_CreateForward(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -177,9 +177,9 @@ static cell_t sm_CreateForward(IPluginContext *pContext, const cell_t *params)
|
||||
forwardParams[i - 2] = static_cast<ParamType>(*addr);
|
||||
}
|
||||
|
||||
IChangeableForward *pForward = forwardsys->CreateForwardEx(NULL, static_cast<ExecType>(params[1]), count - 1, forwardParams);
|
||||
IChangeableForward *pForward = g_Forwards.CreateForwardEx(NULL, static_cast<ExecType>(params[1]), count - 1, forwardParams);
|
||||
|
||||
return handlesys->CreateHandle(g_PrivateFwdType, pForward, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
return g_HandleSys.CreateHandle(g_PrivateFwdType, pForward, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
}
|
||||
|
||||
static cell_t sm_GetForwardFunctionCount(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -188,7 +188,7 @@ static cell_t sm_GetForwardFunctionCount(IPluginContext *pContext, const cell_t
|
||||
HandleError err;
|
||||
IForward *pForward;
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward))
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid forward handle %x (error %d)", hndl, err);
|
||||
@@ -205,7 +205,7 @@ static cell_t sm_AddToForward(IPluginContext *pContext, const cell_t *params)
|
||||
IChangeableForward *pForward;
|
||||
IPlugin *pPlugin;
|
||||
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
if ((err=g_HandleSys.ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
|
||||
@@ -213,9 +213,9 @@ static cell_t sm_AddToForward(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (plHandle == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(plHandle, &err);
|
||||
pPlugin = g_PluginSys.PluginFromHandle(plHandle, &err);
|
||||
|
||||
if (!pPlugin)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *param
|
||||
IChangeableForward *pForward;
|
||||
IPlugin *pPlugin;
|
||||
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
if ((err=g_HandleSys.ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
|
||||
@@ -249,9 +249,9 @@ static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *param
|
||||
|
||||
if (plHandle == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(plHandle, &err);
|
||||
pPlugin = g_PluginSys.PluginFromHandle(plHandle, &err);
|
||||
|
||||
if (!pPlugin)
|
||||
{
|
||||
@@ -277,7 +277,7 @@ static cell_t sm_RemoveAllFromForward(IPluginContext *pContext, const cell_t *pa
|
||||
IChangeableForward *pForward;
|
||||
IPlugin *pPlugin;
|
||||
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
if ((err=g_HandleSys.ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
|
||||
@@ -285,9 +285,9 @@ static cell_t sm_RemoveAllFromForward(IPluginContext *pContext, const cell_t *pa
|
||||
|
||||
if (plHandle == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(plHandle, &err);
|
||||
pPlugin = g_PluginSys.PluginFromHandle(plHandle, &err);
|
||||
|
||||
if (!pPlugin)
|
||||
{
|
||||
@@ -310,9 +310,9 @@ static cell_t sm_CallStartFunction(IPluginContext *pContext, const cell_t *param
|
||||
|
||||
if (hndl == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(hndl, &err);
|
||||
pPlugin = g_PluginSys.PluginFromHandle(hndl, &err);
|
||||
|
||||
if (!pPlugin)
|
||||
{
|
||||
@@ -344,7 +344,7 @@ static cell_t sm_CallStartForward(IPluginContext *pContext, const cell_t *params
|
||||
|
||||
hndl = static_cast<Handle_t>(params[1]);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward))
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid forward handle %x (error %d)", hndl, err);
|
||||
+15
-44
@@ -73,12 +73,7 @@ static cell_t IsDedicatedServer(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t GetEngineTime(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
float fTime = Plat_FloatTime();
|
||||
#else
|
||||
float fTime = engine->Time();
|
||||
#endif
|
||||
|
||||
return sp_ftoc(fTime);
|
||||
}
|
||||
|
||||
@@ -443,29 +438,28 @@ static cell_t smn_IsPlayerAlive(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
int version = g_SMAPI->GetSourceEngineBuild();
|
||||
|
||||
switch (version)
|
||||
if (version == SOURCE_ENGINE_ORIGINAL)
|
||||
{
|
||||
case SOURCE_ENGINE_ORIGINAL:
|
||||
return 10;
|
||||
case SOURCE_ENGINE_EPISODEONE:
|
||||
return 20;
|
||||
|
||||
# if defined METAMOD_PLAPI_VERSION
|
||||
/* Newer games. */
|
||||
case SOURCE_ENGINE_DARKMESSIAH:
|
||||
}
|
||||
else if (version == SOURCE_ENGINE_DARKMESSIAH)
|
||||
{
|
||||
return 15;
|
||||
case SOURCE_ENGINE_ORANGEBOX:
|
||||
}
|
||||
else if (version == SOURCE_ENGINE_EPISODEONE)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
else if (version == SOURCE_ENGINE_ORANGEBOX)
|
||||
{
|
||||
return 30;
|
||||
case SOURCE_ENGINE_ORANGEBOXVALVE:
|
||||
return 35;
|
||||
case SOURCE_ENGINE_LEFT4DEAD:
|
||||
}
|
||||
else if (version == SOURCE_ENGINE_LEFT4DEAD)
|
||||
{
|
||||
return 40;
|
||||
case SOURCE_ENGINE_LEFT4DEAD2:
|
||||
return 50;
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
if (g_HL2.IsOriginalEngine())
|
||||
@@ -481,26 +475,6 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell_t IndexToReference(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
if (params[1] >= NUM_ENT_ENTRIES || params[1] < 0)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid entity index %i", params[1]);
|
||||
}
|
||||
|
||||
return g_HL2.IndexToReference(params[1]);
|
||||
}
|
||||
|
||||
static cell_t ReferenceToIndex(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return g_HL2.ReferenceToIndex(params[1]);
|
||||
}
|
||||
|
||||
static cell_t ReferenceToBCompatRef(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return g_HL2.ReferenceToBCompatRef(params[1]);
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(halflifeNatives)
|
||||
{
|
||||
{"CreateFakeClient", CreateFakeClient},
|
||||
@@ -531,8 +505,5 @@ REGISTER_NATIVES(halflifeNatives)
|
||||
{"ShowVGUIPanel", ShowVGUIPanel},
|
||||
{"IsPlayerAlive", smn_IsPlayerAlive},
|
||||
{"GuessSDKVersion", GuessSDKVersion},
|
||||
{"EntIndexToEntRef", IndexToReference},
|
||||
{"EntRefToEntIndex", ReferenceToIndex},
|
||||
{"MakeCompatEntRef", ReferenceToBCompatRef},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@@ -30,12 +30,17 @@
|
||||
*/
|
||||
|
||||
#include <sh_list.h>
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "common_logic.h"
|
||||
#include "sm_globals.h"
|
||||
#include "sm_trie_tpl.h"
|
||||
#include "CellArray.h"
|
||||
#include <ILibrarySys.h>
|
||||
#include <ITextParsers.h>
|
||||
#include <ISourceMod.h>
|
||||
#include "convar.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "TextParsers.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "sourcemod.h"
|
||||
#include "Logger.h"
|
||||
#include "HandleSys.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
|
||||
@@ -72,7 +77,7 @@ public:
|
||||
}
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
g_pSM->BuildPath(Path_SM, m_ConfigFile, sizeof(m_ConfigFile), "configs/maplists.cfg");
|
||||
g_SourceMod.BuildPath(Path_SM, m_ConfigFile, sizeof(m_ConfigFile), "configs/maplists.cfg");
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
@@ -89,9 +94,13 @@ public:
|
||||
pMapList->bIsCompat = true;
|
||||
pMapList->bIsPath = true;
|
||||
pMapList->last_modified_time = 0;
|
||||
smcore.strncopy(pMapList->name, name, sizeof(pMapList->name));
|
||||
strncopy(pMapList->name, name, sizeof(pMapList->name));
|
||||
pMapList->pArray = NULL;
|
||||
g_pSM->BuildPath(Path_Game, pMapList->path, sizeof(pMapList->path), "%s", file);
|
||||
g_SourceMod.BuildPath(Path_Game,
|
||||
pMapList->path,
|
||||
sizeof(pMapList->path),
|
||||
"%s",
|
||||
file);
|
||||
pMapList->serial = 0;
|
||||
m_ListLookup.insert(name, pMapList);
|
||||
m_MapLists.push_back(pMapList);
|
||||
@@ -106,7 +115,11 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
g_pSM->BuildPath(Path_Game, path, sizeof(path), "%s", file);
|
||||
g_SourceMod.BuildPath(Path_Game,
|
||||
path,
|
||||
sizeof(path),
|
||||
"%s",
|
||||
file);
|
||||
|
||||
/* If the path matches, don't reset the serial/time */
|
||||
if (strcmp(path, pMapList->path) == 0)
|
||||
@@ -114,7 +127,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
smcore.strncopy(pMapList->path, path, sizeof(pMapList->path));
|
||||
strncopy(pMapList->path, path, sizeof(pMapList->path));
|
||||
pMapList->bIsPath = true;
|
||||
pMapList->last_modified_time = 0;
|
||||
pMapList->serial = 0;
|
||||
@@ -126,7 +139,7 @@ public:
|
||||
time_t fileTime;
|
||||
SMCStates states = {0, 0};
|
||||
|
||||
fileFound = libsys->FileTime(m_ConfigFile, FileTime_LastChange, &fileTime);
|
||||
fileFound = g_LibSys.FileTime(m_ConfigFile, FileTime_LastChange, &fileTime);
|
||||
|
||||
/* If the file is found and hasn't changed, bail out now. */
|
||||
if (fileFound && fileTime == m_ConfigLastChanged)
|
||||
@@ -143,7 +156,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
m_pMapCycleFile = smcore.FindConVar("mapcyclefile");
|
||||
m_pMapCycleFile = icvar->FindVar("mapcyclefile");
|
||||
|
||||
/* Dump everything we know about. */
|
||||
List<maplist_info_t *> compat;
|
||||
@@ -153,12 +166,12 @@ public:
|
||||
maplist_info_t *pDefList = new maplist_info_t;
|
||||
|
||||
pDefList->bIsPath = true;
|
||||
smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
|
||||
g_SourceMod.BuildPath(Path_Game,
|
||||
pDefList->path,
|
||||
sizeof(pDefList->path),
|
||||
"%s",
|
||||
m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
|
||||
m_pMapCycleFile ? m_pMapCycleFile->GetString() : "mapcycle.txt");
|
||||
pDefList->last_modified_time = 0;
|
||||
pDefList->pArray = NULL;
|
||||
pDefList->serial = 0;
|
||||
@@ -169,16 +182,19 @@ public:
|
||||
/* Now parse the config file even if we don't know about it.
|
||||
* This will give us a nice error message.
|
||||
*/
|
||||
if ((error = textparser->ParseFile_SMC(m_ConfigFile, this, &states))
|
||||
if ((error = g_TextParser.ParseFile_SMC(m_ConfigFile, this, &states))
|
||||
!= SMCError_Okay)
|
||||
{
|
||||
const char *errmsg = textparser->GetSMCErrorString(error);
|
||||
const char *errmsg = g_TextParser.GetSMCErrorString(error);
|
||||
if (errmsg == NULL)
|
||||
{
|
||||
errmsg = "Unknown error";
|
||||
}
|
||||
smcore.LogError("[SM] Could not parse file \"%s\"", m_ConfigFile);
|
||||
smcore.LogError("[SM] Error on line %d (col %d): %s", states.line, states.col, errmsg);
|
||||
g_Logger.LogError("[SM] Could not parse file \"%s\"", m_ConfigFile);
|
||||
g_Logger.LogError("[SM] Error on line %d (col %d): %s",
|
||||
states.line,
|
||||
states.col,
|
||||
errmsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -233,7 +249,7 @@ public:
|
||||
m_pCurMapList = new maplist_info_t;
|
||||
|
||||
memset(m_pCurMapList, 0, sizeof(maplist_info_t));
|
||||
smcore.strncopy(m_pCurMapList->name, name, sizeof(m_pCurMapList->name));
|
||||
strncopy(m_pCurMapList->name, name, sizeof(m_pCurMapList->name));
|
||||
|
||||
m_CurState = MPS_MAPLIST;
|
||||
}
|
||||
@@ -253,7 +269,7 @@ public:
|
||||
|
||||
if (strcmp(key, "file") == 0)
|
||||
{
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
g_SourceMod.BuildPath(Path_Game,
|
||||
m_pCurMapList->path,
|
||||
sizeof(m_pCurMapList->path),
|
||||
"%s",
|
||||
@@ -262,7 +278,7 @@ public:
|
||||
}
|
||||
else if (strcmp(key, "target") == 0)
|
||||
{
|
||||
smcore.strncopy(m_pCurMapList->path, value, sizeof(m_pCurMapList->path));
|
||||
strncopy(m_pCurMapList->path, value, sizeof(m_pCurMapList->path));
|
||||
m_pCurMapList->bIsPath = false;
|
||||
}
|
||||
|
||||
@@ -353,9 +369,9 @@ public:
|
||||
|
||||
pNewArray = new CellArray(64);
|
||||
free_new_array = true;
|
||||
g_pSM->BuildPath(Path_Game, path, sizeof(path), "maps");
|
||||
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "maps");
|
||||
|
||||
if ((pDir = libsys->OpenDirectory(path)) != NULL)
|
||||
if ((pDir = g_LibSys.OpenDirectory(path)) != NULL)
|
||||
{
|
||||
char *ptr;
|
||||
cell_t *blk;
|
||||
@@ -370,7 +386,7 @@ public:
|
||||
pDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
smcore.strncopy(buffer, pDir->GetEntryName(), sizeof(buffer));
|
||||
strncopy(buffer, pDir->GetEntryName(), sizeof(buffer));
|
||||
if ((ptr = strstr(buffer, ".bsp")) == NULL || ptr[4] != '\0')
|
||||
{
|
||||
pDir->NextEntry();
|
||||
@@ -387,10 +403,10 @@ public:
|
||||
pDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
smcore.strncopy((char *)blk, buffer, 255);
|
||||
strncopy((char *)blk, buffer, 255);
|
||||
pDir->NextEntry();
|
||||
}
|
||||
libsys->CloseDirectory(pDir);
|
||||
g_LibSys.CloseDirectory(pDir);
|
||||
}
|
||||
|
||||
/* Remove the array if there were no items. */
|
||||
@@ -445,7 +461,7 @@ public:
|
||||
{
|
||||
blk_dst = pUseArray->push();
|
||||
blk_src = pNewArray->at(i);
|
||||
smcore.strncopy((char *)blk_dst, (char *)blk_src, pUseArray->blocksize() * sizeof(cell_t));
|
||||
strncopy((char *)blk_dst, (char *)blk_src, pUseArray->blocksize() * sizeof(cell_t));
|
||||
}
|
||||
|
||||
/* Free resources if necessary. */
|
||||
@@ -485,20 +501,20 @@ private:
|
||||
if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
|
||||
{
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
g_SourceMod.BuildPath(Path_Game,
|
||||
path,
|
||||
sizeof(path),
|
||||
"%s",
|
||||
m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
|
||||
m_pMapCycleFile ? m_pMapCycleFile->GetString() : "mapcycle.txt");
|
||||
|
||||
if (strcmp(path, pMapList->path) != 0)
|
||||
{
|
||||
smcore.strncopy(pMapList->path, path, sizeof(pMapList->path));
|
||||
strncopy(pMapList->path, path, sizeof(pMapList->path));
|
||||
pMapList->last_modified_time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!libsys->FileTime(pMapList->path, FileTime_LastChange, &last_time)
|
||||
if (!g_LibSys.FileTime(pMapList->path, FileTime_LastChange, &last_time)
|
||||
|| last_time > pMapList->last_modified_time)
|
||||
{
|
||||
/* Reparse */
|
||||
@@ -517,7 +533,7 @@ private:
|
||||
while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
size_t len = strlen(buffer);
|
||||
char *ptr = smcore.TrimWhitespace(buffer, len);
|
||||
char *ptr = UTIL_TrimWhitespace(buffer, len);
|
||||
if (*ptr == '\0'
|
||||
|| *ptr == ';'
|
||||
|| strncmp(ptr, "//", 2) == 0)
|
||||
@@ -530,7 +546,7 @@ private:
|
||||
}
|
||||
if ((blk = pMapList->pArray->push()) != NULL)
|
||||
{
|
||||
smcore.strncopy((char *)blk, ptr, 255);
|
||||
strncopy((char *)blk, ptr, 255);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +616,7 @@ static cell_t LoadMapList(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(hndl, htCellArray, &sec, (void **)&pArray))
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, htCellArray, &sec, (void **)&pArray))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -619,7 +635,7 @@ static cell_t LoadMapList(IPluginContext *pContext, const cell_t *params)
|
||||
/* If the user wanted a new array, create it now. */
|
||||
if (hndl == BAD_HANDLE)
|
||||
{
|
||||
if ((hndl = handlesys->CreateHandle(htCellArray, pNewArray, pContext->GetIdentity(), g_pCoreIdent, NULL))
|
||||
if ((hndl = g_HandleSys.CreateHandle(htCellArray, pNewArray, pContext->GetIdentity(), g_pCoreIdent, NULL))
|
||||
== BAD_HANDLE)
|
||||
{
|
||||
*addr = -1;
|
||||
@@ -720,10 +720,6 @@ static cell_t GetTimeConnected(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sp_ftoc(pInfo->GetTimeConnected());
|
||||
}
|
||||
@@ -743,10 +739,6 @@ static cell_t GetDataRate(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return pInfo->GetDataRate();
|
||||
}
|
||||
@@ -766,10 +758,6 @@ static cell_t IsTimingOut(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return pInfo->IsTimingOut() ? 1 : 0;
|
||||
}
|
||||
@@ -794,10 +782,6 @@ static cell_t GetLatency(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return sp_ftoc(-1);
|
||||
}
|
||||
|
||||
if (params[2] == MAX_FLOWS)
|
||||
{
|
||||
@@ -831,10 +815,6 @@ static cell_t GetAvgLatency(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return sp_ftoc(-1);
|
||||
}
|
||||
|
||||
if (params[2] == MAX_FLOWS)
|
||||
{
|
||||
@@ -868,10 +848,6 @@ static cell_t GetAvgLoss(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return sp_ftoc(-1);
|
||||
}
|
||||
|
||||
if (params[2] == MAX_FLOWS)
|
||||
{
|
||||
@@ -905,10 +881,6 @@ static cell_t GetAvgChoke(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return sp_ftoc(-1);
|
||||
}
|
||||
|
||||
if (params[2] == MAX_FLOWS)
|
||||
{
|
||||
@@ -942,10 +914,6 @@ static cell_t GetAvgData(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (params[2] == MAX_FLOWS)
|
||||
{
|
||||
@@ -980,11 +948,6 @@ static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (params[2] == MAX_FLOWS)
|
||||
{
|
||||
value = pInfo->GetAvgPackets(FLOW_INCOMING) + pInfo->GetAvgPackets(FLOW_OUTGOING);
|
||||
|
||||
@@ -29,10 +29,11 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include <IHandleSys.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "common_logic.h"
|
||||
#include "HandleSys.h"
|
||||
#include "CellArray.h"
|
||||
|
||||
/***********************************
|
||||
@@ -447,7 +448,7 @@ static cell_t sm_SortADTArray(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&cArray))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&cArray))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -534,7 +535,7 @@ static cell_t sm_SortADTArrayCustom(IPluginContext *pContext, const cell_t *para
|
||||
HandleError err;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err = handlesys->ReadHandle(params[1], htCellArray, &sec, (void **)&cArray))
|
||||
if ((err = g_HandleSys.ReadHandle(params[1], htCellArray, &sec, (void **)&cArray))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||
@@ -29,9 +29,9 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include "sm_globals.h"
|
||||
#include <ITextParsers.h>
|
||||
#include <ISourceMod.h>
|
||||
#include "HandleSys.h"
|
||||
|
||||
HandleType_t g_TypeSMC = 0;
|
||||
|
||||
@@ -152,16 +152,16 @@ public:
|
||||
/* These cannot be cloned, because they are locked to a specific plugin.
|
||||
* However, we let anyone read them because we don't care.
|
||||
*/
|
||||
handlesys->InitAccessDefaults(NULL, &sec);
|
||||
g_HandleSys.InitAccessDefaults(NULL, &sec);
|
||||
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY;
|
||||
sec.access[HandleAccess_Read] = 0;
|
||||
|
||||
g_TypeSMC = handlesys->CreateType("SMCParser", this, 0, NULL, &sec, g_pCoreIdent, NULL);
|
||||
g_TypeSMC = g_HandleSys.CreateType("SMCParser", this, 0, NULL, &sec, g_pCoreIdent, NULL);
|
||||
}
|
||||
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
handlesys->RemoveType(g_TypeSMC, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(g_TypeSMC, g_pCoreIdent);
|
||||
}
|
||||
|
||||
void OnHandleDestroy(HandleType_t type, void *object)
|
||||
@@ -183,7 +183,7 @@ static cell_t SMC_CreateParser(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
ParseInfo *pInfo = new ParseInfo();
|
||||
|
||||
Handle_t hndl = handlesys->CreateHandle(g_TypeSMC, pInfo, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
Handle_t hndl = g_HandleSys.CreateHandle(g_TypeSMC, pInfo, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
|
||||
/* Should never happen */
|
||||
if (!hndl)
|
||||
@@ -203,7 +203,7 @@ static cell_t SMC_SetParseStart(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -220,7 +220,7 @@ static cell_t SMC_SetParseEnd(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -237,7 +237,7 @@ static cell_t SMC_SetReaders(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -256,7 +256,7 @@ static cell_t SMC_SetRawLine(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -273,7 +273,7 @@ static cell_t SMC_ParseFile(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -283,7 +283,7 @@ static cell_t SMC_ParseFile(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToString(params[2], &file);
|
||||
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
g_pSM->BuildPath(Path_Game, path, sizeof(path), "%s", file);
|
||||
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "%s", file);
|
||||
|
||||
SMCStates states;
|
||||
SMCError p_err = textparsers->ParseFile_SMC(path, parse, &states);
|
||||
@@ -87,7 +87,7 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
||||
|
||||
ismm->AddListener(this, this);
|
||||
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
if ((vsp_interface = g_SMAPI->GetVSPInfo(&vsp_version)) == NULL)
|
||||
#endif
|
||||
{
|
||||
@@ -177,7 +177,7 @@ void SourceMod_Core::OnVSPListening(IServerPluginCallbacks *iface)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
if (vsp_version == 0)
|
||||
{
|
||||
g_SMAPI->GetVSPInfo(&vsp_version);
|
||||
@@ -205,13 +205,11 @@ void SourceMod_Core::OnVSPListening(IServerPluginCallbacks *iface)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
|
||||
void SourceMod_Core::OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand)
|
||||
{
|
||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||
Global_OnUnlinkConCommandBase(pCommand);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_
|
||||
#define _INCLUDE_SOURCEMOD_MM_API_H_
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#include "convar_sm_l4d.h"
|
||||
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||
#include "convar_sm_ob.h"
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
const char *GetLogTag();
|
||||
public:
|
||||
void OnVSPListening(IServerPluginCallbacks *iface);
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
void OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand);
|
||||
#else
|
||||
void OnPluginUnload(PluginId id);
|
||||
|
||||
+10
-12
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 :
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -47,8 +47,8 @@
|
||||
#include "TimerSys.h"
|
||||
#include "GameConfigs.h"
|
||||
#include "DebugReporter.h"
|
||||
#include "Profiler.h"
|
||||
#include "frame_hooks.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
|
||||
SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false);
|
||||
@@ -166,11 +166,6 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late
|
||||
g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/%s", g_BaseDir.c_str(), basepath);
|
||||
g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "%s", basepath);
|
||||
|
||||
if (!StartLogicBridge(error, maxlength))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Initialize CoreConfig to get the SourceMod base path properly - this parses core.cfg */
|
||||
g_CoreConfig.Initialize();
|
||||
|
||||
@@ -190,7 +185,7 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late
|
||||
{
|
||||
if (error && maxlength)
|
||||
{
|
||||
UTIL_Format(error, maxlength, "%s (failed to load bin/sourcepawn.jit.x86.%s)",
|
||||
snprintf(error, maxlength, "%s (failed to load bin/sourcepawn.jit.x86.%s)",
|
||||
myerror,
|
||||
PLATFORM_LIB_EXT);
|
||||
}
|
||||
@@ -243,6 +238,7 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late
|
||||
}
|
||||
|
||||
g_pSourcePawn2->SetDebugListener(&g_DbgReporter);
|
||||
g_pSourcePawn2->SetProfiler(&g_Profiler);
|
||||
|
||||
/* Hook this now so we can detect startup without calling StartSourceMod() */
|
||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
|
||||
@@ -269,8 +265,6 @@ void SourceModBase::StartSourceMod(bool late)
|
||||
/* Make the global core identity */
|
||||
g_pCoreIdent = g_ShareSys.CreateCoreIdentity();
|
||||
|
||||
InitLogicBridge();
|
||||
|
||||
/* Notify! */
|
||||
SMGlobalClass *pBase = SMGlobalClass::head;
|
||||
while (pBase)
|
||||
@@ -541,7 +535,6 @@ void SourceModBase::CloseSourceMod()
|
||||
}
|
||||
|
||||
/* Rest In Peace */
|
||||
ShutdownLogicBridge();
|
||||
ShutdownJIT();
|
||||
}
|
||||
|
||||
@@ -738,3 +731,8 @@ int SourceModBase::GetPluginId()
|
||||
|
||||
SMGlobalClass *SMGlobalClass::head = NULL;
|
||||
|
||||
SMGlobalClass::SMGlobalClass()
|
||||
{
|
||||
m_pGlobalClassNext = SMGlobalClass::head;
|
||||
SMGlobalClass::head = this;
|
||||
}
|
||||
|
||||
@@ -1,847 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: SourcePawn
|
||||
" Generated by vimsyntax.pl
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
"if exists("b:current_syntax")
|
||||
" finish
|
||||
"endif
|
||||
|
||||
" A bunch of useful C keywords
|
||||
syn keyword cStatement goto break return continue assert state sleep exit
|
||||
syn keyword cLabel case default
|
||||
syn keyword cConditional if else switch
|
||||
syn keyword cRepeat while for do
|
||||
|
||||
syn keyword cTodo contained TODO FIXME XXX
|
||||
|
||||
" cCommentGroup allows adding matches for special things in comments
|
||||
syn cluster cCommentGroup contains=cTodo
|
||||
|
||||
" String and Character constants
|
||||
" Highlight special characters (those which have a backslash) differently
|
||||
syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
|
||||
if !exists("c_no_utf")
|
||||
syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
|
||||
endif
|
||||
if exists("c_no_cformat")
|
||||
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell
|
||||
" cCppString: same as cString, but ends at end of line
|
||||
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell
|
||||
else
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
else
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
endif
|
||||
syn match cFormat display "%%" contained
|
||||
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell
|
||||
" cCppString: same as cString, but ends at end of line
|
||||
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
endif
|
||||
|
||||
syn match cCharacter "L\='[^\\]'"
|
||||
syn match cCharacter "L'[^']*'" contains=cSpecial
|
||||
if exists("c_gnu")
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
|
||||
else
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
|
||||
endif
|
||||
syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
|
||||
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
|
||||
syn match cSpecialCharacter display "L'\\x\x\+'"
|
||||
|
||||
"when wanted, highlight trailing white space
|
||||
if exists("c_space_errors")
|
||||
if !exists("c_no_trail_space_error")
|
||||
syn match cSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
if !exists("c_no_tab_space_error")
|
||||
syn match cSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
" This should be before cErrInParen to avoid problems with #define ({ xxx })
|
||||
syntax region cBlock start="{" end="}" transparent fold
|
||||
|
||||
"catch errors caused by wrong parenthesis and brackets
|
||||
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
|
||||
" But avoid matching <::.
|
||||
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cCommentSkip,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cNumbersCom
|
||||
if exists("c_no_curly_error")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
|
||||
elseif exists("c_no_bracket_error")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "[{}]\|<%\|%>"
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
syn match cParenError display "[\])]"
|
||||
syn match cErrInParen display contained "[\]{}]\|<%\|%>"
|
||||
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
|
||||
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
|
||||
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
|
||||
endif
|
||||
|
||||
"integer number, or floating point number without a dot and with "f".
|
||||
syn case ignore
|
||||
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat
|
||||
" Same (for comments)
|
||||
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat
|
||||
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
"hex number
|
||||
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
syn match cFloat display contained "\d\+f"
|
||||
"floating point number, with dot, optional exponent
|
||||
syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
|
||||
"floating point number, starting with a dot, optional exponent
|
||||
syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
|
||||
"floating point number, without dot, with exponent
|
||||
syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
|
||||
if !exists("c_no_c99")
|
||||
"hexadecimal floating point number, optional leading digits, with dot, with exponent
|
||||
syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
|
||||
"hexadecimal floating point number, with leading digits, optional dot, with exponent
|
||||
syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
if exists("c_comment_strings")
|
||||
" A comment can contain cString, cCharacter and cNumber.
|
||||
" But a "*/" inside a cString in a cComment DOES end the comment! So we
|
||||
" need to use a special type of cString: cCommentString, which also ends on
|
||||
" "*/", and sees a "*" at the start of the line as comment again.
|
||||
" Unfortunately this doesn't very well work for // type of comments :-(
|
||||
syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
|
||||
syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
|
||||
syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
|
||||
syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
" Use "extend" here to have preprocessor lines not terminate halfway a
|
||||
" comment.
|
||||
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
|
||||
else
|
||||
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
|
||||
endif
|
||||
else
|
||||
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell
|
||||
else
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold
|
||||
endif
|
||||
endif
|
||||
" keep a // comment separately, it terminates a preproc. conditional
|
||||
syntax match cCommentError display "\*/"
|
||||
syntax match cCommentStartError display "/\*"me=e-1 contained
|
||||
|
||||
syn keyword cOperator sizeof tagof state defined char
|
||||
|
||||
syn keyword cTag any bool Fixed Float String Function
|
||||
|
||||
syn keyword cStructure enum
|
||||
syn keyword cStorageClass static const stock native forward
|
||||
|
||||
" Constants
|
||||
" ======
|
||||
syn keyword cConstant cellbits cellmax cellmin charbits charmax charmin ucharmax __Pawn debug
|
||||
syn keyword cConstant true false
|
||||
|
||||
" admin.inc
|
||||
syn keyword cFunction DumpAdminCache AddCommandOverride GetCommandOverride UnsetCommandOverride
|
||||
syn keyword cFunction CreateAdmGroup FindAdmGroup SetAdmGroupAddFlag GetAdmGroupAddFlag
|
||||
syn keyword cFunction GetAdmGroupAddFlags SetAdmGroupImmunity GetAdmGroupImmunity SetAdmGroupImmuneFrom
|
||||
syn keyword cFunction GetAdmGroupImmuneCount GetAdmGroupImmuneFrom AddAdmGroupCmdOverride GetAdmGroupCmdOverride
|
||||
syn keyword cFunction RegisterAuthIdentType CreateAdmin GetAdminUsername BindAdminIdentity
|
||||
syn keyword cFunction SetAdminFlag GetAdminFlag GetAdminFlags AdminInheritGroup
|
||||
syn keyword cFunction GetAdminGroupCount GetAdminGroup SetAdminPassword GetAdminPassword
|
||||
syn keyword cFunction FindAdminByIdentity RemoveAdmin FlagBitsToBitArray FlagBitArrayToBits
|
||||
syn keyword cFunction FlagArrayToBits FlagBitsToArray FindFlagByName FindFlagByChar
|
||||
syn keyword cFunction ReadFlagString CanAdminTarget CreateAuthMethod SetAdmGroupImmunityLevel
|
||||
syn keyword cFunction GetAdmGroupImmunityLevel SetAdminImmunityLevel GetAdminImmunityLevel FlagToBit
|
||||
syn keyword cFunction BitToFlag
|
||||
syn keyword cConstant Admin_Reservation Admin_Generic Admin_Kick Admin_Ban
|
||||
syn keyword cConstant Admin_Unban Admin_Slay Admin_Changemap Admin_Convars
|
||||
syn keyword cConstant Admin_Config Admin_Chat Admin_Vote Admin_Password
|
||||
syn keyword cConstant Admin_RCON Admin_Cheats Admin_Root Admin_Custom1
|
||||
syn keyword cConstant Admin_Custom2 Admin_Custom3 Admin_Custom4 Admin_Custom5
|
||||
syn keyword cConstant Admin_Custom6 AdminFlags_TOTAL ADMFLAG_RESERVATION ADMFLAG_GENERIC
|
||||
syn keyword cConstant ADMFLAG_KICK ADMFLAG_BAN ADMFLAG_UNBAN ADMFLAG_SLAY
|
||||
syn keyword cConstant ADMFLAG_CHANGEMAP ADMFLAG_CONVARS ADMFLAG_CONFIG ADMFLAG_CHAT
|
||||
syn keyword cConstant ADMFLAG_VOTE ADMFLAG_PASSWORD ADMFLAG_RCON ADMFLAG_CHEATS
|
||||
syn keyword cConstant ADMFLAG_ROOT ADMFLAG_CUSTOM1 ADMFLAG_CUSTOM2 ADMFLAG_CUSTOM3
|
||||
syn keyword cConstant ADMFLAG_CUSTOM4 ADMFLAG_CUSTOM5 ADMFLAG_CUSTOM6 AUTHMETHOD_STEAM
|
||||
syn keyword cConstant AUTHMETHOD_IP AUTHMETHOD_NAME Override_Command Override_CommandGroup
|
||||
syn keyword cConstant Command_Deny Command_Allow Immunity_Default Immunity_Global
|
||||
syn keyword cConstant INVALID_GROUP_ID INVALID_ADMIN_ID Access_Real Access_Effective
|
||||
syn keyword cConstant AdminCache_Overrides AdminCache_Groups AdminCache_Admins
|
||||
syn keyword cTag AdminFlag OverrideType OverrideRule ImmunityType
|
||||
syn keyword cTag GroupId AdminId AdmAccessMode AdminCachePart
|
||||
syn keyword cForward OnRebuildAdminCache
|
||||
|
||||
" adminmenu.inc
|
||||
syn keyword cFunction GetAdminTopMenu AddTargetsToMenu AddTargetsToMenu2 RedisplayAdminMenu
|
||||
syn keyword cConstant ADMINMENU_PLAYERCOMMANDS ADMINMENU_SERVERCOMMANDS ADMINMENU_VOTINGCOMMANDS
|
||||
syn keyword cForward OnAdminMenuCreated OnAdminMenuReady
|
||||
|
||||
" adt.inc
|
||||
|
||||
" adt_array.inc
|
||||
syn keyword cFunction ByteCountToCells CreateArray ClearArray CloneArray
|
||||
syn keyword cFunction ResizeArray GetArraySize PushArrayCell PushArrayString
|
||||
syn keyword cFunction PushArrayArray GetArrayCell GetArrayString GetArrayArray
|
||||
syn keyword cFunction SetArrayCell SetArrayString SetArrayArray ShiftArrayUp
|
||||
syn keyword cFunction RemoveFromArray SwapArrayItems FindStringInArray FindValueInArray
|
||||
|
||||
" adt_stack.inc
|
||||
syn keyword cFunction CreateStack PushStackCell PushStackString PushStackArray
|
||||
syn keyword cFunction PopStackCell PopStackString PopStackArray IsStackEmpty
|
||||
syn keyword cFunction PopStack
|
||||
|
||||
" adt_trie.inc
|
||||
syn keyword cFunction CreateTrie SetTrieValue SetTrieArray SetTrieString
|
||||
syn keyword cFunction GetTrieValue GetTrieArray GetTrieString RemoveFromTrie
|
||||
syn keyword cFunction ClearTrie GetTrieSize
|
||||
|
||||
" banning.inc
|
||||
syn keyword cFunction BanClient BanIdentity RemoveBan
|
||||
syn keyword cConstant BANFLAG_AUTO BANFLAG_IP BANFLAG_AUTHID BANFLAG_NOKICK
|
||||
syn keyword cForward OnBanClient OnBanIdentity OnRemoveBan
|
||||
|
||||
" bitbuffer.inc
|
||||
syn keyword cFunction BfWriteBool BfWriteByte BfWriteChar BfWriteShort
|
||||
syn keyword cFunction BfWriteWord BfWriteNum BfWriteFloat BfWriteString
|
||||
syn keyword cFunction BfWriteEntity BfWriteAngle BfWriteCoord BfWriteVecCoord
|
||||
syn keyword cFunction BfWriteVecNormal BfWriteAngles BfReadBool BfReadByte
|
||||
syn keyword cFunction BfReadChar BfReadShort BfReadWord BfReadNum
|
||||
syn keyword cFunction BfReadFloat BfReadString BfReadEntity BfReadAngle
|
||||
syn keyword cFunction BfReadCoord BfReadVecCoord BfReadVecNormal BfReadAngles
|
||||
syn keyword cFunction BfGetNumBytesLeft
|
||||
|
||||
" clientprefs.inc
|
||||
syn keyword cFunction RegClientCookie FindClientCookie SetClientCookie GetClientCookie
|
||||
syn keyword cFunction AreClientCookiesCached SetCookiePrefabMenu SetCookieMenuItem ShowCookieMenu
|
||||
syn keyword cFunction GetCookieIterator ReadCookieIterator GetCookieAccess
|
||||
syn keyword cConstant CookieAccess_Public CookieAccess_Protected CookieAccess_Private CookieMenu_YesNo
|
||||
syn keyword cConstant CookieMenu_YesNo_Int CookieMenu_OnOff CookieMenu_OnOff_Int CookieMenuAction_DisplayOption
|
||||
syn keyword cConstant CookieMenuAction_SelectOption
|
||||
syn keyword cTag CookieAccess CookieMenu CookieMenuAction CookieMenuHandler
|
||||
syn keyword cForward OnClientCookiesCached
|
||||
|
||||
" clients.inc
|
||||
syn keyword cFunction GetMaxClients GetClientCount GetClientName GetClientIP
|
||||
syn keyword cFunction GetClientAuthString GetClientUserId IsClientConnected IsClientInGame
|
||||
syn keyword cFunction IsClientInKickQueue IsPlayerInGame IsClientAuthorized IsFakeClient
|
||||
syn keyword cFunction IsClientObserver IsPlayerAlive GetClientInfo GetClientTeam
|
||||
syn keyword cFunction SetUserAdmin GetUserAdmin AddUserFlags RemoveUserFlags
|
||||
syn keyword cFunction SetUserFlagBits GetUserFlagBits CanUserTarget RunAdminCacheChecks
|
||||
syn keyword cFunction NotifyPostAdminCheck CreateFakeClient SetFakeClientConVar GetClientHealth
|
||||
syn keyword cFunction GetClientModel GetClientWeapon GetClientMaxs GetClientMins
|
||||
syn keyword cFunction GetClientAbsAngles GetClientAbsOrigin GetClientArmor GetClientDeaths
|
||||
syn keyword cFunction GetClientFrags GetClientDataRate IsClientTimingOut GetClientTime
|
||||
syn keyword cFunction GetClientLatency GetClientAvgLatency GetClientAvgLoss GetClientAvgChoke
|
||||
syn keyword cFunction GetClientAvgData GetClientAvgPackets GetClientOfUserId KickClient
|
||||
syn keyword cFunction KickClientEx ChangeClientTeam GetClientSerial GetClientFromSerial
|
||||
syn keyword cConstant NetFlow_Outgoing NetFlow_Incoming NetFlow_Both MAXPLAYERS
|
||||
syn keyword cConstant MAX_NAME_LENGTH MaxClients
|
||||
syn keyword cTag NetFlow
|
||||
syn keyword cForward OnClientConnect OnClientConnected OnClientPutInServer OnClientDisconnect
|
||||
syn keyword cForward OnClientDisconnect_Post OnClientCommand OnClientSettingsChanged OnClientAuthorized
|
||||
syn keyword cForward OnClientPreAdminCheck OnClientPostAdminFilter OnClientPostAdminCheck
|
||||
|
||||
" commandfilters.inc
|
||||
syn keyword cFunction ProcessTargetString ReplyToTargetError
|
||||
syn keyword cConstant MAX_TARGET_LENGTH COMMAND_FILTER_ALIVE COMMAND_FILTER_DEAD COMMAND_FILTER_CONNECTED
|
||||
syn keyword cConstant COMMAND_FILTER_NO_IMMUNITY COMMAND_FILTER_NO_MULTI COMMAND_FILTER_NO_BOTS COMMAND_TARGET_NONE
|
||||
syn keyword cConstant COMMAND_TARGET_NOT_ALIVE COMMAND_TARGET_NOT_DEAD COMMAND_TARGET_NOT_IN_GAME COMMAND_TARGET_IMMUNE
|
||||
syn keyword cConstant COMMAND_TARGET_EMPTY_FILTER COMMAND_TARGET_NOT_HUMAN COMMAND_TARGET_AMBIGUOUS
|
||||
|
||||
" console.inc
|
||||
syn keyword cFunction ServerCommand InsertServerCommand ServerExecute ClientCommand
|
||||
syn keyword cFunction FakeClientCommand FakeClientCommandEx PrintToServer PrintToConsole
|
||||
syn keyword cFunction ReplyToCommand GetCmdReplySource SetCmdReplySource IsChatTrigger
|
||||
syn keyword cFunction ShowActivity2 ShowActivity ShowActivityEx FormatActivitySource
|
||||
syn keyword cFunction RegServerCmd RegConsoleCmd RegAdminCmd GetCmdArgs
|
||||
syn keyword cFunction GetCmdArg GetCmdArgString CreateConVar FindConVar
|
||||
syn keyword cFunction HookConVarChange UnhookConVarChange GetConVarBool SetConVarBool
|
||||
syn keyword cFunction GetConVarInt SetConVarInt GetConVarFloat SetConVarFloat
|
||||
syn keyword cFunction GetConVarString SetConVarString ResetConVar GetConVarFlags
|
||||
syn keyword cFunction SetConVarFlags GetConVarBounds SetConVarBounds GetConVarName
|
||||
syn keyword cFunction QueryClientConVar GetCommandIterator ReadCommandIterator CheckCommandAccess
|
||||
syn keyword cFunction IsValidConVarChar GetCommandFlags SetCommandFlags FindFirstConCommand
|
||||
syn keyword cFunction FindNextConCommand SendConVarValue AddServerTag RemoveServerTag
|
||||
syn keyword cConstant INVALID_FCVAR_FLAGS ConVarBound_Upper ConVarBound_Lower QUERYCOOKIE_FAILED
|
||||
syn keyword cConstant SM_REPLY_TO_CONSOLE SM_REPLY_TO_CHAT ConVarQuery_Okay ConVarQuery_NotFound
|
||||
syn keyword cConstant ConVarQuery_NotValid ConVarQuery_Protected FCVAR_NONE FCVAR_UNREGISTERED
|
||||
syn keyword cConstant FCVAR_LAUNCHER FCVAR_GAMEDLL FCVAR_CLIENTDLL FCVAR_MATERIAL_SYSTEM
|
||||
syn keyword cConstant FCVAR_PROTECTED FCVAR_SPONLY FCVAR_ARCHIVE FCVAR_NOTIFY
|
||||
syn keyword cConstant FCVAR_USERINFO FCVAR_PRINTABLEONLY FCVAR_UNLOGGED FCVAR_NEVER_AS_STRING
|
||||
syn keyword cConstant FCVAR_REPLICATED FCVAR_CHEAT FCVAR_STUDIORENDER FCVAR_DEMO
|
||||
syn keyword cConstant FCVAR_DONTRECORD FCVAR_PLUGIN FCVAR_DATACACHE FCVAR_TOOLSYSTEM
|
||||
syn keyword cConstant FCVAR_FILESYSTEM FCVAR_NOT_CONNECTED FCVAR_SOUNDSYSTEM FCVAR_ARCHIVE_XBOX
|
||||
syn keyword cConstant FCVAR_INPUTSYSTEM FCVAR_NETWORKSYSTEM FCVAR_VPHYSICS
|
||||
syn keyword cTag ConVarBounds QueryCookie ReplySource ConVarQueryResult
|
||||
syn keyword cTag SrvCmd ConCmd ConVarChanged ConVarQueryFinished
|
||||
|
||||
" core.inc
|
||||
syn keyword cFunction VerifyCoreVersion
|
||||
syn keyword cConstant SOURCEMOD_PLUGINAPI_VERSION Plugin_Continue Plugin_Changed Plugin_Handled
|
||||
syn keyword cConstant Plugin_Stop Identity_Core Identity_Extension Identity_Plugin
|
||||
syn keyword cConstant Plugin_Running Plugin_Paused Plugin_Error Plugin_Loaded
|
||||
syn keyword cConstant Plugin_Failed Plugin_Created Plugin_Uncompiled Plugin_BadLoad
|
||||
syn keyword cConstant PlInfo_Name PlInfo_Author PlInfo_Description PlInfo_Version
|
||||
syn keyword cConstant PlInfo_URL NULL_VECTOR NULL_STRING
|
||||
syn keyword cTag PlVers Function Action Identity
|
||||
syn keyword cTag PluginStatus PluginInfo Extension SharedPlugin
|
||||
|
||||
" cstrike.inc
|
||||
syn keyword cFunction CS_RespawnPlayer CS_SwitchTeam
|
||||
syn keyword cConstant CS_TEAM_NONE CS_TEAM_SPECTATOR CS_TEAM_T CS_TEAM_CT
|
||||
syn keyword cConstant CS_SLOT_PRIMARY CS_SLOT_SECONDARY CS_SLOT_GRENADE CS_SLOT_C4
|
||||
|
||||
" datapack.inc
|
||||
syn keyword cFunction CreateDataPack WritePackCell WritePackFloat WritePackString
|
||||
syn keyword cFunction ReadPackCell ReadPackFloat ReadPackString ResetPack
|
||||
syn keyword cFunction GetPackPosition SetPackPosition IsPackReadable
|
||||
|
||||
" dbi.inc
|
||||
syn keyword cFunction SQL_Connect SQL_DefConnect SQL_ConnectCustom SQLite_UseDatabase
|
||||
syn keyword cFunction SQL_ConnectEx SQL_CheckConfig SQL_GetDriver SQL_ReadDriver
|
||||
syn keyword cFunction SQL_GetDriverIdent SQL_GetDriverProduct SQL_GetAffectedRows SQL_GetInsertId
|
||||
syn keyword cFunction SQL_GetError SQL_EscapeString SQL_QuoteString SQL_FastQuery
|
||||
syn keyword cFunction SQL_Query SQL_PrepareQuery SQL_FetchMoreResults SQL_HasResultSet
|
||||
syn keyword cFunction SQL_GetRowCount SQL_GetFieldCount SQL_FieldNumToName SQL_FieldNameToNum
|
||||
syn keyword cFunction SQL_FetchRow SQL_MoreRows SQL_Rewind SQL_FetchString
|
||||
syn keyword cFunction SQL_FetchFloat SQL_FetchInt SQL_IsFieldNull SQL_FetchSize
|
||||
syn keyword cFunction SQL_BindParamInt SQL_BindParamFloat SQL_BindParamString SQL_Execute
|
||||
syn keyword cFunction SQL_LockDatabase SQL_UnlockDatabase SQL_IsSameConnection SQL_TConnect
|
||||
syn keyword cFunction SQL_TQuery
|
||||
syn keyword cConstant DBVal_Error DBVal_TypeMismatch DBVal_Null DBVal_Data
|
||||
syn keyword cConstant DBBind_Int DBBind_Float DBBind_String DBPrio_High
|
||||
syn keyword cConstant DBPrio_Normal DBPrio_Low
|
||||
syn keyword cTag DBResult DBBindType DBPriority SQLTCallback
|
||||
|
||||
" entity.inc
|
||||
syn keyword cFunction GetMaxEntities GetEntityCount IsValidEntity IsValidEdict
|
||||
syn keyword cFunction IsEntNetworkable CreateEdict RemoveEdict GetEdictFlags
|
||||
syn keyword cFunction SetEdictFlags GetEdictClassname GetEntityNetClass ChangeEdictState
|
||||
syn keyword cFunction GetEntData SetEntData GetEntDataFloat SetEntDataFloat
|
||||
syn keyword cFunction GetEntDataEnt SetEntDataEnt GetEntDataEnt2 SetEntDataEnt2
|
||||
syn keyword cFunction GetEntDataVector SetEntDataVector GetEntDataString SetEntDataString
|
||||
syn keyword cFunction FindSendPropOffs FindSendPropInfo FindDataMapOffs GetEntSendPropOffs
|
||||
syn keyword cFunction GetEntProp SetEntProp GetEntPropFloat SetEntPropFloat
|
||||
syn keyword cFunction GetEntPropEnt SetEntPropEnt GetEntPropVector SetEntPropVector
|
||||
syn keyword cFunction GetEntPropString SetEntPropString GetEntDataArray SetEntDataArray
|
||||
syn keyword cConstant Prop_Send Prop_Data FL_EDICT_CHANGED FL_EDICT_FREE
|
||||
syn keyword cConstant FL_EDICT_FULL FL_EDICT_FULLCHECK FL_EDICT_ALWAYS FL_EDICT_DONTSEND
|
||||
syn keyword cConstant FL_EDICT_PVSCHECK FL_EDICT_PENDING_DORMANT_CHECK FL_EDICT_DIRTY_PVS_INFORMATION FL_FULL_EDICT_CHANGED
|
||||
syn keyword cConstant PropField_Unsupported PropField_Integer PropField_Float PropField_Entity
|
||||
syn keyword cConstant PropField_Vector PropField_String PropField_String_T
|
||||
syn keyword cTag PropType PropFieldType
|
||||
|
||||
" entity_prop_stocks.inc
|
||||
syn keyword cFunction GetEntityFlags GetEntityMoveType SetEntityMoveType GetEntityRenderMode
|
||||
syn keyword cFunction SetEntityRenderMode GetEntityRenderFx SetEntityRenderFx SetEntityRenderColor
|
||||
syn keyword cFunction GetEntityGravity SetEntityGravity SetEntityHealth GetClientButtons
|
||||
syn keyword cConstant MOVETYPE_NONE MOVETYPE_ISOMETRIC MOVETYPE_WALK MOVETYPE_STEP
|
||||
syn keyword cConstant MOVETYPE_FLY MOVETYPE_FLYGRAVITY MOVETYPE_VPHYSICS MOVETYPE_PUSH
|
||||
syn keyword cConstant MOVETYPE_NOCLIP MOVETYPE_LADDER MOVETYPE_OBSERVER MOVETYPE_CUSTOM
|
||||
syn keyword cConstant RENDER_NORMAL RENDER_TRANSCOLOR RENDER_TRANSTEXTURE RENDER_GLOW
|
||||
syn keyword cConstant RENDER_TRANSALPHA RENDER_TRANSADD RENDER_ENVIRONMENTAL RENDER_TRANSADDFRAMEBLEND
|
||||
syn keyword cConstant RENDER_TRANSALPHAADD RENDER_WORLDGLOW RENDER_NONE RENDERFX_NONE
|
||||
syn keyword cConstant RENDERFX_PULSE_SLOW RENDERFX_PULSE_FAST RENDERFX_PULSE_SLOW_WIDE RENDERFX_PULSE_FAST_WIDE
|
||||
syn keyword cConstant RENDERFX_FADE_SLOW RENDERFX_FADE_FAST RENDERFX_SOLID_SLOW RENDERFX_SOLID_FAST
|
||||
syn keyword cConstant RENDERFX_STROBE_SLOW RENDERFX_STROBE_FAST RENDERFX_STROBE_FASTER RENDERFX_FLICKER_SLOW
|
||||
syn keyword cConstant RENDERFX_FLICKER_FAST RENDERFX_NO_DISSIPATION RENDERFX_DISTORT RENDERFX_HOLOGRAM
|
||||
syn keyword cConstant RENDERFX_EXPLODE RENDERFX_GLOWSHELL RENDERFX_CLAMP_MIN_SCALE RENDERFX_ENV_RAIN
|
||||
syn keyword cConstant RENDERFX_ENV_SNOW RENDERFX_SPOTLIGHT RENDERFX_RAGDOLL RENDERFX_PULSE_FAST_WIDER
|
||||
syn keyword cConstant RENDERFX_MAX IN_ATTACK IN_JUMP IN_DUCK
|
||||
syn keyword cConstant IN_FORWARD IN_BACK IN_USE IN_CANCEL
|
||||
syn keyword cConstant IN_LEFT IN_RIGHT IN_MOVELEFT IN_MOVERIGHT
|
||||
syn keyword cConstant IN_ATTACK2 IN_RUN IN_RELOAD IN_ALT1
|
||||
syn keyword cConstant IN_ALT2 IN_SCORE IN_SPEED IN_WALK
|
||||
syn keyword cConstant IN_ZOOM IN_WEAPON1 IN_WEAPON2 IN_BULLRUSH
|
||||
syn keyword cConstant IN_GRENADE1 IN_GRENADE2 FL_ONGROUND FL_DUCKING
|
||||
syn keyword cConstant FL_WATERJUMP FL_ONTRAIN FL_INRAIN FL_FROZEN
|
||||
syn keyword cConstant FL_ATCONTROLS FL_CLIENT FL_FAKECLIENT PLAYER_FLAG_BITS
|
||||
syn keyword cConstant FL_INWATER FL_FLY FL_SWIM FL_CONVEYOR
|
||||
syn keyword cConstant FL_NPC FL_GODMODE FL_NOTARGET FL_AIMTARGET
|
||||
syn keyword cConstant FL_PARTIALGROUND FL_STATICPROP FL_GRAPHED FL_GRENADE
|
||||
syn keyword cConstant FL_STEPMOVEMENT FL_DONTTOUCH FL_BASEVELOCITY FL_WORLDBRUSH
|
||||
syn keyword cConstant FL_OBJECT FL_KILLME FL_ONFIRE FL_DISSOLVING
|
||||
syn keyword cConstant FL_TRANSRAGDOLL FL_UNBLOCKABLE_BY_PLAYER
|
||||
syn keyword cTag MoveType RenderMode RenderFx
|
||||
|
||||
" events.inc
|
||||
syn keyword cFunction HookEvent HookEventEx UnhookEvent CreateEvent
|
||||
syn keyword cFunction FireEvent CancelCreatedEvent GetEventBool SetEventBool
|
||||
syn keyword cFunction GetEventInt SetEventInt GetEventFloat SetEventFloat
|
||||
syn keyword cFunction GetEventString SetEventString GetEventName
|
||||
syn keyword cConstant EventHookMode_Pre EventHookMode_Post EventHookMode_PostNoCopy
|
||||
syn keyword cTag EventHookMode EventHook
|
||||
|
||||
" files.inc
|
||||
syn keyword cFunction BuildPath OpenDirectory ReadDirEntry OpenFile
|
||||
syn keyword cFunction DeleteFile ReadFileLine ReadFile ReadFileString
|
||||
syn keyword cFunction WriteFile WriteFileString WriteFileLine ReadFileCell
|
||||
syn keyword cFunction WriteFileCell IsEndOfFile FileSeek FilePosition
|
||||
syn keyword cFunction FileExists RenameFile DirExists FileSize
|
||||
syn keyword cFunction FlushFile RemoveDir CreateDirectory GetFileTime
|
||||
syn keyword cFunction LogToOpenFile LogToOpenFileEx
|
||||
syn keyword cConstant FileType_Unknown FileType_Directory FileType_File FileTime_LastAccess
|
||||
syn keyword cConstant FileTime_Created FileTime_LastChange PLATFORM_MAX_PATH SEEK_SET
|
||||
syn keyword cConstant SEEK_CUR SEEK_END Path_SM FPERM_U_READ
|
||||
syn keyword cConstant FPERM_U_WRITE FPERM_U_EXEC FPERM_G_READ FPERM_G_WRITE
|
||||
syn keyword cConstant FPERM_G_EXEC FPERM_O_READ FPERM_O_WRITE FPERM_O_EXEC
|
||||
syn keyword cTag FileType FileTimeMode PathType
|
||||
|
||||
" float.inc
|
||||
syn keyword cFunction float FloatMul FloatDiv FloatAdd
|
||||
syn keyword cFunction FloatSub FloatFraction RoundToZero RoundToCeil
|
||||
syn keyword cFunction RoundToFloor RoundToNearest FloatCompare SquareRoot
|
||||
syn keyword cFunction Pow Exponential Logarithm Sine
|
||||
syn keyword cFunction Cosine Tangent FloatAbs ArcTangent
|
||||
syn keyword cFunction ArcCosine ArcSine ArcTangent2 RoundFloat
|
||||
syn keyword cFunction DegToRad RadToDeg
|
||||
syn keyword cConstant FLOAT_PI
|
||||
|
||||
" functions.inc
|
||||
syn keyword cFunction GetFunctionByName CreateGlobalForward CreateForward GetForwardFunctionCount
|
||||
syn keyword cFunction AddToForward RemoveFromForward RemoveAllFromForward Call_StartForward
|
||||
syn keyword cFunction Call_StartFunction Call_PushCell Call_PushCellRef Call_PushFloat
|
||||
syn keyword cFunction Call_PushFloatRef Call_PushArray Call_PushArrayEx Call_PushString
|
||||
syn keyword cFunction Call_PushStringEx Call_Finish Call_Cancel CreateNative
|
||||
syn keyword cFunction ThrowNativeError GetNativeStringLength GetNativeString SetNativeString
|
||||
syn keyword cFunction GetNativeCell GetNativeCellRef SetNativeCellRef GetNativeArray
|
||||
syn keyword cFunction SetNativeArray FormatNativeString
|
||||
syn keyword cConstant SP_PARAMFLAG_BYREF Param_Any Param_Cell Param_Float
|
||||
syn keyword cConstant Param_String Param_Array Param_VarArgs Param_CellByRef
|
||||
syn keyword cConstant Param_FloatByRef ET_Ignore ET_Single ET_Event
|
||||
syn keyword cConstant ET_Hook SM_PARAM_COPYBACK SM_PARAM_STRING_UTF8 SM_PARAM_STRING_COPY
|
||||
syn keyword cConstant SM_PARAM_STRING_BINARY SP_ERROR_NONE SP_ERROR_FILE_FORMAT SP_ERROR_DECOMPRESSOR
|
||||
syn keyword cConstant SP_ERROR_HEAPLOW SP_ERROR_PARAM SP_ERROR_INVALID_ADDRESS SP_ERROR_NOT_FOUND
|
||||
syn keyword cConstant SP_ERROR_INDEX SP_ERROR_STACKLOW SP_ERROR_NOTDEBUGGING SP_ERROR_INVALID_INSTRUCTION
|
||||
syn keyword cConstant SP_ERROR_MEMACCESS SP_ERROR_STACKMIN SP_ERROR_HEAPMIN SP_ERROR_DIVIDE_BY_ZERO
|
||||
syn keyword cConstant SP_ERROR_ARRAY_BOUNDS SP_ERROR_INSTRUCTION_PARAM SP_ERROR_STACKLEAK SP_ERROR_HEAPLEAK
|
||||
syn keyword cConstant SP_ERROR_ARRAY_TOO_BIG SP_ERROR_TRACKER_BOUNDS SP_ERROR_INVALID_NATIVE SP_ERROR_PARAMS_MAX
|
||||
syn keyword cConstant SP_ERROR_NATIVE SP_ERROR_NOT_RUNNABLE SP_ERROR_ABORTED
|
||||
syn keyword cTag ParamType ExecType NativeCall
|
||||
|
||||
" geoip.inc
|
||||
syn keyword cFunction GeoipCode2 GeoipCode3 GeoipCountry
|
||||
|
||||
" halflife.inc
|
||||
syn keyword cFunction LogToGame SetRandomSeed GetRandomFloat GetRandomInt
|
||||
syn keyword cFunction IsMapValid IsDedicatedServer GetEngineTime GetGameTime
|
||||
syn keyword cFunction GetGameDescription GetGameFolderName GetCurrentMap PrecacheModel
|
||||
syn keyword cFunction PrecacheSentenceFile PrecacheDecal PrecacheGeneric IsModelPrecached
|
||||
syn keyword cFunction IsDecalPrecached IsGenericPrecached PrecacheSound IsSoundPrecached
|
||||
syn keyword cFunction CreateDialog GuessSDKVersion PrintToChat PrintToChatAll
|
||||
syn keyword cFunction PrintCenterText PrintCenterTextAll PrintHintText PrintHintTextToAll
|
||||
syn keyword cFunction ShowVGUIPanel CreateHudSynchronizer SetHudTextParams SetHudTextParamsEx
|
||||
syn keyword cFunction ShowSyncHudText ClearSyncHud ShowHudText ShowMOTDPanel
|
||||
syn keyword cFunction DisplayAskConnectBox
|
||||
syn keyword cConstant SOURCE_SDK_UNKNOWN SOURCE_SDK_ORIGINAL SOURCE_SDK_DARKMESSIAH SOURCE_SDK_EPISODE1
|
||||
syn keyword cConstant SOURCE_SDK_EPISODE2 SOURCE_SDK_LEFT4DEAD MOTDPANEL_TYPE_TEXT MOTDPANEL_TYPE_INDEX
|
||||
syn keyword cConstant MOTDPANEL_TYPE_URL MOTDPANEL_TYPE_FILE DialogType_Msg DialogType_Menu
|
||||
syn keyword cConstant DialogType_Text DialogType_Entry DialogType_AskConnect
|
||||
syn keyword cTag DialogType
|
||||
|
||||
" handles.inc
|
||||
syn keyword cFunction CloseHandle CloneHandle IsValidHandle
|
||||
syn keyword cConstant INVALID_HANDLE
|
||||
syn keyword cTag Handle
|
||||
|
||||
" helpers.inc
|
||||
syn keyword cFunction FormatUserLogText FindPluginByFile SearchForClients FindTarget
|
||||
syn keyword cFunction LoadMaps
|
||||
|
||||
" keyvalues.inc
|
||||
syn keyword cFunction CreateKeyValues KvSetString KvSetNum KvSetUInt64
|
||||
syn keyword cFunction KvSetFloat KvSetColor KvSetVector KvGetString
|
||||
syn keyword cFunction KvGetNum KvGetFloat KvGetColor KvGetUInt64
|
||||
syn keyword cFunction KvGetVector KvJumpToKey KvJumpToKeySymbol KvGotoFirstSubKey
|
||||
syn keyword cFunction KvGotoNextKey KvSavePosition KvDeleteKey KvDeleteThis
|
||||
syn keyword cFunction KvGoBack KvRewind KvGetSectionName KvSetSectionName
|
||||
syn keyword cFunction KvGetDataType KeyValuesToFile FileToKeyValues KvSetEscapeSequences
|
||||
syn keyword cFunction KvNodesInStack KvCopySubkeys KvFindKeyById KvGetNameSymbol
|
||||
syn keyword cFunction KvGetSectionSymbol
|
||||
syn keyword cConstant KvData_None KvData_String KvData_Int KvData_Float
|
||||
syn keyword cConstant KvData_Ptr KvData_WString KvData_Color KvData_UInt64
|
||||
syn keyword cConstant KvData_NUMTYPES
|
||||
syn keyword cTag KvDataTypes
|
||||
|
||||
" lang.inc
|
||||
syn keyword cFunction LoadTranslations SetGlobalTransTarget GetClientLanguage GetServerLanguage
|
||||
syn keyword cFunction GetLanguageCount GetLanguageInfo
|
||||
syn keyword cConstant LANG_SERVER
|
||||
|
||||
" logging.inc
|
||||
syn keyword cFunction LogMessage LogMessageEx LogToFile LogToFileEx
|
||||
syn keyword cFunction LogAction LogError AddGameLogHook RemoveGameLogHook
|
||||
syn keyword cTag GameLogHook
|
||||
syn keyword cForward OnLogAction
|
||||
|
||||
" mapchooser.inc
|
||||
syn keyword cFunction NominateMap GetExcludeMapList CanMapChooserStartVote InitiateMapChooserVote
|
||||
syn keyword cFunction HasEndOfMapVoteFinished EndOfMapVoteEnabled
|
||||
syn keyword cConstant Nominate_Added Nominate_Replaced Nominate_AlreadyInVote Nominate_InvalidMap
|
||||
syn keyword cConstant Nominate_VoteFull MapChange_Instant MapChange_RoundEnd MapChange_MapEnd
|
||||
syn keyword cTag NominateResult MapChange
|
||||
syn keyword cForward OnNominationRemoved
|
||||
|
||||
" menus.inc
|
||||
syn keyword cFunction CreateMenu DisplayMenu DisplayMenuAtItem AddMenuItem
|
||||
syn keyword cFunction InsertMenuItem RemoveMenuItem RemoveAllMenuItems GetMenuItem
|
||||
syn keyword cFunction GetMenuSelectionPosition GetMenuItemCount SetMenuPagination GetMenuPagination
|
||||
syn keyword cFunction GetMenuStyle SetMenuTitle GetMenuTitle CreatePanelFromMenu
|
||||
syn keyword cFunction GetMenuExitButton SetMenuExitButton GetMenuExitBackButton SetMenuExitBackButton
|
||||
syn keyword cFunction CancelMenu GetMenuOptionFlags SetMenuOptionFlags IsVoteInProgress
|
||||
syn keyword cFunction CancelVote VoteMenu VoteMenuToAll SetVoteResultCallback
|
||||
syn keyword cFunction CheckVoteDelay IsClientInVotePool RedrawClientVoteMenu GetMenuStyleHandle
|
||||
syn keyword cFunction CreatePanel CreateMenuEx GetClientMenu CancelClientMenu
|
||||
syn keyword cFunction GetMaxPageItems GetPanelStyle SetPanelTitle DrawPanelItem
|
||||
syn keyword cFunction DrawPanelText CanPanelDrawFlags SetPanelKeys SendPanelToClient
|
||||
syn keyword cFunction GetPanelTextRemaining GetPanelCurrentKey SetPanelCurrentKey RedrawMenuItem
|
||||
syn keyword cFunction InternalShowMenu GetMenuVoteInfo IsNewVoteAllowed
|
||||
syn keyword cConstant MenuStyle_Default MenuStyle_Valve MenuStyle_Radio MenuAction_Start
|
||||
syn keyword cConstant MenuAction_Display MenuAction_Select MenuAction_Cancel MenuAction_End
|
||||
syn keyword cConstant MenuAction_VoteEnd MenuAction_VoteStart MenuAction_VoteCancel MenuAction_DrawItem
|
||||
syn keyword cConstant MenuAction_DisplayItem MENU_ACTIONS_DEFAULT MENU_ACTIONS_ALL MENU_NO_PAGINATION
|
||||
syn keyword cConstant MENU_TIME_FOREVER ITEMDRAW_DEFAULT ITEMDRAW_DISABLED ITEMDRAW_RAWLINE
|
||||
syn keyword cConstant ITEMDRAW_NOTEXT ITEMDRAW_SPACER ITEMDRAW_IGNORE ITEMDRAW_CONTROL
|
||||
syn keyword cConstant MENUFLAG_BUTTON_EXIT MENUFLAG_BUTTON_EXITBACK MENUFLAG_NO_SOUND VOTEINFO_CLIENT_INDEX
|
||||
syn keyword cConstant VOTEINFO_CLIENT_ITEM VOTEINFO_ITEM_INDEX VOTEINFO_ITEM_VOTES MenuSource_None
|
||||
syn keyword cConstant MenuSource_External MenuSource_Normal MenuSource_RawPanel
|
||||
syn keyword cTag MenuStyle MenuAction MenuSource MenuHandler
|
||||
syn keyword cTag VoteHandler
|
||||
|
||||
" nextmap.inc
|
||||
syn keyword cFunction SetNextMap GetNextMap ForceChangeLevel GetMapHistorySize
|
||||
syn keyword cFunction GetMapHistory
|
||||
|
||||
" profiler.inc
|
||||
syn keyword cFunction CreateProfiler StartProfiling StopProfiling GetProfilerTime
|
||||
|
||||
" regex.inc
|
||||
syn keyword cFunction CompileRegex MatchRegex GetRegexSubString SimpleRegexMatch
|
||||
syn keyword cConstant PCRE_CASELESS PCRE_MULTILINE PCRE_DOTALL PCRE_EXTENDED
|
||||
syn keyword cConstant PCRE_UNGREEDY PCRE_UTF8 PCRE_NO_UTF8_CHECK REGEX_ERROR_NONE
|
||||
syn keyword cConstant REGEX_ERROR_NOMATCH REGEX_ERROR_NULL REGEX_ERROR_BADOPTION REGEX_ERROR_BADMAGIC
|
||||
syn keyword cConstant REGEX_ERROR_UNKNOWN_OPCODE REGEX_ERROR_NOMEMORY REGEX_ERROR_NOSUBSTRING REGEX_ERROR_MATCHLIMIT
|
||||
syn keyword cConstant REGEX_ERROR_CALLOUT REGEX_ERROR_BADUTF8 REGEX_ERROR_BADUTF8_OFFSET REGEX_ERROR_PARTIAL
|
||||
syn keyword cConstant REGEX_ERROR_BADPARTIAL REGEX_ERROR_INTERNAL REGEX_ERROR_BADCOUNT REGEX_ERROR_DFA_UITEM
|
||||
syn keyword cConstant REGEX_ERROR_DFA_UCOND REGEX_ERROR_DFA_UMLIMIT REGEX_ERROR_DFA_WSSIZE REGEX_ERROR_DFA_RECURSE
|
||||
syn keyword cConstant REGEX_ERROR_RECURSIONLIMIT REGEX_ERROR_NULLWSLIMIT REGEX_ERROR_BADNEWLINE
|
||||
syn keyword cTag RegexError
|
||||
|
||||
" sdktools.inc
|
||||
syn keyword cFunction StartPrepSDKCall PrepSDKCall_SetVirtual PrepSDKCall_SetSignature PrepSDKCall_SetFromConf
|
||||
syn keyword cFunction PrepSDKCall_SetReturnInfo PrepSDKCall_AddParameter EndPrepSDKCall SDKCall
|
||||
syn keyword cConstant SDKCall_Static SDKCall_Entity SDKCall_Player SDKCall_GameRules
|
||||
syn keyword cConstant SDKCall_EntityList SDKLibrary_Server SDKLibrary_Engine SDKConf_Virtual
|
||||
syn keyword cConstant SDKConf_Signature SDKType_CBaseEntity SDKType_CBasePlayer SDKType_Vector
|
||||
syn keyword cConstant SDKType_QAngle SDKType_PlainOldData SDKType_Float SDKType_Edict
|
||||
syn keyword cConstant SDKType_String SDKType_Bool SDKPass_Pointer SDKPass_Plain
|
||||
syn keyword cConstant SDKPass_ByValue SDKPass_ByRef VDECODE_FLAG_ALLOWNULL VDECODE_FLAG_ALLOWNOTINGAME
|
||||
syn keyword cConstant VDECODE_FLAG_ALLOWWORLD VDECODE_FLAG_BYREF VENCODE_FLAG_COPYBACK
|
||||
syn keyword cTag SDKCallType SDKLibrary SDKFuncConfSource SDKType
|
||||
syn keyword cTag SDKPassMethod
|
||||
|
||||
" sdktools_engine.inc
|
||||
syn keyword cFunction SetClientViewEntity SetLightStyle GetClientEyePosition
|
||||
syn keyword cConstant MAX_LIGHTSTYLES
|
||||
|
||||
" sdktools_entinput.inc
|
||||
syn keyword cFunction AcceptEntityInput SetVariantBool SetVariantString SetVariantInt
|
||||
syn keyword cFunction SetVariantFloat SetVariantVector3D SetVariantPosVector3D SetVariantColor
|
||||
syn keyword cFunction SetVariantEntity
|
||||
|
||||
" sdktools_entoutput.inc
|
||||
syn keyword cFunction HookEntityOutput UnhookEntityOutput HookSingleEntityOutput UnhookSingleEntityOutput
|
||||
syn keyword cTag EntityOutput
|
||||
|
||||
" sdktools_functions.inc
|
||||
syn keyword cFunction RemovePlayerItem GivePlayerItem GetPlayerWeaponSlot IgniteEntity
|
||||
syn keyword cFunction ExtinguishEntity TeleportEntity ForcePlayerSuicide SlapPlayer
|
||||
syn keyword cFunction FindEntityByClassname GetClientEyeAngles CreateEntityByName DispatchSpawn
|
||||
syn keyword cFunction DispatchKeyValue DispatchKeyValueFloat DispatchKeyValueVector GetClientAimTarget
|
||||
syn keyword cFunction GetTeamCount GetTeamName GetTeamScore SetTeamScore
|
||||
syn keyword cFunction GetTeamClientCount SetEntityModel GetPlayerDecalFile GetServerNetStats
|
||||
syn keyword cFunction EquipPlayerWeapon ActivateEntity SetClientInfo
|
||||
|
||||
" sdktools_sound.inc
|
||||
syn keyword cFunction PrefetchSound GetSoundDuration EmitAmbientSound FadeClientVolume
|
||||
syn keyword cFunction StopSound EmitSound EmitSentence AddAmbientSoundHook
|
||||
syn keyword cFunction AddNormalSoundHook RemoveAmbientSoundHook RemoveNormalSoundHook EmitSoundToClient
|
||||
syn keyword cFunction EmitSoundToAll ATTN_TO_SNDLEVEL
|
||||
syn keyword cConstant SOUND_FROM_PLAYER SOUND_FROM_LOCAL_PLAYER SOUND_FROM_WORLD SNDVOL_NORMAL
|
||||
syn keyword cConstant SNDPITCH_NORMAL SNDPITCH_LOW SNDPITCH_HIGH SNDATTN_NONE
|
||||
syn keyword cConstant SNDATTN_NORMAL SNDATTN_STATIC SNDATTN_RICOCHET SNDATTN_IDLE
|
||||
syn keyword cTag AmbientSHook NormalSHook
|
||||
|
||||
" sdktools_stocks.inc
|
||||
syn keyword cFunction FindTeamByName
|
||||
|
||||
" sdktools_stringtables.inc
|
||||
syn keyword cFunction FindStringTable GetNumStringTables GetStringTableNumStrings GetStringTableMaxStrings
|
||||
syn keyword cFunction GetStringTableName FindStringIndex ReadStringTable GetStringTableDataLength
|
||||
syn keyword cFunction GetStringTableData SetStringTableData AddToStringTable LockStringTables
|
||||
syn keyword cFunction AddFileToDownloadsTable
|
||||
syn keyword cConstant INVALID_STRING_TABLE INVALID_STRING_INDEX
|
||||
|
||||
" sdktools_tempents.inc
|
||||
syn keyword cFunction AddTempEntHook RemoveTempEntHook TE_Start TE_IsValidProp
|
||||
syn keyword cFunction TE_WriteNum TE_ReadNum TE_WriteFloat TE_ReadFloat
|
||||
syn keyword cFunction TE_WriteVector TE_ReadVector TE_WriteAngles TE_WriteFloatArray
|
||||
syn keyword cFunction TE_Send TE_WriteEncodedEnt TE_SendToAll TE_SendToClient
|
||||
syn keyword cTag TEHook
|
||||
|
||||
" sdktools_tempents_stocks.inc
|
||||
syn keyword cFunction TE_SetupSparks TE_SetupSmoke TE_SetupDust TE_SetupMuzzleFlash
|
||||
syn keyword cFunction TE_SetupMetalSparks TE_SetupEnergySplash TE_SetupArmorRicochet TE_SetupGlowSprite
|
||||
syn keyword cFunction TE_SetupExplosion TE_SetupBloodSprite TE_SetupBeamRingPoint TE_SetupBeamPoints
|
||||
syn keyword cFunction TE_SetupBeamLaser TE_SetupBeamRing TE_SetupBeamFollow
|
||||
syn keyword cConstant TE_EXPLFLAG_NONE TE_EXPLFLAG_NOADDITIVE TE_EXPLFLAG_NODLIGHTS TE_EXPLFLAG_NOSOUND
|
||||
syn keyword cConstant TE_EXPLFLAG_NOPARTICLES TE_EXPLFLAG_DRAWALPHA TE_EXPLFLAG_ROTATE TE_EXPLFLAG_NOFIREBALL
|
||||
syn keyword cConstant TE_EXPLFLAG_NOFIREBALLSMOKE FBEAM_STARTENTITY FBEAM_ENDENTITY FBEAM_FADEIN
|
||||
syn keyword cConstant FBEAM_FADEOUT FBEAM_SINENOISE FBEAM_SOLID FBEAM_SHADEIN
|
||||
syn keyword cConstant FBEAM_SHADEOUT FBEAM_ONLYNOISEONCE FBEAM_NOTILE FBEAM_USE_HITBOXES
|
||||
syn keyword cConstant FBEAM_STARTVISIBLE FBEAM_ENDVISIBLE FBEAM_ISACTIVE FBEAM_FOREVER
|
||||
syn keyword cConstant FBEAM_HALOBEAM
|
||||
|
||||
" sdktools_trace.inc
|
||||
syn keyword cFunction TR_GetPointContents TR_GetPointContentsEnt TR_TraceRay TR_TraceHull
|
||||
syn keyword cFunction TR_TraceRayFilter TR_TraceHullFilter TR_TraceRayEx TR_TraceHullEx
|
||||
syn keyword cFunction TR_TraceRayFilterEx TR_TraceHullFilterEx TR_GetFraction TR_GetEndPosition
|
||||
syn keyword cFunction TR_GetEntityIndex TR_DidHit TR_GetHitGroup TR_GetPlaneNormal
|
||||
syn keyword cConstant CONTENTS_EMPTY CONTENTS_SOLID CONTENTS_WINDOW CONTENTS_AUX
|
||||
syn keyword cConstant CONTENTS_GRATE CONTENTS_SLIME CONTENTS_WATER CONTENTS_MIST
|
||||
syn keyword cConstant CONTENTS_OPAQUE LAST_VISIBLE_CONTENTS ALL_VISIBLE_CONTENTS CONTENTS_TESTFOGVOLUME
|
||||
syn keyword cConstant CONTENTS_UNUSED5 CONTENTS_UNUSED6 CONTENTS_TEAM1 CONTENTS_TEAM2
|
||||
syn keyword cConstant CONTENTS_IGNORE_NODRAW_OPAQUE CONTENTS_MOVEABLE CONTENTS_AREAPORTAL CONTENTS_PLAYERCLIP
|
||||
syn keyword cConstant CONTENTS_MONSTERCLIP CONTENTS_CURRENT_0 CONTENTS_CURRENT_90 CONTENTS_CURRENT_180
|
||||
syn keyword cConstant CONTENTS_CURRENT_270 CONTENTS_CURRENT_UP CONTENTS_CURRENT_DOWN CONTENTS_ORIGIN
|
||||
syn keyword cConstant CONTENTS_MONSTER CONTENTS_DEBRIS CONTENTS_DETAIL CONTENTS_TRANSLUCENT
|
||||
syn keyword cConstant CONTENTS_LADDER CONTENTS_HITBOX MASK_ALL MASK_SOLID
|
||||
syn keyword cConstant MASK_PLAYERSOLID MASK_NPCSOLID MASK_WATER MASK_OPAQUE
|
||||
syn keyword cConstant MASK_OPAQUE_AND_NPCS MASK_VISIBLE MASK_VISIBLE_AND_NPCS MASK_SHOT
|
||||
syn keyword cConstant MASK_SHOT_HULL MASK_SHOT_PORTAL MASK_SOLID_BRUSHONLY MASK_PLAYERSOLID_BRUSHONLY
|
||||
syn keyword cConstant MASK_NPCSOLID_BRUSHONLY MASK_NPCWORLDSTATIC MASK_SPLITAREAPORTAL RayType_EndPoint
|
||||
syn keyword cConstant RayType_Infinite
|
||||
syn keyword cTag RayType TraceEntityFilter
|
||||
|
||||
" sdktools_voice.inc
|
||||
syn keyword cFunction SetClientListeningFlags GetClientListeningFlags SetClientListening GetClientListening
|
||||
syn keyword cConstant VOICE_NORMAL VOICE_MUTED VOICE_SPEAKALL VOICE_LISTENALL
|
||||
syn keyword cConstant VOICE_TEAM VOICE_LISTENTEAM
|
||||
|
||||
" sorting.inc
|
||||
syn keyword cFunction SortIntegers SortFloats SortStrings SortCustom1D
|
||||
syn keyword cFunction SortCustom2D SortADTArray SortADTArrayCustom
|
||||
syn keyword cConstant Sort_Ascending Sort_Descending Sort_Random
|
||||
syn keyword cTag SortOrder SortType SortFunc1D SortFunc2D
|
||||
syn keyword cTag SortFuncADTArray
|
||||
|
||||
" sourcemod.inc
|
||||
syn keyword cFunction GetMyHandle GetPluginIterator MorePlugins ReadPlugin
|
||||
syn keyword cFunction GetPluginStatus GetPluginFilename IsPluginDebugging GetPluginInfo
|
||||
syn keyword cFunction FindPluginByNumber SetFailState ThrowError GetTime
|
||||
syn keyword cFunction FormatTime LoadGameConfigFile GameConfGetOffset GameConfGetKeyValue
|
||||
syn keyword cFunction GetSysTickCount AutoExecConfig MarkNativeAsOptional RegPluginLibrary
|
||||
syn keyword cFunction LibraryExists GetExtensionFileStatus ReadMapList SetMapListCompatBind
|
||||
syn keyword cConstant myinfo MAPLIST_FLAG_MAPSFOLDER MAPLIST_FLAG_CLEARARRAY MAPLIST_FLAG_NO_DEFAULT
|
||||
syn keyword cTag Plugin
|
||||
syn keyword cForward OnPluginStart AskPluginLoad OnPluginEnd OnPluginPauseChange
|
||||
syn keyword cForward OnGameFrame OnMapStart OnMapEnd OnConfigsExecuted
|
||||
syn keyword cForward OnAutoConfigsBuffered OnServerCfg OnAllPluginsLoaded OnLibraryAdded
|
||||
syn keyword cForward OnLibraryRemoved OnClientFloodCheck OnClientFloodResult
|
||||
|
||||
" string.inc
|
||||
syn keyword cFunction strlen StrContains strcmp strncmp
|
||||
syn keyword cFunction StrCompare StrEqual strcopy StrCopy
|
||||
syn keyword cFunction Format FormatEx VFormat StringToInt
|
||||
syn keyword cFunction StringToIntEx IntToString StringToFloat StringToFloatEx
|
||||
syn keyword cFunction FloatToString BreakString StrBreak TrimString
|
||||
syn keyword cFunction SplitString ReplaceString ReplaceStringEx GetCharBytes
|
||||
syn keyword cFunction IsCharAlpha IsCharNumeric IsCharSpace IsCharMB
|
||||
syn keyword cFunction IsCharUpper IsCharLower StripQuotes CharToUpper
|
||||
syn keyword cFunction CharToLower FindCharInString StrCat ExplodeString
|
||||
syn keyword cFunction ImplodeStrings
|
||||
|
||||
" textparse.inc
|
||||
syn keyword cFunction SMC_CreateParser SMC_ParseFile SMC_GetErrorString SMC_SetParseStart
|
||||
syn keyword cFunction SMC_SetParseEnd SMC_SetReaders SMC_SetRawLine
|
||||
syn keyword cConstant SMCParse_Continue SMCParse_Halt SMCParse_HaltFail SMCError_Okay
|
||||
syn keyword cConstant SMCError_StreamOpen SMCError_StreamError SMCError_Custom SMCError_InvalidSection1
|
||||
syn keyword cConstant SMCError_InvalidSection2 SMCError_InvalidSection3 SMCError_InvalidSection4 SMCError_InvalidSection5
|
||||
syn keyword cConstant SMCError_InvalidTokens SMCError_TokenOverflow SMCError_InvalidProperty1
|
||||
syn keyword cTag SMCResult SMCError SMC_ParseStart SMC_ParseEnd
|
||||
syn keyword cTag SMC_NewSection SMC_KeyValue SMC_EndSection SMC_RawLine
|
||||
|
||||
" tf2.inc
|
||||
syn keyword cFunction TF2_RespawnPlayer TF2_DisguisePlayer TF2_RemovePlayerDisguise TF2_GetResourceEntity
|
||||
syn keyword cFunction TF2_GetClass
|
||||
syn keyword cConstant TFClass_Unknown TFClass_Scout TFClass_Sniper TFClass_Soldier
|
||||
syn keyword cConstant TFClass_DemoMan TFClass_Medic TFClass_Heavy TFClass_Pyro
|
||||
syn keyword cConstant TFClass_Spy TFClass_Engineer TFTeam_Unassigned TFTeam_Spectator
|
||||
syn keyword cConstant TFTeam_Red TFTeam_Blue
|
||||
syn keyword cTag TFClassType TFTeam
|
||||
syn keyword cForward TF2_CalcIsAttackCritical
|
||||
|
||||
" tf2_stocks.inc
|
||||
syn keyword cFunction TF2_GetPlayerClass TF2_SetPlayerClass TF2_GetPlayerResourceData TF2_SetPlayerResourceData
|
||||
syn keyword cFunction TF2_RemoveWeaponSlot TF2_RemoveAllWeapons
|
||||
syn keyword cConstant TFResource_Ping TFResource_Score TFResource_Deaths TFResource_TotalScore
|
||||
syn keyword cConstant TFResource_Captures TFResource_Defenses TFResource_Dominations TFResource_Revenge
|
||||
syn keyword cConstant TFResource_BuildingsDestroyed TFResource_Headshots TFResource_Backstabs TFResource_HealPoints
|
||||
syn keyword cConstant TFResource_Invulns TFResource_Teleports TFResource_ResupplyPoints TFResource_KillAssists
|
||||
syn keyword cConstant TFResource_MaxHealth TFResource_PlayerClass
|
||||
syn keyword cTag TFResourceType
|
||||
|
||||
" timers.inc
|
||||
syn keyword cFunction CreateTimer KillTimer TriggerTimer GetTickedTime
|
||||
syn keyword cFunction GetMapTimeLeft GetMapTimeLimit ExtendMapTimeLimit GetTickInterval
|
||||
syn keyword cFunction IsServerProcessing CreateDataTimer
|
||||
syn keyword cConstant TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE TIMER_HNDL_CLOSE TIMER_DATA_HNDL_CLOSE
|
||||
syn keyword cTag Timer
|
||||
syn keyword cForward OnMapTimeLeftChanged
|
||||
|
||||
" topmenus.inc
|
||||
syn keyword cFunction CreateTopMenu LoadTopMenuConfig AddToTopMenu GetTopMenuInfoString
|
||||
syn keyword cFunction GetTopMenuObjName RemoveFromTopMenu DisplayTopMenu FindTopMenuCategory
|
||||
syn keyword cConstant TopMenuAction_DisplayOption TopMenuAction_DisplayTitle TopMenuAction_SelectOption TopMenuObject_Category
|
||||
syn keyword cConstant TopMenuObject_Item TopMenuPosition_Start TopMenuPosition_LastRoot TopMenuPosition_LastCategory
|
||||
syn keyword cConstant INVALID_TOPMENUOBJECT
|
||||
syn keyword cTag TopMenuAction TopMenuObjectType TopMenuPosition TopMenuObject
|
||||
syn keyword cTag TopMenuHandler
|
||||
|
||||
" usermessages.inc
|
||||
syn keyword cFunction GetUserMessageId GetUserMessageName StartMessage StartMessageEx
|
||||
syn keyword cFunction EndMessage HookUserMessage UnhookUserMessage StartMessageAll
|
||||
syn keyword cFunction StartMessageOne
|
||||
syn keyword cConstant INVALID_MESSAGE_ID USERMSG_RELIABLE USERMSG_INITMSG USERMSG_BLOCKHOOKS
|
||||
syn keyword cTag UserMsg MsgHook MsgPostHook
|
||||
|
||||
" vector.inc
|
||||
syn keyword cFunction GetVectorLength GetVectorDistance GetVectorDotProduct GetVectorCrossProduct
|
||||
syn keyword cFunction NormalizeVector GetAngleVectors GetVectorAngles GetVectorVectors
|
||||
syn keyword cFunction AddVectors SubtractVectors ScaleVector NegateVector
|
||||
syn keyword cFunction MakeVectorFromPoints
|
||||
|
||||
" version.inc
|
||||
syn keyword cConstant SOURCEMOD_V_MAJOR SOURCEMOD_V_MINOR SOURCEMOD_V_RELEASE SOURCEMOD_VERSION
|
||||
" Accept %: for # (C99)
|
||||
syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
|
||||
syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
|
||||
if !exists("c_no_if0")
|
||||
if !exists("c_no_if0_fold")
|
||||
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2 fold
|
||||
else
|
||||
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
|
||||
endif
|
||||
syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip
|
||||
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
|
||||
endif
|
||||
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
syn match cIncluded display contained "<[^>]*>"
|
||||
syn match cInclude display "^\s*\(%:\|#\)\s*\(include\>\|tryinclude\>\)\s*["<]" contains=cIncluded
|
||||
"syn match cLineSkip "\\$"
|
||||
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti
|
||||
syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
syn region cPreProc start="^\s*\(%:\|#\)\s*\(assert\>\|emit\>\|endinput\>\|endscript\>\|pragma\>\|line\>\|section\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
|
||||
" Highlight User Labels
|
||||
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cNumbersCom,cCppParen,cCppBracket,cCppString
|
||||
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
|
||||
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
|
||||
syn cluster cLabelGroup contains=cUserLabel
|
||||
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup
|
||||
syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
|
||||
syn match cUserLabel display "\I\i*" contained
|
||||
|
||||
" C++ extentions
|
||||
syn keyword cppStatement new decl
|
||||
syn keyword cppAccess public
|
||||
syn keyword cppOperator operator
|
||||
|
||||
if exists("c_minlines")
|
||||
let b:c_minlines = c_minlines
|
||||
else
|
||||
if !exists("c_no_if0")
|
||||
let b:c_minlines = 50 " #if 0 constructs can be long
|
||||
else
|
||||
let b:c_minlines = 15 " mostly for () constructs
|
||||
endif
|
||||
endif
|
||||
exec "syn sync ccomment cComment minlines=" . b:c_minlines
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only used when an item doesn't have highlighting yet
|
||||
hi def link cFormat cSpecial
|
||||
hi def link cCppString cString
|
||||
hi def link cCommentL cComment
|
||||
hi def link cCommentStart cComment
|
||||
hi def link cLabel Label
|
||||
hi def link cUserLabel Label
|
||||
hi def link cConditional Conditional
|
||||
hi def link cRepeat Repeat
|
||||
hi def link cCharacter Character
|
||||
hi def link cSpecialCharacter cSpecial
|
||||
hi def link cNumber Number
|
||||
hi def link cFloat Float
|
||||
hi def link cParenError cError
|
||||
hi def link cErrInParen cError
|
||||
hi def link cErrInBracket cError
|
||||
hi def link cCommentError cError
|
||||
hi def link cCommentStartError cError
|
||||
hi def link cSpaceError cError
|
||||
hi def link cSpecialError cError
|
||||
hi def link cOperator Operator
|
||||
hi def link cStructure Structure
|
||||
hi def link cStorageClass StorageClass
|
||||
hi def link cInclude Include
|
||||
hi def link cPreProc PreProc
|
||||
hi def link cDefine Macro
|
||||
hi def link cIncluded cString
|
||||
hi def link cError Error
|
||||
hi def link cStatement Statement
|
||||
hi def link cPreCondit PreCondit
|
||||
hi def link cTag Type
|
||||
hi def link cConstant Constant
|
||||
hi def link cCommentString cString
|
||||
hi def link cComment2String cString
|
||||
hi def link cCommentSkip cComment
|
||||
hi def link cString String
|
||||
hi def link cComment Comment
|
||||
hi def link cSpecial SpecialChar
|
||||
hi def link cTodo Todo
|
||||
hi def link cCppSkip cCppOut
|
||||
hi def link cCppOut2 cCppOut
|
||||
hi def link cCppOut Comment
|
||||
|
||||
hi def link cppAccess cppStatement
|
||||
hi def link cppOperator Operator
|
||||
hi def link cppStatement Statement
|
||||
|
||||
hi def link cFunction Function
|
||||
hi def link cForward Function
|
||||
|
||||
let b:current_syntax = "sourcepawn"
|
||||
|
||||
" vim: ts=8
|
||||
@@ -1,324 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
|
||||
my $group = 4;
|
||||
|
||||
my @files = <*.inc>;
|
||||
|
||||
#the header and footer strings come from naris' original SourcePawn syntax file
|
||||
#skip way down below for actual code
|
||||
my $header = <<'HEADER';
|
||||
" Vim syntax file
|
||||
" Language: SourcePawn
|
||||
" Generated by vimsyntax.pl
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
"if exists("b:current_syntax")
|
||||
" finish
|
||||
"endif
|
||||
|
||||
" A bunch of useful C keywords
|
||||
syn keyword cStatement goto break return continue assert state sleep exit
|
||||
syn keyword cLabel case default
|
||||
syn keyword cConditional if else switch
|
||||
syn keyword cRepeat while for do
|
||||
|
||||
syn keyword cTodo contained TODO FIXME XXX
|
||||
|
||||
" cCommentGroup allows adding matches for special things in comments
|
||||
syn cluster cCommentGroup contains=cTodo
|
||||
|
||||
" String and Character constants
|
||||
" Highlight special characters (those which have a backslash) differently
|
||||
syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
|
||||
if !exists("c_no_utf")
|
||||
syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
|
||||
endif
|
||||
if exists("c_no_cformat")
|
||||
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell
|
||||
" cCppString: same as cString, but ends at end of line
|
||||
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell
|
||||
else
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
else
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
endif
|
||||
syn match cFormat display "%%" contained
|
||||
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell
|
||||
" cCppString: same as cString, but ends at end of line
|
||||
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
endif
|
||||
|
||||
syn match cCharacter "L\='[^\\]'"
|
||||
syn match cCharacter "L'[^']*'" contains=cSpecial
|
||||
if exists("c_gnu")
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
|
||||
else
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
|
||||
endif
|
||||
syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
|
||||
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
|
||||
syn match cSpecialCharacter display "L'\\x\x\+'"
|
||||
|
||||
"when wanted, highlight trailing white space
|
||||
if exists("c_space_errors")
|
||||
if !exists("c_no_trail_space_error")
|
||||
syn match cSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
if !exists("c_no_tab_space_error")
|
||||
syn match cSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
" This should be before cErrInParen to avoid problems with #define ({ xxx })
|
||||
syntax region cBlock start="{" end="}" transparent fold
|
||||
|
||||
"catch errors caused by wrong parenthesis and brackets
|
||||
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
|
||||
" But avoid matching <::.
|
||||
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cCommentSkip,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cNumbersCom
|
||||
if exists("c_no_curly_error")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
|
||||
elseif exists("c_no_bracket_error")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "[{}]\|<%\|%>"
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
syn match cParenError display "[\])]"
|
||||
syn match cErrInParen display contained "[\]{}]\|<%\|%>"
|
||||
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
|
||||
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
|
||||
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
|
||||
endif
|
||||
|
||||
"integer number, or floating point number without a dot and with "f".
|
||||
syn case ignore
|
||||
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat
|
||||
" Same (for comments)
|
||||
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat
|
||||
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
"hex number
|
||||
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
syn match cFloat display contained "\d\+f"
|
||||
"floating point number, with dot, optional exponent
|
||||
syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
|
||||
"floating point number, starting with a dot, optional exponent
|
||||
syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
|
||||
"floating point number, without dot, with exponent
|
||||
syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
|
||||
if !exists("c_no_c99")
|
||||
"hexadecimal floating point number, optional leading digits, with dot, with exponent
|
||||
syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
|
||||
"hexadecimal floating point number, with leading digits, optional dot, with exponent
|
||||
syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
if exists("c_comment_strings")
|
||||
" A comment can contain cString, cCharacter and cNumber.
|
||||
" But a "*/" inside a cString in a cComment DOES end the comment! So we
|
||||
" need to use a special type of cString: cCommentString, which also ends on
|
||||
" "*/", and sees a "*" at the start of the line as comment again.
|
||||
" Unfortunately this doesn't very well work for // type of comments :-(
|
||||
syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
|
||||
syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
|
||||
syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
|
||||
syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
" Use "extend" here to have preprocessor lines not terminate halfway a
|
||||
" comment.
|
||||
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
|
||||
else
|
||||
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
|
||||
endif
|
||||
else
|
||||
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell
|
||||
else
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold
|
||||
endif
|
||||
endif
|
||||
" keep a // comment separately, it terminates a preproc. conditional
|
||||
syntax match cCommentError display "\*/"
|
||||
syntax match cCommentStartError display "/\*"me=e-1 contained
|
||||
|
||||
syn keyword cOperator sizeof tagof state defined char
|
||||
|
||||
syn keyword cTag any bool Fixed Float String Function
|
||||
|
||||
syn keyword cStructure enum
|
||||
syn keyword cStorageClass static const stock native forward
|
||||
|
||||
" Constants
|
||||
" ======
|
||||
syn keyword cConstant cellbits cellmax cellmin charbits charmax charmin ucharmax __Pawn debug
|
||||
syn keyword cConstant true false
|
||||
HEADER
|
||||
|
||||
my $footer = <<'FOOTER';
|
||||
" Accept %: for # (C99)
|
||||
syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
|
||||
syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
|
||||
if !exists("c_no_if0")
|
||||
if !exists("c_no_if0_fold")
|
||||
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2 fold
|
||||
else
|
||||
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
|
||||
endif
|
||||
syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip
|
||||
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
|
||||
endif
|
||||
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
syn match cIncluded display contained "<[^>]*>"
|
||||
syn match cInclude display "^\s*\(%:\|#\)\s*\(include\>\|tryinclude\>\)\s*["<]" contains=cIncluded
|
||||
"syn match cLineSkip "\\$"
|
||||
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti
|
||||
syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
syn region cPreProc start="^\s*\(%:\|#\)\s*\(assert\>\|emit\>\|endinput\>\|endscript\>\|pragma\>\|line\>\|section\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
|
||||
" Highlight User Labels
|
||||
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cNumbersCom,cCppParen,cCppBracket,cCppString
|
||||
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
|
||||
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
|
||||
syn cluster cLabelGroup contains=cUserLabel
|
||||
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup
|
||||
syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
|
||||
syn match cUserLabel display "\I\i*" contained
|
||||
|
||||
" C++ extentions
|
||||
syn keyword cppStatement new decl
|
||||
syn keyword cppAccess public
|
||||
syn keyword cppOperator operator
|
||||
|
||||
if exists("c_minlines")
|
||||
let b:c_minlines = c_minlines
|
||||
else
|
||||
if !exists("c_no_if0")
|
||||
let b:c_minlines = 50 " #if 0 constructs can be long
|
||||
else
|
||||
let b:c_minlines = 15 " mostly for () constructs
|
||||
endif
|
||||
endif
|
||||
exec "syn sync ccomment cComment minlines=" . b:c_minlines
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only used when an item doesn't have highlighting yet
|
||||
hi def link cFormat cSpecial
|
||||
hi def link cCppString cString
|
||||
hi def link cCommentL cComment
|
||||
hi def link cCommentStart cComment
|
||||
hi def link cLabel Label
|
||||
hi def link cUserLabel Label
|
||||
hi def link cConditional Conditional
|
||||
hi def link cRepeat Repeat
|
||||
hi def link cCharacter Character
|
||||
hi def link cSpecialCharacter cSpecial
|
||||
hi def link cNumber Number
|
||||
hi def link cFloat Float
|
||||
hi def link cParenError cError
|
||||
hi def link cErrInParen cError
|
||||
hi def link cErrInBracket cError
|
||||
hi def link cCommentError cError
|
||||
hi def link cCommentStartError cError
|
||||
hi def link cSpaceError cError
|
||||
hi def link cSpecialError cError
|
||||
hi def link cOperator Operator
|
||||
hi def link cStructure Structure
|
||||
hi def link cStorageClass StorageClass
|
||||
hi def link cInclude Include
|
||||
hi def link cPreProc PreProc
|
||||
hi def link cDefine Macro
|
||||
hi def link cIncluded cString
|
||||
hi def link cError Error
|
||||
hi def link cStatement Statement
|
||||
hi def link cPreCondit PreCondit
|
||||
hi def link cTag Type
|
||||
hi def link cConstant Constant
|
||||
hi def link cCommentString cString
|
||||
hi def link cComment2String cString
|
||||
hi def link cCommentSkip cComment
|
||||
hi def link cString String
|
||||
hi def link cComment Comment
|
||||
hi def link cSpecial SpecialChar
|
||||
hi def link cTodo Todo
|
||||
hi def link cCppSkip cCppOut
|
||||
hi def link cCppOut2 cCppOut
|
||||
hi def link cCppOut Comment
|
||||
|
||||
hi def link cppAccess cppStatement
|
||||
hi def link cppOperator Operator
|
||||
hi def link cppStatement Statement
|
||||
|
||||
hi def link cFunction Function
|
||||
hi def link cForward Function
|
||||
|
||||
let b:current_syntax = "sourcepawn"
|
||||
|
||||
" vim: ts=4
|
||||
FOOTER
|
||||
|
||||
print $header;
|
||||
|
||||
for my $file (@files)
|
||||
{
|
||||
my @constants;
|
||||
my @tags;
|
||||
my @functions;
|
||||
my @forwards;
|
||||
my $inEnum = 0;
|
||||
|
||||
open(FILE, $file) or die "couldn't open $file: $!";
|
||||
|
||||
foreach (<FILE>)
|
||||
{
|
||||
if ($inEnum == 0)
|
||||
{
|
||||
if (/^\s*#define\s+([^_]\w+)\s+\S/) { push(@constants, $1); }
|
||||
elsif (/^\s*public(?:\s+const)?\s+(?:\w+:)?([^_](?>\w+))(?!:)/) { push(@constants, $1); }
|
||||
elsif (/^\s*(?:native|stock)\s+(?:\w+:)?(\w+)\(/) { push(@functions, $1); }
|
||||
elsif (/^\s*functag public\s+(?:\w+:)?(\w+)/) { push(@tags, $1); }
|
||||
elsif (/^\s*enum\s+(\w+)/) { push(@tags, $1); $inEnum = 1; }
|
||||
elsif (/^\s*(?:struct|funcenum)\s+(\w+)/) { push(@tags, $1); }
|
||||
elsif (/^\s*forward\s+(?:\w+:)?(\w+)\(/) { push(@forwards, $1); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (/^\s*}/) { $inEnum = 0; }
|
||||
elsif (/^\t?(\w+)/) { push(@constants, $1); }
|
||||
}
|
||||
}
|
||||
|
||||
print "\n\" $file\n";
|
||||
|
||||
if (@constants % $group) { push @constants, ("") x ($group - (@constants % $group)); }
|
||||
if (@tags % $group) { push @tags, ("") x ($group - (@tags % $group)); }
|
||||
if (@functions % $group) { push @functions, ("") x ($group - (@functions % $group)); }
|
||||
if (@forwards % $group) { push @forwards, ("") x ($group - (@forwards % $group)); }
|
||||
|
||||
$, = " ";
|
||||
for (my $i = 0; $i <= $#functions; $i += $group) { print "syn keyword\tcFunction\t@functions[$i .. $i + $group - 1]\n"; }
|
||||
for (my $i = 0; $i <= $#constants; $i += $group) { print "syn keyword\tcConstant\t@constants[$i .. $i + $group - 1]\n"; }
|
||||
for (my $i = 0; $i <= $#tags; $i += $group) { print "syn keyword\tcTag\t\t@tags[$i .. $i + $group - 1]\n"; }
|
||||
for (my $i = 0; $i <= $#forwards; $i += $group) { print "syn keyword\tcForward\t@forwards[$i .. $i + $group - 1]\n"; }
|
||||
}
|
||||
|
||||
print $footer;
|
||||
@@ -7,8 +7,7 @@ HL2SDK_ORIG = ../../../hl2sdk
|
||||
HL2SDK_OB = ../../../hl2sdk-ob
|
||||
HL2SDK_OB_VALVE = ../../../hl2sdk-ob-valve
|
||||
HL2SDK_L4D = ../../../hl2sdk-l4d
|
||||
HL2SDK_L4D2 = ../../../hl2sdk-l4d2
|
||||
MMSOURCE17 = ../../../mmsource-central
|
||||
MMSOURCE17 = ../../../mmsource-1.7
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
@@ -80,33 +79,16 @@ ifeq "$(ENGINE)" "left4dead"
|
||||
USEMETA = true
|
||||
CFLAGS += -DHOOKING_ENABLED
|
||||
endif
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
HL2SDK = $(HL2SDK_L4D2)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=6
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/left4dead2_demo
|
||||
GAMEFIX = 2.l4d2
|
||||
override ENGSET = true
|
||||
USEMETA = true
|
||||
CFLAGS += -DHOOKING_ENABLED
|
||||
endif
|
||||
|
||||
ifeq "$(USEMETA)" "true"
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_linux.so tier0_linux.so
|
||||
else
|
||||
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
|
||||
endif
|
||||
|
||||
LINK += $(LINK_HL2)
|
||||
|
||||
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
|
||||
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn \
|
||||
-I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit -I$(SMSDK)/public/jit/x86
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5
|
||||
else
|
||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit \
|
||||
-I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/sourcepawn
|
||||
@@ -160,13 +142,8 @@ $(BIN_DIR)/%.o: %.cpp
|
||||
all: check
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
if [ "$(USEMETA)" = "true" ]; then \
|
||||
if [ "$(ENGINE)" = "left4dead2" ]; then \
|
||||
ln -sf $(SRCDS)/bin/vstdlib_linux.so vstdlib_linux.so; \
|
||||
ln -sf $(SRCDS)/bin/tier0_linux.so tier0_linux.so; \
|
||||
else \
|
||||
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so; \
|
||||
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so; \
|
||||
fi \
|
||||
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so; \
|
||||
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so; \
|
||||
fi
|
||||
$(MAKE) -f Makefile extension
|
||||
|
||||
|
||||
@@ -7,14 +7,12 @@ Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
|
||||
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||
Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32
|
||||
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
|
||||
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
|
||||
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||
Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32
|
||||
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
|
||||
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
|
||||
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
|
||||
@@ -25,8 +23,6 @@ Global
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
|
||||
@@ -39,8 +35,6 @@ Global
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
|
||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user