Format project

This commit is contained in:
Northstar 2023-12-20 15:20:02 +01:00
parent 714282b520
commit 1e5c4a7f6a
39 changed files with 134 additions and 134 deletions

View File

@ -14,11 +14,11 @@ enum class AudioSelectionStrategy
class EventOverrideData class EventOverrideData
{ {
public: public:
EventOverrideData(const std::string&, const fs::path&); EventOverrideData(const std::string&, const fs::path&);
EventOverrideData(); EventOverrideData();
public: public:
bool LoadedSuccessfully = false; bool LoadedSuccessfully = false;
std::vector<std::string> EventIds = {}; std::vector<std::string> EventIds = {};
@ -34,7 +34,7 @@ class EventOverrideData
class CustomAudioManager class CustomAudioManager
{ {
public: public:
bool TryLoadAudioOverride(const fs::path&); bool TryLoadAudioOverride(const fs::path&);
void ClearAudioOverrides(); void ClearAudioOverrides();

View File

@ -4,13 +4,13 @@ class vgui_BaseRichText_vtable;
class vgui_BaseRichText class vgui_BaseRichText
{ {
public: public:
vgui_BaseRichText_vtable* vtable; vgui_BaseRichText_vtable* vtable;
}; };
class vgui_BaseRichText_vtable class vgui_BaseRichText_vtable
{ {
public: public:
char unknown1[1880]; char unknown1[1880];
void(__fastcall* InsertChar)(vgui_BaseRichText* self, wchar_t ch); void(__fastcall* InsertChar)(vgui_BaseRichText* self, wchar_t ch);
@ -49,7 +49,7 @@ class vgui_BaseRichText_vtable
class CGameSettings class CGameSettings
{ {
public: public:
char unknown1[92]; char unknown1[92];
int isChatEnabled; int isChatEnabled;
}; };
@ -58,7 +58,7 @@ class CGameSettings
// have their value at the same offset // have their value at the same offset
class CGameFloatVar class CGameFloatVar
{ {
public: public:
char unknown1[88]; char unknown1[88];
float value; float value;
}; };
@ -101,7 +101,7 @@ Color lightColors[8] = {
class AnsiEscapeParser class AnsiEscapeParser
{ {
public: public:
explicit AnsiEscapeParser(LocalChatWriter* writer) : m_writer(writer) {} explicit AnsiEscapeParser(LocalChatWriter* writer) : m_writer(writer) {}
void HandleVal(unsigned long val) void HandleVal(unsigned long val)
@ -129,7 +129,7 @@ class AnsiEscapeParser
} }
} }
private: private:
enum class Next enum class Next
{ {
ControlType, ControlType,

View File

@ -5,7 +5,7 @@ class vgui_BaseRichText;
class CHudChat class CHudChat
{ {
public: public:
static CHudChat** allHuds; static CHudChat** allHuds;
char unknown1[720]; char unknown1[720];
@ -29,7 +29,7 @@ class CHudChat
class LocalChatWriter class LocalChatWriter
{ {
public: public:
enum Context enum Context
{ {
NetworkContext = 0, NetworkContext = 0,
@ -56,7 +56,7 @@ class LocalChatWriter
void InsertColorChange(Color color); void InsertColorChange(Color color);
void InsertSwatchColorChange(SwatchColor color); void InsertSwatchColorChange(SwatchColor color);
private: private:
Context m_context; Context m_context;
const char* ApplyAnsiEscape(const char* escape); const char* ApplyAnsiEscape(const char* escape);

View File

@ -4,7 +4,7 @@
class ConCommandBase; class ConCommandBase;
class IConCommandBaseAccessor class IConCommandBaseAccessor
{ {
public: public:
// Flags is a combination of FCVAR flags in cvar.h. // Flags is a combination of FCVAR flags in cvar.h.
// hOut is filled in with a handle to the variable. // hOut is filled in with a handle to the variable.
virtual bool RegisterConCommandBase(ConCommandBase* pVar) = 0; virtual bool RegisterConCommandBase(ConCommandBase* pVar) = 0;
@ -12,7 +12,7 @@ class IConCommandBaseAccessor
class CCommand class CCommand
{ {
public: public:
CCommand() = delete; CCommand() = delete;
int64_t ArgC() const; int64_t ArgC() const;
@ -24,7 +24,7 @@ class CCommand
static int MaxCommandLength(); static int MaxCommandLength();
private: private:
enum enum
{ {
COMMAND_MAX_ARGC = 64, COMMAND_MAX_ARGC = 64,
@ -88,7 +88,7 @@ typedef int (*FnCommandCompletionCallback)(const char* partial, char commands[CO
// From r5reloaded // From r5reloaded
class ConCommandBase class ConCommandBase
{ {
public: public:
bool HasFlags(int nFlags); bool HasFlags(int nFlags);
void AddFlags(int nFlags); void AddFlags(int nFlags);
void RemoveFlags(int nFlags); void RemoveFlags(int nFlags);
@ -120,7 +120,7 @@ class ConCommand : public ConCommandBase
{ {
friend class CCVar; friend class CCVar;
public: public:
ConCommand(void) {}; // !TODO: Rebuild engine constructor in SDK instead. ConCommand(void) {}; // !TODO: Rebuild engine constructor in SDK instead.
ConCommand(const char* szName, const char* szHelpString, int nFlags, void* pCallback, void* pCommandCompletionCallback); ConCommand(const char* szName, const char* szHelpString, int nFlags, void* pCallback, void* pCommandCompletionCallback);
void Init(void); void Init(void);

View File

@ -124,7 +124,7 @@ typedef void (*FnChangeCallback_t)(ConVar* var, const char* pOldValue, float flO
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class ConVar class ConVar
{ {
public: public:
ConVar(void) {}; ConVar(void) {};
ConVar(const char* pszName, const char* pszDefaultValue, int nFlags, const char* pszHelpString); ConVar(const char* pszName, const char* pszDefaultValue, int nFlags, const char* pszHelpString);
ConVar( ConVar(

View File

@ -13,7 +13,7 @@ class ConVar;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class CCVarIteratorInternal // Fully reversed table, just look at the virtual function table and rename the function. class CCVarIteratorInternal // Fully reversed table, just look at the virtual function table and rename the function.
{ {
public: public:
virtual void SetFirst(void) = 0; // 0 virtual void SetFirst(void) = 0; // 0
virtual void Next(void) = 0; // 1 virtual void Next(void) = 0; // 1
virtual bool IsValid(void) = 0; // 2 virtual bool IsValid(void) = 0; // 2
@ -25,7 +25,7 @@ class CCVarIteratorInternal // Fully reversed table, just look at the virtual fu
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class CCvar class CCvar
{ {
public: public:
M_VMETHOD(ConCommandBase*, FindCommandBase, 14, (const char* pszCommandName), (this, pszCommandName)); M_VMETHOD(ConCommandBase*, FindCommandBase, 14, (const char* pszCommandName), (this, pszCommandName));
M_VMETHOD(ConVar*, FindVar, 16, (const char* pszVarName), (this, pszVarName)); M_VMETHOD(ConVar*, FindVar, 16, (const char* pszVarName), (this, pszVarName));
M_VMETHOD(ConCommand*, FindCommand, 18, (const char* pszCommandName), (this, pszCommandName)); M_VMETHOD(ConCommand*, FindCommand, 18, (const char* pszCommandName), (this, pszCommandName));

View File

@ -29,14 +29,14 @@ enum SearchPathAdd_t
class CSearchPath class CSearchPath
{ {
public: public:
unsigned char unknown[0x18]; unsigned char unknown[0x18];
const char* debugPath; const char* debugPath;
}; };
class IFileSystem class IFileSystem
{ {
public: public:
struct VTable struct VTable
{ {
void* unknown[10]; void* unknown[10];

View File

@ -17,11 +17,11 @@ struct LoadedPak
class PakLoadManager class PakLoadManager
{ {
private: private:
std::map<int, LoadedPak> m_vLoadedPaks {}; std::map<int, LoadedPak> m_vLoadedPaks {};
std::unordered_map<size_t, int> m_HashToPakHandle {}; std::unordered_map<size_t, int> m_HashToPakHandle {};
public: public:
int LoadPakAsync(const char* pPath, const ePakLoadSource nLoadSource); int LoadPakAsync(const char* pPath, const ePakLoadSource nLoadSource);
void UnloadPak(const int nPakHandle); void UnloadPak(const int nPakHandle);
void UnloadMapPaks(); void UnloadMapPaks();

View File

@ -25,7 +25,7 @@ enum class eDllLoadCallbackSide
class __dllLoadCallback class __dllLoadCallback
{ {
public: public:
__dllLoadCallback() = delete; __dllLoadCallback() = delete;
__dllLoadCallback( __dllLoadCallback(
eDllLoadCallbackSide side, eDllLoadCallbackSide side,
@ -67,7 +67,7 @@ class __autovar;
class __fileAutohook class __fileAutohook
{ {
public: public:
std::vector<__autohook*> hooks; std::vector<__autohook*> hooks;
std::vector<__autovar*> vars; std::vector<__autovar*> vars;
@ -91,7 +91,7 @@ uintptr_t ParseDLLOffsetString(const char* pAddrString);
class __autohook class __autohook
{ {
public: public:
enum AddressResolutionMode enum AddressResolutionMode
{ {
OFFSET_STRING, // we're using a string that of the format dllname.dll + offset OFFSET_STRING, // we're using a string that of the format dllname.dll + offset
@ -111,7 +111,7 @@ class __autohook
char* pModuleName; // for PROCADDRESS char* pModuleName; // for PROCADDRESS
char* pProcName; // for PROCADDRESS char* pProcName; // for PROCADDRESS
public: public:
__autohook() = delete; __autohook() = delete;
__autohook(__fileAutohook* autohook, const char* funcName, LPVOID absoluteAddress, LPVOID* orig, LPVOID func) __autohook(__fileAutohook* autohook, const char* funcName, LPVOID absoluteAddress, LPVOID* orig, LPVOID func)
@ -250,13 +250,13 @@ class __autohook
class ManualHook class ManualHook
{ {
public: public:
char* pFuncName; char* pFuncName;
LPVOID pHookFunc; LPVOID pHookFunc;
LPVOID* ppOrigFunc; LPVOID* ppOrigFunc;
public: public:
ManualHook() = delete; ManualHook() = delete;
ManualHook(const char* funcName, LPVOID func); ManualHook(const char* funcName, LPVOID func);
ManualHook(const char* funcName, LPVOID* orig, LPVOID func); ManualHook(const char* funcName, LPVOID* orig, LPVOID func);
@ -284,11 +284,11 @@ void MakeHook(LPVOID pTarget, LPVOID pDetour, void* ppOriginal, const char* pFun
class __autovar class __autovar
{ {
public: public:
char* m_pAddrString; char* m_pAddrString;
void** m_pTarget; void** m_pTarget;
public: public:
__autovar(__fileAutohook* pAutohook, const char* pAddrString, void** pTarget) __autovar(__fileAutohook* pAutohook, const char* pAddrString, void** pTarget)
{ {
m_pTarget = pTarget; m_pTarget = pTarget;

View File

@ -89,13 +89,13 @@ enum EBitCoordType
class BitBufferBase class BitBufferBase
{ {
protected: protected:
INLINE void SetName(const char* name) INLINE void SetName(const char* name)
{ {
m_BufferName = name; m_BufferName = name;
} }
public: public:
INLINE bool IsOverflowed() INLINE bool IsOverflowed()
{ {
return m_Overflow; return m_Overflow;
@ -110,16 +110,16 @@ class BitBufferBase
return m_BufferName; return m_BufferName;
} }
private: private:
const char* m_BufferName = ""; const char* m_BufferName = "";
protected: protected:
u8 m_Overflow = false; u8 m_Overflow = false;
}; };
class BFRead : public BitBufferBase class BFRead : public BitBufferBase
{ {
public: public:
BFRead() = default; BFRead() = default;
INLINE BFRead(uptr data, size_t byteLength, size_t startPos = 0, const char* bufferName = 0) INLINE BFRead(uptr data, size_t byteLength, size_t startPos = 0, const char* bufferName = 0)
@ -130,7 +130,7 @@ class BFRead : public BitBufferBase
SetName(bufferName); SetName(bufferName);
} }
public: public:
INLINE void StartReading(uptr data, size_t byteLength, size_t startPos = 0) INLINE void StartReading(uptr data, size_t byteLength, size_t startPos = 0)
{ {
m_Data = reinterpret_cast<u32 const*>(data); m_Data = reinterpret_cast<u32 const*>(data);
@ -706,7 +706,7 @@ class BFRead : public BitBufferBase
return GetNumBitsLeft() >> 3; return GetNumBitsLeft() >> 3;
} }
private: private:
size_t m_DataBits; // 0x0010 size_t m_DataBits; // 0x0010
size_t m_DataBytes; // 0x0018 size_t m_DataBytes; // 0x0018
@ -720,7 +720,7 @@ class BFRead : public BitBufferBase
class BFWrite : public BitBufferBase class BFWrite : public BitBufferBase
{ {
public: public:
BFWrite() = default; BFWrite() = default;
INLINE BFWrite(uptr data, size_t byteLength, const char* bufferName = 0) INLINE BFWrite(uptr data, size_t byteLength, const char* bufferName = 0)
@ -731,7 +731,7 @@ class BFWrite : public BitBufferBase
SetName(bufferName); SetName(bufferName);
} }
public: public:
INLINE void StartWriting(uptr data, size_t byteLength) INLINE void StartWriting(uptr data, size_t byteLength)
{ {
m_Data = reinterpret_cast<u32*>(data); m_Data = reinterpret_cast<u32*>(data);
@ -1131,7 +1131,7 @@ class BFWrite : public BitBufferBase
WriteBitVec3Coord(tmp); WriteBitVec3Coord(tmp);
}*/ }*/
private: private:
size_t m_DataBits = 0; size_t m_DataBits = 0;
size_t m_DataBytes = 0; size_t m_DataBytes = 0;

View File

@ -57,7 +57,7 @@ struct SourceColor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class Color class Color
{ {
public: public:
Color(int r, int g, int b, int a = 255) Color(int r, int g, int b, int a = 255)
{ {
_color[0] = (unsigned char)r; _color[0] = (unsigned char)r;
@ -169,7 +169,7 @@ class Color
return SourceColor(_color[0], _color[1], _color[2], _color[3]); return SourceColor(_color[0], _color[1], _color[2], _color[3]);
} }
private: private:
unsigned char _color[4]; unsigned char _color[4];
}; };

View File

@ -17,7 +17,7 @@ void operator delete(void* p) noexcept;
class SourceAllocator class SourceAllocator
{ {
public: public:
static const bool kNeedFree = true; static const bool kNeedFree = true;
void* Malloc(size_t size) void* Malloc(size_t size)
{ {

View File

@ -2,10 +2,10 @@
class CMemoryAddress class CMemoryAddress
{ {
public: public:
uintptr_t m_nAddress; uintptr_t m_nAddress;
public: public:
CMemoryAddress(); CMemoryAddress();
CMemoryAddress(const uintptr_t nAddress); CMemoryAddress(const uintptr_t nAddress);
CMemoryAddress(const void* pAddress); CMemoryAddress(const void* pAddress);
@ -47,7 +47,7 @@ class CMemoryAddress
// based on https://github.com/Mauler125/r5sdk/blob/master/r5dev/public/include/module.h // based on https://github.com/Mauler125/r5sdk/blob/master/r5dev/public/include/module.h
class CModule : public CMemoryAddress class CModule : public CMemoryAddress
{ {
public: public:
struct ModuleSections_t struct ModuleSections_t
{ {
ModuleSections_t(void) = default; ModuleSections_t(void) = default;
@ -71,7 +71,7 @@ class CModule : public CMemoryAddress
ModuleSections_t m_RunTimeData; ModuleSections_t m_RunTimeData;
ModuleSections_t m_ReadOnlyData; ModuleSections_t m_ReadOnlyData;
private: private:
std::string m_svModuleName; std::string m_svModuleName;
uintptr_t m_pModuleBase {}; uintptr_t m_pModuleBase {};
DWORD m_nModuleSize {}; DWORD m_nModuleSize {};
@ -79,7 +79,7 @@ class CModule : public CMemoryAddress
IMAGE_DOS_HEADER* m_pDOSHeader = nullptr; IMAGE_DOS_HEADER* m_pDOSHeader = nullptr;
std::vector<ModuleSections_t> m_vModuleSections; std::vector<ModuleSections_t> m_vModuleSections;
public: public:
CModule() = delete; // no default, we need a module name CModule() = delete; // no default, we need a module name
CModule(const HMODULE pModule); CModule(const HMODULE pModule);
CModule(const char* pModuleName); CModule(const char* pModuleName);

View File

@ -6,10 +6,10 @@ typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode);
template <typename T> class SourceInterface template <typename T> class SourceInterface
{ {
private: private:
T* m_interface; T* m_interface;
public: public:
SourceInterface(const std::string& moduleName, const std::string& interfaceName) SourceInterface(const std::string& moduleName, const std::string& interfaceName)
{ {
HMODULE handle = GetModuleHandleA(moduleName.c_str()); HMODULE handle = GetModuleHandleA(moduleName.c_str());

View File

@ -2,7 +2,7 @@
class IMemAlloc class IMemAlloc
{ {
public: public:
struct VTable struct VTable
{ {
void* unknown[1]; // alloc debug void* unknown[1]; // alloc debug
@ -25,7 +25,7 @@ class IMemAlloc
class CCommandLine class CCommandLine
{ {
public: public:
// based on the defs in the 2013 source sdk, but for some reason has an extra function (may be another CreateCmdLine overload?) // based on the defs in the 2013 source sdk, but for some reason has an extra function (may be another CreateCmdLine overload?)
// these seem to line up with what they should be though // these seem to line up with what they should be though
virtual void CreateCmdLine(const char* commandline) = 0; virtual void CreateCmdLine(const char* commandline) = 0;

View File

@ -6,7 +6,7 @@
/// as well as various other small changes for compatibility /// as well as various other small changes for compatibility
class VanillaCompatibility class VanillaCompatibility
{ {
public: public:
void SetVanillaCompatibility(bool isVanilla) void SetVanillaCompatibility(bool isVanilla)
{ {
static bool bInitialised = false; static bool bInitialised = false;
@ -22,7 +22,7 @@ class VanillaCompatibility
return m_bIsVanillaCompatible; return m_bIsVanillaCompatible;
} }
private: private:
bool m_bIsVanillaCompatible = false; bool m_bIsVanillaCompatible = false;
}; };

View File

@ -4,7 +4,7 @@
class DedicatedServerLogToClientSink : public CustomSink class DedicatedServerLogToClientSink : public CustomSink
{ {
protected: protected:
void custom_sink_it_(const custom_log_msg& msg); void custom_sink_it_(const custom_log_msg& msg);
void sink_it_(const spdlog::details::log_msg& msg) override; void sink_it_(const spdlog::details::log_msg& msg) override;
void flush_() override; void flush_() override;

View File

@ -14,7 +14,7 @@ enum class HostState_t
struct CHostState struct CHostState
{ {
public: public:
HostState_t m_iCurrentState; HostState_t m_iCurrentState;
HostState_t m_iNextState; HostState_t m_iNextState;

View File

@ -78,7 +78,7 @@ enum class EngineState_t
class CEngine class CEngine
{ {
public: public:
virtual void unknown() = 0; // unsure if this is where virtual void unknown() = 0; // unsure if this is where
virtual bool Load(bool dedicated, const char* baseDir) = 0; virtual bool Load(bool dedicated, const char* baseDir) = 0;
virtual void Unload() = 0; virtual void Unload() = 0;

View File

@ -7,7 +7,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class CCrashHandler class CCrashHandler
{ {
public: public:
CCrashHandler(); CCrashHandler();
~CCrashHandler(); ~CCrashHandler();
@ -77,7 +77,7 @@ class CCrashHandler
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void WriteMinidump(); void WriteMinidump();
private: private:
PVOID m_hExceptionFilter; PVOID m_hExceptionFilter;
EXCEPTION_POINTERS* m_pExceptionInfos; EXCEPTION_POINTERS* m_pExceptionInfos;

View File

@ -13,7 +13,7 @@ class ColoredLogger;
struct custom_log_msg : spdlog::details::log_msg struct custom_log_msg : spdlog::details::log_msg
{ {
public: public:
custom_log_msg(ColoredLogger* origin, spdlog::details::log_msg msg) : origin(origin), spdlog::details::log_msg(msg) {} custom_log_msg(ColoredLogger* origin, spdlog::details::log_msg msg) : origin(origin), spdlog::details::log_msg(msg) {}
ColoredLogger* origin; ColoredLogger* origin;
@ -21,7 +21,7 @@ struct custom_log_msg : spdlog::details::log_msg
class CustomSink : public spdlog::sinks::base_sink<std::mutex> class CustomSink : public spdlog::sinks::base_sink<std::mutex>
{ {
public: public:
void custom_log(const custom_log_msg& msg); void custom_log(const custom_log_msg& msg);
virtual void custom_sink_it_(const custom_log_msg& msg) virtual void custom_sink_it_(const custom_log_msg& msg)
{ {
@ -31,7 +31,7 @@ class CustomSink : public spdlog::sinks::base_sink<std::mutex>
class ColoredLogger : public spdlog::logger class ColoredLogger : public spdlog::logger
{ {
public: public:
std::string ANSIColor; std::string ANSIColor;
SourceColor SRCColor; SourceColor SRCColor;
@ -117,7 +117,7 @@ static const char* level_names[] {"trac", "dbug", "info", "warn", "errr", "crit"
// spdlog logger, for cool colour things // spdlog logger, for cool colour things
class ExternalConsoleSink : public CustomSink class ExternalConsoleSink : public CustomSink
{ {
private: private:
std::map<spdlog::level::level_enum, std::string> m_LogColours = { std::map<spdlog::level::level_enum, std::string> m_LogColours = {
{spdlog::level::trace, NS::Colors::TRACE.ToANSIColor()}, {spdlog::level::trace, NS::Colors::TRACE.ToANSIColor()},
{spdlog::level::debug, NS::Colors::DEBUG.ToANSIColor()}, {spdlog::level::debug, NS::Colors::DEBUG.ToANSIColor()},
@ -129,7 +129,7 @@ class ExternalConsoleSink : public CustomSink
std::string default_color = "\033[39;49m"; std::string default_color = "\033[39;49m";
protected: protected:
void sink_it_(const spdlog::details::log_msg& msg) override; void sink_it_(const spdlog::details::log_msg& msg) override;
void custom_sink_it_(const custom_log_msg& msg); void custom_sink_it_(const custom_log_msg& msg);
void flush_() override; void flush_() override;

View File

@ -24,7 +24,7 @@ enum class TextMsgPrintType_t
class ICenterPrint class ICenterPrint
{ {
public: public:
virtual void ctor() = 0; virtual void ctor() = 0;
virtual void Clear(void) = 0; virtual void Clear(void) = 0;
virtual void ColorPrint(int r, int g, int b, int a, wchar_t* text) = 0; virtual void ColorPrint(int r, int g, int b, int a, wchar_t* text) = 0;

View File

@ -5,14 +5,14 @@
class EditablePanel class EditablePanel
{ {
public: public:
virtual ~EditablePanel() = 0; virtual ~EditablePanel() = 0;
unsigned char unknown[0x2B0]; unsigned char unknown[0x2B0];
}; };
class IConsoleDisplayFunc class IConsoleDisplayFunc
{ {
public: public:
virtual void ColorPrint(const SourceColor& clr, const char* pMessage) = 0; virtual void ColorPrint(const SourceColor& clr, const char* pMessage) = 0;
virtual void Print(const char* pMessage) = 0; virtual void Print(const char* pMessage) = 0;
virtual void DPrint(const char* pMessage) = 0; virtual void DPrint(const char* pMessage) = 0;
@ -24,7 +24,7 @@ class CConsolePanel : public EditablePanel, public IConsoleDisplayFunc
class CConsoleDialog class CConsoleDialog
{ {
public: public:
struct VTable struct VTable
{ {
void* unknown[298]; void* unknown[298];
@ -38,7 +38,7 @@ class CConsoleDialog
class CGameConsole class CGameConsole
{ {
public: public:
virtual ~CGameConsole() = 0; virtual ~CGameConsole() = 0;
// activates the console, makes it visible and brings it to the foreground // activates the console, makes it visible and brings it to the foreground
@ -66,7 +66,7 @@ extern SourceInterface<CGameConsole>* g_pSourceGameConsole;
// spdlog logger // spdlog logger
class SourceConsoleSink : public CustomSink class SourceConsoleSink : public CustomSink
{ {
private: private:
std::map<spdlog::level::level_enum, SourceColor> m_LogColours = { std::map<spdlog::level::level_enum, SourceColor> m_LogColours = {
{spdlog::level::trace, NS::Colors::TRACE.ToSourceColor()}, {spdlog::level::trace, NS::Colors::TRACE.ToSourceColor()},
{spdlog::level::debug, NS::Colors::DEBUG.ToSourceColor()}, {spdlog::level::debug, NS::Colors::DEBUG.ToSourceColor()},
@ -76,7 +76,7 @@ class SourceConsoleSink : public CustomSink
{spdlog::level::critical, NS::Colors::CRIT.ToSourceColor()}, {spdlog::level::critical, NS::Colors::CRIT.ToSourceColor()},
{spdlog::level::off, NS::Colors::OFF.ToSourceColor()}}; {spdlog::level::off, NS::Colors::OFF.ToSourceColor()}};
protected: protected:
void custom_sink_it_(const custom_log_msg& msg); void custom_sink_it_(const custom_log_msg& msg);
void sink_it_(const spdlog::details::log_msg& msg) override; void sink_it_(const spdlog::details::log_msg& msg) override;
void flush_() override; void flush_() override;

View File

@ -13,14 +13,14 @@ extern ConVar* Cvar_ns_curl_log_enable;
struct RemoteModInfo struct RemoteModInfo
{ {
public: public:
std::string Name; std::string Name;
std::string Version; std::string Version;
}; };
class RemoteServerInfo class RemoteServerInfo
{ {
public: public:
char id[33]; // 32 bytes + nullterminator char id[33]; // 32 bytes + nullterminator
// server info // server info
@ -37,7 +37,7 @@ class RemoteServerInfo
// connection stuff // connection stuff
bool requiresPassword; bool requiresPassword;
public: public:
RemoteServerInfo( RemoteServerInfo(
const char* newId, const char* newId,
const char* newName, const char* newName,
@ -52,7 +52,7 @@ class RemoteServerInfo
struct RemoteServerConnectionInfo struct RemoteServerConnectionInfo
{ {
public: public:
char authToken[32]; char authToken[32];
in_addr ip; in_addr ip;
@ -61,7 +61,7 @@ struct RemoteServerConnectionInfo
struct MainMenuPromoData struct MainMenuPromoData
{ {
public: public:
std::string newInfoTitle1; std::string newInfoTitle1;
std::string newInfoTitle2; std::string newInfoTitle2;
std::string newInfoTitle3; std::string newInfoTitle3;
@ -82,11 +82,11 @@ struct MainMenuPromoData
class MasterServerManager class MasterServerManager
{ {
private: private:
bool m_bRequestingServerList = false; bool m_bRequestingServerList = false;
bool m_bAuthenticatingWithGameServer = false; bool m_bAuthenticatingWithGameServer = false;
public: public:
char m_sOwnServerId[33]; char m_sOwnServerId[33];
char m_sOwnServerAuthToken[33]; char m_sOwnServerAuthToken[33];
char m_sOwnClientAuthToken[33]; char m_sOwnClientAuthToken[33];
@ -123,7 +123,7 @@ class MasterServerManager
std::unordered_set<std::string> m_handledServerConnections; std::unordered_set<std::string> m_handledServerConnections;
public: public:
MasterServerManager(); MasterServerManager();
void ClearServerList(); void ClearServerList();
@ -156,7 +156,7 @@ enum class MasterServerReportPresenceResult
class MasterServerPresenceReporter : public ServerPresenceReporter class MasterServerPresenceReporter : public ServerPresenceReporter
{ {
public: public:
/** Full data returned in the std::future of a MasterServerPresenceReporter::ReportPresence() call. */ /** Full data returned in the std::future of a MasterServerPresenceReporter::ReportPresence() call. */
struct ReportPresenceResultData struct ReportPresenceResultData
{ {
@ -180,7 +180,7 @@ class MasterServerPresenceReporter : public ServerPresenceReporter
// Called every frame. // Called every frame.
void RunFrame(double flCurrentTime, const ServerPresence* pServerPresence) override; void RunFrame(double flCurrentTime, const ServerPresence* pServerPresence) override;
protected: protected:
// Contains the async logic to add the server to the MS. // Contains the async logic to add the server to the MS.
void InternalAddServer(const ServerPresence* pServerPresence); void InternalAddServer(const ServerPresence* pServerPresence);

View File

@ -1,6 +1,6 @@
class ModDownloader class ModDownloader
{ {
private: private:
const char* VERIFICATION_FLAG = "-disablemodverification"; const char* VERIFICATION_FLAG = "-disablemodverification";
const char* CUSTOM_MODS_URL_FLAG = "-customverifiedurl="; const char* CUSTOM_MODS_URL_FLAG = "-customverifiedurl=";
const char* STORE_URL = "https://gcdn.thunderstore.io/live/repository/packages/"; const char* STORE_URL = "https://gcdn.thunderstore.io/live/repository/packages/";
@ -70,7 +70,7 @@ class ModDownloader
*/ */
void ExtractMod(fs::path modPath); void ExtractMod(fs::path modPath);
public: public:
ModDownloader(); ModDownloader();
/** /**

View File

@ -19,7 +19,7 @@ const std::set<std::string> MODS_BLACKLIST = {"Mod Settings"};
struct ModConVar struct ModConVar
{ {
public: public:
std::string Name; std::string Name;
std::string DefaultValue; std::string DefaultValue;
std::string HelpString; std::string HelpString;
@ -28,7 +28,7 @@ struct ModConVar
struct ModConCommand struct ModConCommand
{ {
public: public:
std::string Name; std::string Name;
std::string Function; std::string Function;
std::string HelpString; std::string HelpString;
@ -38,7 +38,7 @@ struct ModConCommand
struct ModScriptCallback struct ModScriptCallback
{ {
public: public:
ScriptContext Context; ScriptContext Context;
// called before the codecallback is executed // called before the codecallback is executed
@ -51,7 +51,7 @@ struct ModScriptCallback
struct ModScript struct ModScript
{ {
public: public:
std::string Path; std::string Path;
std::string RunOn; std::string RunOn;
@ -61,14 +61,14 @@ struct ModScript
// these are pretty much identical, could refactor to use the same stuff? // these are pretty much identical, could refactor to use the same stuff?
struct ModVPKEntry struct ModVPKEntry
{ {
public: public:
bool m_bAutoLoad; bool m_bAutoLoad;
std::string m_sVpkPath; std::string m_sVpkPath;
}; };
struct ModRpakEntry struct ModRpakEntry
{ {
public: public:
bool m_bAutoLoad; bool m_bAutoLoad;
std::string m_sPakName; std::string m_sPakName;
std::string m_sLoadAfterPak; std::string m_sLoadAfterPak;
@ -76,7 +76,7 @@ struct ModRpakEntry
class Mod class Mod
{ {
public: public:
// runtime stuff // runtime stuff
bool m_bEnabled = true; bool m_bEnabled = true;
bool m_bWasReadSuccessfully = false; bool m_bWasReadSuccessfully = false;
@ -127,10 +127,10 @@ class Mod
std::unordered_map<std::string, std::string> DependencyConstants; std::unordered_map<std::string, std::string> DependencyConstants;
std::vector<std::string> PluginDependencyConstants; std::vector<std::string> PluginDependencyConstants;
public: public:
Mod(fs::path modPath, char* jsonBuf); Mod(fs::path modPath, char* jsonBuf);
private: private:
void ParseConVars(rapidjson_document& json); void ParseConVars(rapidjson_document& json);
void ParseConCommands(rapidjson_document& json); void ParseConCommands(rapidjson_document& json);
void ParseScripts(rapidjson_document& json); void ParseScripts(rapidjson_document& json);
@ -142,14 +142,14 @@ class Mod
struct ModOverrideFile struct ModOverrideFile
{ {
public: public:
Mod* m_pOwningMod; Mod* m_pOwningMod;
fs::path m_Path; fs::path m_Path;
}; };
class ModManager class ModManager
{ {
private: private:
bool m_bHasLoadedMods = false; bool m_bHasLoadedMods = false;
bool m_bHasEnabledModsCfg; bool m_bHasEnabledModsCfg;
rapidjson_document m_EnabledModsCfg; rapidjson_document m_EnabledModsCfg;
@ -159,13 +159,13 @@ class ModManager
size_t m_hPdefHash; size_t m_hPdefHash;
size_t m_hKBActHash; size_t m_hKBActHash;
public: public:
std::vector<Mod> m_LoadedMods; std::vector<Mod> m_LoadedMods;
std::unordered_map<std::string, ModOverrideFile> m_ModFiles; std::unordered_map<std::string, ModOverrideFile> m_ModFiles;
std::unordered_map<std::string, std::string> m_DependencyConstants; std::unordered_map<std::string, std::string> m_DependencyConstants;
std::unordered_set<std::string> m_PluginDependencyConstants; std::unordered_set<std::string> m_PluginDependencyConstants;
public: public:
ModManager(); ModManager();
void LoadMods(); void LoadMods();
void UnloadMods(); void UnloadMods();

View File

@ -4,13 +4,13 @@ bool ContainsInvalidChars(std::string str);
class SaveFileManager class SaveFileManager
{ {
public: public:
template <ScriptContext context> void SaveFileAsync(fs::path file, std::string content); template <ScriptContext context> void SaveFileAsync(fs::path file, std::string content);
template <ScriptContext context> int LoadFileAsync(fs::path file); template <ScriptContext context> int LoadFileAsync(fs::path file);
template <ScriptContext context> void DeleteFileAsync(fs::path file); template <ScriptContext context> void DeleteFileAsync(fs::path file);
// Future proofed in that if we ever get multi-threaded SSDs this code will take advantage of them. // Future proofed in that if we ever get multi-threaded SSDs this code will take advantage of them.
std::mutex fileMutex; std::mutex fileMutex;
private: private:
int m_iLastRequestHandle = 0; int m_iLastRequestHandle = 0;
}; };

View File

@ -17,7 +17,7 @@ union PluginRespondDataCallable
class PluginDataRequest class PluginDataRequest
{ {
public: public:
PluginDataRequestType type; PluginDataRequestType type;
PluginRespondDataCallable func; PluginRespondDataCallable func;
PluginDataRequest(PluginDataRequestType type, PluginRespondDataCallable func) : type(type), func(func) {} PluginDataRequest(PluginDataRequestType type, PluginRespondDataCallable func) : type(type), func(func) {}
@ -25,11 +25,11 @@ class PluginDataRequest
class PluginCommunicationHandler class PluginCommunicationHandler
{ {
public: public:
void RunFrame(); void RunFrame();
void PushRequest(PluginDataRequestType type, PluginRespondDataCallable func); void PushRequest(PluginDataRequestType type, PluginRespondDataCallable func);
public: public:
std::queue<PluginDataRequest> requestQueue = {}; std::queue<PluginDataRequest> requestQueue = {};
std::mutex requestMutex; std::mutex requestMutex;

View File

@ -5,7 +5,7 @@ const int IDR_RCDATA1 = 101;
class Plugin class Plugin
{ {
public: public:
std::string name; std::string name;
std::string displayName; std::string displayName;
std::string dependencyName; std::string dependencyName;
@ -23,7 +23,7 @@ class Plugin
bool run_on_client = false; bool run_on_client = false;
bool run_on_server = false; bool run_on_server = false;
public: public:
PLUGIN_INIT_TYPE init; PLUGIN_INIT_TYPE init;
PLUGIN_INIT_SQVM_TYPE init_sqvm_client; PLUGIN_INIT_SQVM_TYPE init_sqvm_client;
PLUGIN_INIT_SQVM_TYPE init_sqvm_server; PLUGIN_INIT_SQVM_TYPE init_sqvm_server;
@ -37,10 +37,10 @@ class Plugin
class PluginManager class PluginManager
{ {
public: public:
std::vector<Plugin> m_vLoadedPlugins; std::vector<Plugin> m_vLoadedPlugins;
public: public:
bool LoadPlugins(); bool LoadPlugins();
std::optional<Plugin> LoadPlugin(fs::path path, PluginInitFuncs* funcs, PluginNorthstarData* data); std::optional<Plugin> LoadPlugin(fs::path path, PluginInitFuncs* funcs, PluginNorthstarData* data);
@ -52,7 +52,7 @@ class PluginManager
void RunFrame(); void RunFrame();
private: private:
std::string pluginPath; std::string pluginPath;
}; };

View File

@ -99,7 +99,7 @@ struct HttpRequest
*/ */
class HttpRequestHandler class HttpRequestHandler
{ {
public: public:
HttpRequestHandler(); HttpRequestHandler();
// Start/Stop the HTTP request handler. Right now this doesn't do much. // Start/Stop the HTTP request handler. Right now this doesn't do much.
@ -122,7 +122,7 @@ class HttpRequestHandler
/** Registers the HTTP request Squirrel functions for the given script context. */ /** Registers the HTTP request Squirrel functions for the given script context. */
template <ScriptContext context> void RegisterSQFuncs(); template <ScriptContext context> void RegisterSQFuncs();
private: private:
int m_iLastRequestHandle = 0; int m_iLastRequestHandle = 0;
std::atomic_bool m_bIsHttpRequestHandlerRunning = false; std::atomic_bool m_bIsHttpRequestHandlerRunning = false;
}; };

View File

@ -3,11 +3,11 @@
class ServerBanSystem class ServerBanSystem
{ {
private: private:
std::ofstream m_sBanlistStream; std::ofstream m_sBanlistStream;
std::vector<uint64_t> m_vBannedUids; std::vector<uint64_t> m_vBannedUids;
public: public:
void OpenBanlist(); void OpenBanlist();
void ReloadBanlist(); void ReloadBanlist();
void ClearBanlist(); void ClearBanlist();

View File

@ -26,7 +26,7 @@ extern CBaseServer__RejectConnectionType CBaseServer__RejectConnection;
class ServerAuthenticationManager class ServerAuthenticationManager
{ {
public: public:
ConVar* Cvar_ns_erase_auth_info; ConVar* Cvar_ns_erase_auth_info;
ConVar* Cvar_ns_auth_allow_insecure; ConVar* Cvar_ns_auth_allow_insecure;
ConVar* Cvar_ns_auth_allow_insecure_write; ConVar* Cvar_ns_auth_allow_insecure_write;
@ -40,7 +40,7 @@ class ServerAuthenticationManager
bool m_bForceResetLocalPlayerPersistence = false; bool m_bForceResetLocalPlayerPersistence = false;
bool m_bStartingLocalSPGame = false; bool m_bStartingLocalSPGame = false;
public: public:
void AddRemotePlayer(std::string token, uint64_t uid, std::string username, std::string pdata); void AddRemotePlayer(std::string token, uint64_t uid, std::string username, std::string pdata);
void AddPlayer(CBaseClient* pPlayer, const char* pAuthToken); void AddPlayer(CBaseClient* pPlayer, const char* pAuthToken);

View File

@ -3,7 +3,7 @@
struct ServerPresence struct ServerPresence
{ {
public: public:
int m_iPort; int m_iPort;
std::string m_sServerId; std::string m_sServerId;
@ -44,7 +44,7 @@ struct ServerPresence
class ServerPresenceReporter class ServerPresenceReporter
{ {
public: public:
virtual void CreatePresence(const ServerPresence* pServerPresence) {} virtual void CreatePresence(const ServerPresence* pServerPresence) {}
virtual void ReportPresence(const ServerPresence* pServerPresence) {} virtual void ReportPresence(const ServerPresence* pServerPresence) {}
virtual void DestroyPresence(const ServerPresence* pServerPresence) {} virtual void DestroyPresence(const ServerPresence* pServerPresence) {}
@ -53,7 +53,7 @@ class ServerPresenceReporter
class ServerPresenceManager class ServerPresenceManager
{ {
private: private:
ServerPresence m_ServerPresence; ServerPresence m_ServerPresence;
bool m_bHasPresence = false; bool m_bHasPresence = false;
@ -71,7 +71,7 @@ class ServerPresenceManager
ConVar* Cvar_ns_report_server_to_masterserver; ConVar* Cvar_ns_report_server_to_masterserver;
ConVar* Cvar_ns_report_sp_server_to_masterserver; ConVar* Cvar_ns_report_sp_server_to_masterserver;
public: public:
void AddPresenceReporter(ServerPresenceReporter* reporter); void AddPresenceReporter(ServerPresenceReporter* reporter);
void CreateConVars(); void CreateConVars();

View File

@ -27,7 +27,7 @@ struct UnconnectedPlayerLimitData
class ServerLimitsManager class ServerLimitsManager
{ {
public: public:
ConVar* CVar_sv_quota_stringcmdspersecond; ConVar* CVar_sv_quota_stringcmdspersecond;
ConVar* Cvar_net_chan_limit_mode; ConVar* Cvar_net_chan_limit_mode;
ConVar* Cvar_net_chan_limit_msec_per_sec; ConVar* Cvar_net_chan_limit_msec_per_sec;
@ -40,7 +40,7 @@ class ServerLimitsManager
std::unordered_map<CBaseClient*, PlayerLimitData> m_PlayerLimitData; std::unordered_map<CBaseClient*, PlayerLimitData> m_PlayerLimitData;
std::vector<UnconnectedPlayerLimitData> m_UnconnectedPlayerLimitData; std::vector<UnconnectedPlayerLimitData> m_UnconnectedPlayerLimitData;
public: public:
void RunFrame(double flCurrentTime, float flFrameTime); void RunFrame(double flCurrentTime, float flFrameTime);
void AddPlayer(CBaseClient* player); void AddPlayer(CBaseClient* player);
void RemovePlayer(CBaseClient* player); void RemovePlayer(CBaseClient* player);

View File

@ -17,7 +17,7 @@ typedef int HKeySymbol;
struct CKeyValuesSystem struct CKeyValuesSystem
{ {
public: public:
struct __VTable struct __VTable
{ {
char pad0[8 * 3]; // 2 methods char pad0[8 * 3]; // 2 methods

View File

@ -48,10 +48,10 @@ enum MergeKeyValuesOp_t
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class KeyValues class KeyValues
{ {
private: private:
KeyValues(); // for internal use only KeyValues(); // for internal use only
public: public:
// Constructors/destructors // Constructors/destructors
KeyValues(const char* pszSetName); KeyValues(const char* pszSetName);
KeyValues(const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue); KeyValues(const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue);
@ -112,7 +112,7 @@ class KeyValues
void CopySubkeys(KeyValues* pParent) const; void CopySubkeys(KeyValues* pParent) const;
KeyValues* MakeCopy(void) const; KeyValues* MakeCopy(void) const;
public: public:
uint32_t m_iKeyName : 24; // 0x0000 uint32_t m_iKeyName : 24; // 0x0000
uint32_t m_iKeyNameCaseSensitive1 : 8; // 0x0003 uint32_t m_iKeyNameCaseSensitive1 : 8; // 0x0003
char* m_sValue; // 0x0008 char* m_sValue; // 0x0008

View File

@ -64,10 +64,10 @@ namespace NS::log
// Cuts down on compile time by ~5 seconds // Cuts down on compile time by ~5 seconds
class SquirrelManagerBase class SquirrelManagerBase
{ {
protected: protected:
std::vector<SQFuncRegistration*> m_funcRegistrations; std::vector<SQFuncRegistration*> m_funcRegistrations;
public: public:
CSquirrelVM* m_pSQVM; CSquirrelVM* m_pSQVM;
std::map<std::string, SQFunction> m_funcOverrides = {}; std::map<std::string, SQFunction> m_funcOverrides = {};
std::map<std::string, SQFunction> m_funcOriginals = {}; std::map<std::string, SQFunction> m_funcOriginals = {};
@ -319,7 +319,7 @@ class SquirrelManagerBase
template <ScriptContext context> class SquirrelManager : public virtual SquirrelManagerBase template <ScriptContext context> class SquirrelManager : public virtual SquirrelManagerBase
{ {
public: public:
#pragma region MessageBuffer #pragma region MessageBuffer
SquirrelMessageBuffer* messageBuffer; SquirrelMessageBuffer* messageBuffer;
@ -404,7 +404,7 @@ template <ScriptContext context> class SquirrelManager : public virtual Squirrel
#pragma endregion #pragma endregion
public: public:
SquirrelManager() SquirrelManager()
{ {
m_pSQVM = nullptr; m_pSQVM = nullptr;

View File

@ -5,7 +5,7 @@ typedef void (*SqAutoBindFunc)();
class SquirrelAutoBindContainer class SquirrelAutoBindContainer
{ {
public: public:
std::vector<std::function<void()>> clientSqAutoBindFuncs; std::vector<std::function<void()>> clientSqAutoBindFuncs;
std::vector<std::function<void()>> serverSqAutoBindFuncs; std::vector<std::function<void()>> serverSqAutoBindFuncs;
}; };
@ -61,7 +61,7 @@ class __squirrelautobind;
class __squirrelautobind class __squirrelautobind
{ {
public: public:
__squirrelautobind() = delete; __squirrelautobind() = delete;
__squirrelautobind(std::function<void()> clientAutoBindFunc, std::function<void()> serverAutoBindFunc) __squirrelautobind(std::function<void()> clientAutoBindFunc, std::function<void()> serverAutoBindFunc)

View File

@ -122,7 +122,7 @@ typedef void (*sq_schedule_call_externalType)(
class SquirrelMessage class SquirrelMessage
{ {
public: public:
std::string functionName; std::string functionName;
FunctionVector args; FunctionVector args;
bool isExternal = false; bool isExternal = false;
@ -133,10 +133,10 @@ class SquirrelMessage
class SquirrelMessageBuffer class SquirrelMessageBuffer
{ {
private: private:
std::queue<SquirrelMessage> messages = {}; std::queue<SquirrelMessage> messages = {};
public: public:
std::mutex mutex; std::mutex mutex;
std::optional<SquirrelMessage> pop() std::optional<SquirrelMessage> pop()
{ {
@ -179,7 +179,7 @@ class SquirrelMessageBuffer
// Super simple wrapper class to allow pushing Assets via call // Super simple wrapper class to allow pushing Assets via call
class SquirrelAsset class SquirrelAsset
{ {
public: public:
std::string path; std::string path;
SquirrelAsset(std::string path) : path(path) {}; SquirrelAsset(std::string path) : path(path) {};
}; };