- Fix a bunch of project warnings
This commit is contained in:
parent
43cfbcba3a
commit
3ffa2517c2
@ -311,7 +311,7 @@ BOOL WINAPI CloseHandleWrapExBoard(
|
|||||||
reset_addressedExBoard();
|
reset_addressedExBoard();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
CloseHandle(hObject);
|
return CloseHandle(hObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __stdcall GetKeyLicenseWrap(void)
|
int __stdcall GetKeyLicenseWrap(void)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS 1
|
||||||
|
|
||||||
enum class GameID
|
enum class GameID
|
||||||
{
|
{
|
||||||
Global,
|
Global,
|
||||||
|
106
deps/inc/injector/gvm/gvm.hpp
vendored
106
deps/inc/injector/gvm/gvm.hpp
vendored
@ -24,6 +24,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -39,110 +40,11 @@ namespace injector
|
|||||||
* This assumes the executable is decrypted, so, Silent's ASI Loader is recommended.
|
* This assumes the executable is decrypted, so, Silent's ASI Loader is recommended.
|
||||||
*/
|
*/
|
||||||
#ifndef INJECTOR_OWN_GVM
|
#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
|
class game_version_manager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool Detect() { return true; }
|
bool Detect() { return true; }
|
||||||
};
|
};
|
||||||
#endif // INJECTOR_GVM_DUMMY
|
|
||||||
#endif // INJECTOR_OWN_GVM
|
#endif // INJECTOR_OWN_GVM
|
||||||
|
|
||||||
|
|
||||||
@ -189,12 +91,6 @@ class address_manager : public game_version_manager
|
|||||||
return singleton().translate(p);
|
return singleton().translate(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
static void set_name(const char* modname)
|
|
||||||
{
|
|
||||||
singleton().PluginName = modname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Functors for memory translation:
|
// Functors for memory translation:
|
||||||
|
|
||||||
|
91
deps/inc/injector/injector.hpp
vendored
91
deps/inc/injector/injector.hpp
vendored
@ -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<uint8_t>(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<uint8_t>(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
|
} // namespace
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user