Added config file for saved dvars and added menu for unlocking loot
This commit is contained in:
101
src/client/component/dvars.cpp
Normal file
101
src/client/component/dvars.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/string.hpp>
|
||||
|
||||
#include "scheduler.hpp"
|
||||
|
||||
namespace dvars
|
||||
{
|
||||
namespace
|
||||
{
|
||||
bool initial_config_read = false;
|
||||
utils::hook::detour dvar_register_new_hook;
|
||||
utils::hook::detour dvar_set_variant_hook;
|
||||
|
||||
utils::hook::detour set_config_dvar_hook;
|
||||
utils::hook::detour for_each_name_match_hook;
|
||||
utils::hook::detour get_debug_name_hook;
|
||||
|
||||
|
||||
const std::string get_config_file_path()
|
||||
{
|
||||
return "players/user/config.cfg";
|
||||
}
|
||||
|
||||
void write_archive_dvars()
|
||||
{
|
||||
std::string config_buffer;
|
||||
|
||||
for (int i = 0; i < *game::g_dvarCount; ++i)
|
||||
{
|
||||
const auto* dvar = reinterpret_cast<const game::dvar_t*>(&game::s_dvarPool[160 * i]);
|
||||
|
||||
if (!dvar->debugName || (game::dvarFlags_e::DVAR_SAVED & dvar->flags) == 0)
|
||||
continue;
|
||||
|
||||
auto name = dvar->debugName;
|
||||
auto value = game::Dvar_DisplayableValue(dvar);
|
||||
|
||||
config_buffer.append(utils::string::va("set %s %s\n", name, value));
|
||||
}
|
||||
|
||||
if (config_buffer.length() == 0)
|
||||
return;
|
||||
|
||||
utils::io::write_file(get_config_file_path(), config_buffer);
|
||||
}
|
||||
|
||||
void dvar_set_variant_stub(game::dvar_t* dvar, game::DvarValue* value, unsigned int source)
|
||||
{
|
||||
dvar_set_variant_hook.invoke(dvar, value, source);
|
||||
|
||||
if (initial_config_read && (game::dvarFlags_e::DVAR_SAVED & dvar->flags) != 0 && dvar->debugName)
|
||||
{
|
||||
write_archive_dvars();
|
||||
}
|
||||
}
|
||||
|
||||
void read_archive_dvars()
|
||||
{
|
||||
const std::string path = get_config_file_path();
|
||||
|
||||
if (!utils::io::file_exists(path))
|
||||
return;
|
||||
|
||||
std::string filedata;
|
||||
utils::io::read_file(path, &filedata);
|
||||
|
||||
game::Cbuf_ExecuteBuffer(0, game::ControllerIndex_t::CONTROLLER_INDEX_0, filedata.c_str());
|
||||
initial_config_read = true;
|
||||
}
|
||||
|
||||
game::dvar_t* dvar_register_new_stub(game::dvarStrHash_t hash, const char* dvar_name, game::dvarType_t type, unsigned int flags,
|
||||
game::DvarValue value, game::DvarLimits domain, const char* description)
|
||||
{
|
||||
auto dvar = dvar_register_new_hook.invoke<game::dvar_t*>(hash, dvar_name, type, flags, value, domain, description);
|
||||
|
||||
dvar->debugName = dvar_name; // TODO: gives access violation error
|
||||
|
||||
return dvar;
|
||||
}
|
||||
}
|
||||
|
||||
class component final : public client_component
|
||||
{
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
scheduler::once(read_archive_dvars, scheduler::pipeline::main);
|
||||
|
||||
//dvar_register_new_hook.create(0x1422C5330_g, dvar_register_new_stub);
|
||||
dvar_set_variant_hook.create(0x1422C9A90_g, dvar_set_variant_stub);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
REGISTER_COMPONENT(dvars::component)
|
@ -10,13 +10,20 @@ namespace loot
|
||||
{
|
||||
namespace
|
||||
{
|
||||
game::dvar_t* dvar_cg_unlockall_loot;
|
||||
|
||||
utils::hook::detour loot_getitemquantity_hook;
|
||||
utils::hook::detour liveinventory_getitemquantity_hook;
|
||||
utils::hook::detour liveinventory_areextraslotspurchased_hook;
|
||||
|
||||
int loot_getitemquantity_stub(const game::ControllerIndex_t /*controller_index*/, const game::eModes mode,
|
||||
const int /*item_id*/)
|
||||
int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode,
|
||||
const int item_id)
|
||||
{
|
||||
if (!dvar_cg_unlockall_loot->current.enabled)
|
||||
{
|
||||
return loot_getitemquantity_hook.invoke<int>(controller_index, mode, item_id);
|
||||
}
|
||||
|
||||
if (mode == game::eModes::MODE_ZOMBIES)
|
||||
{
|
||||
return 999;
|
||||
@ -28,8 +35,8 @@ namespace loot
|
||||
int liveinventory_getitemquantity_stub(const game::ControllerIndex_t controller_index, const int item_id)
|
||||
{
|
||||
// Item id's for extra CaC slots, CWL camo's and paid specialist outfits
|
||||
if (item_id == 99003 || item_id >= 99018 && item_id <= 99021 || item_id == 99025 || item_id >= 90047 &&
|
||||
item_id <= 90064)
|
||||
if (dvar_cg_unlockall_loot->current.enabled && (item_id == 99003 || item_id >= 99018 && item_id <= 99021 || item_id == 99025||
|
||||
item_id >= 90047 && item_id <= 90064))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -37,15 +44,14 @@ namespace loot
|
||||
return liveinventory_getitemquantity_hook.invoke<int>(controller_index, item_id);
|
||||
}
|
||||
|
||||
bool liveinventory_areextraslotspurchased_stub(const game::ControllerIndex_t /*controller_index*/)
|
||||
bool liveinventory_areextraslotspurchased_stub(const game::ControllerIndex_t controller_index)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (dvar_cg_unlockall_loot->current.enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void set_dvars_on_startup()
|
||||
{
|
||||
game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true);
|
||||
game::Dvar_SetFromStringByName("ui_allLootUnlocked", "1", true);
|
||||
return liveinventory_areextraslotspurchased_hook.invoke<bool>(controller_index);
|
||||
}
|
||||
};
|
||||
|
||||
@ -53,7 +59,9 @@ namespace loot
|
||||
{
|
||||
void post_unpack() override
|
||||
{
|
||||
scheduler::once(set_dvars_on_startup, scheduler::pipeline::main);
|
||||
dvar_cg_unlockall_loot = game::Dvar_RegisterBool(game::Dvar_GenerateHash("cg_unlockall_loot"), "cg_unlockall_loot", false, (game::dvarFlags_e)0x40, "Unlocks blackmarket loot");
|
||||
dvar_cg_unlockall_loot->debugName = "cg_unlockall_loot";
|
||||
|
||||
loot_getitemquantity_hook.create(0x141E82C90_g, loot_getitemquantity_stub);
|
||||
liveinventory_getitemquantity_hook.create(0x141E090C0_g, liveinventory_getitemquantity_stub);
|
||||
liveinventory_areextraslotspurchased_hook.create(0x141E089E0_g, liveinventory_areextraslotspurchased_stub);
|
||||
|
@ -222,7 +222,14 @@ namespace ui_scripting
|
||||
ui_cod_init_hook.invoke(frontend);
|
||||
|
||||
if (game::Com_IsRunningUILevel())
|
||||
{
|
||||
// Fetch the names of the local files so file overrides are already handled
|
||||
globals = {};
|
||||
load_local_script_files(game::get_host_library().get_folder().append("/data/ui_scripts/").string());
|
||||
load_local_script_files("boiii/ui_scripts/");
|
||||
load_local_script_files("data/ui_scripts/");
|
||||
return;
|
||||
}
|
||||
const auto _0 = utils::finally(&try_start);
|
||||
}
|
||||
|
||||
|
@ -417,8 +417,8 @@ namespace game
|
||||
ERROR_LUA = 0x200,
|
||||
ERROR_SOFTRESTART = 0x400,
|
||||
ERROR_SOFTRESTART_KEEPDW = 0x800,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
enum XAssetType
|
||||
{
|
||||
ASSET_TYPE_PHYSPRESET = 0x0,
|
||||
@ -530,19 +530,19 @@ namespace game
|
||||
ASSET_TYPE_REPORT = 0x6A,
|
||||
ASSET_TYPE_DEPEND = 0x68,
|
||||
ASSET_TYPE_FULL_COUNT = 0x6C,
|
||||
};
|
||||
|
||||
struct LuaFile
|
||||
{
|
||||
const char* name;
|
||||
int len;
|
||||
const char* buffer;
|
||||
};
|
||||
|
||||
union XAssetHeader
|
||||
{
|
||||
void* data;
|
||||
LuaFile* luaFile;
|
||||
};
|
||||
|
||||
struct LuaFile
|
||||
{
|
||||
const char* name;
|
||||
int len;
|
||||
const char* buffer;
|
||||
};
|
||||
|
||||
union XAssetHeader
|
||||
{
|
||||
void* data;
|
||||
LuaFile* luaFile;
|
||||
};
|
||||
|
||||
struct XZoneBuffer
|
||||
@ -624,8 +624,8 @@ namespace game
|
||||
DVAR_TYPE_COLOR_LAB = 0xE,
|
||||
DVAR_TYPE_SESSIONMODE_BASE_DVAR = 0xF,
|
||||
DVAR_TYPE_COUNT = 0x10,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
enum dvarFlags_e
|
||||
{
|
||||
DVAR_ARCHIVE = 1 << 0,
|
||||
@ -666,7 +666,6 @@ namespace game
|
||||
vec4_t vector;
|
||||
const char* string;
|
||||
byte color[4];
|
||||
const dvar_t* indirect[3];
|
||||
};
|
||||
|
||||
struct $7034703ED3857507327AE195CCA24A71
|
||||
@ -1016,15 +1015,15 @@ namespace game
|
||||
Agreement debugAgreement;
|
||||
JoinType joinType;
|
||||
JoinResult joinResult;
|
||||
};
|
||||
|
||||
|
||||
namespace hks
|
||||
{
|
||||
struct lua_State;
|
||||
struct HashTable;
|
||||
struct StringTable;
|
||||
struct cclosure;
|
||||
};
|
||||
|
||||
|
||||
namespace hks
|
||||
{
|
||||
struct lua_State;
|
||||
struct HashTable;
|
||||
struct StringTable;
|
||||
struct cclosure;
|
||||
typedef int hksBool;
|
||||
typedef char hksChar;
|
||||
typedef unsigned __int8 hksByte;
|
||||
@ -1034,183 +1033,183 @@ namespace game
|
||||
typedef int hksInt32;
|
||||
typedef unsigned int hksUint32;
|
||||
typedef __int64 hksInt64;
|
||||
typedef unsigned __int64 hksUint64;
|
||||
typedef unsigned __int64 hksUint64;
|
||||
|
||||
typedef int HksGcCost;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef size_t hksSize;
|
||||
typedef void* (*lua_Alloc)(void*, void*, size_t, size_t);
|
||||
typedef hksInt32(*lua_CFunction)(lua_State*);
|
||||
|
||||
struct GenericChunkHeader
|
||||
{
|
||||
hksSize m_flags;
|
||||
};
|
||||
|
||||
struct ChunkHeader : GenericChunkHeader
|
||||
{
|
||||
ChunkHeader* m_next;
|
||||
typedef hksInt32(*lua_CFunction)(lua_State*);
|
||||
|
||||
struct GenericChunkHeader
|
||||
{
|
||||
hksSize m_flags;
|
||||
};
|
||||
|
||||
struct ChunkHeader : GenericChunkHeader
|
||||
{
|
||||
ChunkHeader* m_next;
|
||||
};
|
||||
|
||||
struct ChunkList
|
||||
{
|
||||
ChunkHeader m_head;
|
||||
};
|
||||
|
||||
struct UserData : ChunkHeader
|
||||
{
|
||||
unsigned __int64 m_envAndSizeOffsetHighBits;
|
||||
unsigned __int64 m_metaAndSizeOffsetLowBits;
|
||||
char m_data[8];
|
||||
};
|
||||
|
||||
struct InternString
|
||||
{
|
||||
unsigned __int64 m_flags;
|
||||
unsigned __int64 m_lengthbits;
|
||||
unsigned int m_hash;
|
||||
char m_data[30];
|
||||
};
|
||||
|
||||
union HksValue
|
||||
{
|
||||
cclosure* cClosure;
|
||||
void* closure;
|
||||
UserData* userData;
|
||||
HashTable* table;
|
||||
void* tstruct;
|
||||
InternString* str;
|
||||
void* thread;
|
||||
void* ptr;
|
||||
float number;
|
||||
unsigned int native;
|
||||
bool boolean;
|
||||
};
|
||||
|
||||
enum HksObjectType
|
||||
{
|
||||
TANY = 0xFFFFFFFE,
|
||||
TNONE = 0xFFFFFFFF,
|
||||
TNIL = 0x0,
|
||||
TBOOLEAN = 0x1,
|
||||
TLIGHTUSERDATA = 0x2,
|
||||
TNUMBER = 0x3,
|
||||
TSTRING = 0x4,
|
||||
TTABLE = 0x5,
|
||||
TFUNCTION = 0x6, // idk
|
||||
TUSERDATA = 0x7,
|
||||
TTHREAD = 0x8,
|
||||
TIFUNCTION = 0x9, // Lua function
|
||||
TCFUNCTION = 0xA, // C function
|
||||
TUI64 = 0xB,
|
||||
TSTRUCT = 0xC,
|
||||
NUM_TYPE_OBJECTS = 0xE,
|
||||
};
|
||||
|
||||
struct HksObject
|
||||
{
|
||||
HksObjectType t;
|
||||
HksValue v;
|
||||
};
|
||||
|
||||
const struct hksInstruction
|
||||
{
|
||||
unsigned int code;
|
||||
};
|
||||
|
||||
struct ActivationRecord
|
||||
{
|
||||
HksObject* m_base;
|
||||
const hksInstruction* m_returnAddress;
|
||||
__int16 m_tailCallDepth;
|
||||
__int16 m_numVarargs;
|
||||
int m_numExpectedReturns;
|
||||
};
|
||||
|
||||
struct CallStack
|
||||
{
|
||||
ActivationRecord* m_records;
|
||||
ActivationRecord* m_lastrecord;
|
||||
ActivationRecord* m_current;
|
||||
const hksInstruction* m_current_lua_pc;
|
||||
const hksInstruction* m_hook_return_addr;
|
||||
int m_hook_level;
|
||||
};
|
||||
|
||||
struct ApiStack
|
||||
{
|
||||
HksObject* top;
|
||||
HksObject* base;
|
||||
HksObject* alloc_top;
|
||||
HksObject* bottom;
|
||||
};
|
||||
|
||||
struct UpValue : ChunkHeader
|
||||
{
|
||||
HksObject m_storage;
|
||||
HksObject* loc;
|
||||
UpValue* m_next;
|
||||
};
|
||||
|
||||
struct CallSite
|
||||
{
|
||||
_SETJMP_FLOAT128 m_jumpBuffer[16];
|
||||
CallSite* m_prev;
|
||||
};
|
||||
|
||||
enum Status
|
||||
{
|
||||
NEW = 0x1,
|
||||
RUNNING = 0x2,
|
||||
YIELDED = 0x3,
|
||||
DEAD_ERROR = 0x4,
|
||||
};
|
||||
|
||||
enum HksError
|
||||
{
|
||||
HKS_NO_ERROR = 0,
|
||||
HKS_ERRSYNTAX = -4,
|
||||
HKS_ERRFILE = -5,
|
||||
HKS_ERRRUN = -100,
|
||||
HKS_ERRMEM = -200,
|
||||
HKS_ERRERR = -300,
|
||||
HKS_THROWING_ERROR = -500,
|
||||
HKS_GC_YIELD = 1,
|
||||
};
|
||||
|
||||
struct lua_Debug
|
||||
{
|
||||
int event;
|
||||
const char* name;
|
||||
const char* namewhat;
|
||||
const char* what;
|
||||
const char* source;
|
||||
int currentline;
|
||||
int nups;
|
||||
int nparams;
|
||||
int ishksfunc;
|
||||
int linedefined;
|
||||
int lastlinedefined;
|
||||
char short_src[512];
|
||||
int callstack_level;
|
||||
int is_tail_call;
|
||||
};
|
||||
|
||||
using lua_function = int(__fastcall*)(lua_State*);
|
||||
|
||||
struct luaL_Reg
|
||||
{
|
||||
const char* name;
|
||||
lua_function function;
|
||||
};
|
||||
|
||||
struct Node
|
||||
{
|
||||
HksObject m_key;
|
||||
HksObject m_value;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
struct UserData : ChunkHeader
|
||||
{
|
||||
unsigned __int64 m_envAndSizeOffsetHighBits;
|
||||
unsigned __int64 m_metaAndSizeOffsetLowBits;
|
||||
char m_data[8];
|
||||
};
|
||||
|
||||
struct InternString
|
||||
{
|
||||
unsigned __int64 m_flags;
|
||||
unsigned __int64 m_lengthbits;
|
||||
unsigned int m_hash;
|
||||
char m_data[30];
|
||||
};
|
||||
|
||||
union HksValue
|
||||
{
|
||||
cclosure* cClosure;
|
||||
void* closure;
|
||||
UserData* userData;
|
||||
HashTable* table;
|
||||
void* tstruct;
|
||||
InternString* str;
|
||||
void* thread;
|
||||
void* ptr;
|
||||
float number;
|
||||
unsigned int native;
|
||||
bool boolean;
|
||||
};
|
||||
|
||||
enum HksObjectType
|
||||
{
|
||||
TANY = 0xFFFFFFFE,
|
||||
TNONE = 0xFFFFFFFF,
|
||||
TNIL = 0x0,
|
||||
TBOOLEAN = 0x1,
|
||||
TLIGHTUSERDATA = 0x2,
|
||||
TNUMBER = 0x3,
|
||||
TSTRING = 0x4,
|
||||
TTABLE = 0x5,
|
||||
TFUNCTION = 0x6, // idk
|
||||
TUSERDATA = 0x7,
|
||||
TTHREAD = 0x8,
|
||||
TIFUNCTION = 0x9, // Lua function
|
||||
TCFUNCTION = 0xA, // C function
|
||||
TUI64 = 0xB,
|
||||
TSTRUCT = 0xC,
|
||||
NUM_TYPE_OBJECTS = 0xE,
|
||||
};
|
||||
|
||||
struct HksObject
|
||||
{
|
||||
HksObjectType t;
|
||||
HksValue v;
|
||||
};
|
||||
|
||||
const struct hksInstruction
|
||||
{
|
||||
unsigned int code;
|
||||
};
|
||||
|
||||
struct ActivationRecord
|
||||
{
|
||||
HksObject* m_base;
|
||||
const hksInstruction* m_returnAddress;
|
||||
__int16 m_tailCallDepth;
|
||||
__int16 m_numVarargs;
|
||||
int m_numExpectedReturns;
|
||||
};
|
||||
|
||||
struct CallStack
|
||||
{
|
||||
ActivationRecord* m_records;
|
||||
ActivationRecord* m_lastrecord;
|
||||
ActivationRecord* m_current;
|
||||
const hksInstruction* m_current_lua_pc;
|
||||
const hksInstruction* m_hook_return_addr;
|
||||
int m_hook_level;
|
||||
};
|
||||
|
||||
struct ApiStack
|
||||
{
|
||||
HksObject* top;
|
||||
HksObject* base;
|
||||
HksObject* alloc_top;
|
||||
HksObject* bottom;
|
||||
};
|
||||
|
||||
struct UpValue : ChunkHeader
|
||||
{
|
||||
HksObject m_storage;
|
||||
HksObject* loc;
|
||||
UpValue* m_next;
|
||||
};
|
||||
|
||||
struct CallSite
|
||||
{
|
||||
_SETJMP_FLOAT128 m_jumpBuffer[16];
|
||||
CallSite* m_prev;
|
||||
};
|
||||
|
||||
enum Status
|
||||
{
|
||||
NEW = 0x1,
|
||||
RUNNING = 0x2,
|
||||
YIELDED = 0x3,
|
||||
DEAD_ERROR = 0x4,
|
||||
};
|
||||
|
||||
enum HksError
|
||||
{
|
||||
HKS_NO_ERROR = 0,
|
||||
HKS_ERRSYNTAX = -4,
|
||||
HKS_ERRFILE = -5,
|
||||
HKS_ERRRUN = -100,
|
||||
HKS_ERRMEM = -200,
|
||||
HKS_ERRERR = -300,
|
||||
HKS_THROWING_ERROR = -500,
|
||||
HKS_GC_YIELD = 1,
|
||||
};
|
||||
|
||||
struct lua_Debug
|
||||
{
|
||||
int event;
|
||||
const char* name;
|
||||
const char* namewhat;
|
||||
const char* what;
|
||||
const char* source;
|
||||
int currentline;
|
||||
int nups;
|
||||
int nparams;
|
||||
int ishksfunc;
|
||||
int linedefined;
|
||||
int lastlinedefined;
|
||||
char short_src[512];
|
||||
int callstack_level;
|
||||
int is_tail_call;
|
||||
};
|
||||
|
||||
using lua_function = int(__fastcall*)(lua_State*);
|
||||
|
||||
struct luaL_Reg
|
||||
{
|
||||
const char* name;
|
||||
lua_function function;
|
||||
};
|
||||
|
||||
struct Node
|
||||
{
|
||||
HksObject m_key;
|
||||
HksObject m_value;
|
||||
};
|
||||
|
||||
struct StringPinner
|
||||
{
|
||||
struct Node
|
||||
@ -1224,7 +1223,7 @@ namespace game
|
||||
InternString** m_nextStringsPlace;
|
||||
Node m_firstNode;
|
||||
Node* m_currentNode;
|
||||
};
|
||||
};
|
||||
|
||||
struct StringTable
|
||||
{
|
||||
@ -1232,102 +1231,102 @@ namespace game
|
||||
unsigned int m_count;
|
||||
unsigned int m_mask;
|
||||
StringPinner* m_pinnedStrings;
|
||||
};
|
||||
|
||||
struct Metatable
|
||||
{
|
||||
};
|
||||
|
||||
struct HashTable : ChunkHeader
|
||||
{
|
||||
Metatable* m_meta;
|
||||
unsigned int m_version;
|
||||
unsigned int m_mask;
|
||||
Node* m_hashPart;
|
||||
HksObject* m_arrayPart;
|
||||
unsigned int m_arraySize;
|
||||
Node* m_freeNode;
|
||||
};
|
||||
|
||||
struct cclosure : ChunkHeader
|
||||
{
|
||||
lua_function m_function;
|
||||
HashTable* m_env;
|
||||
__int16 m_numUpvalues;
|
||||
__int16 m_flags;
|
||||
InternString* m_name;
|
||||
HksObject m_upvalues[1];
|
||||
};
|
||||
|
||||
enum HksCompilerSettings_BytecodeSharingFormat
|
||||
{
|
||||
BYTECODE_DEFAULT = 0x0,
|
||||
BYTECODE_INPLACE = 0x1,
|
||||
BYTECODE_REFERENCED = 0x2,
|
||||
};
|
||||
|
||||
enum HksCompilerSettings_IntLiteralOptions
|
||||
{
|
||||
INT_LITERALS_NONE = 0x0,
|
||||
INT_LITERALS_LUD = 0x1,
|
||||
INT_LITERALS_32BIT = 0x1,
|
||||
INT_LITERALS_UI64 = 0x2,
|
||||
INT_LITERALS_64BIT = 0x2,
|
||||
INT_LITERALS_ALL = 0x3,
|
||||
};
|
||||
|
||||
struct HksCompilerSettings
|
||||
{
|
||||
int m_emitStructCode;
|
||||
const char** m_stripNames;
|
||||
int m_emitGlobalMemoization;
|
||||
int _m_isHksGlobalMemoTestingMode;
|
||||
HksCompilerSettings_BytecodeSharingFormat m_bytecodeSharingFormat;
|
||||
HksCompilerSettings_IntLiteralOptions m_enableIntLiterals;
|
||||
int(*m_debugMap)(const char*, int);
|
||||
};
|
||||
|
||||
enum HksBytecodeSharingMode : __int64
|
||||
{
|
||||
};
|
||||
|
||||
struct Metatable
|
||||
{
|
||||
};
|
||||
|
||||
struct HashTable : ChunkHeader
|
||||
{
|
||||
Metatable* m_meta;
|
||||
unsigned int m_version;
|
||||
unsigned int m_mask;
|
||||
Node* m_hashPart;
|
||||
HksObject* m_arrayPart;
|
||||
unsigned int m_arraySize;
|
||||
Node* m_freeNode;
|
||||
};
|
||||
|
||||
struct cclosure : ChunkHeader
|
||||
{
|
||||
lua_function m_function;
|
||||
HashTable* m_env;
|
||||
__int16 m_numUpvalues;
|
||||
__int16 m_flags;
|
||||
InternString* m_name;
|
||||
HksObject m_upvalues[1];
|
||||
};
|
||||
|
||||
enum HksCompilerSettings_BytecodeSharingFormat
|
||||
{
|
||||
BYTECODE_DEFAULT = 0x0,
|
||||
BYTECODE_INPLACE = 0x1,
|
||||
BYTECODE_REFERENCED = 0x2,
|
||||
};
|
||||
|
||||
enum HksCompilerSettings_IntLiteralOptions
|
||||
{
|
||||
INT_LITERALS_NONE = 0x0,
|
||||
INT_LITERALS_LUD = 0x1,
|
||||
INT_LITERALS_32BIT = 0x1,
|
||||
INT_LITERALS_UI64 = 0x2,
|
||||
INT_LITERALS_64BIT = 0x2,
|
||||
INT_LITERALS_ALL = 0x3,
|
||||
};
|
||||
|
||||
struct HksCompilerSettings
|
||||
{
|
||||
int m_emitStructCode;
|
||||
const char** m_stripNames;
|
||||
int m_emitGlobalMemoization;
|
||||
int _m_isHksGlobalMemoTestingMode;
|
||||
HksCompilerSettings_BytecodeSharingFormat m_bytecodeSharingFormat;
|
||||
HksCompilerSettings_IntLiteralOptions m_enableIntLiterals;
|
||||
int(*m_debugMap)(const char*, int);
|
||||
};
|
||||
|
||||
enum HksBytecodeSharingMode : __int64
|
||||
{
|
||||
HKS_BYTECODE_SHARING_OFF = 0,
|
||||
HKS_BYTECODE_SHARING_ON = 1,
|
||||
HKS_BYTECODE_SHARING_SECURE = 2
|
||||
};
|
||||
|
||||
struct HksGcWeights
|
||||
{
|
||||
int m_removeString;
|
||||
int m_finalizeUserdataNoMM;
|
||||
int m_finalizeUserdataGcMM;
|
||||
int m_cleanCoroutine;
|
||||
int m_removeWeak;
|
||||
int m_markObject;
|
||||
int m_traverseString;
|
||||
int m_traverseUserdata;
|
||||
int m_traverseCoroutine;
|
||||
int m_traverseWeakTable;
|
||||
int m_freeChunk;
|
||||
int m_sweepTraverse;
|
||||
};
|
||||
|
||||
struct GarbageCollector_Stack
|
||||
{
|
||||
void* m_storage;
|
||||
unsigned int m_numEntries;
|
||||
unsigned int m_numAllocated;
|
||||
};
|
||||
|
||||
struct ProtoList
|
||||
{
|
||||
void** m_protoList;
|
||||
unsigned __int16 m_protoSize;
|
||||
unsigned __int16 m_protoAllocSize;
|
||||
};
|
||||
|
||||
struct MemoryManager;
|
||||
|
||||
struct GarbageCollector
|
||||
{
|
||||
HKS_BYTECODE_SHARING_SECURE = 2
|
||||
};
|
||||
|
||||
struct HksGcWeights
|
||||
{
|
||||
int m_removeString;
|
||||
int m_finalizeUserdataNoMM;
|
||||
int m_finalizeUserdataGcMM;
|
||||
int m_cleanCoroutine;
|
||||
int m_removeWeak;
|
||||
int m_markObject;
|
||||
int m_traverseString;
|
||||
int m_traverseUserdata;
|
||||
int m_traverseCoroutine;
|
||||
int m_traverseWeakTable;
|
||||
int m_freeChunk;
|
||||
int m_sweepTraverse;
|
||||
};
|
||||
|
||||
struct GarbageCollector_Stack
|
||||
{
|
||||
void* m_storage;
|
||||
unsigned int m_numEntries;
|
||||
unsigned int m_numAllocated;
|
||||
};
|
||||
|
||||
struct ProtoList
|
||||
{
|
||||
void** m_protoList;
|
||||
unsigned __int16 m_protoSize;
|
||||
unsigned __int16 m_protoAllocSize;
|
||||
};
|
||||
|
||||
struct MemoryManager;
|
||||
|
||||
struct GarbageCollector
|
||||
{
|
||||
struct ResumeStack
|
||||
{
|
||||
void* m_storage;
|
||||
@ -1360,8 +1359,8 @@ namespace game
|
||||
WeakStack_Entry* m_storage;
|
||||
hksInt32 m_numEntries;
|
||||
hksUint32 m_numAllocated;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
HksGcCost m_target;
|
||||
HksGcCost m_stepsLeft;
|
||||
HksGcCost m_stepLimit;
|
||||
@ -1396,24 +1395,24 @@ namespace game
|
||||
hksUint32 m_stringTableIndex;
|
||||
hksUint32 m_stringTableSize;
|
||||
UserData* m_lastBlackUD;
|
||||
UserData* m_activeUD;
|
||||
};
|
||||
|
||||
enum MemoryManager_ChunkColor
|
||||
{
|
||||
RED = 0x0,
|
||||
BLACK = 0x1,
|
||||
};
|
||||
|
||||
enum Hks_DeleteCheckingMode
|
||||
{
|
||||
HKS_DELETE_CHECKING_OFF = 0x0,
|
||||
HKS_DELETE_CHECKING_ACCURATE = 0x1,
|
||||
HKS_DELETE_CHECKING_SAFE = 0x2,
|
||||
};
|
||||
|
||||
struct MemoryManager
|
||||
{
|
||||
UserData* m_activeUD;
|
||||
};
|
||||
|
||||
enum MemoryManager_ChunkColor
|
||||
{
|
||||
RED = 0x0,
|
||||
BLACK = 0x1,
|
||||
};
|
||||
|
||||
enum Hks_DeleteCheckingMode
|
||||
{
|
||||
HKS_DELETE_CHECKING_OFF = 0x0,
|
||||
HKS_DELETE_CHECKING_ACCURATE = 0x1,
|
||||
HKS_DELETE_CHECKING_SAFE = 0x2,
|
||||
};
|
||||
|
||||
struct MemoryManager
|
||||
{
|
||||
enum ChunkColor : __int32
|
||||
{
|
||||
WHITE = 0x0,
|
||||
@ -1428,58 +1427,58 @@ namespace game
|
||||
ChunkList m_allocationList;
|
||||
ChunkList m_sweepList;
|
||||
ChunkHeader* m_lastKeptChunk;
|
||||
lua_State* m_state;
|
||||
};
|
||||
|
||||
struct StaticStringCache
|
||||
{
|
||||
HksObject m_objects[41];
|
||||
};
|
||||
|
||||
enum HksBytecodeEndianness
|
||||
{
|
||||
HKS_BYTECODE_DEFAULT_ENDIAN = 0x0,
|
||||
HKS_BYTECODE_BIG_ENDIAN = 0x1,
|
||||
HKS_BYTECODE_LITTLE_ENDIAN = 0x2,
|
||||
};
|
||||
|
||||
struct RuntimeProfileData_Stats
|
||||
{
|
||||
unsigned __int64 hksTime;
|
||||
unsigned __int64 callbackTime;
|
||||
unsigned __int64 gcTime;
|
||||
unsigned __int64 cFinalizerTime;
|
||||
unsigned __int64 compilerTime;
|
||||
unsigned int hkssTimeSamples;
|
||||
unsigned int callbackTimeSamples;
|
||||
unsigned int gcTimeSamples;
|
||||
unsigned int compilerTimeSamples;
|
||||
unsigned int num_newuserdata;
|
||||
unsigned int num_tablerehash;
|
||||
unsigned int num_pushstring;
|
||||
unsigned int num_pushcfunction;
|
||||
unsigned int num_newtables;
|
||||
};
|
||||
|
||||
struct RuntimeProfileData
|
||||
{
|
||||
__int64 stackDepth;
|
||||
__int64 callbackDepth;
|
||||
unsigned __int64 lastTimer;
|
||||
RuntimeProfileData_Stats frameStats;
|
||||
unsigned __int64 gcStartTime;
|
||||
unsigned __int64 finalizerStartTime;
|
||||
unsigned __int64 compilerStartTime;
|
||||
unsigned __int64 compilerStartGCTime;
|
||||
unsigned __int64 compilerStartGCFinalizerTime;
|
||||
unsigned __int64 compilerCallbackStartTime;
|
||||
__int64 compilerDepth;
|
||||
void* outFile;
|
||||
lua_State* rootState;
|
||||
};
|
||||
|
||||
struct HksGlobal
|
||||
{
|
||||
lua_State* m_state;
|
||||
};
|
||||
|
||||
struct StaticStringCache
|
||||
{
|
||||
HksObject m_objects[41];
|
||||
};
|
||||
|
||||
enum HksBytecodeEndianness
|
||||
{
|
||||
HKS_BYTECODE_DEFAULT_ENDIAN = 0x0,
|
||||
HKS_BYTECODE_BIG_ENDIAN = 0x1,
|
||||
HKS_BYTECODE_LITTLE_ENDIAN = 0x2,
|
||||
};
|
||||
|
||||
struct RuntimeProfileData_Stats
|
||||
{
|
||||
unsigned __int64 hksTime;
|
||||
unsigned __int64 callbackTime;
|
||||
unsigned __int64 gcTime;
|
||||
unsigned __int64 cFinalizerTime;
|
||||
unsigned __int64 compilerTime;
|
||||
unsigned int hkssTimeSamples;
|
||||
unsigned int callbackTimeSamples;
|
||||
unsigned int gcTimeSamples;
|
||||
unsigned int compilerTimeSamples;
|
||||
unsigned int num_newuserdata;
|
||||
unsigned int num_tablerehash;
|
||||
unsigned int num_pushstring;
|
||||
unsigned int num_pushcfunction;
|
||||
unsigned int num_newtables;
|
||||
};
|
||||
|
||||
struct RuntimeProfileData
|
||||
{
|
||||
__int64 stackDepth;
|
||||
__int64 callbackDepth;
|
||||
unsigned __int64 lastTimer;
|
||||
RuntimeProfileData_Stats frameStats;
|
||||
unsigned __int64 gcStartTime;
|
||||
unsigned __int64 finalizerStartTime;
|
||||
unsigned __int64 compilerStartTime;
|
||||
unsigned __int64 compilerStartGCTime;
|
||||
unsigned __int64 compilerStartGCFinalizerTime;
|
||||
unsigned __int64 compilerCallbackStartTime;
|
||||
__int64 compilerDepth;
|
||||
void* outFile;
|
||||
lua_State* rootState;
|
||||
};
|
||||
|
||||
struct HksGlobal
|
||||
{
|
||||
MemoryManager m_memory;
|
||||
GarbageCollector m_collector;
|
||||
StringTable m_stringTable;
|
||||
@ -1498,30 +1497,30 @@ namespace game
|
||||
void* m_luaplusObjectList;
|
||||
int m_heapAssertionFrequency;
|
||||
int m_heapAssertionCount;
|
||||
void (*m_logFunction)(lua_State*, const char*, ...);
|
||||
void (*m_logFunction)(lua_State*, const char*, ...);
|
||||
void (*m_emergencyGCFailFunction)(lua_State*, size_t);
|
||||
HksBytecodeEndianness m_bytecodeDumpEndianness;
|
||||
int padding2;
|
||||
};
|
||||
|
||||
struct lua_State
|
||||
int padding2;
|
||||
};
|
||||
|
||||
struct lua_State
|
||||
{
|
||||
ChunkHeader baseclass;
|
||||
HksGlobal* m_global;
|
||||
CallStack m_callStack;
|
||||
ApiStack m_apistack;
|
||||
UpValue* pending;
|
||||
HksObject globals;
|
||||
HksObject m_cEnv;
|
||||
CallSite* m_callsites;
|
||||
int m_numberOfCCalls;
|
||||
void* m_context;
|
||||
InternString* m_name;
|
||||
lua_State* m_nextState;
|
||||
lua_State* m_nextStateStack;
|
||||
Status m_status;
|
||||
HksError m_error;
|
||||
};
|
||||
ChunkHeader baseclass;
|
||||
HksGlobal* m_global;
|
||||
CallStack m_callStack;
|
||||
ApiStack m_apistack;
|
||||
UpValue* pending;
|
||||
HksObject globals;
|
||||
HksObject m_cEnv;
|
||||
CallSite* m_callsites;
|
||||
int m_numberOfCCalls;
|
||||
void* m_context;
|
||||
InternString* m_name;
|
||||
lua_State* m_nextState;
|
||||
lua_State* m_nextStateStack;
|
||||
Status m_status;
|
||||
HksError m_error;
|
||||
};
|
||||
}
|
||||
|
||||
typedef uint32_t ScrVarCanonicalName_t;
|
||||
|
@ -20,7 +20,7 @@ namespace game
|
||||
// Com
|
||||
WEAK symbol<void(int channel, unsigned int label, const char* fmt, ...)> Com_Printf{0x1421499C0, 0x140505630};
|
||||
WEAK symbol<void(const char* file, int line, int code, const char* fmt, ...)> Com_Error_{0x1420F8BD0};
|
||||
WEAK symbol<bool(eModes mode)> Com_SessionMode_IsMode{0x1420F7DD0};
|
||||
WEAK symbol<bool(eModes mode)> Com_SessionMode_IsMode{0x1420F7DD0};
|
||||
WEAK symbol<bool()> Com_IsRunningUILevel{0x142148DB0};
|
||||
WEAK symbol<void(uint32_t localClientNum, eModes fromMode, eModes toMode, uint32_t flags)> Com_SwitchMode{
|
||||
0x14214AF30
|
||||
@ -43,6 +43,7 @@ namespace game
|
||||
0x1420EDC20
|
||||
};
|
||||
WEAK symbol<void(char* text, int maxSize)> Con_GetTextCopy{0x14133A7D0, 0x140182C40};
|
||||
WEAK symbol<void(uint32_t localClientNum, ControllerIndex_t controllerIndex, const char* buffer)> Cbuf_ExecuteBuffer{0x14133BE10};
|
||||
|
||||
// DB
|
||||
WEAK symbol<void(XZoneInfo* zoneInfo, uint32_t zoneCount, bool sync, bool suppressSync)> DB_LoadXAssets{
|
||||
@ -80,9 +81,17 @@ namespace game
|
||||
WEAK symbol<dvar_t*(unsigned int hash)> Dvar_FindMalleableVar{0x1422BD6A0};
|
||||
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_GetDebugName{0x1422BDCB0};
|
||||
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_GetString{0x1422BFFF0, 0x140575E30};
|
||||
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_DisplayableValue{0x1422BCAE0};
|
||||
WEAK symbol<bool(const dvar_t* dvar)> Dvar_GetBool{ 0x1422BD930 };
|
||||
WEAK symbol<dvar_t*(dvarStrHash_t hash, const char* dvarName, bool value, dvarFlags_e flags, const char* description)> Dvar_RegisterBool{
|
||||
0x1422D1360
|
||||
};
|
||||
WEAK symbol<void (void (*callback)(const dvar_t*, void*), void* userData)> Dvar_ForEach{ 0x1422BD760 };
|
||||
WEAK symbol<void(const char* dvarName, const char* string, bool createIfMissing)> Dvar_SetFromStringByName{
|
||||
0x1422C7F60
|
||||
};
|
||||
WEAK symbol<char> s_dvarPool{ 0x157AC8220 };
|
||||
WEAK symbol<int> g_dvarCount{ 0x157AC81CC };
|
||||
|
||||
// Scr
|
||||
WEAK symbol<void(scriptInstance_t inst, int value)> Scr_AddInt{0x0, 0x14016F160};
|
||||
|
Reference in New Issue
Block a user