Class DesktopInstanceLockDetector
Reports a second process of this game on the same machine.
Implements
Inherited Members
Namespace: GUPS.AntiCheat.Detector.Desktop
Assembly: cs.temp.dll.dll
Syntax
public class DesktopInstanceLockDetector : ADetector<IDesktopCheatingDetectionStatus>
Remarks
The check is opt-in through
The first process holds GUPS.AntiCheat.Detector.Desktop.InstanceLock until it quits. A later process that cannot take the same lock reports once. The process that holds the lock does not report. This detector does not close the game. Attach a punisher when a second copy should end the session.
The lock is the handle the running game holds. On Windows that handle is a named mutex. On macOS and Linux it is a lock on an open file. Quitting releases the handle. A crash or a kill releases it too, because the operating system closes the handle when the process is gone, so the next start can take the lock. A start is reported only while a previous process of this game is still running.
Development builds and the Unity editor skip the lock unless
Fields
OnCheatingDetectionEvent
Unity event raised when a second copy is reported. Useful to wire up reactions through the inspector
without writing an
Declaration
public CheatingDetectionEvent<DesktopCheatingDetectionStatus> OnCheatingDetectionEvent
Field Value
| Type | Description |
|---|---|
| CheatingDetectionEvent<DesktopCheatingDetectionStatus> |
Properties
IsSupported
Gets a value indicating whether the detector is supported on the current platform.
Declaration
public override bool IsSupported { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Name
Gets the human-readable name of the detector.
Declaration
public override String Name { get; }
Property Value
| Type | Description |
|---|---|
| String |
Overrides
PossibilityOfFalsePositive
Gets the false-positive likelihood reported with a second-copy detection.
Declaration
public float PossibilityOfFalsePositive { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
PossibleCheatingDetected
Gets a value indicating whether the detector has observed possible cheating activity.
Declaration
public override bool PossibleCheatingDetected { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
ThreatRating
Gets the threat rating reported with every detection. Higher values denote greater perceived threats.
Declaration
public override uint ThreatRating { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.UInt32 |
Overrides
Methods
ManualScan()
Tries the lock once. Returns false when the setting is off, this process holds the lock, or the
lock could not be created. Returns true when another process already holds it.
Declaration
public bool ManualScan()
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
OnCompleted()
Called when an observed subject signals completion.
Declaration
public override void OnCompleted()
Overrides
OnDestroy()
Drops this component's hold. The native lock stays while another component in this process still holds it.
Declaration
protected virtual void OnDestroy()
OnError(Exception)
Called when an observed subject reports an error.
Declaration
public override void OnError(Exception _Error)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | _Error | The error reported by the observed subject. |
Overrides
OnNext(IWatchedSubject)
Called when an observed subject publishes a new status.
Declaration
public override void OnNext(IWatchedSubject _Subject)
Parameters
| Type | Name | Description |
|---|---|---|
| IWatchedSubject | _Subject | The status published by the observed subject. |
Overrides
Start()
Runs the one check at start. There is no recheck: the holder cannot see a later attempt.
Declaration
protected virtual void Start()