Label some useful functions

This commit is contained in:
Diavolo 2022-08-10 11:26:19 +02:00
parent dd0503e4ce
commit ca263a16e7
3 changed files with 92 additions and 2 deletions

View File

@ -1,9 +1,12 @@
#pragma once
//#include "structs.hpp"
#include "structs.hpp"
namespace game
{
#define Com_Error(code, fmt, ...) \
Com_Error_(__FILE__, __LINE__, code, fmt, ##__VA_ARGS__)
int Conbuf_CleanText(const char* source, char* target);
template <typename T>
@ -34,6 +37,8 @@ namespace game
T* address_;
};
// Global game definitions
constexpr auto CMD_MAX_NESTING = 8;
}
#include "symbols.hpp"

View File

@ -0,0 +1,67 @@
#pragma once
namespace game
{
typedef void (*xcommand_t)();
enum errorCode
{
ERROR_NONE = 0x0,
ERROR_FATAL = 0x1,
ERROR_DROP = 0x2,
ERROR_FROM_STARTUP = 0x4,
ERROR_SERVERDISCONNECT = 0x8,
ERROR_DISCONNECT = 0x10,
ERROR_SCRIPT = 0x20,
ERROR_SCRIPT_DROP = 0x40,
ERROR_LOCALIZATION = 0x80,
ERROR_UI = 0x100,
ERROR_LUA = 0x200,
ERROR_SOFTRESTART = 0x400,
ERROR_SOFTRESTART_KEEPDW = 0x800,
};
struct cmd_function_s
{
cmd_function_s* next;
const char* name;
const char* autoCompleteDir;
const char* autoCompleteExt;
xcommand_t function;
};
struct CmdArgs
{
int nesting;
int localClientNum[8];
int controllerIndex[8];
int argshift[8];
int argc[8];
const char** argv[8];
char textPool[8192];
const char* argvPool[512];
int usedTextPool[8];
int totalUsedArgvPool;
int totalUsedTextPool;
};
struct va_info_t
{
char va_string[4][1024];
int index;
};
struct TLSData
{
va_info_t* vaInfo;
jmp_buf* errorJmpBuf;
void* traceInfo;
CmdArgs* cmdArgs;
void* errorData;
};
struct dvar_t
{
unsigned int name;
}; // Incomplete
}

View File

@ -4,10 +4,28 @@
namespace game
{
WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x1420EC8B0_g};
// Com
WEAK symbol<void(int channel, unsigned int label, const char* fmt, ...)> Com_Printf{0x1421499C0_g};
WEAK symbol<void(const char* file, int line, int code, const char* fmt, ...)> Com_Error_{0x1420F8BD0_g};
WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x1420EC8B0_g};
WEAK symbol<void(const char* cmdName, xcommand_t function, cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x1420ED530_g};
WEAK symbol<void(char* text, int maxSize)> Con_GetTextCopy{0x14133A7D0_g};
// Sys
WEAK symbol<void()> Sys_ShowConsole{0x142333F80_g};
WEAK symbol<TLSData*()> Sys_GetTLS{0x142184210_g};
// Dvar
WEAK symbol<const dvar_t*(const char* dvarName)> Dvar_FindVar{0x1422BD730_g};
WEAK symbol<unsigned int(const char* str)> Dvar_GenerateHash{0x14133DBF0_g};
WEAK symbol<dvar_t*(unsigned int hash)> Dvar_FindMalleableVar{0x1422BD6A0_g};
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_GetDebugName{0x1422BDCB0_g};
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_GetString{0x1422BFFF0_g};
// Variables
WEAK symbol<cmd_function_s> cmd_functions{0x15689FF58_g};
WEAK symbol<CmdArgs> sv_cmd_args{0x15689CE30_g};
namespace s_wcd
{