You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Serious Sam patch supports all mods for the vanilla game. But there are also new features available for modders, who wish to utilize the new executable and its features.
Patch detection
In order to determine whether or not your mod is being played with this Serious Sam patch, you can try checking for the existence of PatchAPI symbol like this:
CShellSymbol *pssAPI = _pShell->GetSymbol("PatchAPI", TRUE);
if (pssAPI != NULL) {
// Playing with this Serious Sam patch
} else {
// Playing without this Serious Sam patch
}
API utilization
You can also utilize this API in your own mod by including PatchAPI.h header file into your mod and access this API class using previously retrieved shell symbol like this:
#include"PatchAPI.h"
...
CShellSymbol *pssAPI = _pShell->GetSymbol("PatchAPI", TRUE);
if (pssAPI != NULL) {
CPatchAPI *pAPI = (CPatchAPI *)pssAPI->ss_pvValue;
// Access any of the API fields through the 'pAPI' pointer
}
Or via less direct module handles:
#include"PatchAPI.h"
...
CPatchAPI *pAPI = NULL;
// Get instance of the running executableconst CTFileName fnEXE = _fnmApplicationPath + _fnmApplicationExe;
HMODULE pEXE = GetModuleHandleA(fnEXE);
if (pEXE != NULL) {
// Get API pointer from the executable modulevoid *pPointerToAPI = GetProcAddress(pEXE, "_pPatchAPI");
if (pPointerToAPI != NULL) {
pAPI = *(CPatchAPI **)pPointerToAPI;
}
}
if (pAPI != NULL) {
// Access any of the API fields through the 'pAPI' pointer
}