diff --git a/src/Components/Loader.cpp b/src/Components/Loader.cpp index 5c244e66..0e544032 100644 --- a/src/Components/Loader.cpp +++ b/src/Components/Loader.cpp @@ -1,4 +1,5 @@ #include +#include #include "Modules/Bans.hpp" #include "Modules/Bots.hpp" @@ -17,12 +18,14 @@ #include "Modules/Discovery.hpp" #include "Modules/Download.hpp" #include "Modules/Elevators.hpp" +#include "Modules/FastFiles.hpp" #include "Modules/Gamepad.hpp" #include "Modules/Lean.hpp" #include "Modules/MapDump.hpp" #include "Modules/MapRotation.hpp" #include "Modules/NetworkDebug.hpp" #include "Modules/News.hpp" +#include "Modules/Party.hpp" #include "Modules/PlayerMovement.hpp" #include "Modules/PlayerName.hpp" #include "Modules/Playlist.hpp" diff --git a/src/Components/Loader.hpp b/src/Components/Loader.hpp index 4957c9df..7fc7d59c 100644 --- a/src/Components/Loader.hpp +++ b/src/Components/Loader.hpp @@ -77,7 +77,6 @@ namespace Components #include "Modules/AssetHandler.hpp" #include "Modules/Dedicated.hpp" #include "Modules/Events.hpp" -#include "Modules/FastFiles.hpp" #include "Modules/FileSystem.hpp" #include "Modules/Friends.hpp" #include "Modules/IPCPipe.hpp" @@ -88,7 +87,6 @@ namespace Components #include "Modules/ModList.hpp" #include "Modules/ModelSurfs.hpp" #include "Modules/Node.hpp" -#include "Modules/Party.hpp" #include "Modules/Renderer.hpp" #include "Modules/Scheduler.hpp" #include "Modules/TextRenderer.hpp" diff --git a/src/Components/Modules/AssetHandler.cpp b/src/Components/Modules/AssetHandler.cpp index baf089bf..d7606ee5 100644 --- a/src/Components/Modules/AssetHandler.cpp +++ b/src/Components/Modules/AssetHandler.cpp @@ -1,4 +1,5 @@ #include +#include "FastFiles.hpp" #include "Weapon.hpp" #include "AssetInterfaces/IFont_s.hpp" diff --git a/src/Components/Modules/AssetInterfaces/IFont_s.cpp b/src/Components/Modules/AssetInterfaces/IFont_s.cpp index b2988164..faa4c17e 100644 --- a/src/Components/Modules/AssetInterfaces/IFont_s.cpp +++ b/src/Components/Modules/AssetInterfaces/IFont_s.cpp @@ -4,6 +4,8 @@ #define STB_TRUETYPE_IMPLEMENTATION #include +#include + namespace Assets { namespace diff --git a/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp b/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp index 1656d480..2bbbb004 100644 --- a/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp +++ b/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp @@ -1,6 +1,8 @@ #include #include "IGameWorldMp.hpp" +#include + #define IW4X_GAMEWORLD_VERSION 1 namespace Assets diff --git a/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp b/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp index 243c0958..063a0ee6 100644 --- a/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp +++ b/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp @@ -1,6 +1,8 @@ #include #include "ILocalizeEntry.hpp" +#include + namespace Assets { void ILocalizeEntry::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder) diff --git a/src/Components/Modules/AssetInterfaces/IMaterial.cpp b/src/Components/Modules/AssetInterfaces/IMaterial.cpp index 42b63a8e..ebe509e2 100644 --- a/src/Components/Modules/AssetInterfaces/IMaterial.cpp +++ b/src/Components/Modules/AssetInterfaces/IMaterial.cpp @@ -1,6 +1,8 @@ #include #include "IMaterial.hpp" +#include + #define IW4X_MAT_BIN_VERSION "1" #define IW4X_MAT_JSON_VERSION 1 diff --git a/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp b/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp index 839c3fb0..a7519a12 100644 --- a/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp +++ b/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp @@ -1,6 +1,8 @@ #include #include "IMaterialTechniqueSet.hpp" +#include + #define IW4X_TECHSET_VERSION 1 namespace Assets diff --git a/src/Components/Modules/AssetInterfaces/IRawFile.cpp b/src/Components/Modules/AssetInterfaces/IRawFile.cpp index 5a254acd..a206c3f7 100644 --- a/src/Components/Modules/AssetInterfaces/IRawFile.cpp +++ b/src/Components/Modules/AssetInterfaces/IRawFile.cpp @@ -1,6 +1,8 @@ #include #include "IRawFile.hpp" +#include + namespace Assets { void IRawFile::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder) diff --git a/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp b/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp index 21a88b27..545acc75 100644 --- a/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp +++ b/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp @@ -1,6 +1,8 @@ #include #include "Isnd_alias_list_t.hpp" +#include + namespace Assets { void Isnd_alias_list_t::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder) diff --git a/src/Components/Modules/Auth.cpp b/src/Components/Modules/Auth.cpp index 9bf90a68..c0ada431 100644 --- a/src/Components/Modules/Auth.cpp +++ b/src/Components/Modules/Auth.cpp @@ -1,4 +1,8 @@ #include +#include + +#include + #include "Bans.hpp" namespace Components diff --git a/src/Components/Modules/Bans.cpp b/src/Components/Modules/Bans.cpp index 955fbe81..21a7d880 100644 --- a/src/Components/Modules/Bans.cpp +++ b/src/Components/Modules/Bans.cpp @@ -1,6 +1,8 @@ #include #include "Bans.hpp" +#include + namespace Components { // Have only one instance of IW4x read/write the file diff --git a/src/Components/Modules/Console.cpp b/src/Components/Modules/Console.cpp index cbb1c1ad..ed61489c 100644 --- a/src/Components/Modules/Console.cpp +++ b/src/Components/Modules/Console.cpp @@ -871,6 +871,9 @@ namespace Components Utils::Hook(0x4F690C, Con_ToggleConsole, HOOK_CALL).install()->quick(); Utils::Hook(0x4F65A5, Con_ToggleConsole, HOOK_JUMP).install()->quick(); + // Allow the client console to always be opened (sv_allowClientConsole) + Utils::Hook::Nop(0x4F68EC, 2); + // Patch safearea for ingame-console Utils::Hook(0x5A50EF, DrawSolidConsoleStub, HOOK_CALL).install()->quick(); @@ -944,7 +947,7 @@ namespace Components if (type != FILE_TYPE_CHAR) { MessageBoxA(nullptr, "Console not supported, please use '-stdout' or '-console' flag!", "ERRROR", MB_ICONERROR); - TerminateProcess(GetCurrentProcess(), 1); + TerminateProcess(GetCurrentProcess(), EXIT_FAILURE); } Utils::Hook::Nop(0x60BB58, 11); diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index b3f66475..3ebd4b6b 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -1,4 +1,6 @@ #include +#include + #include "CardTitles.hpp" #include "ClanTags.hpp" #include "ServerCommands.hpp" diff --git a/src/Components/Modules/Discovery.cpp b/src/Components/Modules/Discovery.cpp index 86bee2ee..3458d0dc 100644 --- a/src/Components/Modules/Discovery.cpp +++ b/src/Components/Modules/Discovery.cpp @@ -1,4 +1,6 @@ #include +#include + #include "Discovery.hpp" #include "ServerList.hpp" diff --git a/src/Components/Modules/Download.cpp b/src/Components/Modules/Download.cpp index 577cd19f..0296d12e 100644 --- a/src/Components/Modules/Download.cpp +++ b/src/Components/Modules/Download.cpp @@ -1,5 +1,8 @@ #include +#include + #include "Download.hpp" +#include "Party.hpp" #include "ServerInfo.hpp" #include diff --git a/src/Components/Modules/FastFiles.cpp b/src/Components/Modules/FastFiles.cpp index c3b3cb01..a3d780ea 100644 --- a/src/Components/Modules/FastFiles.cpp +++ b/src/Components/Modules/FastFiles.cpp @@ -1,5 +1,9 @@ #include +#include + +#include "FastFiles.hpp" + namespace Components { FastFiles::Key FastFiles::CurrentKey; @@ -390,7 +394,7 @@ namespace Components return Utils::Hook::Call(0x5BA240)(buffer, length, ivValue); } - int FastFiles::InflateInitDecrypt(z_streamp strm, const char *version, int stream_size) + static int InflateInitDecrypt(z_streamp strm, const char *version, int stream_size) { if (Zones::Version() >= 319) { @@ -398,7 +402,6 @@ namespace Components } return Utils::Hook::Call(0x4D8090)(strm, version, stream_size); - //return inflateInit_(strm, version, stream_size); } void FastFiles::AuthLoadInflateDecryptBaseFunc(unsigned char* buffer) @@ -547,7 +550,7 @@ namespace Components Utils::Hook(0x4D02F0, FastFiles::AuthLoadInitCrypto, HOOK_CALL).install()->quick(); // Initial stage decryption - Utils::Hook(0x4D0306, FastFiles::InflateInitDecrypt, HOOK_CALL).install()->quick(); + Utils::Hook(0x4D0306, InflateInitDecrypt, HOOK_CALL).install()->quick(); // Hash bit decryption Utils::Hook(0x5B9958, FastFiles::AuthLoadInflateCompare, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/FastFiles.hpp b/src/Components/Modules/FastFiles.hpp index a1b4c235..1e8d3bd2 100644 --- a/src/Components/Modules/FastFiles.hpp +++ b/src/Components/Modules/FastFiles.hpp @@ -18,6 +18,8 @@ namespace Components static unsigned char ZoneKey[1191]; + static symmetric_CTR CurrentCTR; + private: union Key { @@ -39,7 +41,6 @@ namespace Components static char LastByteRead; static Key CurrentKey; - static symmetric_CTR CurrentCTR; static std::vector ZonePaths; static const char* GetZoneLocation(const char* file); static void LoadInitialZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync); @@ -55,7 +56,6 @@ namespace Components static int AuthLoadInflateCompare(unsigned char* buffer, int length, unsigned char* ivValue); static void AuthLoadInflateDecryptBase(); static void AuthLoadInflateDecryptBaseFunc(unsigned char* buffer); - static int InflateInitDecrypt(z_streamp strm, const char *version, int stream_size); static void LoadZonesStub(Game::XZoneInfo *zoneInfo, unsigned int zoneCount); diff --git a/src/Components/Modules/Friends.cpp b/src/Components/Modules/Friends.cpp index db4a9c27..d888275b 100644 --- a/src/Components/Modules/Friends.cpp +++ b/src/Components/Modules/Friends.cpp @@ -1,4 +1,11 @@ #include + +#pragma warning(push) +#pragma warning(disable: 4100) +#include +#pragma warning(pop) + +#include "Party.hpp" #include "UIFeeder.hpp" namespace Components diff --git a/src/Components/Modules/GSC/ScriptStorage.cpp b/src/Components/Modules/GSC/ScriptStorage.cpp index e89425d7..eeb85719 100644 --- a/src/Components/Modules/GSC/ScriptStorage.cpp +++ b/src/Components/Modules/GSC/ScriptStorage.cpp @@ -1,4 +1,7 @@ #include + +#include + #include "ScriptStorage.hpp" #include "Script.hpp" diff --git a/src/Components/Modules/IPCPipe.cpp b/src/Components/Modules/IPCPipe.cpp index 1de08efb..a2712ac2 100644 --- a/src/Components/Modules/IPCPipe.cpp +++ b/src/Components/Modules/IPCPipe.cpp @@ -1,4 +1,5 @@ #include +#include namespace Components { diff --git a/src/Components/Modules/MapRotation.cpp b/src/Components/Modules/MapRotation.cpp index 1367ed41..02ade5cb 100644 --- a/src/Components/Modules/MapRotation.cpp +++ b/src/Components/Modules/MapRotation.cpp @@ -72,33 +72,6 @@ namespace Components }); } - nlohmann::json MapRotation::RotationData::to_json() const - { - std::vector mapVector; - std::vector gametypeVector; - - for (const auto& [key, val] : this->rotationEntries_) - { - if (key == "map"s) - { - mapVector.emplace_back(val); - } - else if (key == "gametype"s) - { - gametypeVector.emplace_back(val); - } - } - - - auto mapRotationJson = nlohmann::json - { - {"maps", mapVector}, - {"gametypes", gametypeVector}, - }; - - return mapRotationJson; - } - void MapRotation::LoadRotation(const std::string& data) { static auto loaded = false; diff --git a/src/Components/Modules/MapRotation.hpp b/src/Components/Modules/MapRotation.hpp index 09da7517..90204697 100644 --- a/src/Components/Modules/MapRotation.hpp +++ b/src/Components/Modules/MapRotation.hpp @@ -38,8 +38,6 @@ namespace Components [[nodiscard]] bool empty() const noexcept; [[nodiscard]] bool contains(const std::string& key, const std::string& value) const; - [[nodiscard]] nlohmann::json to_json() const; - private: std::vector rotationEntries_; diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 74739a29..0a266f4b 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -1,8 +1,11 @@ #include + +#include + +#include "FastFiles.hpp" #include "RawFiles.hpp" #include "StartupMessages.hpp" #include "Theatre.hpp" -#include "UIFeeder.hpp" namespace Components { diff --git a/src/Components/Modules/Menus.cpp b/src/Components/Modules/Menus.cpp index e9adf249..d0dfa97f 100644 --- a/src/Components/Modules/Menus.cpp +++ b/src/Components/Modules/Menus.cpp @@ -1,4 +1,5 @@ #include +#include "Party.hpp" namespace Components { diff --git a/src/Components/Modules/Node.cpp b/src/Components/Modules/Node.cpp index 5ad1dc5d..7c796801 100644 --- a/src/Components/Modules/Node.cpp +++ b/src/Components/Modules/Node.cpp @@ -1,4 +1,9 @@ #include +#include +#include + +#include + #include "ServerList.hpp" #include "Session.hpp" diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index 9186a4c5..d1b7d12d 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -1,6 +1,9 @@ #include +#include + #include "Download.hpp" #include "Gamepad.hpp" +#include "Party.hpp" #include "ServerList.hpp" #include "Stats.hpp" #include "Voice.hpp" @@ -9,8 +12,25 @@ namespace Components { - Party::JoinContainer Party::Container; - std::map Party::LobbyMap; + class JoinContainer + { + public: + Network::Address target; + std::string challenge; + std::string motd; + DWORD joinTime; + bool valid; + int matchType; + + Utils::InfoString info; + + // Party-specific stuff + DWORD requestTime; + bool awaitingPlaylist; + }; + + static JoinContainer Container; + std::map Party::LobbyMap; Dvar::Var Party::PartyEnable; @@ -401,15 +421,15 @@ namespace Components const Utils::InfoString info(data); // Handle connection - if (Party::Container.valid) + if (Container.valid) { - if (Party::Container.target == address) + if (Container.target == address) { // Invalidate handler for future packets - Party::Container.valid = false; - Party::Container.info = info; + Container.valid = false; + Container.info = info; - Party::Container.matchType = atoi(info.get("matchtype").data()); + Container.matchType = atoi(info.get("matchtype").data()); auto securityLevel = static_cast(atoi(info.get("securityLevel").data())); bool isUsermap = !info.get("usermaphash").empty(); auto usermapHash = static_cast(atoi(info.get("usermaphash").data())); @@ -428,30 +448,30 @@ namespace Components Download::SV_wwwBaseUrl.set(""); } - if (info.get("challenge") != Party::Container.challenge) + if (info.get("challenge") != Container.challenge) { - Party::ConnectError("Invalid join response: Challenge mismatch."); + ConnectError("Invalid join response: Challenge mismatch."); } else if (securityLevel > Auth::GetSecurityLevel()) { Command::Execute("closemenu popup_reconnectingtoparty"); Auth::IncreaseSecurityLevel(securityLevel, "reconnect"); } - else if (!Party::Container.matchType) + else if (!Container.matchType) { - Party::ConnectError("Server is not hosting a match."); + ConnectError("Server is not hosting a match."); } - else if (Party::Container.matchType > 2 || Party::Container.matchType < 0) + else if (Container.matchType > 2 || Container.matchType < 0) { - Party::ConnectError("Invalid join response: Unknown matchtype"); + ConnectError("Invalid join response: Unknown matchtype"); } - else if (Party::Container.info.get("mapname").empty() || Party::Container.info.get("gametype").empty()) + else if (Container.info.get("mapname").empty() || Container.info.get("gametype").empty()) { - Party::ConnectError("Invalid map or gametype."); + ConnectError("Invalid map or gametype."); } - else if (Party::Container.info.get("isPrivate") == "1"s && !Dvar::Var("password").get().length()) + else if (Container.info.get("isPrivate") == "1"s && !Dvar::Var("password").get().length()) { - Party::ConnectError("A password is required to join this server! Set it at the bottom of the serverlist."); + ConnectError("A password is required to join this server! Set it at the bottom of the serverlist."); } else if (isUsermap && usermapHash != Maps::GetUsermapHash(info.get("mapname"))) { @@ -476,16 +496,16 @@ namespace Components } else { - if (!Maps::CheckMapInstalled(Party::Container.info.get("mapname"), true)) return; + if (!Maps::CheckMapInstalled(Container.info.get("mapname"), true)) return; - Party::Container.motd = info.get("sv_motd"); + Container.motd = info.get("sv_motd"); - if (Party::Container.matchType == 1) // Party + if (Container.matchType == 1) // Party { // Send playlist request - Party::Container.requestTime = Game::Sys_Milliseconds(); - Party::Container.awaitingPlaylist = true; - Network::SendCommand(Party::Container.target, "getplaylist", Dvar::Var("password").get()); + Container.requestTime = Game::Sys_Milliseconds(); + Container.awaitingPlaylist = true; + Network::SendCommand(Container.target, "getplaylist", Dvar::Var("password").get()); // This is not a safe method // TODO: Fix actual error! @@ -494,7 +514,7 @@ namespace Components Command::Execute("disconnect", true); } } - else if (Party::Container.matchType == 2) // Match + else if (Container.matchType == 2) // Match { int clients; int maxClients; @@ -521,7 +541,7 @@ namespace Components Game::Menus_CloseAll(Game::uiContext); Game::_XSESSION_INFO hostInfo; - Game::CL_ConnectFromParty(0, &hostInfo, *Party::Container.target.get(), 0, 0, Party::Container.info.get("mapname").data(), Party::Container.info.get("gametype").data()); + Game::CL_ConnectFromParty(0, &hostInfo, *Container.target.get(), 0, 0, Container.info.get("mapname").data(), Container.info.get("gametype").data()); } } } diff --git a/src/Components/Modules/Party.hpp b/src/Components/Modules/Party.hpp index cac3e7bd..1dbfba83 100644 --- a/src/Components/Modules/Party.hpp +++ b/src/Components/Modules/Party.hpp @@ -26,25 +26,7 @@ namespace Components static std::string GetMotd(); private: - class JoinContainer - { - public: - Network::Address target; - std::string challenge; - std::string motd; - DWORD joinTime; - bool valid; - int matchType; - - Utils::InfoString info; - - // Party-specific stuff - DWORD requestTime; - bool awaitingPlaylist; - }; - - static JoinContainer Container; - static std::map LobbyMap; + static std::map LobbyMap; static Dvar::Var PartyEnable; diff --git a/src/Components/Modules/Playlist.cpp b/src/Components/Modules/Playlist.cpp index 52aa12b5..6e3bc714 100644 --- a/src/Components/Modules/Playlist.cpp +++ b/src/Components/Modules/Playlist.cpp @@ -1,4 +1,9 @@ #include +#include + +#include + +#include "Party.hpp" #include "Playlist.hpp" namespace Components diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index 5631fcca..69ca4d78 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -1,4 +1,6 @@ #include +#include + #include "QuickPatch.hpp" namespace Components diff --git a/src/Components/Modules/RCon.cpp b/src/Components/Modules/RCon.cpp index 56cf17ba..7e5e604a 100644 --- a/src/Components/Modules/RCon.cpp +++ b/src/Components/Modules/RCon.cpp @@ -1,5 +1,8 @@ #include +#include + #include "RCon.hpp" +#include "Party.hpp" namespace Components { diff --git a/src/Components/Modules/ServerInfo.cpp b/src/Components/Modules/ServerInfo.cpp index a1a6fb4f..9033ef7d 100644 --- a/src/Components/Modules/ServerInfo.cpp +++ b/src/Components/Modules/ServerInfo.cpp @@ -1,5 +1,8 @@ #include +#include + #include "Gamepad.hpp" +#include "Party.hpp" #include "ServerInfo.hpp" #include "ServerList.hpp" #include "UIFeeder.hpp" diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index b2426ff2..02f5b9d5 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -1,5 +1,8 @@ #include +#include + #include "Discovery.hpp" +#include "Party.hpp" #include "ServerList.hpp" #include "UIFeeder.hpp" diff --git a/src/Components/Modules/Session.cpp b/src/Components/Modules/Session.cpp index 096ccd24..5138b28e 100644 --- a/src/Components/Modules/Session.cpp +++ b/src/Components/Modules/Session.cpp @@ -1,4 +1,6 @@ #include +#include + #include "Session.hpp" namespace Components diff --git a/src/Components/Modules/StructuredData.cpp b/src/Components/Modules/StructuredData.cpp index f60437c7..6e0bec37 100644 --- a/src/Components/Modules/StructuredData.cpp +++ b/src/Components/Modules/StructuredData.cpp @@ -1,6 +1,8 @@ #include #include "StructuredData.hpp" +#include + namespace Components { Utils::Memory::Allocator StructuredData::MemAllocator; diff --git a/src/Components/Modules/Theatre.cpp b/src/Components/Modules/Theatre.cpp index a48a5b07..4cbdb746 100644 --- a/src/Components/Modules/Theatre.cpp +++ b/src/Components/Modules/Theatre.cpp @@ -1,4 +1,7 @@ #include + +#include + #include "Theatre.hpp" #include "UIFeeder.hpp" diff --git a/src/Components/Modules/Theatre.hpp b/src/Components/Modules/Theatre.hpp index 0a880c68..6c61c06d 100644 --- a/src/Components/Modules/Theatre.hpp +++ b/src/Components/Modules/Theatre.hpp @@ -20,7 +20,7 @@ namespace Components int length; std::time_t timeStamp; - nlohmann::json to_json() const + [[nodiscard]] nlohmann::json to_json() const { return nlohmann::json { @@ -28,7 +28,7 @@ namespace Components { "gametype", gametype }, { "author", author }, { "length", length }, - { "timestamp", Utils::String::VA("%lld", timeStamp) } //Ugly, but prevents information loss + { "timestamp", Utils::String::VA("%lld", timeStamp) } // Ugly, but prevents information loss }; } }; diff --git a/src/Components/Modules/UserInfo.cpp b/src/Components/Modules/UserInfo.cpp index 4b71931b..9d0f9245 100644 --- a/src/Components/Modules/UserInfo.cpp +++ b/src/Components/Modules/UserInfo.cpp @@ -1,4 +1,6 @@ #include +#include + #include "UserInfo.hpp" #include "GSC/Script.hpp" diff --git a/src/Components/Modules/Window.cpp b/src/Components/Modules/Window.cpp index f044ea08..5ed7e497 100644 --- a/src/Components/Modules/Window.cpp +++ b/src/Components/Modules/Window.cpp @@ -1,5 +1,7 @@ #include +#include "FastFiles.hpp" + namespace Components { Dvar::Var Window::NoBorder; diff --git a/src/Components/Modules/ZoneBuilder.cpp b/src/Components/Modules/ZoneBuilder.cpp index 4d10a89d..6a1547af 100644 --- a/src/Components/Modules/ZoneBuilder.cpp +++ b/src/Components/Modules/ZoneBuilder.cpp @@ -1,5 +1,10 @@ #include +#include + #include "Console.hpp" +#include "FastFiles.hpp" + +#include #include diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index 6efd7be6..42801f28 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -1,5 +1,9 @@ #include +#include + +#include "FastFiles.hpp" + #pragma optimize( "", off ) namespace Components { diff --git a/src/DllMain.cpp b/src/DllMain.cpp index eadda265..12fc9e1b 100644 --- a/src/DllMain.cpp +++ b/src/DllMain.cpp @@ -26,7 +26,6 @@ namespace Main void Uninitialize() { Components::Loader::Uninitialize(); - google::protobuf::ShutdownProtobufLibrary(); } __declspec(naked) void EntryPoint() diff --git a/src/STDInclude.hpp b/src/STDInclude.hpp index 776d1211..543d86f4 100644 --- a/src/STDInclude.hpp +++ b/src/STDInclude.hpp @@ -46,7 +46,10 @@ #include #include #include +#include +#include #include +#include #pragma warning(pop) @@ -80,7 +83,6 @@ #include #include -#include // Enable additional literals using namespace std::literals; @@ -93,12 +95,6 @@ using namespace std::literals; #undef min #endif -// Needs to be included after the nominmax above ^ -#ifdef snprintf - #undef snprintf -#endif -#include - #define AssertSize(x, size) \ static_assert(sizeof(x) == (size), \ "Structure has an invalid size. " #x " must be " #size " bytes") @@ -111,30 +107,18 @@ using namespace std::literals; #define AssertUnreachable assert(0 && "unreachable") -// Protobuf -#include "proto/session.pb.h" -#include "proto/party.pb.h" -#include "proto/auth.pb.h" -#include "proto/node.pb.h" -#include "proto/rcon.pb.h" -#include "proto/ipc.pb.h" -#include "proto/friends.pb.h" - #pragma warning(pop) #include "Utils/Memory.hpp" // Breaks order on purpose #include "Utils/Cache.hpp" #include "Utils/Chain.hpp" -#include "Utils/Compression.hpp" #include "Utils/Concurrency.hpp" #include "Utils/Cryptography.hpp" #include "Utils/CSV.hpp" #include "Utils/Entities.hpp" #include "Utils/Hooking.hpp" -#include "Utils/InfoString.hpp" #include "Utils/IO.hpp" -#include "Utils/Json.hpp" #include "Utils/Library.hpp" #include "Utils/Maths.hpp" #include "Utils/NamedMutex.hpp" diff --git a/src/Steam/Interfaces/SteamMatchmaking.cpp b/src/Steam/Interfaces/SteamMatchmaking.cpp index 72e56f94..a5cf4fba 100644 --- a/src/Steam/Interfaces/SteamMatchmaking.cpp +++ b/src/Steam/Interfaces/SteamMatchmaking.cpp @@ -1,4 +1,5 @@ #include +#include STEAM_IGNORE_WARNINGS_START diff --git a/src/Utils/Compression.cpp b/src/Utils/Compression.cpp index adf5aefd..d3b40963 100644 --- a/src/Utils/Compression.cpp +++ b/src/Utils/Compression.cpp @@ -1,4 +1,7 @@ #include +#include + +#include "Compression.hpp" namespace Utils::Compression { diff --git a/src/Utils/InfoString.cpp b/src/Utils/InfoString.cpp index bfefdff2..523d7c0e 100644 --- a/src/Utils/InfoString.cpp +++ b/src/Utils/InfoString.cpp @@ -1,4 +1,5 @@ #include +#include "InfoString.hpp" namespace Utils { diff --git a/src/Utils/InfoString.hpp b/src/Utils/InfoString.hpp index 3229eebb..ce2e1220 100644 --- a/src/Utils/InfoString.hpp +++ b/src/Utils/InfoString.hpp @@ -1,4 +1,5 @@ #pragma once +#include namespace Utils { diff --git a/src/Utils/Json.cpp b/src/Utils/Json.cpp index eb36fff6..ff401f86 100644 --- a/src/Utils/Json.cpp +++ b/src/Utils/Json.cpp @@ -1,6 +1,8 @@ #include #include +#include "Json.hpp" + namespace Utils::Json { std::string TypeToString(const nlohmann::json::value_t type) @@ -33,7 +35,7 @@ namespace Utils::Json } } - unsigned long ReadFlags(const std::string binaryFlags, size_t size) + unsigned long ReadFlags(const std::string binaryFlags, std::size_t size) { std::bitset<64> input; const auto binarySize = size * 8; @@ -53,7 +55,7 @@ namespace Utils::Json break; } - bool isOne = bit == '1'; + auto isOne = bit == '1'; input.set(i--, isOne); } diff --git a/src/Utils/Json.hpp b/src/Utils/Json.hpp index 415309e7..c73de553 100644 --- a/src/Utils/Json.hpp +++ b/src/Utils/Json.hpp @@ -1,8 +1,9 @@ #pragma once +#include namespace Utils::Json { std::string TypeToString(nlohmann::json::value_t type); - unsigned long ReadFlags(const std::string binaryFlags, size_t size); + unsigned long ReadFlags(std::string binaryFlags, size_t size); }