mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Added interface struct, Enabled DevMode by default.
This commit is contained in:
parent
2b7d4f45fb
commit
50a37735b1
@ -326,6 +326,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct Interface
|
||||
{
|
||||
__int64 (*InterfacePtr)(void);
|
||||
const char* InterfaceName;
|
||||
__int64* NextInterfacePtr;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Game Globals
|
||||
|
||||
|
@ -83,5 +83,7 @@ namespace Hooks
|
||||
void InstallHooks();
|
||||
void RemoveHooks();
|
||||
void ToggleNetHooks();
|
||||
extern bool bToggledNetHooks;
|
||||
void ToggleDevCommands();
|
||||
extern bool bToggledDevFlags;
|
||||
}
|
@ -13,6 +13,12 @@ namespace GameGlobals
|
||||
HostState = reinterpret_cast<CHostState*>(0x141736120); // Get CHostState from memory.
|
||||
InputSystem = *reinterpret_cast<CInputSystem**>(0x14D40B380); // Get IInputSystem from memory.
|
||||
Cvar = *reinterpret_cast<CCVar**>(0x14D40B348); // Get CCVar from memory.
|
||||
// Interface* interfaces = *reinterpret_cast<Interface**>(0x167F4FA48);
|
||||
|
||||
// for (Interface* current = interfaces; current; current = reinterpret_cast<Interface*>(current->NextInterfacePtr))
|
||||
// {
|
||||
// printf("%s: %p\n", current->InterfaceName, current->InterfacePtr);
|
||||
// }
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
|
@ -3,6 +3,12 @@
|
||||
|
||||
bool g_bBlockInput = false;
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
bool bToggledDevFlags = false;
|
||||
bool bToggledNetHooks = false;
|
||||
}
|
||||
|
||||
void Hooks::InstallHooks()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -58,6 +64,10 @@ void Hooks::InstallHooks()
|
||||
MH_EnableHook(addr_CHLClient_FrameStageNotify);
|
||||
MH_EnableHook(addr_CVEngineServer_IsPersistenceDataAvailable);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Enable ConVar | ConCommand hooks
|
||||
ToggleDevCommands();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Enable WinAPI hooks
|
||||
MH_EnableHook(SetCursorPosPtr);
|
||||
@ -117,9 +127,7 @@ void Hooks::RemoveHooks()
|
||||
|
||||
void Hooks::ToggleNetHooks()
|
||||
{
|
||||
static bool g_net = false;
|
||||
|
||||
if (!g_net)
|
||||
if (!bToggledNetHooks)
|
||||
{
|
||||
MH_EnableHook(addr_NET_ReceiveDatagram);
|
||||
MH_EnableHook(addr_NET_SendDatagram);
|
||||
@ -139,15 +147,12 @@ void Hooks::ToggleNetHooks()
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
g_net = !g_net;
|
||||
bToggledNetHooks = !bToggledNetHooks;
|
||||
}
|
||||
|
||||
void Hooks::ToggleDevCommands()
|
||||
{
|
||||
static bool g_dev = false;
|
||||
|
||||
if (!g_dev)
|
||||
if (!bToggledDevFlags)
|
||||
{
|
||||
MH_EnableHook(addr_ConVar_IsFlagSet);
|
||||
MH_EnableHook(addr_ConCommand_IsFlagSet);
|
||||
@ -156,7 +161,6 @@ void Hooks::ToggleDevCommands()
|
||||
printf("|>>>>>>>>>>>>>| DEVONLY COMMANDS ACTIVATED |<<<<<<<<<<<<<|\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -168,6 +172,5 @@ void Hooks::ToggleDevCommands()
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
g_dev = !g_dev;
|
||||
bToggledDevFlags = !bToggledDevFlags;
|
||||
}
|
||||
|
@ -17,7 +17,10 @@ bool Hooks::ConVar_IsFlagSet(int** cvar, int flag)
|
||||
printf(" Verify: %08X\n", flag);
|
||||
printf("--------------------------------------------------\n");
|
||||
}
|
||||
if (flag & 0x80000) { return true; }
|
||||
if (flag & 0x80000)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!g_bReturnAllFalse)
|
||||
{
|
||||
@ -45,11 +48,15 @@ bool Hooks::ConCommand_IsFlagSet(int* cmd, int flag)
|
||||
printf(" Verify: %08X\n", flag);
|
||||
printf("--------------------------------------------------\n");
|
||||
}
|
||||
if (flag & 0x80000) { return true; }
|
||||
|
||||
if (flag & 0x80000)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!g_bReturnAllFalse)
|
||||
{
|
||||
return(real_flags & flag) != 0;
|
||||
return (real_flags & flag) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -65,6 +65,8 @@ void CGameConsole::Draw(const char* title)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// If bToggledDevFlags is true, override text color to be green, if its false red.
|
||||
Hooks::bToggledDevFlags ? ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0, 255, 0, 255)) : ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(255, 0, 0, 255));
|
||||
if (ImGui::SmallButton("Developer mode"))
|
||||
{
|
||||
Hooks::ToggleDevCommands();
|
||||
@ -73,7 +75,12 @@ void CGameConsole::Draw(const char* title)
|
||||
AddLog("+--------------------------------------------------------+\n");
|
||||
ProcessCommand("exec autoexec");
|
||||
}
|
||||
ImGui::PopStyleColor(); // Pop color override.
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
// Do the same for bToggledNetHooks.
|
||||
Hooks::bToggledNetHooks ? ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0, 255, 0, 255)) : ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(255, 0, 0, 255));
|
||||
if (ImGui::SmallButton("Netchannel Trace"))
|
||||
{
|
||||
Hooks::ToggleNetHooks();
|
||||
@ -82,6 +89,9 @@ void CGameConsole::Draw(const char* title)
|
||||
AddLog("+--------------------------------------------------------+\n");
|
||||
ProcessCommand("exec netchan");
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(); // Pop color override.
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
ImGui::SameLine();
|
||||
if (ImGui::SmallButton("Clear"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user