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:
- Add Concord to your mod project.
- Reference the game assemblies you want to patch.
- Write one or more patch classes.
- Create a
Patcherwith your mod id. - 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.