mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* Codebase restructured to SourceSDK codebase style and .cpp/.h assertion paths in the game executable. * Document most functions with valve style 'Purpose' blocks. * Rename variables to match the rest of the codebase and Valve's naming convention. * Dedicated DLL and the SDKLauncher now share the same codebase as the DevSDK. * Obtain globals or pointers directly instead of waiting for runtime initialized data. * Dynamically search for all functions and globals (this doesn't count for dedicated yet!). * Initialize most in-SDK variables. * Move certain prints and other utilities under ConVars to reduce verbosity and increase performance. * Print all pattern scan results through a virtual function to make it easier to add and debug new patterns in the future. * Type global var pointers appropriately if class or type is known and implemented. * Forward declare 'CClient' class to avoid having 2 'g_pClient' copies. * Add IDA's pseudo definitions for easier prototyping with decompiled assembly code. * RPAK decompress Command callback implementation. * Load decompressed RPaks from 'paks\Win32\' overriding the ones in 'paks\Win64\' (the decompress callback will automatically fix the header and write it to 'paks\Win32\'). * VPK decompress Command callback implementation. * Move CRC32 ands Adler32 to implementation files. * Server will print out more details about the connecting client. * Upgrade ImGui lib to v1.86. * Don't compile id3dx.h for dedicated. * Don't compile id3dx.cpp for dedicated * Implement DevMsg print function allowing to print information to the in-game VGUI/RUI console overlay, ImGui console overlay and the external windows console * Fixed bug where the Error function would not properly terminate the process when an error is called. This caused access violations for critical/non-recoverable errors. * Fixed bug where the game would crash if the console or server browser was enabled while the game was still starting up. * Several bug fixes for the dedicated server (warning: dedicated is still considered work-in-progress!).
77 lines
3.1 KiB
C++
77 lines
3.1 KiB
C++
#pragma once
|
|
#include "core/stdafx.h"
|
|
#include "tier0/basetypes.h"
|
|
|
|
enum class LogType_t : int
|
|
{
|
|
SCRIPT_SERVER,
|
|
SCRIPT_CLIENT,
|
|
SCRIPT_UI,
|
|
SCRIPT_WARNING,
|
|
NATIVE
|
|
};
|
|
|
|
struct Log
|
|
{
|
|
Log(const std::string Message, const int Ticks, const LogType_t Type)
|
|
{
|
|
this->Message = Message;
|
|
this->Ticks = Ticks;
|
|
this->Type = Type;
|
|
}
|
|
std::string Message = "";
|
|
int Ticks = 1024;
|
|
LogType_t Type = LogType_t::NATIVE;
|
|
};
|
|
|
|
class CLogSystem
|
|
{
|
|
public:
|
|
void AddLog(LogType_t type, std::string text);
|
|
void Update();
|
|
|
|
private:
|
|
std::array<int, 3> GetLogColorForType(LogType_t type);
|
|
std::vector<Log> m_vLogs{};
|
|
};
|
|
|
|
namespace
|
|
{
|
|
/* ==== CENGINEVGUI ===================================================================================================================================================== */
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
|
ADDRESS p_CEngineVGui_Paint = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x89\x54\x24\x10\x55\x56\x41\x55\x48\x81\xEC\x00\x00\x00\x00", "xxxxxxxxxxx????");
|
|
int (*CEngineVGui_Paint)(void* thisptr, int mode) = (int (*)(void*, int))p_CEngineVGui_Paint.GetPtr(); /*41 55 41 56 48 83 EC 78 44 8B EA*/
|
|
|
|
ADDRESS p_CEngineVGui_Unknown = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x4C\x8B\x81\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x4C\x3B\xC0\x74\x1F", "xxx????xxx????xxxxx");
|
|
void** (*CEngineVGui_Unknown)(std::int64_t a1) = (void** (*)(std::int64_t))p_CEngineVGui_Paint.GetPtr(); /*4C 8B 81 ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ?? 4C 3B C0 74 1F*/
|
|
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
|
ADDRESS p_CEngineVGui_Paint = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x41\x55\x41\x56\x48\x83\xEC\x78\x44\x8B\xEA", "xxxxxxxxxxx");
|
|
int (*CEngineVGui_Paint)(void* thisptr, int mode) = (int (*)(void*, int))p_CEngineVGui_Paint.GetPtr(); /*41 55 41 56 48 83 EC 78 44 8B EA*/
|
|
|
|
ADDRESS p_CEngineVGui_Unknown = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x53\x48\x83\xEC\x20\x48\x8D\x05\x00\x00\x00\x00\x48\x8B\xD9\x48\x39\x81\x00\x00\x00\x00\x74\x29", "xxxxxxxxx????xxxxxx????xx");
|
|
void** (*CEngineVGui_Unknown)(std::int64_t a1) = (void** (*)(std::int64_t))p_CEngineVGui_Paint.GetPtr(); /*40 53 48 83 EC 20 48 8D 05 ?? ?? ?? ?? 48 8B D9 48 39 81 ?? ?? ?? ?? 74 29*/
|
|
#endif
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
int HCEngineVGui_Paint(void* thisptr, int mode);
|
|
void CEngineVGui_Attach();
|
|
void CEngineVGui_Detach();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
extern CLogSystem g_pLogSystem;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class HEngineVGui : public IDetour
|
|
{
|
|
virtual void debugp()
|
|
{
|
|
std::cout << "| FUN: CEngineVGui::Paint : 0x" << std::hex << std::uppercase << p_CEngineVGui_Paint.GetPtr() << std::setw(npad) << " |" << std::endl;
|
|
std::cout << "| FUN: CEngineVGui::Unknown : 0x" << std::hex << std::uppercase << p_CEngineVGui_Unknown.GetPtr() << std::setw(npad) << " |" << std::endl;
|
|
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
|
}
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
REGISTER(HEngineVGui);
|