Skip to content

Commit

Permalink
Update with lua support
Browse files Browse the repository at this point in the history
  • Loading branch information
rafradek committed May 18, 2022
1 parent 3ee734c commit 92a3c7e
Show file tree
Hide file tree
Showing 39 changed files with 8,002 additions and 2,421 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ MSVC/Report*.csv

*.sublime-project
*.sublime-workspace

libs/lua/
1 change: 1 addition & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"${workspaceFolder}/libs/capstone/include",
"${workspaceFolder}/libs/ann/include",
"${workspaceFolder}/libs/fmt/include",
"${workspaceFolder}/libs/lua/src",
"${workspaceFolder}/../alliedmodders/sourcemod/public",
"${workspaceFolder}/../alliedmodders/sourcemod/public/extensions",
"${workspaceFolder}/../alliedmodders/sourcemod/sourcepawn/include",
Expand Down
72 changes: 70 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,74 @@
"files.associations": {
"typeindex": "cpp",
"typeinfo": "cpp",
"new": "cpp"
}
"new": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"set": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"ostream": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"variant": "cpp",
"charconv": "cpp",
"bit": "cpp",
"forward_list": "cpp",
"*.inc": "cpp",
"unordered_set": "cpp",
"mutex": "cpp",
"thread": "cpp"
},
"Lua.runtime.fileEncoding": "utf8",
"Lua.diagnostics.disable": [
"lowercase-global"
]
}
1 change: 1 addition & 0 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class ExtensionConfig(object):
cxx.defines += ['GNUC']
cxx.defines += ['PLATFORM_X86']
cxx.defines += ['FMT_HEADER_ONLY']
cxx.defines += ['LUAJIT_ENABLE_LUA52COMPAT']

############################################################################
# C & C++ COMPILER #########################################################
Expand Down
4 changes: 4 additions & 0 deletions AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ sourceFiles += [
'src/util/firehose_base.cpp',
'src/util/firehose_recv.cpp',
'src/util/firehose_send.cpp',
'src/util/lua.cpp',
'src/util/pooled_string.cpp',
'src/util/misc.cpp',
'src/util/rtti.cpp',
Expand Down Expand Up @@ -165,6 +166,7 @@ sourceFiles += [
'src/mod/etc/limp_projectiles.cpp',
'src/mod/etc/loose_cannon_damage_fix.cpp',
'src/mod/etc/mapentity_additions.cpp',
'src/mod/etc/mapentity_inputs.cpp',
'src/mod/etc/medicgun_beam_machinery.cpp',
'src/mod/etc/melee_ignore_teammates.cpp',
'src/mod/etc/misc.cpp',
Expand Down Expand Up @@ -474,6 +476,7 @@ binary.compiler.linkflags += [
'-liberty',
# os.path.join(builder.currentSourcePath, 'libs', 'capstone', 'libcapstone.a'),
os.path.join(builder.currentSourcePath, 'libs', 'ann', 'lib', 'libANN.a'),
os.path.join(builder.currentSourcePath, 'libs', 'lua', 'src', 'liblua.a'),
]

if builder.options.debug == '1':
Expand All @@ -490,6 +493,7 @@ binary.compiler.includes += [
os.path.join(builder.currentSourcePath, 'libs', 'capstone', 'include'),
os.path.join(builder.currentSourcePath, 'libs', 'ann', 'include'),
os.path.join(builder.currentSourcePath, 'libs', 'fmt', 'include'),
os.path.join(builder.currentSourcePath, 'libs', 'lua', 'src'),
]

# add libstrcompat dependency (for Linux only)
Expand Down
8 changes: 8 additions & 0 deletions PackageScript
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ CopyFiles('scripts', 'custom/sigsegv/scripts',
]
)

# Lua Script files
CopyFiles('src/lua', 'custom/sigsegv/scripts',
[
'globals.lua',
'natives.lua'
]
)

builder.AddCopy('cfg/sigsegv_convars.cfg', folder_map['cfg'])
builder.AddCopy('sigsegv.autoload', folder_map['addons/sourcemod/extensions'])
builder.AddCopy('scripts/mvm_bigrock_sigdemo.pop', folder_map['custom/sigsegv/scripts/population'])
Expand Down
14 changes: 7 additions & 7 deletions src/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ union MemberPtrUnion


template<class C, typename RET, typename... PARAMS>
MemberPtrType<C, RET, PARAMS...> MakePtrToMemberFunc(const void *ptr)
inline MemberPtrType<C, RET, PARAMS...> MakePtrToMemberFunc(const void *ptr)
{
MemberPtrUnion<C, RET, PARAMS...> u;

Expand All @@ -152,34 +152,34 @@ MemberPtrType<C, RET, PARAMS...> MakePtrToMemberFunc(const void *ptr)
return u.fptr;
}
template<class C, typename RET, typename... PARAMS>
MemberPtrTypeConst<C, RET, PARAMS...> MakePtrToConstMemberFunc(const void *ptr)
inline MemberPtrTypeConst<C, RET, PARAMS...> MakePtrToConstMemberFunc(const void *ptr)
{
return reinterpret_cast<MemberPtrTypeConst<C, RET, PARAMS...>>(MakePtrToMemberFunc<C, RET, PARAMS...>(ptr));
}


template<class C, typename RET, typename... PARAMS>
void *GetAddrOfMemberFunc(MemberPtrType<C, RET, PARAMS...> ptr)
inline void *GetAddrOfMemberFunc(MemberPtrType<C, RET, PARAMS...> ptr)
{
MemberPtrUnion<C, RET, PARAMS...> u;

u.fptr = ptr;

assert((uintptr_t)u.guts.ptr % 2 == 0);
// assert((uintptr_t)u.guts.ptr % 2 == 0);
return (void *)u.guts.ptr;
}
template<class C, typename RET, typename... PARAMS>
void *GetAddrOfMemberFunc(MemberPtrTypeConst<C, RET, PARAMS...> ptr)
inline void *GetAddrOfMemberFunc(MemberPtrTypeConst<C, RET, PARAMS...> ptr)
{
return GetAddrOfMemberFunc(reinterpret_cast<MemberPtrType<C, RET, PARAMS...>>(ptr));
}
template<class C, typename RET, typename... PARAMS>
void *GetAddrOfMemberFunc(MemberPtrTypeVa<C, RET, PARAMS...> ptr)
inline void *GetAddrOfMemberFunc(MemberPtrTypeVa<C, RET, PARAMS...> ptr)
{
return GetAddrOfMemberFunc(reinterpret_cast<MemberPtrType<C, RET, PARAMS...>>(ptr));
}
template<class C, typename RET, typename... PARAMS>
void *GetAddrOfMemberFunc(MemberPtrTypeVaConst<C, RET, PARAMS...> ptr)
inline void *GetAddrOfMemberFunc(MemberPtrTypeVaConst<C, RET, PARAMS...> ptr)
{
return GetAddrOfMemberFunc(reinterpret_cast<MemberPtrType<C, RET, PARAMS...>>(ptr));
}
Expand Down
3 changes: 2 additions & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ WARN_RESTORE()
#include <ehandle.h>
#include <datamap.h>
#include <predictioncopy.h>
#include <takedamageinfo.h>
#include "sdk2013/takedamageinfo.h"
//#include <takedamageinfo.h>
#include <iserverentity.h>
WARN_IGNORE__ADDRESS()
WARN_IGNORE__NONNULL_COMPARE()
Expand Down
Loading

0 comments on commit 92a3c7e

Please sign in to comment.