From 3ffa2517c2629237ce76b8569d097c5dab6082c8 Mon Sep 17 00:00:00 2001 From: Poliwrath Date: Thu, 26 Aug 2021 22:02:39 -0400 Subject: [PATCH] - Fix a bunch of project warnings --- .../Games/Ex-Board/Ex-BoardGeneric.cpp | 2 +- OpenParrot/src/Utility/GameID.h | 2 + deps/inc/injector/gvm/gvm.hpp | 106 +----------------- deps/inc/injector/injector.hpp | 91 --------------- 4 files changed, 4 insertions(+), 197 deletions(-) diff --git a/OpenParrot/src/Functions/Games/Ex-Board/Ex-BoardGeneric.cpp b/OpenParrot/src/Functions/Games/Ex-Board/Ex-BoardGeneric.cpp index 3ff1c08..40d9dc5 100644 --- a/OpenParrot/src/Functions/Games/Ex-Board/Ex-BoardGeneric.cpp +++ b/OpenParrot/src/Functions/Games/Ex-Board/Ex-BoardGeneric.cpp @@ -311,7 +311,7 @@ BOOL WINAPI CloseHandleWrapExBoard( reset_addressedExBoard(); return TRUE; } - CloseHandle(hObject); + return CloseHandle(hObject); } int __stdcall GetKeyLicenseWrap(void) diff --git a/OpenParrot/src/Utility/GameID.h b/OpenParrot/src/Utility/GameID.h index ba7f8df..49c57f9 100644 --- a/OpenParrot/src/Utility/GameID.h +++ b/OpenParrot/src/Utility/GameID.h @@ -1,5 +1,7 @@ #pragma once +#define _CRT_SECURE_NO_WARNINGS 1 + enum class GameID { Global, diff --git a/deps/inc/injector/gvm/gvm.hpp b/deps/inc/injector/gvm/gvm.hpp index 27a0562..9c1a772 100644 --- a/deps/inc/injector/gvm/gvm.hpp +++ b/deps/inc/injector/gvm/gvm.hpp @@ -24,6 +24,7 @@ * */ #pragma once + #include #include #include @@ -39,110 +40,11 @@ namespace injector * This assumes the executable is decrypted, so, Silent's ASI Loader is recommended. */ #ifndef INJECTOR_OWN_GVM -#ifndef INJECTOR_GVM_DUMMY -class game_version_manager -{ - public: - // Set this if you would like that MessagesBox contain PluginName as caption - const char* PluginName; - - private: - char game, region, major, minor, majorRevision, minorRevision, cracker, steam; - - public: - game_version_manager() - { - #ifdef INJECTOR_GVM_PLUGIN_NAME - PluginName = INJECTOR_GVM_PLUGIN_NAME; - #else - PluginName = "Unknown Plugin Name"; - #endif - - this->Clear(); - } - - - // Clear any information about game version - void Clear() - { - game = region = major = minor = majorRevision = minorRevision = cracker = steam = 0; - } - - // Checks if I don't know the game we are attached to - bool IsUnknown() { return game == 0; } - // Checks if this is the steam version - bool IsSteam() { return steam != 0; } - // Gets the game we are attached to (0, '3', 'V', 'S', 'I', 'E') - char GetGame() { return game; } - // Gets the region from the game we are attached to (0, 'U', 'E'); - char GetRegion() { return region; } - // Get major and minor version of the game (e.g. [major = 1, minor = 0] = 1.0) - int GetMajorVersion() { return major; } - int GetMinorVersion() { return minor; } - int GetMajorRevisionVersion() { return majorRevision; } - int GetMinorRevisionVersion() { return minorRevision; } - - bool IsHoodlum() { return cracker == 'H'; } - - // Region conditions - bool IsUS() { return region == 'U'; } - bool IsEU() { return region == 'E'; } - - // Game Conditions - bool IsIII() { return game == '3'; } - bool IsVC () { return game == 'V'; } - bool IsSA () { return game == 'S'; } - bool IsIV () { return game == 'I'; } - bool IsEFLC(){ return game == 'E'; } - - // Detects game, region and version; returns false if could not detect it - bool Detect(); - - // Gets the game version as text, the buffer must contain at least 32 bytes of space. - char* GetVersionText(char* buffer) - { - if(this->IsUnknown()) - { - strcpy(buffer, "UNKNOWN GAME"); - return buffer; - } - - const char* g = this->IsIII() ? "III" : this->IsVC() ? "VC" : this->IsSA() ? "SA" : this->IsIV() ? "IV" : this->IsEFLC() ? "EFLC" : "UNK"; - const char* r = this->IsUS()? "US" : this->IsEU()? "EURO" : "UNK_REGION"; - const char* s = this->IsSteam()? "Steam" : ""; - sprintf(buffer, "GTA %s %d.%d.%d.%d %s%s", g, major, minor, majorRevision, minorRevision, r, s); - return buffer; - } - - - public: - // Raises a error saying that you could not detect the game version - void RaiseCouldNotDetect() - { - MessageBoxA(0, - "Could not detect the game version\nContact the mod creator!", - PluginName, MB_ICONERROR - ); - } - - // Raises a error saying that the exe version is incompatible (and output the exe name) - void RaiseIncompatibleVersion() - { - char buf[128], v[32]; - sprintf(buf, - "An incompatible exe version has been detected! (%s)\nContact the mod creator!", - GetVersionText(v) - ); - MessageBoxA(0, buf, PluginName, MB_ICONERROR); - } -}; -#else // INJECTOR_GVM_DUMMY class game_version_manager { public: bool Detect() { return true; } }; -#endif // INJECTOR_GVM_DUMMY #endif // INJECTOR_OWN_GVM @@ -189,12 +91,6 @@ class address_manager : public game_version_manager return singleton().translate(p); } - // - static void set_name(const char* modname) - { - singleton().PluginName = modname; - } - public: // Functors for memory translation: diff --git a/deps/inc/injector/injector.hpp b/deps/inc/injector/injector.hpp index 11a79fa..ce84314 100644 --- a/deps/inc/injector/injector.hpp +++ b/deps/inc/injector/injector.hpp @@ -657,96 +657,5 @@ inline memory_pointer_aslr aslr_ptr(T p) -#ifndef INJECTOR_GVM_OWN_DETECT // Should we implement our detection method? - -// Detects game, region and version; returns false if could not detect it -inline bool game_version_manager::Detect() -{ - // Cleanup data - this->Clear(); - - // Find NT header - uintptr_t base = (uintptr_t) GetModuleHandleA(NULL); - IMAGE_DOS_HEADER* dos = (IMAGE_DOS_HEADER*)(base); - IMAGE_NT_HEADERS* nt = (IMAGE_NT_HEADERS*)(base + dos->e_lfanew); - - // Look for game and version thought the entry-point - // Thanks to Silent for many of the entry point offsets - switch (base + nt->OptionalHeader.AddressOfEntryPoint + (0x400000 - base)) - { - case 0x5C1E70: // GTA III 1.0 - game = '3', major = 1, minor = 0, region = 0, steam = false; - return true; - - case 0x5C2130: // GTA III 1.1 - game = '3', major = 1, minor = 1, region = 0, steam = false; - return true; - - case 0x5C6FD0: // GTA III 1.1 (Cracked Steam Version) - case 0x9912ED: // GTA III 1.1 (Encrypted Steam Version) - game = '3', major = 1, minor = 1, region = 0, steam = true; - return true; - - case 0x667BF0: // GTA VC 1.0 - game = 'V', major = 1, minor = 0, region = 0, steam = false; - return true; - - case 0x667C40: // GTA VC 1.1 - game = 'V', major = 1, minor = 1, region = 0, steam = false; - return true; - - case 0x666BA0: // GTA VC 1.1 (Cracked Steam Version) - case 0xA402ED: // GTA VC 1.1 (Encrypted Steam Version) - game = 'V', major = 1, minor = 1, region = 0, steam = true; - return true; - - case 0x82457C: // GTA SA 1.0 US Cracked - case 0x824570: // GTA SA 1.0 US Compact - game = 'S', major = 1, minor = 0, region = 'U', steam = false; - cracker = injector::ReadMemory(raw_ptr(0x406A20), true) == 0xE9? 'H' : 0; - return true; - - case 0x8245BC: // GTA SA 1.0 EU Cracked (??????) - case 0x8245B0: // GTA SA 1.0 EU Cracked - game = 'S', major = 1, minor = 0, region = 'E', steam = false; - cracker = injector::ReadMemory(raw_ptr(0x406A20), true) == 0xE9? 'H' : 0; // just to say 'securom' - return true; - - case 0x8252FC: // GTA SA 1.1 US Cracked - game = 'S', major = 1, minor = 1, region = 'U', steam = false; - return true; - - case 0x82533C: // GTA SA 1.1 EU Cracked - game = 'S', major = 1, minor = 1, region = 'E', steam = false; - return true; - - case 0x85EC4A: // GTA SA 3.0 (Cracked Steam Version) - case 0xD3C3DB: // GTA SA 3.0 (Encrypted Steam Version) - game = 'S', major = 3, minor = 0, region = 0, steam = true; - return true; - - case 0xC965AD: // GTA IV 1.0.0.4 US - game = 'I', major = 1, minor = 0, majorRevision = 0, minorRevision = 4, region = 'U', steam = false; - return true; - - case 0xD0D011: // GTA IV 1.0.0.7 US - game = 'I', major = 1, minor = 0, majorRevision = 0, minorRevision = 7, region = 'U', steam = false; - return true; - - case 0xD0AF06: // GTA EFLC 1.1.2.0 US - game = 'E', major = 1, minor = 1, majorRevision = 2, minorRevision = 0, region = 'U', steam = false; - return true; - - case 0x1415FF790: // GTA 5 v1.0.350.2 Non-Steam US - game = '5', major = 1, minor = 0, majorRevision = 350, minorRevision = 2, region = 'U', steam = false; - return true; - default: - return false; - } -} - -#endif - - } // namespace