From 256b463411bd0d90e9e3898692ef8d1ca1c5c49d Mon Sep 17 00:00:00 2001 From: momo5502 Date: Thu, 18 Aug 2016 02:18:45 +0200 Subject: [PATCH] Don't ignore warning 4100 --- src/Components/Modules/AssetHandler.hpp | 8 ++++---- src/Components/Modules/Auth.cpp | 4 ++-- src/Components/Modules/Command.cpp | 4 ++-- src/Components/Modules/Download.cpp | 4 ++-- src/Components/Modules/Dvar.cpp | 2 +- src/Components/Modules/IPCPipe.cpp | 2 +- src/Components/Modules/Localization.cpp | 2 +- src/Components/Modules/Logger.cpp | 2 +- src/Components/Modules/Menus.cpp | 4 ++-- src/Components/Modules/ModList.cpp | 2 +- src/Components/Modules/Node.cpp | 4 ++-- src/Components/Modules/Party.cpp | 4 ++-- src/Components/Modules/QuickPatch.cpp | 6 +++--- src/Components/Modules/StructuredData.cpp | 2 +- src/Components/Modules/Theatre.cpp | 2 +- src/Components/Modules/Weapon.cpp | 2 +- src/Components/Modules/ZoneBuilder.cpp | 2 +- src/Game/Functions.cpp | 7 ++++++- src/Main.cpp | 2 +- src/STDInclude.hpp | 4 +--- src/Steam/Interfaces/SteamFriends.cpp | 6 +++++- src/Steam/Interfaces/SteamGameServer.cpp | 4 ++++ src/Steam/Interfaces/SteamMasterServerUpdater.cpp | 4 ++++ src/Steam/Interfaces/SteamMatchmaking.cpp | 6 +++++- src/Steam/Interfaces/SteamNetworking.cpp | 4 ++++ src/Steam/Interfaces/SteamRemoteStorage.cpp | 4 ++++ src/Steam/Interfaces/SteamUser.cpp | 4 ++++ src/Steam/Interfaces/SteamUtils.cpp | 4 ++++ src/Steam/Steam.hpp | 5 +++++ src/Utils/Cryptography.hpp | 2 +- 30 files changed, 76 insertions(+), 36 deletions(-) diff --git a/src/Components/Modules/AssetHandler.hpp b/src/Components/Modules/AssetHandler.hpp index 33d30fa2..702dd429 100644 --- a/src/Components/Modules/AssetHandler.hpp +++ b/src/Components/Modules/AssetHandler.hpp @@ -8,10 +8,10 @@ namespace Components public: virtual ~IAsset() {}; virtual Game::XAssetType GetType() { return Game::XAssetType::ASSET_TYPE_INVALID; }; - virtual void Mark(Game::XAssetHeader header, ZoneBuilder::Zone* builder) { /*ErrorTypeNotSupported(this);*/ }; - virtual void Save(Game::XAssetHeader header, ZoneBuilder::Zone* builder) { /*ErrorTypeNotSupported(this);*/ }; - virtual void Dump(Game::XAssetHeader header) { /*ErrorTypeNotSupported(this);*/ }; - virtual void Load(Game::XAssetHeader* header, std::string name, ZoneBuilder::Zone* builder) { /*ErrorTypeNotSupported(this);*/ }; + virtual void Mark(Game::XAssetHeader /*header*/, ZoneBuilder::Zone* /*builder*/) { /*ErrorTypeNotSupported(this);*/ }; + virtual void Save(Game::XAssetHeader /*header*/, ZoneBuilder::Zone* /*builder*/) { /*ErrorTypeNotSupported(this);*/ }; + virtual void Dump(Game::XAssetHeader /*header*/) { /*ErrorTypeNotSupported(this);*/ }; + virtual void Load(Game::XAssetHeader* /*header*/, std::string name, ZoneBuilder::Zone* /*builder*/) { /*ErrorTypeNotSupported(this);*/ }; }; typedef Game::XAssetHeader(Callback)(Game::XAssetType type, std::string name); diff --git a/src/Components/Modules/Auth.cpp b/src/Components/Modules/Auth.cpp index 853ab54e..cebec5ec 100644 --- a/src/Components/Modules/Auth.cpp +++ b/src/Components/Modules/Auth.cpp @@ -247,7 +247,7 @@ namespace Components Proto::Auth::Certificate cert; if (cert.ParseFromString(::Utils::IO::ReadFile("players/guid.dat"))) { - Auth::GuidKey.Import(cert.privatekey(), PK_PRIVATE); + Auth::GuidKey.Import(cert.privatekey()); Auth::GuidToken = cert.token(); Auth::ComputeToken = cert.ctoken(); } @@ -386,7 +386,7 @@ namespace Components Utils::Hook(0x41D3E3, Auth::SendConnectDataStub, HOOK_CALL).Install()->Quick(); // Guid command - Command::Add("guid", [] (Command::Params params) + Command::Add("guid", [] (Command::Params) { Logger::Print("Your guid: %llX\n", Steam::SteamUser()->GetSteamID().Bits); }); diff --git a/src/Components/Modules/Command.cpp b/src/Components/Modules/Command.cpp index 2a50877b..22208eb2 100644 --- a/src/Components/Modules/Command.cpp +++ b/src/Components/Modules/Command.cpp @@ -137,7 +137,7 @@ namespace Components // Disable native noclip command Utils::Hook::Nop(0x474846, 5); - Command::Add("noclip", [] (Command::Params params) + Command::Add("noclip", [] (Command::Params) { if (!Game::CL_IsCgameInitialized()) { @@ -170,7 +170,7 @@ namespace Components Logger::Print("Noclip toggled\n"); }); - Command::Add("ufo", [] (Command::Params params) + Command::Add("ufo", [] (Command::Params) { if (!Game::CL_IsCgameInitialized()) { diff --git a/src/Components/Modules/Download.cpp b/src/Components/Modules/Download.cpp index 8803a060..f8d25832 100644 --- a/src/Components/Modules/Download.cpp +++ b/src/Components/Modules/Download.cpp @@ -40,7 +40,7 @@ namespace Components nc->flags |= MG_F_SEND_AND_CLOSE; } - void Download::ListHandler(mg_connection *nc, int ev, void *ev_data) + void Download::ListHandler(mg_connection* nc, int ev, void* /*ev_data*/) { // Only handle http requests if (ev != MG_EV_HTTP_REQUEST) return; @@ -150,7 +150,7 @@ namespace Components } } - void Download::InfoHandler(mg_connection *nc, int ev, void *ev_data) + void Download::InfoHandler(mg_connection* nc, int ev, void* /*ev_data*/) { // Only handle http requests if (ev != MG_EV_HTTP_REQUEST) return; diff --git a/src/Components/Modules/Dvar.cpp b/src/Components/Modules/Dvar.cpp index 4e53f1a7..60204aa5 100644 --- a/src/Components/Modules/Dvar.cpp +++ b/src/Components/Modules/Dvar.cpp @@ -136,7 +136,7 @@ namespace Components Dvar::RegistrationSignal.connect(callback); } - Game::dvar_t* Dvar::RegisterName(const char* name, const char* default, Game::dvar_flag flag, const char* description) + Game::dvar_t* Dvar::RegisterName(const char* name, const char* /*default*/, Game::dvar_flag flag, const char* description) { // Run callbacks Dvar::RegistrationSignal(); diff --git a/src/Components/Modules/IPCPipe.cpp b/src/Components/Modules/IPCPipe.cpp index 38d396f4..0263af91 100644 --- a/src/Components/Modules/IPCPipe.cpp +++ b/src/Components/Modules/IPCPipe.cpp @@ -236,7 +236,7 @@ namespace Components }); // Test pipe functionality by sending pings - Command::Add("ipcping", [] (Command::Params params) + Command::Add("ipcping", [] (Command::Params) { Logger::Print("Sending ping to pipe!\n"); IPCPipe::Write("ping", ""); diff --git a/src/Components/Modules/Localization.cpp b/src/Components/Modules/Localization.cpp index 959e603d..f9d9115d 100644 --- a/src/Components/Modules/Localization.cpp +++ b/src/Components/Modules/Localization.cpp @@ -113,7 +113,7 @@ namespace Components Localization::TempLocalizeMap.clear(); } - void __stdcall Localization::SetStringStub(const char* key, const char* value, bool isEnglish) + void __stdcall Localization::SetStringStub(const char* key, const char* value, bool /*isEnglish*/) { Localization::Set(key, value); } diff --git a/src/Components/Modules/Logger.cpp b/src/Components/Modules/Logger.cpp index d72c34ab..c2b4d5a8 100644 --- a/src/Components/Modules/Logger.cpp +++ b/src/Components/Modules/Logger.cpp @@ -41,7 +41,7 @@ namespace Components } else { - Game::Com_PrintMessage(0, message.data(), 0); + Game::Com_PrintMessage(channel, message.data(), 0); } } diff --git a/src/Components/Modules/Menus.cpp b/src/Components/Modules/Menus.cpp index 6519d2a7..db2b2a1b 100644 --- a/src/Components/Modules/Menus.cpp +++ b/src/Components/Modules/Menus.cpp @@ -506,7 +506,7 @@ namespace Components Menus::MenuList.clear(); } - Game::XAssetHeader Menus::MenuLoad(Game::XAssetType type, std::string filename) + Game::XAssetHeader Menus::MenuLoad(Game::XAssetType /*type*/, std::string filename) { return { Game::Menus_FindByName(Game::uiContext, filename.data()) }; } @@ -644,7 +644,7 @@ namespace Components Game::Menus_OpenByName(Game::uiContext, params[1]); }); - Command::Add("reloadmenus", [] (Command::Params params) + Command::Add("reloadmenus", [] (Command::Params) { // Close all menus Game::Menus_CloseAll(Game::uiContext); diff --git a/src/Components/Modules/ModList.cpp b/src/Components/Modules/ModList.cpp index 8854ece8..2fc9b170 100644 --- a/src/Components/Modules/ModList.cpp +++ b/src/Components/Modules/ModList.cpp @@ -25,7 +25,7 @@ namespace Components return ModList::Mods.size(); } - const char* ModList::GetItemText(unsigned int index, int column) + const char* ModList::GetItemText(unsigned int index, int /*column*/) { if (index < ModList::Mods.size()) { diff --git a/src/Components/Modules/Node.cpp b/src/Components/Modules/Node.cpp index 0e6047f6..50c3e977 100644 --- a/src/Components/Modules/Node.cpp +++ b/src/Components/Modules/Node.cpp @@ -778,7 +778,7 @@ namespace Components } }); - Command::Add("listnodes", [] (Command::Params params) + Command::Add("listnodes", [] (Command::Params) { Logger::Print("Nodes: %d (%d)\n", Node::Nodes.size(), Node::GetValidNodeCount()); @@ -803,7 +803,7 @@ namespace Components } }); - Command::Add("syncnodes", [] (Command::Params params) + Command::Add("syncnodes", [] (Command::Params) { Logger::Print("Re-Synchronizing nodes...\n"); diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index cffa59b5..7922d1c8 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -69,7 +69,7 @@ namespace Components Command::Execute("openmenu menu_xboxlive_partyended"); } - Game::dvar_t* Party::RegisterMinPlayers(const char* name, int value, int min, int max, Game::dvar_flag flag, const char* description) + Game::dvar_t* Party::RegisterMinPlayers(const char* name, int /*value*/, int /*min*/, int max, Game::dvar_flag flag, const char* description) { return Dvar::Register(name, 1, 1, max, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED | flag, description).Get(); } @@ -249,7 +249,7 @@ namespace Components Party::Connect(Network::Address(params[1])); }); - Command::Add("reconnect", [] (Command::Params params) + Command::Add("reconnect", [] (Command::Params) { Party::Connect(Party::Container.Target); }); diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index d560af08..a8c94bdc 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -17,7 +17,7 @@ namespace Components void QuickPatch::ShutdownStub(int channel, const char* message) { - Game::Com_Printf(0, message); + Game::Com_Printf(channel, message); QuickPatch::ShutdownSignal(); } @@ -362,12 +362,12 @@ namespace Components // Patch selectStringTableEntryInDvar Utils::Hook::Set(0x405959, QuickPatch::SelectStringTableEntryInDvarStub); - Command::Add("unlockstats", [] (Command::Params params) + Command::Add("unlockstats", [] (Command::Params) { QuickPatch::UnlockStats(); }); - Command::Add("crash", [] (Command::Params params) + Command::Add("crash", [] (Command::Params) { throw new std::exception(); }); diff --git a/src/Components/Modules/StructuredData.cpp b/src/Components/Modules/StructuredData.cpp index 99866c85..ccef9b53 100644 --- a/src/Components/Modules/StructuredData.cpp +++ b/src/Components/Modules/StructuredData.cpp @@ -84,7 +84,7 @@ namespace Components // Only execute this when building zones if (!ZoneBuilder::IsEnabled()) return; - AssetHandler::OnLoad([] (Game::XAssetType type, Game::XAssetHeader asset, std::string filename, bool* restrict) + AssetHandler::OnLoad([] (Game::XAssetType type, Game::XAssetHeader asset, std::string filename, bool* /*restrict*/) { // Only intercept playerdatadef loading if (filename != "mp/playerdata.def" || type != Game::XAssetType::ASSET_TYPE_STRUCTUREDDATADEF) return; diff --git a/src/Components/Modules/Theatre.cpp b/src/Components/Modules/Theatre.cpp index 3937bfa8..139b5ef11 100644 --- a/src/Components/Modules/Theatre.cpp +++ b/src/Components/Modules/Theatre.cpp @@ -252,7 +252,7 @@ namespace Components } // Omit column here - const char* Theatre::GetDemoText(unsigned int item, int column) + const char* Theatre::GetDemoText(unsigned int item, int /*column*/) { if (item < Theatre::DemoContainer.Demos.size()) { diff --git a/src/Components/Modules/Weapon.cpp b/src/Components/Modules/Weapon.cpp index aaaaf435..857fad94 100644 --- a/src/Components/Modules/Weapon.cpp +++ b/src/Components/Modules/Weapon.cpp @@ -2,7 +2,7 @@ namespace Components { - Game::XAssetHeader Weapon::WeaponFileLoad(Game::XAssetType type, std::string filename) + Game::XAssetHeader Weapon::WeaponFileLoad(Game::XAssetType /*type*/, std::string filename) { Game::XAssetHeader header = { 0 }; diff --git a/src/Components/Modules/ZoneBuilder.cpp b/src/Components/Modules/ZoneBuilder.cpp index ddfc257a..91488a54 100644 --- a/src/Components/Modules/ZoneBuilder.cpp +++ b/src/Components/Modules/ZoneBuilder.cpp @@ -500,7 +500,7 @@ namespace Components Utils::Hook::Set(0x64A029, 0x38400000); // 900 MiB Utils::Hook::Set(0x64A057, 0x38400000); - AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict) + AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader /*asset*/, std::string name, bool* /*restrict*/) { if (!ZoneBuilder::TraceZone.empty() && ZoneBuilder::TraceZone == FastFiles::Current()) { diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index e35b1b6b..53714476 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -317,11 +317,16 @@ namespace Game float UI_GetScoreboardLeft(void* a1) { static int func = 0x590390; + float result = 0; + __asm { - mov eax, [esp + 4h] + mov eax, a1 call func + mov result, eax } + + return result; } const char *DB_GetXAssetName(XAsset *asset) diff --git a/src/Main.cpp b/src/Main.cpp index 4ecf77e4..cbcc4de0 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -46,7 +46,7 @@ namespace Main } } -BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { diff --git a/src/STDInclude.hpp b/src/STDInclude.hpp index 86216cce..73032776 100644 --- a/src/STDInclude.hpp +++ b/src/STDInclude.hpp @@ -5,9 +5,6 @@ #ifndef RESOURCE_DATA -// Disable irrelevant warnings -#pragma warning(disable: 4100) // Unreferenced parameter (steam has to have them and other stubs as well, due to their calling convention) - #define VC_EXTRALEAN #define WIN32_LEAN_AND_MEAN @@ -46,6 +43,7 @@ // Ignore the warnings, it's no our code! #pragma warning(push) #pragma warning(disable: 4005) +#pragma warning(disable: 4100) #pragma warning(disable: 4389) #pragma warning(disable: 4702) #pragma warning(disable: 6001) diff --git a/src/Steam/Interfaces/SteamFriends.cpp b/src/Steam/Interfaces/SteamFriends.cpp index 9a18c91a..13d40535 100644 --- a/src/Steam/Interfaces/SteamFriends.cpp +++ b/src/Steam/Interfaces/SteamFriends.cpp @@ -1,6 +1,8 @@ #include "STDInclude.hpp" -using namespace Components; +using namespace Components; + +STEAM_IGNORE_WARNINGS_START namespace Steam { @@ -118,3 +120,5 @@ namespace Steam { } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Interfaces/SteamGameServer.cpp b/src/Steam/Interfaces/SteamGameServer.cpp index 7ffe6610..26261093 100644 --- a/src/Steam/Interfaces/SteamGameServer.cpp +++ b/src/Steam/Interfaces/SteamGameServer.cpp @@ -1,5 +1,7 @@ #include "STDInclude.hpp" +STEAM_IGNORE_WARNINGS_START + namespace Steam { void GameServer::LogOn() @@ -89,3 +91,5 @@ namespace Steam return 0; } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Interfaces/SteamMasterServerUpdater.cpp b/src/Steam/Interfaces/SteamMasterServerUpdater.cpp index 62ad95b3..431fd46a 100644 --- a/src/Steam/Interfaces/SteamMasterServerUpdater.cpp +++ b/src/Steam/Interfaces/SteamMasterServerUpdater.cpp @@ -1,5 +1,7 @@ #include "STDInclude.hpp" +STEAM_IGNORE_WARNINGS_START + namespace Steam { void MasterServerUpdater::SetActive(bool bActive) @@ -65,3 +67,5 @@ namespace Steam return 0; } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Interfaces/SteamMatchmaking.cpp b/src/Steam/Interfaces/SteamMatchmaking.cpp index aab4776a..ef32f6eb 100644 --- a/src/Steam/Interfaces/SteamMatchmaking.cpp +++ b/src/Steam/Interfaces/SteamMatchmaking.cpp @@ -1,4 +1,6 @@ -#include "STDInclude.hpp" +#include "STDInclude.hpp" + +STEAM_IGNORE_WARNINGS_START namespace Steam { @@ -191,3 +193,5 @@ namespace Steam return true; } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Interfaces/SteamNetworking.cpp b/src/Steam/Interfaces/SteamNetworking.cpp index 59428ca6..fb98f2d1 100644 --- a/src/Steam/Interfaces/SteamNetworking.cpp +++ b/src/Steam/Interfaces/SteamNetworking.cpp @@ -1,5 +1,7 @@ #include "STDInclude.hpp" +STEAM_IGNORE_WARNINGS_START + namespace Steam { bool Networking::SendP2PPacket(SteamID steamIDRemote, const void *pubData, unsigned int cubData, int eP2PSendType) @@ -102,3 +104,5 @@ namespace Steam return 0; } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Interfaces/SteamRemoteStorage.cpp b/src/Steam/Interfaces/SteamRemoteStorage.cpp index 4a4a2602..0e7192c1 100644 --- a/src/Steam/Interfaces/SteamRemoteStorage.cpp +++ b/src/Steam/Interfaces/SteamRemoteStorage.cpp @@ -1,5 +1,7 @@ #include "STDInclude.hpp" +STEAM_IGNORE_WARNINGS_START + namespace Steam { bool RemoteStorage::FileWrite(const char *pchFile, const void *pvData, int cubData) @@ -41,3 +43,5 @@ namespace Steam return false; } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Interfaces/SteamUser.cpp b/src/Steam/Interfaces/SteamUser.cpp index 6364592d..880dd782 100644 --- a/src/Steam/Interfaces/SteamUser.cpp +++ b/src/Steam/Interfaces/SteamUser.cpp @@ -1,4 +1,6 @@ #include "STDInclude.hpp" + +STEAM_IGNORE_WARNINGS_START namespace Steam { @@ -100,3 +102,5 @@ namespace Steam return 0; } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Interfaces/SteamUtils.cpp b/src/Steam/Interfaces/SteamUtils.cpp index 67216b7f..aa797c9b 100644 --- a/src/Steam/Interfaces/SteamUtils.cpp +++ b/src/Steam/Interfaces/SteamUtils.cpp @@ -1,5 +1,7 @@ #include "STDInclude.hpp" +STEAM_IGNORE_WARNINGS_START + namespace Steam { unsigned int Utils::GetSecondsSinceAppActive() @@ -95,3 +97,5 @@ namespace Steam return false; } } + +STEAM_IGNORE_WARNINGS_END diff --git a/src/Steam/Steam.hpp b/src/Steam/Steam.hpp index 59aa1603..b45b2f57 100644 --- a/src/Steam/Steam.hpp +++ b/src/Steam/Steam.hpp @@ -2,6 +2,11 @@ #define STEAM_EXPORT extern "C" __declspec(dllexport) +#define STEAM_IGNORE_WARNINGS_START __pragma(warning(push)) \ + __pragma(warning(disable: 4100)) + +#define STEAM_IGNORE_WARNINGS_END __pragma(warning(pop)) + typedef union { struct diff --git a/src/Utils/Cryptography.hpp b/src/Utils/Cryptography.hpp index 236532f1..4adda3e7 100644 --- a/src/Utils/Cryptography.hpp +++ b/src/Utils/Cryptography.hpp @@ -194,7 +194,7 @@ namespace Utils } } - void Import(std::string key, int type = PK_PRIVATE) + void Import(std::string key) { this->Free();