diff --git a/r5dev/include/gameclasses.h b/r5dev/include/gameclasses.h index 89619123..61c39cd4 100644 --- a/r5dev/include/gameclasses.h +++ b/r5dev/include/gameclasses.h @@ -41,15 +41,15 @@ class CKeyValuesSystem // VTABLE @ 0x1413AA1E8 in R5pc_r5launch_N1094_CL456479_2 { public: - void RegisterSizeofKeyValues(__int64 size) //@0x1413AA1F0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM + void RegisterSizeofKeyValues(std::int64_t size) //@0x1413AA1F0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM { - using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, __int64); + using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, std::int64_t); (*reinterpret_cast(this))[0](this, size); } - void* AllocKeyValuesMemory(__int64 size) // @0x1413AA1F8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM + void* AllocKeyValuesMemory(std::int64_t size) // @0x1413AA1F8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM { - using OriginalFn = void* (__thiscall*)(CKeyValuesSystem*, __int64); + using OriginalFn = void* (__thiscall*)(CKeyValuesSystem*, std::int64_t); return (*reinterpret_cast(this))[1](this, size); } @@ -122,15 +122,15 @@ public: // Datatypes aren't accurate. But full fill the actual byte distance. public: void* vtable; // 0x0000 - __int64 m_iMaxKeyValuesSize; // 0x0008 + std::int64_t m_iMaxKeyValuesSize; // 0x0008 private: char gap10[240]; // 0x0010 public: - __int32 m_KvConditionalSymbolTable; // 0x0100 + int m_KvConditionalSymbolTable; // 0x0100 private: char gap104[4]; // 0x0104 public: - __int64 field_108; // 0x0108 + std::int64_t field_108; // 0x0108 private: char gap110[32]; // 0x0110 public: @@ -315,7 +315,7 @@ public: return COMMAND_MAX_LENGTH - 1; } - inline int64_t ArgC() const + inline std::int64_t ArgC() const { return m_nArgc; } @@ -372,7 +372,7 @@ public: private: char pad_0028[16]; //0x0028 public: - __int32 m_nFlags; //0x0038 + int m_nFlags; //0x0038 private: char pad_003C[4]; //0x003C }; //Size: 0x0038 @@ -385,7 +385,7 @@ public: ConVar* m_pParent; //0x0048 const char* n_pszDefaultValue; //0x0050 const char* m_pzsCurrentValue; //0x0058 - __int64 m_iStringLength; //0x0060 + std::int64_t m_iStringLength; //0x0060 float m_flValue; //0x0068 int m_iValue; //0x006C bool m_bHasMin; //0x0070 @@ -451,9 +451,9 @@ public: struct Interface { - __int64 (*InterfacePtr)(void); + std::int64_t(*InterfacePtr)(void); const char* InterfaceName; - __int64* NextInterfacePtr; + std::int64_t* NextInterfacePtr; }; struct SQFuncRegistration @@ -463,17 +463,17 @@ struct SQFuncRegistration const char* helpString; // 10 const char* retValType; // 18 const char* argTypes; // 20 - int16_t unk28; // 28 - int16_t padding1; // 2A - int32_t unk2c; // 2C - int64_t unk30; // 30 - int32_t unk38; // 38 - int32_t padding2; // 3C - int64_t unk40; // 40 - int64_t unk48; // 48 - int64_t unk50; // 50 - int32_t unk58; // 58 - int32_t padding3; // 5C + std::int16_t unk28; // 28 + std::int16_t padding1; // 2A + std::int32_t unk2c; // 2C + std::int64_t unk30; // 30 + std::int32_t unk38; // 38 + std::int32_t padding2; // 3C + std::int64_t unk40; // 40 + std::int64_t unk48; // 48 + std::int64_t unk50; // 50 + std::int32_t unk58; // 58 + std::int32_t padding3; // 5C void* funcPtr; // 60 SQFuncRegistration() diff --git a/r5dev/src/CCompanion.cpp b/r5dev/src/CCompanion.cpp index 0863af10..f69e3873 100644 --- a/r5dev/src/CCompanion.cpp +++ b/r5dev/src/CCompanion.cpp @@ -528,6 +528,7 @@ void CCompanion::HostServerSection() { if (ImGui::Button("Reload Playlist from Disk##ServerHost_ReloadPlaylist", ImVec2(ImGui::GetWindowSize().x, 32))) { + spdlog::debug("[+CCompanion+] Reloading playlist..\n"); addr_downloadPlaylists_Callback(); GameGlobals::InitPlaylist(); // Re-Init playlist. } @@ -543,9 +544,8 @@ void CCompanion::SettingsSection() if (r5net) { delete r5net; + r5net = new R5Net::Client(MatchmakingServerStringBuffer); } - - r5net = new R5Net::Client(MatchmakingServerStringBuffer); } // Encryption Key if (ImGui::Button("Regenerate Encryption Key##SettingsSection_RegenEncKey")) @@ -590,9 +590,11 @@ void CCompanion::Draw(const char* title) void CCompanion::ProcessCommand(const char* command_line) { - spdlog::debug("[+CCompanion+] Processing command {}\n", command_line); + spdlog::debug("[+CCompanion+] Processing command: {} creating tread now.\n", command_line); std::thread t(&CCompanion::ExecCommand, this, command_line); + spdlog::debug("[+CCompanion+] Thread created.\n"); t.detach(); + spdlog::debug("[+CCompanion+] Detached from Thread.\n"); // HACK: This is to avoid a race condition. std::this_thread::sleep_for(std::chrono::milliseconds(1)); @@ -603,6 +605,7 @@ void CCompanion::ProcessCommand(const char* command_line) void CCompanion::ExecCommand(const char* command_line) { + spdlog::debug("[+CCompanion+] Executing command {}\n", command_line); addr_CommandExecute(NULL, command_line); } @@ -643,7 +646,7 @@ void CCompanion::RegenerateEncryptionKey() { spdlog::critical("[+CCompanion+] Failed to generate random data\n"); } - std::string fin; + std::string fin = std::string(); for (int i = 0; i < 0x10u; i++) { diff --git a/r5dev/src/gameclasses.cpp b/r5dev/src/gameclasses.cpp index b59fec2b..26008da9 100644 --- a/r5dev/src/gameclasses.cpp +++ b/r5dev/src/gameclasses.cpp @@ -143,7 +143,7 @@ namespace GameGlobals } catch (std::exception& e) { - std::cout << "Kick UID asked for a userID or originID :( You can get the userid with the 'status' command. Error: " << e.what() << std::endl; + spdlog::critical("Kick UID asked for a userID or originID :( You can get the userid with the 'status' command. Error: {}\n", e.what()); g_GameConsole->AddLog("Kick UID asked for a userID or originID :( You can get the userid with the 'status' command. Error: %s", e.what()); return; } @@ -183,7 +183,7 @@ namespace GameGlobals } catch (std::exception& e) { - std::cout << "Unban Error: " << e.what() << std::endl; + spdlog::critical("Unban Error: {}\n", e.what()); g_GameConsole->AddLog("Unban Error: %s", e.what()); return; } @@ -317,7 +317,7 @@ namespace GameGlobals } catch (std::exception& e) { - std::cout << "Banid Error: " << e.what() << std::endl; + spdlog::critical("Banid Error: {}\n", e.what()); g_GameConsole->AddLog("Banid Error: %s", e.what()); return; } diff --git a/r5dev/src/hooks/connectclient.cpp b/r5dev/src/hooks/connectclient.cpp index 210eb167..847e05a8 100644 --- a/r5dev/src/hooks/connectclient.cpp +++ b/r5dev/src/hooks/connectclient.cpp @@ -78,11 +78,14 @@ void* Hooks::ConnectClient(void* thisptr, void* packet) if (g_CheckCompBanDB) { - R5Net::Client* r5net = g_ServerBrowser->GetR5Net(); - if (r5net) + if (g_ServerBrowser) { - std::thread t1(IsClientBanned, r5net, finalIPAddress, originID); - t1.detach(); + R5Net::Client* r5net = g_ServerBrowser->GetR5Net(); + if (r5net) + { + std::thread t1(IsClientBanned, r5net, finalIPAddress, originID); + t1.detach(); + } } } diff --git a/r5dev/src/id3dx.cpp b/r5dev/src/id3dx.cpp index 7f8f0d52..60eaaac1 100644 --- a/r5dev/src/id3dx.cpp +++ b/r5dev/src/id3dx.cpp @@ -289,8 +289,8 @@ HRESULT __stdcall GetResizeBuffers(IDXGISwapChain* pSwapChain, UINT nBufferCount // Set up the viewport. D3D11_VIEWPORT vp; - vp.Width = nWidth; - vp.Height = nHeight; + vp.Width = static_cast(nWidth); + vp.Height = static_cast(nHeight); vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; @@ -347,7 +347,7 @@ HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT n void InstallDXHooks() { - spdlog::debug("Initializing DirectC hooks..\n"); + spdlog::debug("Initializing DirectX hooks..\n"); MH_CreateHook(g_fnIDXGISwapChainPresent, &Present, reinterpret_cast(&originalPresent)); MH_CreateHook(g_fnIDXGIResizeBuffers, &GetResizeBuffers, reinterpret_cast(&originalResizeBuffers)); diff --git a/r5net/include/r5/r5net.h b/r5net/include/r5/r5net.h index c3005b65..ca6b97c7 100644 --- a/r5net/include/r5/r5net.h +++ b/r5net/include/r5/r5net.h @@ -14,9 +14,6 @@ namespace R5Net class Client { - httplib::Client m_HttpClient; - Config config; - public: Client(std::string serverString) : m_HttpClient(serverString.c_str()) { @@ -27,8 +24,10 @@ namespace R5Net bool PostServerHost(std::string& outMessage, std::string& outToken, const ServerListing& serverListing); bool GetServerByToken(ServerListing& outServer, std::string& outMessage, const std::string token); bool GetClientIsBanned(std::string ip, std::int64_t orid, std::string& outErrCl); - std::string GetVersionString(); + private: + httplib::Client m_HttpClient; + Config config; }; } \ No newline at end of file