From 0f22133cdb300a31bf1669c1a81e0b4f81a29004 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 29 May 2020 03:08:20 +0100 Subject: [PATCH] Added x86-64 support to Source SDK --- helpers_extended/source/InterfacePointers.cpp | 2 +- include/lauxlib.h | 34 ++++++++----------- include/lua.h | 11 +++++- include/luaconf.h | 10 ++---- include/luajit.h | 19 ++++++++--- include/lualib.h | 2 +- lua_shared/source/LuaShared.cpp | 13 +++++++ premake/generator.lua | 2 +- sourcesdk-minimal | 2 +- 9 files changed, 58 insertions(+), 37 deletions(-) diff --git a/helpers_extended/source/InterfacePointers.cpp b/helpers_extended/source/InterfacePointers.cpp index e6cc970..396315e 100644 --- a/helpers_extended/source/InterfacePointers.cpp +++ b/helpers_extended/source/InterfacePointers.cpp @@ -23,7 +23,7 @@ namespace InterfacePointers static const char filesystem_name[] = "VFileSystem022"; static const char vengineserver_name[] = "VEngineServer021"; static const char vengineclient_name[] = "VEngineClient015"; - static const char cvar_name[] = "VEngineCvar004"; + static const char cvar_name[] = "VEngineCvar007"; static const char servergamedll_name[] = "ServerGameDLL009"; static const char networkstringtableserver_name[] = "VEngineServerStringTable001"; static const char networkstringtableclient_name[] = "VEngineClientStringTable001"; diff --git a/include/lauxlib.h b/include/lauxlib.h index ae3bb59..85ec03a 100644 --- a/include/lauxlib.h +++ b/include/lauxlib.h @@ -15,9 +15,6 @@ #include "lua.h" -#define luaL_getn(L,i) ((int)lua_objlen(L, i)) -#define luaL_setn(L,i,j) ((void)0) /* no op! */ - /* extra error code for `luaL_load' */ #define LUA_ERRFILE (LUA_ERRERR+1) @@ -58,6 +55,10 @@ LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, const char *const lst[]); +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + LUALIB_API int (luaL_ref) (lua_State *L, int t); LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); @@ -84,6 +85,11 @@ LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode); LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg, int level); +LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); +LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, + int sizehint); +LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); +LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); /* @@ -113,6 +119,11 @@ LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg, #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) +/* From Lua 5.2. */ +#define luaL_newlibtable(L, l) \ + lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) +#define luaL_newlib(L, l) (luaL_newlibtable(L, l), luaL_setfuncs(L, l, 0)) + /* ** {====================================================== ** Generic Buffer manipulation @@ -147,21 +158,4 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); /* }====================================================== */ - -/* compatibility with ref system */ - -/* pre-defined references */ -#define LUA_NOREF (-2) -#define LUA_REFNIL (-1) - -#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ - (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) - -#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) - -#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) - - -#define luaL_reg luaL_Reg - #endif diff --git a/include/lua.h b/include/lua.h index 3205662..dd894f5 100644 --- a/include/lua.h +++ b/include/lua.h @@ -39,7 +39,8 @@ #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) -/* thread status; 0 is OK */ +/* thread status */ +#define LUA_OK 0 #define LUA_YIELD 1 #define LUA_ERRRUN 2 #define LUA_ERRSYNTAX 3 @@ -226,6 +227,7 @@ LUA_API int (lua_status) (lua_State *L); #define LUA_GCSTEP 5 #define LUA_GCSETPAUSE 6 #define LUA_GCSETSTEPMUL 7 +#define LUA_GCISRUNNING 9 LUA_API int (lua_gc) (lua_State *L, int what, int data); @@ -346,6 +348,13 @@ LUA_API void *lua_upvalueid (lua_State *L, int idx, int n); LUA_API void lua_upvaluejoin (lua_State *L, int idx1, int n1, int idx2, int n2); LUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt, const char *chunkname, const char *mode); +LUA_API const lua_Number *lua_version (lua_State *L); +LUA_API void lua_copy (lua_State *L, int fromidx, int toidx); +LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum); +LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum); + +/* From Lua 5.3. */ +LUA_API int lua_isyieldable (lua_State *L); struct lua_Debug { diff --git a/include/luaconf.h b/include/luaconf.h index 8d1b23f..2ec9dc2 100644 --- a/include/luaconf.h +++ b/include/luaconf.h @@ -1,6 +1,6 @@ /* ** Configuration header. -** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h */ #ifndef luaconf_h @@ -37,7 +37,7 @@ #endif #define LUA_LROOT "/usr/local" #define LUA_LUADIR "/lua/5.1/" -#define LUA_LJDIR "/luajit-2.0.4/" +#define LUA_LJDIR "/luajit-2.1.0-beta3/" #ifdef LUA_ROOT #define LUA_JROOT LUA_ROOT @@ -79,7 +79,7 @@ #define LUA_IGMARK "-" #define LUA_PATH_CONFIG \ LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \ - LUA_EXECDIR "\n" LUA_IGMARK + LUA_EXECDIR "\n" LUA_IGMARK "\n" /* Quoting in error messages. */ #define LUA_QL(x) "'" x "'" @@ -92,10 +92,6 @@ #define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */ #define LUA_MAXCAPTURES 32 /* Max. pattern captures. */ -/* Compatibility with older library function names. */ -#define LUA_COMPAT_MOD /* OLD: math.mod, NEW: math.fmod */ -#define LUA_COMPAT_GFIND /* OLD: string.gfind, NEW: string.gmatch */ - /* Configuration for the frontend (the luajit executable). */ #if defined(luajit_c) #define LUA_PROGNAME "luajit" /* Fallback frontend name. */ diff --git a/include/luajit.h b/include/luajit.h index 9ced18e..708a5a1 100644 --- a/include/luajit.h +++ b/include/luajit.h @@ -1,7 +1,7 @@ /* ** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ ** -** Copyright (C) 2005-2015 Mike Pall. All rights reserved. +** Copyright (C) 2005-2017 Mike Pall. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining ** a copy of this software and associated documentation files (the @@ -30,10 +30,10 @@ #include "lua.h" -#define LUAJIT_VERSION "LuaJIT 2.0.4" -#define LUAJIT_VERSION_NUM 20004 /* Version 2.0.4 = 02.00.04. */ -#define LUAJIT_VERSION_SYM luaJIT_version_2_0_4 -#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2015 Mike Pall" +#define LUAJIT_VERSION "LuaJIT 2.1.0-beta3" +#define LUAJIT_VERSION_NUM 20100 /* Version 2.1.0 = 02.01.00. */ +#define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta3 +#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2017 Mike Pall" #define LUAJIT_URL "http://luajit.org/" /* Modes for luaJIT_setmode. */ @@ -64,6 +64,15 @@ enum { /* Control the JIT engine. */ LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode); +/* Low-overhead profiling API. */ +typedef void (*luaJIT_profile_callback)(void *data, lua_State *L, + int samples, int vmstate); +LUA_API void luaJIT_profile_start(lua_State *L, const char *mode, + luaJIT_profile_callback cb, void *data); +LUA_API void luaJIT_profile_stop(lua_State *L); +LUA_API const char *luaJIT_profile_dumpstack(lua_State *L, const char *fmt, + int depth, size_t *len); + /* Enforce (dynamic) linker error for version mismatches. Call from main. */ LUA_API void LUAJIT_VERSION_SYM(void); diff --git a/include/lualib.h b/include/lualib.h index 96530e7..bfc130a 100644 --- a/include/lualib.h +++ b/include/lualib.h @@ -1,6 +1,6 @@ /* ** Standard library header. -** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LUALIB_H diff --git a/lua_shared/source/LuaShared.cpp b/lua_shared/source/LuaShared.cpp index c7d9b8f..4ab1d5a 100644 --- a/lua_shared/source/LuaShared.cpp +++ b/lua_shared/source/LuaShared.cpp @@ -179,6 +179,11 @@ extern "C" CreateLoader( void *, lua_upvalueid, ( lua_State *a, int b, int c ), ( a, b, c ) ); CreateLoader( void, lua_upvaluejoin, ( lua_State *a, int b, int c, int d, int e ), ( a, b, c, d, e ) ); CreateLoader( int, lua_loadx, ( lua_State *a, lua_Reader b, void *c, const char *d, const char *e ), ( a, b, c, d, e ) ); + CreateLoader( const lua_Number *, lua_version, ( lua_State *a ), ( a ) ); + CreateLoader( void, lua_copy, ( lua_State *a, int b, int c ), ( a, b, c ) ); + CreateLoader( lua_Number, lua_tonumberx, (lua_State *a, int b, int *c ), ( a, b, c ) ); + CreateLoader( lua_Integer, lua_tointegerx, ( lua_State* a, int b, int *c ), ( a, b, c ) ); + CreateLoader( int, lua_isyieldable, ( lua_State *a ), ( a ) ); CreateLoader( int, luaL_typerror, ( lua_State *a, int b, const char *c ), ( a, b, c ) ); CreateLoader( void, luaL_openlib, ( lua_State *a, const char *b, const luaL_Reg *c, int d ), ( a, b, c, d ) ); @@ -213,6 +218,10 @@ extern "C" CreateLoader( int, luaL_loadfilex, ( lua_State *a, const char *b, const char *c ), ( a, b, c ) ); CreateLoader( int, luaL_loadbufferx, ( lua_State *a, const char *b, size_t c, const char *d, const char *e ), ( a, b, c, d, e ) ); CreateLoader( void, luaL_traceback, ( lua_State *a, lua_State *b, const char *c, int d ), ( a, b, c, d ) ); + CreateLoader( void, luaL_setfuncs, ( lua_State *a, const luaL_Reg *b, int c ), ( a, b, c ) ); + CreateLoader( void, luaL_pushmodule, ( lua_State *a, const char *b, int c ), ( a, b, c ) ); + CreateLoader( void *, luaL_testudata, ( lua_State *a, int b, const char *c ), ( a, b, c ) ); + CreateLoader( void, luaL_setmetatable, ( lua_State *a, const char *b ), ( a, b ) ); CreateLoader( void, luaL_buffinit, ( lua_State *a, luaL_Buffer *b ), ( a, b ) ); CreateLoader( char *, luaL_prepbuffer, ( luaL_Buffer *a ), ( a ) ); CreateLoader( void, luaL_addlstring, ( luaL_Buffer *a, const char *b, size_t c ), ( a, b, c ) ); @@ -268,4 +277,8 @@ extern "C" CreateLoader( int, luaJIT_setmode, ( lua_State *a, int b, int c ), ( a, b, c ) ); CreateLoader( void, LUAJIT_VERSION_SYM, ( ), ( ) ); + typedef void ( *luaJIT_profile_callback )( void *data, lua_State *L, int samples, int vmstate ); + CreateLoader( void, luaJIT_profile_start, ( lua_State *a, const char *b, luaJIT_profile_callback c, void *d ), ( a, b, c, d ) ); + CreateLoader( void, luaJIT_profile_stop, ( lua_State *a ), ( a ) ); + CreateLoader( const char *, luaJIT_profile_dumpstack, ( lua_State* a, const char *b, int c, size_t *d ), ( a, b, c, d ) ); } diff --git a/premake/generator.lua b/premake/generator.lua index 9c4ad77..593da19 100644 --- a/premake/generator.lua +++ b/premake/generator.lua @@ -128,7 +128,7 @@ function CreateWorkspace(config) cdialect("GNU11") cppdialect("GNU++17") pic("On") - staticruntime("On") + staticruntime("Off") defaultplatform("x86") linkoptions("-Wl,--no-undefined") diff --git a/sourcesdk-minimal b/sourcesdk-minimal index 58938ea..b2c2a52 160000 --- a/sourcesdk-minimal +++ b/sourcesdk-minimal @@ -1 +1 @@ -Subproject commit 58938eaf9954fb5e8ee4a1780ea260405d25556b +Subproject commit b2c2a520ed2f7c73d716682c9295294ffd26c172