This library lets you check if a DLL was loaded into a specific NFS game.
C++17+ is required.
Supported games:
- Underground
v1.4 - Underground 2
v1.2 - Most Wanted 2005
v1.3 - Carbon
v1.4 - Prostreet
v1.1 - Undercover
v1.0.0.1 - Shift
v1.0.2.0 - The Run
v1.1.0.0
To check the game, follow the prototype:
if (NFSVersionManager::is(NFSVersionManager::GameKey::TheGameToCheck)) {
}
else {
}enum class GameKey {
Underground, // Underground v1.4
Underground2, // Underground 2 v1.2
MostWanted, // Most Wanted 2005 v1.3
Carbon, // Carbon v1.4
Prostreet, // ProStreet v1.1
Undercover, // Undercover v1.0.0.1
Shift, // Shift v1.0.2.0
TheRun, // The Run v1.1.0.0
};To reduce verbosity, use the following expression:
using enum NFSVersionManager::GameKey; // Requires C++20+You can now use any enum key listed above without NFSVersionManager::GameKey::.
using enum NFSVersionManager::GameKey;
BOOL WINAPI DllMain(HINSTANCE, DWORD ul_reason_for_call, LPVOID) // DLL entry point
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH) // DLL is being loaded
{
if (!NFSVersionManager::is(MostWanted)) // If the DLL was not loaded into Most Wanted v1.3
{
MessageBoxA(
nullptr,
"This .exe is not compatible. \r\n"
"Use Most Wanted v1.3 executable. \r\n"
"Expected size: 6.029.312 bytes.",
"My Cool Mod by Author123",
MB_ICONERROR
);
return FALSE; // Detach DLL
}
}
return TRUE; // Keep DLL attached
}- See LICENSE
- Kevin4e - Author of the library