Added GameGlobals, Re-factored overlay.cpp.

This commit is contained in:
IcePixelx 2021-07-18 17:34:15 +02:00
parent 51f5a29541
commit 5191a24d37
13 changed files with 736 additions and 781 deletions

View File

@ -4,6 +4,7 @@
// Initialization
void SetupConsole();
void RemoveCMHooks();
void ToggleDevCommands();
/////////////////////////////////////////////////////////////////////////////
// Hooks

View File

@ -515,4 +515,16 @@ public:
using OriginalFn = void(__thiscall*)(CHLClient*, ClientFrameStage_t);
(*reinterpret_cast<OriginalFn**>(this))[58](this, curStage); /* 48 83 EC 28 89 15 ? ? ? ? */
}
};
};
/////////////////////////////////////////////////////////////////////////////
// Initialize Game Globals
namespace GameGlobals
{
extern CHostState* HostState;
extern CInputSystem* InputSystem;
void InitGameGlobals();
extern bool IsInitialized;
}

View File

@ -11,4 +11,4 @@ void ToggleNetHooks();
// Globals
inline bool g_bDebugLoading = false;
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

View File

@ -8,25 +8,133 @@
void PrintDXAddress();
void InstallDXHooks();
void RemoveDXHooks();
void ShowGameConsole(bool* p_open);
void DrawMenu();
/////////////////////////////////////////////////////////////////////////////
// Internals
int Stricmp(const char* s1, const char* s2);
int Strnicmp(const char* s1, const char* s2, int n);
int Stricmp(const char* s1, const char* s2);
int Strnicmp(const char* s1, const char* s2, int n);
char* Strdup(const char* s);
void Strtrim(char* s);
/////////////////////////////////////////////////////////////////////////////
// Globals
inline ImVector<char*> Items;
inline ImVector<char*> Items;
inline std::string OriginUID = "1010417302770";
/////////////////////////////////////////////////////////////////////////////
class CGameConsole
{
private:
///////////////////////////////////////////////////////////////////////////
char InputBuf[256] = { 0 };
ImVector<const char*> Commands;
ImVector<char*> History;
int HistoryPos = -1;
ImGuiTextFilter Filter;
bool AutoScroll = true;
bool ScrollToBottom = false;
bool ThemeSet = false;
using json = nlohmann::json;
void RunConsoleCommand(std::string command);
public:
///////////////////////////////////////////////////////////////////////////
CGameConsole();
~CGameConsole();
void Draw(const char* title);
void ProcessCommand(const char* command_line);
void ExecCommand(const char* command_line);
int TextEditCallback(ImGuiInputTextCallbackData* data);
///////////////////////////////////////////////////////////////////////////
// History
static int TextEditCallbackStub(ImGuiInputTextCallbackData* data)
{
CGameConsole* console = (CGameConsole*)data->UserData;
return console->TextEditCallback(data);
}
///////////////////////////////////////////////////////////////////////////
// Utility
void ClearLog()
{
for (int i = 0; i < Items.Size; i++) { free(Items[i]); }
Items.clear();
}
void AddLog(const char* fmt, ...) IM_FMTARGS(2)
{
char buf[1024];
va_list args;
va_start(args, fmt);
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
buf[IM_ARRAYSIZE(buf) - 1] = 0;
va_end(args);
Items.push_back(Strdup(buf));
}
///////////////////////////////////////////////////////////////////////
// Style
void SetStyleVar()
{
ImGuiStyle& style = ImGui::GetStyle();
ImVec4* colors = style.Colors;
colors[ImGuiCol_Text] = ImVec4(0.81f, 0.81f, 0.81f, 1.00f);
colors[ImGuiCol_TextDisabled] = ImVec4(0.56f, 0.56f, 0.56f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImGuiCol_PopupBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
colors[ImGuiCol_Border] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.04f, 0.04f, 0.04f, 0.64f);
colors[ImGuiCol_FrameBg] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f);
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.19f, 0.19f, 0.19f, 1.00f);
colors[ImGuiCol_FrameBgActive] = ImVec4(0.24f, 0.24f, 0.24f, 1.00f);
colors[ImGuiCol_TitleBg] = ImVec4(0.22f, 0.22f, 0.22f, 1.00f);
colors[ImGuiCol_TitleBgActive] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImGuiCol_MenuBarBg] = ImVec4(0.22f, 0.22f, 0.22f, 1.00f);
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f);
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
colors[ImGuiCol_CheckMark] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
colors[ImGuiCol_SliderGrab] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
colors[ImGuiCol_Button] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f);
colors[ImGuiCol_ButtonHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
colors[ImGuiCol_ButtonActive] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
colors[ImGuiCol_Header] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f);
colors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
colors[ImGuiCol_Separator] = ImVec4(0.53f, 0.53f, 0.57f, 1.00f);
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
colors[ImGuiCol_SeparatorActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
colors[ImGuiCol_ResizeGrip] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
colors[ImGuiCol_Tab] = ImVec4(0.18f, 0.18f, 0.18f, 1.00f);
colors[ImGuiCol_TabHovered] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
colors[ImGuiCol_TabActive] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
style.WindowBorderSize = 0.0f;
style.FrameBorderSize = 1.0f;
style.ChildBorderSize = 1.0f;
style.PopupBorderSize = 1.0f;
style.TabBorderSize = 1.0f;
style.WindowRounding = 2.5f;
style.FrameRounding = 0.0f;
style.ChildRounding = 0.0f;
style.PopupRounding = 0.0f;
style.TabRounding = 1.0f;
style.ScrollbarRounding = 1.0f;
style.ItemSpacing = ImVec2(4, 4);
style.WindowPadding = ImVec2(5, 5);
}
};
extern CGameConsole* g_GameConsole;
/////////////////////////////////////////////////////////////////////////////
// ServerBrowser
@ -34,28 +142,31 @@ void RunConsoleCommand(std::string command);
class CCompanion
{
public:
CCompanion();
////////////////////
// Enums //
//////////////////
enum class ESection {
ServerBrowser,
HostServer,
Settings
} CurrentSection;
} CurrentSection = ESection::ServerBrowser;
enum class EHostStatus {
NotHosting,
WaitingForStateChange,
Hosting,
ConnectedToSomeoneElse
};
} HostingStatus = EHostStatus::NotHosting;
CCompanion();
////////////////////
// Server Browser //
////////////////////
ImVector<ServerListing*> ServerList;
///////////////////
ImVector<ServerListing*> ServerList;
ServerListing* SelectedServer;
ImGuiTextFilter ServerBrowserFilter;
char ServerConnStringBuffer[256] = { 0 };
////////////////////
@ -63,7 +174,6 @@ public:
////////////////////
char MatchmakingServerStringBuffer[256] = { 0 };
////////////////////
// Host Server //
////////////////////
@ -71,18 +181,18 @@ public:
std::string* SelectedMap = nullptr;
char ServerNameBuffer[64] = { 0 };
bool StartAsDedi;
EHostStatus HostingStatus = EHostStatus::NotHosting;
void SetSection(ESection section)
{
CurrentSection = section;
}
void RefreshServerList();
void SendHostingPostRequest();
void SetSection(ESection section);
void SendHostingPostRequest(char* mapName);
void CompMenu();
void ServerBrowserSection();
void SettingsSection();
void HostServerSection();
void Draw(const char* title, bool* p_open);
void Draw(const char* title);
void UpdateHostingStatus();
std::string GetGameStateLastMap();
};

