• Hello
Search Results for

    Show / Hide Table of Contents

    Desktop - Mod Loader - Detector (Pro)

    A mod loader is a tool that loads other people's code into your game. BepInEx, MelonLoader, and UnityDoorstop are well-known ones. With that code a player can change almost anything in a Windows, macOS, or Linux build.

    Anti-Cheat cannot stop a mod loader from starting. This detector notices it, so you can react.

    This detector needs the Pro version.

    Walkthrough: Protecting a desktop build.

    Do you need to add it?

    Most of the time, no. The predefined Anti-Cheat-Monitor prefab already includes the Desktop Mod Loader Detector.

    If you use your own monitor prefab, drag the detector prefab onto the monitor in your prefab so it becomes a child.

    The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.

    The component is DesktopModLoaderDetector (namespace GUPS.AntiCheat.Detector.Desktop). It does not need a monitor.

    Settings

    On the detector

    The DesktopModLoaderDetector in the Inspector.

    • Is Active (isActive, bool, default on): Turns the detector on or off.
    • Possibility Of False Positive (possibilityOfFalsePositive, float, range 0 to 1, default 0.02): How likely a find is a false alarm. It is low, because the names it looks for are very specific.
    • Threat Rating (threatRating, uint, default 500): How much one find adds to the threat score of the Anti-Cheat Monitor. It is high, because a mod loader can change the whole game.
    • On Cheating Detection Event (OnCheatingDetectionEvent): Your own reactions. Assign a method here.
    • Check Only On Game Start (CheckOnlyOnGameStart, bool, default off): On means it checks once. Off means it checks again and again. Leave it off, because a mod loader can be added later.
    • Recheck Interval For Possible Cheating (RecheckIntervalForPossibleCheating, float, range 1 to 600, default 30): Seconds between two checks.

    In the project settings

    Open Edit > Project Settings > GuardingPearSoftware > AntiCheat. Select the Desktop tab and go to Desktop - Mod Loader - Settings.

    The mod loader settings.

    • Detect mod loaders (Desktop_DetectModLoader, default on): The main switch. Off means the detector reports nothing.
    • Assembly name prefixes (Desktop_ModLoader_AssemblyPrefixes): An assembly is a file with compiled code. A loaded assembly whose name starts with one of these counts as a mod loader. Upper and lower case do not matter. The shipped list has BepInEx, MelonLoader, HarmonyLib, 0Harmony, MonoMod, and more.
    • File / folder names (Desktop_ModLoader_FileNames): Files or folders next to the game that belong to a mod loader. A folder name must end with /. The shipped list has BepInEx/, MelonLoader/, Mods/, doorstop_config.ini, and more.
    • Hijack DLL names (Desktop_ModLoader_HijackDlls): Windows only. These are normal Windows files. They count as a mod loader only when they are loaded from another place, such as the game folder. The shipped list has winhttp.dll and version.dll.
    Important

    An empty list finds nothing. There is no hidden built-in list. If you ship one of the listed names yourself, for example HarmonyLib in your own tools, remove that entry.

    What it reports

    When a mod loader is found, the detector sends a DesktopCheatingDetectionStatus:

    public struct DesktopCheatingDetectionStatus : IDesktopCheatingDetectionStatus
    {
        // How likely this find is a false alarm, from 0 to 1.
        public float PossibilityOfFalsePositive { get; }
    
        // How much this find adds to the threat score.
        public uint ThreatRating { get; }
    
        // What kind of sign was found.
        public EDesktopCheatingType DesktopCheatingType { get; }
    
        // A short text that says what was found.
        public string Evidence { get; }
    }
    

    DesktopCheatingType is one of these:

    MOD_LOADER_ASSEMBLY = 10,  // Loaded code with a mod loader name.
    MOD_LOADER_FILE = 11,      // A mod loader file or folder next to the game.
    MOD_LOADER_INJECTOR = 12   // A mod loader file loaded into the game (Windows only).
    

    Good to know

    • The detector checks when the game starts, and again on the interval. You can also check yourself with ManualScan(), for example after a level load.
    • Each of the three kinds is reported once per session. The threat score does not climb on every repeat check.
    • PossibleCheatingDetected stays true after the first find.
    • A find adds its Threat Rating to the threat score. A higher false-alarm chance makes it add less.
    • The predefined monitor prefab has no punisher. A find only raises the threat score until you react yourself or add a punisher.

    Platforms and requirements

    • Windows, macOS, and Linux standalone builds.
    • Code names and files next to the game are checked on all three. Files loaded into the game are checked on Windows only.
    • No extra plugin is needed.
    Note

    The detector skips the Unity Editor and development builds. Turn on Verify development builds on the Desktop tab to run it there too.

    React to a find

    In the Inspector. Add a method to On Cheating Detection Event. It runs when a mod loader is found.

    In code. Ask the detector:

    var detector = AntiCheatMonitor.Instance.GetDetector<DesktopModLoaderDetector>();
    
    if (detector != null && detector.PossibleCheatingDetected)
    {
        // A mod loader was found.
    }
    

    Or listen, so your code runs at the moment of the find:

    using System;
    using GUPS.AntiCheat;
    using GUPS.AntiCheat.Core.Detector;
    using GUPS.AntiCheat.Detector.Desktop;
    using UnityEngine;
    
    public class ModLoaderLogger : MonoBehaviour, IObserver<IDetectorStatus>
    {
        private void Start()
        {
            var detector = AntiCheatMonitor.Instance.GetDetector<DesktopModLoaderDetector>();
            detector.Subscribe(this);
        }
    
        public void OnNext(IDetectorStatus status)
        {
            if (status is DesktopCheatingDetectionStatus desktopStatus)
            {
                Debug.LogWarning($"Mod loader found: {desktopStatus.DesktopCheatingType} ({desktopStatus.Evidence})");
            }
        }
    
        public void OnError(Exception error) { }
        public void OnCompleted() { }
    }
    

    Back to the Detector overview.

    In This Article
    Back to top GuardingPearSoftware documentation