Table of Contents

Getting Started

How to get into Concord depends on what you're trying to do.

I want to use Concord in a mod

Concord isn't ready as a stable mod-author package yet. The intended workflow:

  1. Add Concord to your mod project.
  2. Reference the game assemblies you want to patch.
  3. Write one or more patch classes.
  4. Create a Patcher with your mod id.
  5. Apply your patches when your mod starts.

The finished API should look something like this:

public sealed class MyMod
{
    public MyMod()
    {
        var patcher = new Patcher("example.my-mod");
        patcher.Apply<PricePatch>();
    }
}

That mod id matters. Concord uses it to track which patches belong to you, which helps with ordering, debugging, and clean unpatching.

I want to learn the patch shape

A patch class usually extends the game class it wants to change:

abstract class PricePatch : ShopItem
{
    [Inject(nameof(GetPrice), At.Return)]
    void AfterGetPrice(CallbackInfo<int> ci)
    {
        ci.ReturnValue += 5;
    }
}

You write normal C#. The compiler checks names and types where it can. Concord copies your patch body into a generated wrapper around the real game method. The patched call doesn't allocate marker objects on every invocation.

You won't normally touch WrapperComposer, BodyCopier, or IDetourBackend directly. Those are lower-level pieces used by Concord itself and by contributors.

What you need to know first

You should be comfortable reading C# attributes ([Inject(...)]), inheritance (class MyPatch : TargetType), generic types (CallbackInfo<int>), nameof(...) expressions, and reflection for advanced cases like reverse patches.

You don't need to know Harmony, MonoMod, IL rewriting, or native detours to use the mod-author API.

I'm working on Concord itself

From the repo root:

dotnet build
dotnet test
docfx docfx.json

The tests under tests/Concord.Emit.Tests are the best executable examples of the current low-level API. They cover callback lowering, call-site injection, reverse patches, generics, structs, async methods, and shadow-field remapping.

DocFX writes generated API metadata to api/ and the built site to _site/. Both are generated outputs.

Where to go next

Your First Patch walks through a complete patch example. Common Tasks covers cancelling methods, changing return values, using private fields, and patching calls inside a method. How Patches Work gives you the mental model behind all of it.