View File

@ -21,33 +21,33 @@ namespace
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ==== SQUIRREL ======================================================================================================================================================== */
DWORD64 p_SQVM_Print = /*0x141057FD0*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe","48 8B C4 48 89 50 10 4C 89 40 18 4C 89 48 20 53 56 57 48 81 EC 30 08 00 00 48 8B DA 48 8D 70 18 48 8B F9 E8 ?? ?? ?? FF 48 89 74 24 28 48 8D 54 24 30 33"));
void* SQVM_Print = (void*)p_SQVM_Print;
void* org_SQVM_Print = (void*)p_SQVM_Print;
//DWORD64 p_SQVM_LoadScript = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x48\x89\x4C\x24\x08\x55\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\x6C", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // For S0 and S1
DWORD64 p_SQVM_LoadScript = /*0x141055630*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "48 8B C4 48 89 48 08 55 41 56 48 8D 68")); // For anything S2 and above (current S8)
bool (*SQVM_LoadScript)(void* sqvm, const char* script_path, const char* script_name, int flag) = (bool (*)(void*, const char*, const char*, int))p_SQVM_LoadScript; /*E8 ?? ?? ?? ?? 84 C0 74 1C 41 B9 ?? ?? ?? ??*/
bool (*org_SQVM_LoadScript)(void* sqvm, const char* script_path, const char* script_name, int flag) = (bool (*)(void*, const char*, const char*, int))p_SQVM_LoadScript; /*E8 ?? ?? ?? ?? 84 C0 74 1C 41 B9 ?? ?? ?? ??*/
DWORD64 p_SQVM_LoadRson = /*0x140C957E0*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "4C 8B DC 49 89 5B 08 57 48 81 EC A0 00 00 00 33"));
int (*SQVM_LoadRson)(const char* rson_name) = (int (*)(const char*))p_SQVM_LoadRson;
int (*org_SQVM_LoadRson)(const char* rson_name) = (int (*)(const char*))p_SQVM_LoadRson;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ==== NETCHAN ========================================================================================================================================================= */
DWORD64 p_NET_ReceiveDatagram = /*0x1402655F0*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "48 89 74 24 18 48 89 7C 24 20 55 41 54 41 55 41 56 41 57 48 8D AC 24 50 EB"));
bool (*NET_ReceiveDatagram)(int, void*, bool) = (bool (*)(int, void*, bool))p_NET_ReceiveDatagram; /*E8 ?? ?? ?? ?? 84 C0 75 35 48 8B D3*/
bool (*org_NET_ReceiveDatagram)(int, void*, bool) = (bool (*)(int, void*, bool))p_NET_ReceiveDatagram; /*E8 ?? ?? ?? ?? 84 C0 75 35 48 8B D3*/
DWORD64 p_NET_SendDatagram = /*0x1402662D0*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 81 EC ? 05 ? ?"));
int (*NET_SendDatagram)(SOCKET s, const char* buf, int len, int flags) = (int (*)(SOCKET, const char*, int, int))p_NET_SendDatagram;
int (*org_NET_SendDatagram)(SOCKET s, const char* buf, int len, int flags) = (int (*)(SOCKET, const char*, int, int))p_NET_SendDatagram;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ==== CHLCLIENT ======================================================================================================================================================= */
DWORD64 p_CHLClient_FrameStageNotify = /*0x1405C0740*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "48 83 EC 28 89 15 ?? ?? ?? ??"));
void (*CHLClient_FrameStageNotify)(void* rcx, int curStage) = (void (*)(void*, int))p_CHLClient_FrameStageNotify;
void (*org_CHLClient_FrameStageNotify)(void* rcx, int curStage) = (void (*)(void*, int))p_CHLClient_FrameStageNotify;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ==== UTILITY ========================================================================================================================================================= */
DWORD64 p_MSG_EngineError = /*0x140295600*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "48 89 5C 24 08 48 89 74 24 10 57 48 81 EC 30 08 00 00 48 8B DA 48 8B F9 E8 ?? ?? ?? FF 33 F6 48"));
int (*MSG_EngineError)(char* fmt, va_list args) = (int (*)(char*, va_list))p_MSG_EngineError;
int (*org_MSG_EngineError)(char* fmt, va_list args) = (int (*)(char*, va_list))p_MSG_EngineError;
// Un-used atm.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
class ServerListing
{
public:
std::string name;
@ -14,6 +13,6 @@ public:
int expiry;
ServerListing(std::string name, std::string map, std::string ip, std::string version, int expiry);
bool Select();
void Select();
};

View File

@ -313,6 +313,7 @@
<ClCompile Include="..\external\imgui\src\imgui_widgets.cpp" />
<ClCompile Include="src\console.cpp" />
<ClCompile Include="src\dllmain.cpp" />
<ClCompile Include="src\gameclasses.cpp" />
<ClCompile Include="src\hooks.cpp" />
<ClCompile Include="src\id3dx.cpp" />
<ClCompile Include="src\input.cpp" />

View File

@ -102,6 +102,9 @@
<ClCompile Include="src\serverlisting.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\gameclasses.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\console.h">

16
r5dev/src/gameclasses.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "gameclasses.h"
namespace GameGlobals
{
bool IsInitialized = false;
CHostState* HostState = nullptr;
CInputSystem* InputSystem = nullptr;
void InitGameGlobals()
{
HostState = reinterpret_cast<CHostState*>(0x141736120); // Get CHostState from memory.
InputSystem = *reinterpret_cast<CInputSystem**>(0x14D40B380); // Get IInputSystem from memory.
IsInitialized = true;
}
}

View File

@ -16,7 +16,7 @@
bool HNET_ReceiveDatagram(int sock, void* inpacket, bool raw)
{
bool result = NET_ReceiveDatagram(sock, inpacket, raw);
bool result = org_NET_ReceiveDatagram(sock, inpacket, raw);
if (result)
{
int i = NULL;
@ -32,7 +32,7 @@ bool HNET_ReceiveDatagram(int sock, void* inpacket, bool raw)
unsigned int HNET_SendDatagram(SOCKET s, const char* buf, int len, int flags)
{
unsigned int result = NET_SendDatagram(s, buf, len, flags);
unsigned int result = org_NET_SendDatagram(s, buf, len, flags);
if (result)
{
///////////////////////////////////////////////////////////////////////////
@ -49,16 +49,12 @@ unsigned int HNET_SendDatagram(SOCKET s, const char* buf, int len, int flags)
void __fastcall HCHLClient__FrameStageNotify(CHLClient* rcx, ClientFrameStage_t curStage) /* __fastcall so we can make sure first argument will be RCX and second RDX. */
{
static CHostState* HostState = reinterpret_cast<CHostState*>(0x141736120);
switch (curStage)
{
case FRAME_START: // FrameStageNotify gets called every frame by CEngine::Frame with the stage being FRAME_START. We can use this to check/set global variables.
{
if (HostState->m_bWaitingForConnection) // Easy way to check if we are DEDI.
{
// printf("AWAITING CONNECTION\n");
}
if (!GameGlobals::IsInitialized)
GameGlobals::InitGameGlobals();
break;
}
@ -66,7 +62,7 @@ void __fastcall HCHLClient__FrameStageNotify(CHLClient* rcx, ClientFrameStage_t
break;
}
CHLClient_FrameStageNotify(rcx, curStage);
org_CHLClient_FrameStageNotify(rcx, curStage);
}
//#################################################################################
@ -103,14 +99,14 @@ __int64 HSQVM_LoadRson(const char* rson_name)
///////////////////////////////////////////////////////////////////////////////
// Returns the new path if the rson exists on the disk
if (FileExists(filepath) && SQVM_LoadRson(rson_name))
if (FileExists(filepath) && org_SQVM_LoadRson(rson_name))
{
printf("\n");
printf("##################################################\n");
printf("] '%s'\n", filepath);
printf("##################################################\n");
printf("\n");
return SQVM_LoadRson(filepath);
return org_SQVM_LoadRson(filepath);
}
else
{
@ -119,7 +115,7 @@ __int64 HSQVM_LoadRson(const char* rson_name)
printf("] '%s'\n", rson_name);
printf("##################################################\n");
printf("\n");
return SQVM_LoadRson(rson_name);
return org_SQVM_LoadRson(rson_name);
}
}
@ -143,7 +139,7 @@ bool HSQVM_LoadScript(void* sqvm, const char* script_path, const char* script_na
}
///////////////////////////////////////////////////////////////////////////////
// Returns true if the script exists on the disk
if (FileExists(filepath) && SQVM_LoadScript(sqvm, filepath, script_name, flag))
if (FileExists(filepath) && org_SQVM_LoadScript(sqvm, filepath, script_name, flag))
{
return true;
}
@ -151,7 +147,7 @@ bool HSQVM_LoadScript(void* sqvm, const char* script_path, const char* script_na
{
printf(" [!] FAILED. Try SP / VPK for '%s'\n", filepath);
}
return SQVM_LoadScript(sqvm, script_path, script_name, flag);
return org_SQVM_LoadScript(sqvm, script_path, script_name, flag);
}
//#################################################################################
@ -166,7 +162,7 @@ int HMSG_EngineError(char* fmt, va_list args)
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
buf[IM_ARRAYSIZE(buf) - 1] = 0;
Items.push_back(Strdup(buf));
return MSG_EngineError(fmt, args);
return org_MSG_EngineError(fmt, args);
}
//#################################################################################
@ -182,17 +178,17 @@ void InstallENHooks()
///////////////////////////////////////////////////////////////////////////////
// Hook Squirrel functions
DetourAttach((LPVOID*)&SQVM_Print, &HSQVM_Print);
DetourAttach((LPVOID*)&SQVM_LoadRson, &HSQVM_LoadRson);
DetourAttach((LPVOID*)&SQVM_LoadScript, &HSQVM_LoadScript);
DetourAttach((LPVOID*)&org_SQVM_Print, &HSQVM_Print);
DetourAttach((LPVOID*)&org_SQVM_LoadRson, &HSQVM_LoadRson);
DetourAttach((LPVOID*)&org_SQVM_LoadScript, &HSQVM_LoadScript);
///////////////////////////////////////////////////////////////////////////////
// Hook Game Functions
DetourAttach((LPVOID*)&CHLClient_FrameStageNotify, &HCHLClient__FrameStageNotify);
DetourAttach((LPVOID*)&org_CHLClient_FrameStageNotify, &HCHLClient__FrameStageNotify);
///////////////////////////////////////////////////////////////////////////////
// Hook Utility functions
DetourAttach((LPVOID*)&MSG_EngineError, &HMSG_EngineError);
DetourAttach((LPVOID*)&org_MSG_EngineError, &HMSG_EngineError);
///////////////////////////////////////////////////////////////////////////////
// Commit the transaction
@ -212,22 +208,22 @@ void RemoveENHooks()
///////////////////////////////////////////////////////////////////////////////
// Unhook Squirrel functions
DetourDetach((LPVOID*)&SQVM_Print, &HSQVM_Print);
DetourDetach((LPVOID*)&SQVM_LoadRson, &HSQVM_LoadRson);
DetourDetach((LPVOID*)&SQVM_LoadScript, &HSQVM_LoadScript);
DetourDetach((LPVOID*)&org_SQVM_Print, &HSQVM_Print);
DetourDetach((LPVOID*)&org_SQVM_LoadRson, &HSQVM_LoadRson);
DetourDetach((LPVOID*)&org_SQVM_LoadScript, &HSQVM_LoadScript);
///////////////////////////////////////////////////////////////////////////////
// Unhook Game Functions
DetourDetach((LPVOID*)&CHLClient_FrameStageNotify, &HCHLClient__FrameStageNotify);
DetourDetach((LPVOID*)&org_CHLClient_FrameStageNotify, &HCHLClient__FrameStageNotify);
///////////////////////////////////////////////////////////////////////////////
// Unhook Netchan functions
DetourDetach((LPVOID*)&NET_SendDatagram, &HNET_SendDatagram);
DetourDetach((LPVOID*)&NET_ReceiveDatagram, &HNET_ReceiveDatagram);
DetourDetach((LPVOID*)&org_NET_SendDatagram, &HNET_SendDatagram);
DetourDetach((LPVOID*)&org_NET_ReceiveDatagram, &HNET_ReceiveDatagram);
///////////////////////////////////////////////////////////////////////////////
// Unhook Utility functions
DetourDetach((LPVOID*)&MSG_EngineError, &HMSG_EngineError);
DetourDetach((LPVOID*)&org_MSG_EngineError, &HMSG_EngineError);
///////////////////////////////////////////////////////////////////////////////
// Commit the transaction
@ -247,8 +243,8 @@ void ToggleNetHooks()
if (!g_net)
{
DetourAttach((LPVOID*)&NET_SendDatagram, &HNET_SendDatagram);
DetourAttach((LPVOID*)&NET_ReceiveDatagram, &HNET_ReceiveDatagram);
DetourAttach((LPVOID*)&org_NET_SendDatagram, &HNET_SendDatagram);
DetourAttach((LPVOID*)&org_NET_ReceiveDatagram, &HNET_ReceiveDatagram);
printf("\n");
printf("+--------------------------------------------------------+\n");
printf("|>>>>>>>>>>>>>| NETCHANNEL TRACE ACTIVATED |<<<<<<<<<<<<<|\n");
@ -257,8 +253,8 @@ void ToggleNetHooks()
}
else
{
DetourDetach((LPVOID*)&NET_SendDatagram, &HNET_SendDatagram);
DetourDetach((LPVOID*)&NET_ReceiveDatagram, &HNET_ReceiveDatagram);
DetourDetach((LPVOID*)&org_NET_SendDatagram, &HNET_SendDatagram);
DetourDetach((LPVOID*)&org_NET_ReceiveDatagram, &HNET_ReceiveDatagram);
printf("\n");
printf("+--------------------------------------------------------+\n");
printf("|>>>>>>>>>>>>| NETCHANNEL TRACE DEACTIVATED |<<<<<<<<<<<<|\n");

View File

@ -256,23 +256,22 @@ void SetupImGui()
void DrawImGui()
{
bool bShowMenu = false;
if (!GameGlobals::IsInitialized || !GameGlobals::InputSystem) // Check if GameGlobals initialized and if InputSystem is valid.
return;
ImGui_ImplWin32_NewFrame();
ImGui_ImplDX11_NewFrame();
ImGui::NewFrame();
static CInputSystem* InputSystem = *reinterpret_cast<CInputSystem**>(0x14D40B380);
if (g_bShowMenu)
{
InputSystem->EnableInput(false); // Disable input.
ShowGameConsole(&bShowMenu);
GameGlobals::InputSystem->EnableInput(false); // Disable input.
DrawMenu();
}
else if (!g_bShowMenu)
else
{
InputSystem->EnableInput(true); // Enable input.
GameGlobals::InputSystem->EnableInput(true); // Enable input.
}
ImGui::EndFrame();

File diff suppressed because it is too large Load Diff

View File

@ -11,10 +11,9 @@ ServerListing::ServerListing(std::string name, std::string map, std::string ip,
this->expiry = expiry;
}
bool ServerListing::Select()
void ServerListing::Select()
{
std::stringstream cmd;
cmd << "connect " << this->ip;
RunConsoleCommand(cmd.str().c_str());
return true;
g_GameConsole->ProcessCommand(cmd.str().c_str());
}