Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Mod support

Dreamy Cecil edited this page Jun 30, 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.

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
}

You can also utilize this API in your own mod by including Cecil/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"

...

// Get instance of the running executable
HMODULE pEXE = GetModuleHandle(_fnmApplicationExe.FileName() + ".exe");

if (pEXE != NULL) {
  // Get API pointer from the executable module
  CPatchAPI *pAPI = (CPatchAPI *)GetProcAddress(pEXE, "_pPatchAPI");

  if (pAPI != NULL) {
    // Access any of the API fields through the 'pAPI' pointer
  }
}

Clone this wiki locally