An unofficial .NET SDK for Cheat Engine plugins.
Get started · Examples · API guide · Diagnostics · Contributing
CheatEngine.SDK lets you write Cheat Engine 7.7 plugins in C#. It packages the plugin-facing libraries, source generators, and analyzers needed to generate the entry point Cheat Engine loads and to expose C# methods to Lua. It is an independent project and is not affiliated with Cheat Engine.
| Requirement | Supported version |
|---|---|
| .NET SDK | 10.0.401 (or a later SDK selected through latestFeature) |
| .NET runtimes | .NET 10 Microsoft.NETCore.App, Microsoft.WindowsDesktop.App, and Microsoft.AspNetCore.App |
| Cheat Engine | 7.7 |
| Platform | Windows x64 |
Cheat Engine must be configured to run on .NET 10.
The live-plugin guide explains the required
ce.runtimeconfig.json changes.
Create a class library and add the package:
dotnet new classlib -n MyPlugin
cd MyPlugin
dotnet add package CheatEngine.SDK --prereleaseSet <PlatformTarget>x64</PlatformTarget> and <AllowUnsafeBlocks>true</AllowUnsafeBlocks> in the project file. A
[LuaFunction] export needs the explicit unsafe opt-in for its generated registration thunk; the package supplies the
dynamic-loading default and copies its bundled Lua bridge into the plugin output on Windows.
Replace the generated class with a plugin class and a Lua-callable method:
using CheatEngine.SDK.Annotations.Lua;
using CheatEngine.SDK.Annotations.Plugin;
using CheatEngine.SDK.Hosting.Plugin;
using CheatEngine.SDK.Lua.Registration;
using CheatEngine.SDK.Lua.Runtime;
namespace MyPlugin;
[CheatEnginePlugin("My Plugin")]
public sealed class HelloPlugin : CheatEnginePlugin
{
private LuaRegistrationLease? _commands;
protected override void OnEnable()
{
using var operation = LuaRuntime.AcquireOperation();
var registration = Commands.TryRegisterLuaFunctions(operation.State);
if (!registration.IsSuccess)
{
_ = registration.Lease?.ReleaseWithOutcome(operation.State);
throw new InvalidOperationException(registration.Kind.ToString());
}
_commands = registration.Lease;
}
protected override void OnDisable() => _commands?.Dispose();
}
internal static partial class Commands
{
[LuaFunction("greet")]
public static string Greet(string name) => $"Hello, {name}!";
}Build the project, then keep the complete output directory together when loading MyPlugin.dll from Cheat Engine's
plugin settings:
dotnet build -c ReleaseAfter enabling the plugin, run print(greet("world")) in Cheat Engine's Lua Engine window. For a fuller walkthrough,
start with Example 01.
The repository pins the .NET SDK in global.json. From the repository root:
dotnet restore CheatEngine.SDK.slnx
dotnet build CheatEngine.SDK.slnx -c Debug --no-restore
dotnet test --solution CheatEngine.SDK.slnx -c Debug --fail-skips on
dotnet test --solution CheatEngine.SDK.slnx -c Release
dotnet pack src/CheatEngine.SDK -c Release -o artifacts/nugetOrdinary managed builds use the checked-in Windows x64 Lua bridge, so they do not require a C toolchain. Contributors
changing native/cheatengine-sdk-lua-bridge need xmake and a Windows x64
C toolchain to rebuild it.
| Path | Purpose |
|---|---|
libs/ |
Layered annotations, ABI, Lua, engine, and hosting libraries. |
src/CheatEngine.SDK/ |
The CheatEngine.SDK NuGet package and consumer build properties. |
source-generators/ |
Generated plugin entry-point and Lua-binding components. |
analyzers/ |
Diagnostics, code fixes, and their documentation. |
native/ |
The Lua test fixture and bundled Windows x64 Lua protection bridge. |
tests/ |
Unit tests, benchmarks, shared fixtures, and the live-plugin sample. |
exemples/ |
Guides, recipes, and API documentation. The directory name is intentional. |
eng/ |
Shared build configuration. |
MIT. Cheat Engine is licensed separately. The Lua DLL retained under
native/cheat-engine is a test fixture under Cheat Engine's terms and is not included
in the NuGet package.