mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Merge branch 'Mauler125:pylon' into pylon
This commit is contained in:
commit
4b6351200b
@ -32,8 +32,8 @@ void __fastcall HFrameStageNotify(CHLClient* rcx, ClientFrameStage_t frameStage)
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg");
|
||||
|
||||
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
|
||||
void* disconnect = g_pCvar->FindCommand("disconnect");
|
||||
*(std::int32_t*)((std::uintptr_t)disconnect + 0x38) |= FCVAR_SERVER_CAN_EXECUTE; // Make sure server is not restricted to this.
|
||||
ConCommandBase* disconnect = (ConCommandBase*)g_pCvar->FindCommand("disconnect");
|
||||
disconnect->AddFlags(FCVAR_SERVER_CAN_EXECUTE); // Make sure server is not restricted to this.
|
||||
|
||||
if (net_userandomkey->m_pParent->m_iValue == 1)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ void Systems_Init()
|
||||
CBaseClient_Attach();
|
||||
CBaseFileSystem_Attach();
|
||||
|
||||
//QHull_Attach();
|
||||
QHull_Attach();
|
||||
//BspLib_Attach();
|
||||
|
||||
#ifndef DEDICATED
|
||||
@ -138,7 +138,7 @@ void Systems_Shutdown()
|
||||
CBaseClient_Detach();
|
||||
CBaseFileSystem_Detach();
|
||||
|
||||
//QHull_Detach();
|
||||
QHull_Detach();
|
||||
//BspLib_Detach();
|
||||
|
||||
#ifndef DEDICATED
|
||||
|
@ -3,12 +3,12 @@
|
||||
//-------------------------------------------------------------------------
|
||||
// NETCHAN |
|
||||
inline auto g_spd_netchan_logger = spdlog::basic_logger_mt("netchan_logger", "platform\\logs\\net_trace.log");
|
||||
static std::ostringstream g_spd_net_p_oss;
|
||||
static auto g_spd_net_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_net_p_oss);
|
||||
inline std::ostringstream g_spd_net_p_oss;
|
||||
inline auto g_spd_net_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_net_p_oss);
|
||||
//-------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
static std::ostringstream fs_oss;
|
||||
static auto fs_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(fs_oss);
|
||||
inline std::ostringstream fs_oss;
|
||||
inline auto fs_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(fs_oss);
|
||||
//-------------------------------------------------------------------------
|
||||
// SQUIRREL PRINTF |
|
||||
inline std::ostringstream g_spd_sqvm_p_oss;
|
||||
@ -21,3 +21,7 @@ inline auto g_spd_sqvm_w_ostream_sink = std::make_shared<spdlog::sinks::ostream_
|
||||
// SYSTEM PRINTF |
|
||||
inline std::ostringstream g_spd_sys_w_oss;
|
||||
inline auto g_spd_sys_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_sys_w_oss);
|
||||
//-------------------------------------------------------------------------
|
||||
// QHULL PRINTF |
|
||||
inline std::ostringstream g_spd_qhull_p_w_oss;
|
||||
inline auto g_spd_qhull_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_qhull_p_w_oss);
|
||||
|
@ -4,6 +4,35 @@
|
||||
#include "engine/net_chan.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "client/IVEngineClient.h"
|
||||
#include "networksystem/r5net.h"
|
||||
#include "squirrel/sqinit.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Send keep alive request to Pylon Master Server.
|
||||
// NOTE: When Pylon update reaches indev remove this and implement properly.
|
||||
//-----------------------------------------------------------------------------
|
||||
void KeepAliveToPylon()
|
||||
{
|
||||
if (g_pHostState->m_bActiveGame && sv_pylonvisibility->m_iValue == 1) // Check for active game.
|
||||
{
|
||||
std::string m_szHostToken = std::string();
|
||||
std::string m_szHostRequestMessage = std::string();
|
||||
DevMsg(eDLL_T::CLIENT, "Sending PostServerHost request\n");
|
||||
bool result = g_pR5net->PostServerHost(m_szHostRequestMessage, m_szHostToken,
|
||||
ServerListing{
|
||||
g_pCvar->FindVar("hostname")->m_pzsCurrentValue,
|
||||
std::string(g_pHostState->m_levelName),
|
||||
"",
|
||||
g_pCvar->FindVar("hostport")->m_pzsCurrentValue,
|
||||
g_pCvar->FindVar("mp_gamemode")->m_pzsCurrentValue,
|
||||
false,
|
||||
std::to_string(*g_nRemoteFunctionCallsChecksum), // BUG BUG: Checksum is null on dedi
|
||||
std::string(),
|
||||
g_szNetKey.c_str()
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: state machine's main processing loop
|
||||
@ -45,8 +74,17 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
|
||||
#endif // !DEDICATED
|
||||
|
||||
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
|
||||
void* disconnect = g_pCvar->FindCommand("disconnect");
|
||||
*(std::int32_t*)((std::uintptr_t)disconnect + 0x38) |= FCVAR_SERVER_CAN_EXECUTE; // Make sure server is not restricted to this.
|
||||
ConCommandBase* disconnect = (ConCommandBase*)g_pCvar->FindCommand("disconnect");
|
||||
disconnect->AddFlags(FCVAR_SERVER_CAN_EXECUTE); // Make sure server is not restricted to this.
|
||||
|
||||
static std::thread PylonThread([]() // Pylon request thread.
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
KeepAliveToPylon();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
}
|
||||
});
|
||||
|
||||
if (net_userandomkey->m_pParent->m_iValue == 1)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "squirrel/sqvm.h"
|
||||
#include "vgui/CEngineVGui.h"
|
||||
#include "gameui/IConsole.h"
|
||||
#include "serverbrowser/serverbrowser.h"
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: prints the output of each VM to the console
|
||||
@ -284,6 +285,17 @@ void RegisterServerScriptFunctions(void* sqvm)
|
||||
HSQVM_RegisterFunction(sqvm, "ServerNativeTest", "native server function", "void", "", &HSQVM_NativeTest);
|
||||
}
|
||||
|
||||
ADDRESS UIVM = (void*)p_SQVM_CreateUIVM.FollowNearCall().FindPatternSelf("48 8B 1D", ADDRESS::Direction::DOWN, 50).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr();
|
||||
|
||||
void HSQVM_RegisterOriginFuncs(void* sqvm)
|
||||
{
|
||||
if (sqvm == *UIVM.RCast<void**>())
|
||||
RegisterUIScriptFunctions(sqvm);
|
||||
else
|
||||
RegisterClientScriptFunctions(sqvm);
|
||||
return SQVM_RegisterOriginFuncs(sqvm);
|
||||
}
|
||||
|
||||
void SQVM_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&SQVM_PrintFunc, &HSQVM_PrintFunc);
|
||||
@ -291,6 +303,7 @@ void SQVM_Attach()
|
||||
DetourAttach((LPVOID*)&SQVM_WarningCmd, &HSQVM_WarningCmd);
|
||||
DetourAttach((LPVOID*)&SQVM_LoadRson, &HSQVM_LoadRson);
|
||||
DetourAttach((LPVOID*)&SQVM_LoadScript, &HSQVM_LoadScript);
|
||||
DetourAttach((LPVOID*)&SQVM_RegisterOriginFuncs, &HSQVM_RegisterOriginFuncs);
|
||||
}
|
||||
|
||||
void SQVM_Detach()
|
||||
@ -300,6 +313,7 @@ void SQVM_Detach()
|
||||
DetourDetach((LPVOID*)&SQVM_WarningCmd, &HSQVM_WarningCmd);
|
||||
DetourDetach((LPVOID*)&SQVM_LoadRson, &HSQVM_LoadRson);
|
||||
DetourDetach((LPVOID*)&SQVM_LoadScript, &HSQVM_LoadScript);
|
||||
DetourDetach((LPVOID*)&SQVM_RegisterOriginFuncs, &HSQVM_RegisterOriginFuncs);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -50,6 +50,17 @@ namespace
|
||||
|
||||
ADDRESS p_SQVM_RegisterFunc = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x83\xEC\x38\x45\x0F\xB6\xC8", "xxxxxxxx"); /*48 83 EC 38 45 0F B6 C8*/
|
||||
void* (*SQVM_RegisterFunc)(void* sqvm, SQFuncRegistration* sqFunc, int a1) = (void* (*)(void*, SQFuncRegistration*, int))p_SQVM_RegisterFunc.GetPtr();
|
||||
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
ADDRESS p_SQVM_CreateUIVM = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\xE8\x00\x00\x00\x00\x84\xC0\x74\x18\xE8\x00\x00\x00\x00", "x????xxxxx????")
|
||||
bool (*SQVM_CreateUIVM)() = (bool(*)())p_SQVM_CreateUIVM.FollowNearCall().GetPtr();
|
||||
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
||||
ADDRESS p_SQVM_CreateUIVM = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\xE8\x00\x00\x00\x00\x84\xC0\x74\xE0\x44\x38\x25\x00\x00\x00\x00", "x????xxxxxxx????");
|
||||
bool (*SQVM_CreateUIVM)() = (bool(*)())p_SQVM_CreateUIVM.FollowNearCall().GetPtr();
|
||||
#endif
|
||||
|
||||
ADDRESS p_SQVM_RegisterOriginFuncs = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\xE8\x00\x00\x00\x00\x48\x8B\x0D\x00\x00\x00\x00\x48\x8D\x15\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x48\x8B\x05\x00\x00\x00\x00\xC7\x05\x00\x00\x00\x00\x00\x00\x00\x00", "x????xxx????xxx????x????xxx????xx????????");
|
||||
void (*SQVM_RegisterOriginFuncs)(void* sqvm) = (void(*)(void*))p_SQVM_RegisterOriginFuncs.FollowNearCall().GetPtr();
|
||||
}
|
||||
|
||||
void* HSQVM_PrintFunc(void* sqvm, char* fmt, ...);
|
||||
@ -59,6 +70,7 @@ bool HSQVM_LoadScript(void* sqvm, const char* szScriptPath, const char* szScript
|
||||
void HSQVM_RegisterFunction(void* sqvm, const char* szName, const char* szHelpString, const char* szRetValType, const char* szArgTypes, void* pFunction);
|
||||
int HSQVM_NativeTest(void* sqvm);
|
||||
|
||||
void HSQVM_RegisterOriginFuncs(void* sqvm);
|
||||
|
||||
void SQVM_Attach();
|
||||
void SQVM_Detach();
|
||||
|
3
r5dev/thirdparty/imgui/src/imgui_widgets.cpp
vendored
3
r5dev/thirdparty/imgui/src/imgui_widgets.cpp
vendored
@ -8588,7 +8588,6 @@ bool ImGui::Hotkey(const char* label, int* key, const ImVec2& ssize)
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool requestedFocus = ImGui::FocusableItemRegister(window, id);
|
||||
const bool isHovered = ImGui::ItemHoverable(frameBB, id);
|
||||
|
||||
if (isHovered) {
|
||||
@ -8598,7 +8597,7 @@ bool ImGui::Hotkey(const char* label, int* key, const ImVec2& ssize)
|
||||
|
||||
const bool didClick = isHovered && io.MouseClicked[0];
|
||||
|
||||
if (requestedFocus || didClick)
|
||||
if (didClick)
|
||||
{
|
||||
if (g.ActiveId != id)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
printf(" Flaged: %08X\n", pCommandBase->m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY.
|
||||
pCommandBase->m_nFlags &= ~(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
pCommandBase->RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pCommandBase->m_nFlags);
|
||||
@ -38,7 +38,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY || FCVAR_CHEAT query.
|
||||
return (pCommandBase->m_nFlags & nFlag) != 0;
|
||||
return pCommandBase->HasFlags(nFlag) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -48,7 +48,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
printf(" Flaged: %08X\n", pCommandBase->m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_DEVELOPMENTONLY.
|
||||
pCommandBase->m_nFlags &= ~(FCVAR_DEVELOPMENTONLY);
|
||||
pCommandBase->RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pCommandBase->m_nFlags);
|
||||
@ -66,7 +66,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY query.
|
||||
return (pCommandBase->m_nFlags & nFlag) != 0;
|
||||
return pCommandBase->HasFlags(nFlag) != 0;
|
||||
}
|
||||
// Default behaviour.
|
||||
return ConCommand_IsFlagSet(pCommandBase, nFlag);
|
||||
|
@ -70,6 +70,22 @@ class ConCommand
|
||||
class ConCommandBase
|
||||
{
|
||||
public:
|
||||
|
||||
void AddFlags(int flags)
|
||||
{
|
||||
m_nFlags |= flags;
|
||||
}
|
||||
|
||||
void RemoveFlags(int flags)
|
||||
{
|
||||
m_nFlags &= ~flags;
|
||||
}
|
||||
|
||||
bool HasFlags(int flags)
|
||||
{
|
||||
return m_nFlags & flags;
|
||||
}
|
||||
|
||||
void* m_pConCommandBaseVTable; //0x0000
|
||||
ConCommandBase* m_pNext; //0x0008
|
||||
bool m_bRegistered; //0x0010
|
||||
|
@ -19,7 +19,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
printf(" Flaged: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY.
|
||||
pConVar->m_ConCommandBase.m_nFlags &= ~(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
pConVar->m_ConCommandBase.RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
@ -37,7 +37,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT query.
|
||||
return (pConVar->m_ConCommandBase.m_nFlags & nFlags) != 0;
|
||||
return pConVar->m_ConCommandBase.HasFlags(nFlags) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -47,7 +47,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
printf(" Flaged: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_DEVELOPMENTONLY.
|
||||
pConVar->m_ConCommandBase.m_nFlags &= ~(FCVAR_DEVELOPMENTONLY);
|
||||
pConVar->m_ConCommandBase.RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
@ -65,7 +65,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY query.
|
||||
return (pConVar->m_ConCommandBase.m_nFlags & nFlags) != 0;
|
||||
return pConVar->m_ConCommandBase.HasFlags(nFlags) != 0;
|
||||
}
|
||||
// Default retail behaviour.
|
||||
return IConVar_IsFlagSet(pConVar, nFlags);
|
||||
@ -101,7 +101,8 @@ void IConVar_InitConVar()
|
||||
cm_return_false_cmdquery_cheats = IConVar_RegisterConVar("cm_return_false_cmdquery_cheats", "0", FCVAR_RELEASE, "Returns false on all FCVAR_DEVELOPMENTONLY and FCVAR_CHEAT ConVar/ConCommand queries ( !warning! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
sv_showconnecting = IConVar_RegisterConVar("sv_showconnecting", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Logs information about the connecting client to the console.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_showconnecting = IConVar_RegisterConVar("sv_showconnecting", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Logs information about the connecting client to the console.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_pylonvisibility = IConVar_RegisterConVar("sv_pylonvisibility", "0", FCVAR_RELEASE, "Determines the visiblity to the Pylon Master Server, 0 = Not visible, 1 = Visible, 2 = Hidden BUG BUG: not implemented yet.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// CLIENT |
|
||||
cl_drawconsoleoverlay = IConVar_RegisterConVar("cl_drawconsoleoverlay", "1", FCVAR_RELEASE, "Draw the console overlay at the top of the screen.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
@ -52,6 +52,34 @@
|
||||
#define FCVAR_SERVER_CANNOT_QUERY (1<<29) // If this is set, then the server is not allowed to query this cvar's value (via IServerPluginHelpers::StartQueryCvarValue).
|
||||
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command.
|
||||
|
||||
/*
|
||||
class ConVar : ConCommandBase, IConVar; [MI] (#classinformer)
|
||||
dq offset ? ? _R4ConVar@@6B@; const ConVar::`RTTI Complete Object Locator'
|
||||
|
||||
dq offset ??_G__ExceptionPtr@@QEAAPEAXI@Z_0; 0 Index
|
||||
dq offset sub_1401F9930
|
||||
dq offset loc_14046FE90
|
||||
dq offset ConVar__AddFlags
|
||||
dq offset ConVar__RemoveFlags
|
||||
dq offset sub_14046FEA0
|
||||
dq offset loc_14046FF70
|
||||
dq offset ConVar__GetHelpString
|
||||
dq offset sub_14046FEC0
|
||||
dq offset sub_14046FEE0
|
||||
dq offset ConVar__IsRegistered
|
||||
dq offset ConVar__GetDllIdentifier
|
||||
dq offset sub_14046F3F0
|
||||
dq offset sub_14046F470
|
||||
dq offset ConVar__InternalSetFloatValue; The one below also does something similar
|
||||
dq offset sub_140470340
|
||||
dq offset sub_140470420; Seems to be InternalSetInt below maybe ?
|
||||
dq offset sub_140470510
|
||||
dq offset nullsub
|
||||
dq offset sub_140470300
|
||||
dq offset sub_1404701A0
|
||||
dq offset RegisterConVar; #STR: "Convar '%s' is flagged as both FCVAR_ARCHIVE and FCVAR_ARC
|
||||
*/
|
||||
|
||||
class ConVar
|
||||
{
|
||||
public:
|
||||
|
@ -11,6 +11,7 @@ ConVar* cm_return_false_cmdquery_cheats = new ConVar();
|
||||
//-------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
ConVar* sv_showconnecting = new ConVar();
|
||||
ConVar* sv_pylonvisibility = new ConVar();
|
||||
//-------------------------------------------------------------------------
|
||||
// CLIENT |
|
||||
ConVar* cl_drawconsoleoverlay = new ConVar();
|
||||
|
@ -22,6 +22,7 @@ extern ConVar* cm_return_false_cmdquery_cheats;
|
||||
//-------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
extern ConVar* sv_showconnecting;
|
||||
extern ConVar* sv_pylonvisibility;
|
||||
//-------------------------------------------------------------------------
|
||||
// CLIENT |
|
||||
extern ConVar* cl_drawconsoleoverlay;
|
||||
|
@ -1,28 +1,56 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "core/logdef.h"
|
||||
#include "vphysics/QHull.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: qhull error and debug prints
|
||||
//-----------------------------------------------------------------------------
|
||||
int HQHull_PrintError(char* fmt, va_list args)
|
||||
int HQHull_PrintFunc(const char* fmt, ...)
|
||||
{
|
||||
vprintf(fmt, args);
|
||||
return QHull_PrintError(fmt, args);
|
||||
static bool initialized = false;
|
||||
static char buf[1024];
|
||||
|
||||
static auto iconsole = spdlog::stdout_logger_mt("qhull_print_iconsole"); // in-game console.
|
||||
static auto wconsole = spdlog::stdout_logger_mt("qhull_print_wconsole"); // windows console.
|
||||
static auto qhlogger = spdlog::basic_logger_mt("qhull_print_logger", "platform\\logs\\qhull_print.log"); // file logger.
|
||||
|
||||
g_spd_sqvm_p_oss.str("");
|
||||
g_spd_sqvm_p_oss.clear();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
iconsole = std::make_shared<spdlog::logger>("qhull_print_ostream", g_spd_sqvm_p_ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
iconsole->set_level(spdlog::level::debug);
|
||||
wconsole->set_pattern("[%S.%e] %v");
|
||||
wconsole->set_level(spdlog::level::debug);
|
||||
qhlogger->set_pattern("[%S.%e] %v");
|
||||
qhlogger->set_level(spdlog::level::debug);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
|
||||
buf[sizeof(buf) - 1] = 0;
|
||||
va_end(args);
|
||||
|
||||
qhlogger->debug(buf);
|
||||
iconsole->debug(buf);
|
||||
wconsole->debug(buf);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int HQHull_PrintDebug(char* fmt, va_list args)
|
||||
{
|
||||
vprintf(fmt, args);
|
||||
return QHull_PrintDebug(fmt, args);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void QHull_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&QHull_PrintDebug, &HQHull_PrintDebug);
|
||||
DetourAttach((LPVOID*)&QHull_PrintError, &HQHull_PrintError);
|
||||
DetourAttach((LPVOID*)&QHull_PrintFunc, &HQHull_PrintFunc);
|
||||
}
|
||||
|
||||
void QHull_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&QHull_PrintDebug, &HQHull_PrintDebug);
|
||||
DetourDetach((LPVOID*)&QHull_PrintError, &HQHull_PrintError);
|
||||
DetourDetach((LPVOID*)&QHull_PrintFunc, &HQHull_PrintFunc);
|
||||
}
|
||||
|
@ -2,16 +2,15 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
ADDRESS p_QHull_PrintError = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x4C\x24\x08\x48\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\x53\xB8\x40\x27\x00\x00\x00\x00\x00\x00\x00\x48", "xxxxxxxxxxxxxxxxxxxxxxxxxx????xx");
|
||||
int (*QHull_PrintError)(char* fmt, va_list args) = (int (*)(char*, va_list))p_QHull_PrintError.GetPtr(); /*48 89 4C 24 08 48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 53 B8 40 27 00 00 ?? ?? ?? ?? 00 48*/
|
||||
ADDRESS p_QHull_PrintFunc = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x4C\x24\x08\x48\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\x53\xB8\x40\x27\x00\x00\x00\x00\x00\x00\x00\x48", "xxxxxxxxxxxxxxxxxxxxxxxxxx????xx");
|
||||
int (*QHull_PrintFunc)(const char* fmt, ...) = (int (*)(const char* fmt, ...))p_QHull_PrintFunc.GetPtr(); /*48 89 4C 24 08 48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 53 B8 40 27 00 00 ?? ?? ?? ?? 00 48*/
|
||||
|
||||
ADDRESS p_QHull_PrintDebug = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\x53\x56\x57\x48\x83\xEC\x30\x48\x8B\xFA\x48\x8D\x74\x24\x60\x48\x8B", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
int (*QHull_PrintDebug)(char* fmt, va_list args) = (int (*)(char*, va_list))p_QHull_PrintDebug.GetPtr(); /*48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 53 56 57 48 83 EC 30 48 8B FA 48 8D 74 24 60 48 8B*/
|
||||
//ADDRESS p_speex_warning_int = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\x53\x56\x57\x48\x83\xEC\x30\x48\x8B\xFA\x48\x8D\x74\x24\x60\x48\x8B", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
//int (*speex_warning_int)(int a1, const char* fmt, ...) = (int (*)(int a1, const char* fmt, ...))p_speex_warning_int.GetPtr(); /*48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 53 56 57 48 83 EC 30 48 8B FA 48 8D 74 24 60 48 8B*/
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int HQHull_PrintError(char* fmt, va_list args);
|
||||
int HQHull_PrintDebug(char* fmt, va_list args);
|
||||
int HQHull_PrintFunc(const char* fmt, ...);
|
||||
|
||||
void QHull_Attach();
|
||||
void QHull_Detach();
|
||||
@ -21,8 +20,8 @@ class HQHull : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: QHull_PrintError : 0x" << std::hex << std::uppercase << p_QHull_PrintError.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: QHull_PrintDebug : 0x" << std::hex << std::uppercase << p_QHull_PrintDebug.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: QHull_PrintFunc : 0x" << std::hex << std::uppercase << p_QHull_PrintFunc.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
//std::cout << "| FUN: speex_warning_int : 0x" << std::hex << std::uppercase << p_speex_warning_int.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user