MDB Framework

Runtime IL2CPP modding framework for Unity games. Dumps metadata, generates C# wrappers, builds an SDK, and loads mods β€” all automatically from a single DLL injection.

Encrypted global-metadata.dat? Don’t care.



What is MDB Framework?

MDB Framework is a powerful runtime modding solution for Unity IL2CPP games. It eliminates the complexity of traditional IL2CPP modding by automating the entire workflow:

  1. Automatic Metadata Dumping - Extracts all classes, methods, and fields from the IL2CPP runtime
  2. C# Wrapper Generation - Creates type-safe C# wrappers for all game types
  3. SDK Auto-Building - Compiles a complete modding SDK using MSBuild
  4. CLR Hosting - Hosts .NET Framework 4.0 for managed mod execution
  5. Mod Loading - Auto-discovers and loads mods from the Mods/ folder
  6. Harmony-Style Patching - Declarative method hooking with [Patch] attributes
  7. ImGui Integration - Built-in Dear ImGui overlay with input capture

All of this happens automatically on first injection. Subsequent launches are instant if nothing has changed.


Key Features

πŸš€ Zero-Configuration Setup

Inject MDB_Bridge.dll into your game and you’re done. No manual dumping, no external tools, no complex setup.

🎯 Harmony-Style Patching

[Patch("GameNamespace", "Player")]
[PatchMethod("TakeDamage", 1)]
public static class PlayerPatch
{
    [Prefix]
    public static bool Prefix(IntPtr __instance, int damage)
    {
        // Named parameters map positionally to native args
        // Return false to skip original method
        return true;
    }
}

🎨 Built-in ImGui UI

public override void OnLoad()
{
    ImGuiManager.RegisterCallback(DrawUI, "My Window");
}

private void DrawUI()
{
    if (ImGui.Begin("My Window"))
    {
        ImGui.Text("Hello from MDB!");
    }
    ImGui.End();
}

πŸ”§ Full IL2CPP Bridge Access

IntPtr playerClass = Il2CppBridge.mdb_find_class("Assembly-CSharp", "", "Player");
IntPtr healthField = Il2CppBridge.mdb_get_field(playerClass, "health");
float health = Il2CppBridge.mdb_field_get_value<float>(playerInstance, healthField);

🧬 Generic Type Resolution

Unlike traditional dumpers that erase generics to object, MDB resolves actual type arguments:


How It Works

Inject MDB_Bridge.dll
  β†’ Wait for GameAssembly.dll
  β†’ Resolve IL2CPP API exports
  β†’ Dump all classes/methods/fields with generic type resolution
  β†’ Generate C# wrapper source files
  β†’ Invoke MSBuild to compile GameSDK.ModHost.dll
  β†’ Host .NET CLR (v4.0.30319)
  β†’ Auto-discover and apply [Patch] hooks
  β†’ Load mods from MDB/Mods/
  β†’ Start update loop (~60Hz)

See the Architecture guide for detailed explanation of each step.


Supported Platforms


Example Mods

The framework includes four example mods demonstrating every major API:

Example Difficulty Description
HelloWorld 🟒 Simple Lifecycle, Logger, basic ImGui
UnityDebugInterceptor 🟒 Simple Declarative patching, hooking Debug.Log
GameStats 🟑 Medium Advanced patching, IL2CPP Bridge
MDB_Explorer_ImGui πŸ”΄ Complex Full IL2CPP reflection, scene traversal

All examples target universal Unity types and work across any Unity IL2CPP game.


Get Started

Ready to start modding? Head to the Getting Started guide to:

  1. Prepare your environment
  2. Inject MDB into a Unity game
  3. Create and load your first mod
  4. Learn the mod lifecycle and APIs

Disclaimer

This framework is provided β€œas-is” for educational and research purposes only.

See the full Disclaimer for important legal information.


Acknowledgments

MDB Framework builds upon the excellent work of:


Full Disclaimer

The author(s) of MDB Framework are not responsible for any consequences resulting from the use or misuse of this software. This includes but is not limited to:

Before using MDB Framework:

  1. Read the game’s Terms of Service - Respect the rules
  2. Never use in online/multiplayer - This ruins experiences for others
  3. Use only for single-player - Or games that explicitly allow modding
  4. Understand the risks - You are solely responsible

By using this framework, you acknowledge that you understand these risks and agree to use it responsibly and ethically.