# lom2333/ed9modmanager architecture

> Architecture diagram of the GitHub repository lom2333/ed9modmanager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lom2333/ed9modmanager
- Repository: https://github.com/lom2333/ed9modmanager

## Overview

ED9ModManager combines a GUI mod manager and merge engine with an injected game plugin loader. The principal workflow is: users organize mods and order them in the manager; the orchestrator reads mod patches and game resources, merges scene/TBL data and stages injected scripts/assets in the merged cache; the loader can expose the resulting runtime environment to plugins. The manager also provides standalone TBL and DAT conversion. The excerpts document the orchestrator’s inputs and outputs and selected loader internals; links for unsampled merge stages follow the README and orchestrator header, not inspected implementations.

Main entry points: [`src/modkit/mod_merge_orchestrator.cpp`](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/mod_merge_orchestrator.cpp) (Merge orchestrator), [`tools/mod_manager/mod_manager.cpp`](https://github.com/lom2333/ed9modmanager/blob/1ST/tools/mod_manager/mod_manager.cpp) (Manager GUI), [`src/ed9loader_api.h`](https://github.com/lom2333/ed9modmanager/blob/1ST/src/ed9loader_api.h) (Plugin API), [`src/plugin_loader.cpp`](https://github.com/lom2333/ed9modmanager/blob/1ST/src/plugin_loader.cpp) (Plugin loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_manager["Mod manager"]
  node_gui["Manager GUI<br/>[mod_manager.cpp]"]
end

subgraph group_merge["Merge engine"]
  node_orchestrator["Merge orchestrator"]
  node_scene["Scene merge<br/>[scene_merge.cpp]"]
  node_bjson["BJSON patching<br/>[bjson_patcher.cpp]"]
  node_inject["Scene injection<br/>[scene_inject.cpp]"]
  node_tblmerge["TBL merge<br/>[tbl_merge.cpp]"]
  node_tblcodec["TBL codec<br/>[tbl_codec.cpp]"]
  node_schema["TBL schemas<br/>[tbl_schema.cpp]"]
  node_fpac["FPAC reader<br/>[fpac_reader.cpp]"]
  node_cache[("Merged cache")]
end

subgraph group_loader["Plugin loader"]
  node_proxy["XInput proxy<br/>[xinput_proxy.cpp]"]
  node_loadercore["Plugin loader<br/>[plugin_loader.cpp]"]
  node_api["Plugin API<br/>[ed9loader_api.h]"]
  node_locator["Runtime locator"]
  node_safescan["Safe memory scan<br/>[safe_scan.cpp]"]
  node_console["Command console"]
end

subgraph group_script["Script tools"]
  node_dat["DAT codec<br/>[ed9_dat.cpp]"]
end

node_user(("Mod author"))
node_game(("Game process"))
node_plugins["Plugins"]

node_user -->|"manages mods"| node_gui
node_gui -->|"scans and runs"| node_orchestrator
node_orchestrator -->|"reads archives"| node_fpac
node_orchestrator -->|"merges scenes"| node_scene
node_scene -->|"patches BJSON"| node_bjson
node_orchestrator -->|"merges tables"| node_tblmerge
node_tblmerge -->|"decodes and encodes"| node_tblcodec
node_tblcodec -->|"uses schemas"| node_schema
node_orchestrator -->|"injects scene data"| node_inject
node_orchestrator -->|"writes merged outputs"| node_cache
node_gui -->|"reads reports"| node_cache
node_gui -->|"converts DAT"| node_dat
node_proxy -->|"starts loader"| node_loadercore
node_game -->|"loads proxy"| node_proxy
node_loadercore -->|"runs merge"| node_orchestrator
node_loadercore -->|"loads plugins"| node_plugins
node_plugins -->|"uses API"| node_api
node_api -->|"locates runtime"| node_locator
node_api -->|"reads and writes safely"| node_safescan
node_api -->|"registers commands"| node_console
node_console -->|"dispatches commands"| node_plugins

click node_gui "https://github.com/lom2333/ed9modmanager/blob/1ST/tools/mod_manager/mod_manager.cpp"
click node_orchestrator "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/mod_merge_orchestrator.cpp"
click node_scene "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/scene_merge.cpp"
click node_bjson "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/bjson_patcher.cpp"
click node_inject "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/scene_inject.cpp"
click node_tblmerge "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/tbl_merge.cpp"
click node_tblcodec "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/tbl_codec.cpp"
click node_schema "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/tbl_schema.cpp"
click node_fpac "https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/fpac_reader.cpp"
click node_proxy "https://github.com/lom2333/ed9modmanager/blob/1ST/src/xinput_proxy.cpp"
click node_loadercore "https://github.com/lom2333/ed9modmanager/blob/1ST/src/plugin_loader.cpp"
click node_api "https://github.com/lom2333/ed9modmanager/blob/1ST/src/ed9loader_api.h"
click node_locator "https://github.com/lom2333/ed9modmanager/blob/1ST/src/runtime_locator.cpp"
click node_safescan "https://github.com/lom2333/ed9modmanager/blob/1ST/src/safe_scan.cpp"
click node_console "https://github.com/lom2333/ed9modmanager/blob/1ST/src/command_console.cpp"
click node_dat "https://github.com/lom2333/ed9modmanager/blob/1ST/ed9_dat/ed9_dat.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gui toneBlue
class node_orchestrator,node_scene,node_bjson,node_inject,node_tblmerge,node_tblcodec,node_schema,node_fpac,node_cache toneAmber
class node_proxy,node_loadercore,node_api,node_locator,node_safescan,node_console toneMint
class node_dat toneRose
class node_user,node_game,node_plugins toneIndigo
```

## Components

### Mod manager

- [Manager GUI](https://github.com/lom2333/ed9modmanager/blob/1ST/tools/mod_manager/mod_manager.cpp): `tools/mod_manager/mod_manager.cpp`

### Merge engine

- [Merge orchestrator](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/mod_merge_orchestrator.cpp): `src/modkit/mod_merge_orchestrator.cpp`
- [Scene merge](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/scene_merge.cpp): `src/modkit/scene_merge.cpp`
- [BJSON patching](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/bjson_patcher.cpp): `src/modkit/bjson_patcher.cpp`
- [Scene injection](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/scene_inject.cpp): `src/modkit/scene_inject.cpp`
- [TBL merge](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/tbl_merge.cpp): `src/modkit/tbl_merge.cpp`
- [TBL codec](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/tbl_codec.cpp): `src/modkit/tbl_codec.cpp`
- [TBL schemas](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/tbl_schema.cpp): `src/modkit/tbl_schema.cpp`
- [FPAC reader](https://github.com/lom2333/ed9modmanager/blob/1ST/src/modkit/fpac_reader.cpp): `src/modkit/fpac_reader.cpp`
- **Merged cache**

### Plugin loader

- [XInput proxy](https://github.com/lom2333/ed9modmanager/blob/1ST/src/xinput_proxy.cpp): `src/xinput_proxy.cpp`
- [Plugin loader](https://github.com/lom2333/ed9modmanager/blob/1ST/src/plugin_loader.cpp): `src/plugin_loader.cpp`
- [Plugin API](https://github.com/lom2333/ed9modmanager/blob/1ST/src/ed9loader_api.h): `src/ed9loader_api.h`
- [Runtime locator](https://github.com/lom2333/ed9modmanager/blob/1ST/src/runtime_locator.cpp): `src/runtime_locator.cpp`
- [Safe memory scan](https://github.com/lom2333/ed9modmanager/blob/1ST/src/safe_scan.cpp): `src/safe_scan.cpp`
- [Command console](https://github.com/lom2333/ed9modmanager/blob/1ST/src/command_console.cpp): `src/command_console.cpp`

### Script tools

- [DAT codec](https://github.com/lom2333/ed9modmanager/blob/1ST/ed9_dat/ed9_dat.cpp): `ed9_dat/ed9_dat.cpp`

### Other components

- **Mod author**
- **Game process**
- **Plugins**

## Connections

- Mod author → Manager GUI: manages mods
- Manager GUI → Merge orchestrator: scans and runs
- Merge orchestrator → FPAC reader: reads archives
- Merge orchestrator → Scene merge: merges scenes
- Scene merge → BJSON patching: patches BJSON
- Merge orchestrator → TBL merge: merges tables
- TBL merge → TBL codec: decodes and encodes
- TBL codec → TBL schemas: uses schemas
- Merge orchestrator → Scene injection: injects scene data
- Merge orchestrator → Merged cache: writes merged outputs
- Manager GUI → Merged cache: reads reports
- Manager GUI → DAT codec: converts DAT
- XInput proxy → Plugin loader: starts loader
- Game process → XInput proxy: loads proxy
- Plugin loader → Merge orchestrator: runs merge
- Plugin loader → Plugins: loads plugins
- Plugins → Plugin API: uses API
- Plugin API → Runtime locator: locates runtime
- Plugin API → Safe memory scan: reads and writes safely
- Plugin API → Command console: registers commands
- Command console → Plugins: dispatches commands
