This repository was archived by the owner on Mar 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Mod support
Dreamy Cecil edited this page Jul 6, 2022
·
9 revisions
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.
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
}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 executable
const CTFileName fnEXE = _fnmApplicationPath + _fnmApplicationExe;
HMODULE pEXE = GetModuleHandleA(fnEXE);
if (pEXE != NULL) {
// Get API pointer from the executable module
void *pPointerToAPI = GetProcAddress(pEXE, "_pPatchAPI");
if (pPointerToAPI != NULL) {
pAPI = *(CPatchAPI **)pPointerToAPI;
}
}
if (pAPI != NULL) {
// Access any of the API fields through the 'pAPI' pointer
}