Skip to content

GameShield Core

Elijah Brown edited this page Apr 10, 2024 · 5 revisions

About GameShield Core Classes

GameShield Core Classes allow you to work with the core core of the toolkit - catching cheating behavior on specific modules, starting and stopping them. The following describes detailed documentation on how to work with the kernel, its methods and events.

Manual Registering GameShield

To get started - add the GameShield prefab to your initial scene, after which you can manually connect and configure modules (if your config was added via Setup Wizzard - it should be initially removed from Resources/Config).

Setup Configuration:

Core.GameShield.Main.LoadConfig(ScriptableObject.CreateInstance<GameShieldConfig>());

Add Module:

Core.GameShield.Main.AddModule<MemoryProtector>(new MemoryProtector.Options {
    // Module Options Here
});

Modules Management at Runtime

While GameShield is running, you can add or remove modules on the fly. To do this, you can access the GameShield internal API:

Core.GameShield.Main.AddModule<MemoryProtector>();

API Reference:

Method Usage
AddModule (generic) Add new module with custom configuration and type
AddModule Add new module with custom configuration and type assembly name
GetModule (generic) Get module by type
RemoveModule (generic) Remove module by type
RemoveAllModules Remove all active modules
GetDeveloperKey Get Developer Key from Configuration
LoadConfig Load Configuration with Rewrite and Force Modules Reload (if it needs)
PauseAllModules Pause Detection for All Modules
StartAllModules Unpause / Start All Detection Modules
ToggleAllModulesDetection Pause / Unpause All Detection Modules

Core Events

You can use Core Events using included in GameShield Pub/Sub Container:

EventMessenger.Main.Subscribe<ApplicationLoopUpdated>(payload => {
    // Work with payload
});

Cheating Detected Event:

EventMessenger.Main.Subscribe<SecurityWarningPayload>(payload => {
    // Work with payload
});

You can read about Event messenger here.

Available Core Events Reference:

Event (Payload) Usage
ApplicationClosePayload On Application Quit
ApplicationPausePayload On Application Paused / Unpaused (Focus / Unfocus)
ApplicationStartedPayload On Application Started
ApplicationLoopUpdated On Application Loop Updated (GameShield Mono Update)
ApplicationFixedLoopUpdated On Application FixedLoop Updated (GameShield Mono FixedUpdate)
RequestCoroutine Request Coroutine at GameShield Mono
StopCoroutine Stop Coroutine at GameShield Mono
SecurityWarningPayload Fired When Cheating Detected at Module
SecurityModuleConfigChanged Fired when some security module configuration is changed
SecurityModuleInitialized Fired when some security module is initialized
SecurityModuleDisconnected Fired when some security module is disconnected
SecurityModulePause Fired when some security module is paused
GetPausedDetectorsCount Get Number of Paused Detectors

GameShield Wiki