Skip to content

Commit

Permalink
Fix attribute inspect sometimes not working, add "$type" keyvalue to …
Browse files Browse the repository at this point in the history
…$filter_itemname
  • Loading branch information
rafradek committed Feb 27, 2023
1 parent fff87c7 commit e112597
Show file tree
Hide file tree
Showing 16 changed files with 761 additions and 689 deletions.
20 changes: 10 additions & 10 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
"${workspaceFolder}/../alliedmodders/sourcemod/public/amtl",
"${workspaceFolder}/../alliedmodders/metamod-source/core",
"${workspaceFolder}/../alliedmodders/metamod-source/core/sourcehook",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public/tier0",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public/tier1",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public/game/server",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public/toolframework",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public/engine",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public/mathlib",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/public/vstdlib",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/game/shared",
"${workspaceFolder}/../alliedmodders/hl2sdk-sdk2013/common"
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public/tier0",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public/tier1",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public/game/server",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public/toolframework",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public/engine",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public/mathlib",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/public/vstdlib",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/game/shared",
"${workspaceFolder}/../alliedmodders/hl2sdk-l4d2/common"
],
"defines": [
"HAVE_STDINT_H",
Expand Down
38 changes: 23 additions & 15 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os, sys

class SDK(object):
def __init__(self, sdk, ext, aDef, name, platform, dir):
def __init__(self, sdk, ext, aDef, name, platform, dir, ddl_dir):
self.folder = 'hl2sdk-' + dir
self.envvar = sdk
self.ext = ext
Expand All @@ -11,15 +11,18 @@ class SDK(object):
self.platform = platform
self.name = dir
self.path = None # Actual path
self.ddl_dir = ddl_dir
self.ddl_path = None # Actual path

WinOnly = ['windows']
WinLinux = ['windows', 'linux']
WinLinuxMac = ['windows', 'linux', 'mac']

PossibleSDKs = {
'tf2': SDK('HL2SDKTF2', '2.tf2', '11', 'TF2', WinLinuxMac, 'sdk2013'),
'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', WinLinuxMac, 'sdk2013'),
'other': SDK('HL2SDKCSS', '2.other', '6', 'OTHER', WinLinuxMac, 'sdk2013'),
'tf2': SDK('HL2SDKTF2', '2.tf2', '11', 'TF2', WinLinuxMac, 'sdk2013', 'tf2'),
'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', WinLinuxMac, 'sdk2013', 'css'),
'other': SDK('HL2SDKCSS', '2.other', '6', 'OTHER', WinLinuxMac, 'sdk2013', 'sdk2013'),
#'otherl4d': SDK('HL2SDKL4D', '2.l4d', '6', 'L4D', WinLinuxMac, 'sdk2013', 'l4d'),
}

def ResolveEnvPath(env, folder):
Expand Down Expand Up @@ -71,14 +74,17 @@ class ExtensionConfig(object):
if builder.target.platform in sdk.platform:
if builder.options.hl2sdk_root:
sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder)
ddl_path = os.path.join(builder.options.hl2sdk_root, 'hl2sdk-' + sdk.ddl_dir)
else:
sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder)
ddl_path = ResolveEnvPath(sdk.envvar, 'hl2sdk-' + sdk.ddl_dir)
if sdk_path is None or not os.path.isdir(sdk_path):
if use_all or sdk_name in sdk_list:
raise Exception('Could not find a valid path for {0}'.format(sdk.envvar))
continue
if use_all or use_present or sdk_name in sdk_list:
sdk.path = Normalize(sdk_path)
sdk.ddl_path = Normalize(ddl_path)
self.sdks[sdk_name] = sdk

if len(self.sdks) < 1:
Expand Down Expand Up @@ -480,17 +486,19 @@ class ExtensionConfig(object):
compiler.includes += [os.path.join(sdk.path, *path)]

if builder.target.platform == 'linux':
if sdk.name == 'episode1':
lib_folder = os.path.join(sdk.path, 'linux_sdk')
elif sdk.name in ['sdk2013', 'bms']:
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
if sdk.ddl_dir == 'episode1':
ddl_lib_folder = os.path.join(sdk.ddl_path, 'linux_sdk')
elif sdk.ddl_dir in ['sdk2013', 'bms']:
ddl_lib_folder = os.path.join(sdk.ddl_path, 'lib', 'public', 'linux32')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
ddl_lib_folder = os.path.join(sdk.ddl_path, 'lib', 'linux')

lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
elif builder.target.platform == 'mac':
if sdk.name in ['sdk2013', 'bms']:
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
ddl_lib_folder = lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
ddl_lib_folder = lib_folder = os.path.join(sdk.path, 'lib', 'mac')

if builder.target.platform in ['linux', 'mac']:
if sdk.name in ['sdk2013', 'bms']:
Expand All @@ -505,13 +513,13 @@ class ExtensionConfig(object):
]

if sdk.name in ['blade', 'insurgency', 'doi', 'csgo']:
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
compiler.postlink += [compiler.Dep(os.path.join(ddl_lib_folder, 'interfaces_i486.a'))]

dynamic_libs = []
if builder.target.platform == 'linux':
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency', 'doi']:
if sdk.ddl_dir in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency', 'doi']:
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
elif sdk.name in ['l4d', 'blade', 'insurgency', 'doi', 'csgo']:
elif sdk.ddl_dir in ['l4d', 'blade', 'insurgency', 'doi', 'csgo', 'pvkii']:
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
else:
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
Expand All @@ -527,7 +535,7 @@ class ExtensionConfig(object):
compiler.linkflags.append(compiler.Dep(lib_path))

for library in dynamic_libs:
source_path = os.path.join(lib_folder, library)
source_path = os.path.join(ddl_lib_folder, library)
output_path = os.path.join(binary.localFolder, library)

def make_linker(source_path, output_path):
Expand Down
2 changes: 2 additions & 0 deletions AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ if not Extension.optimize_mods_only:
if not Extension.optimize_mods_only:
sourceFiles += [

'src/mod/item/item_common.cpp',

'src/mod/bot/interrupt_action.cpp',

'src/mod/attr/blockbackstab_oldstyle.cpp',
Expand Down
17 changes: 16 additions & 1 deletion PackageScript
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,33 @@ else:

builder.AddCopy('sigsegv.autoload', 'addons/sourcemod/extensions/' + Extension.name + '.autoload')

l4dlinks = [
"csgo",
"pvkii",
"blade",
]

# Copy binaries.
for cxx_task in Extension.extensions:
src = os.path.join('..', cxx_task.binary.path)
# binary marked as using 'other' engine is the "default engine"
name = os.path.basename(cxx_task.binary.path).replace(".2.other", "")

dst = os.path.join('addons', 'sourcemod', 'extensions', name)
builder.AddCommand(
inputs = [ cxx_task.binary ],
argv = [ 'cp', '--remove-destination', src, dst ],
outputs = [ dst ],
)

if ".2.l4d" in cxx_task.binary.path:
for l4dlink in l4dlinks:
dst_link = os.path.join('addons', 'sourcemod', 'extensions', name.replace(".2.l4d", ".2." + l4dlink))
builder.AddCommand(
inputs = [ cxx_task.binary ],
argv = [ 'ln', '-s', './'+os.path.basename(cxx_task.binary.path), dst_link ],
outputs = [ dst_link ],
)
# builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions'])

# Copy libstrcompat (Linux only)
Expand Down
6 changes: 6 additions & 0 deletions src/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ bool CExtSigsegv::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength
Msg("CExtSigsegv: compiled @ %s %s\n", GetBuildDate(), GetBuildTime());

GET_IFACE_REQUIRED(Engine, engine, INTERFACEVERSION_VENGINESERVER);
#if SOURCE_ENGINE != SE_L4D
GET_IFACE_REQUIRED(Server, gamedll, INTERFACEVERSION_SERVERGAMEDLL);
#else
GET_IFACE_REQUIRED(Server, gamedll, "ServerGameDLL005");
#endif
GET_IFACE_REQUIRED(FileSystem, filesystem, FILESYSTEM_INTERFACE_VERSION);
GET_IFACE_REQUIRED(Server, serverGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);

Expand Down Expand Up @@ -317,10 +321,12 @@ CON_COMMAND(sig_build, "")
Msg("%s %s\n", GetBuildDate(), GetBuildTime());
}

#ifndef SE_L4D
CON_COMMAND(sig_cpu_usage, "")
{
Msg("%f\n", GetCPUUsage());
}
#endif

CON_COMMAND(sig_memory_stats, "")
{
Expand Down
Loading

0 comments on commit e112597

Please sign in to comment.