# morerokk/mhgurecomp architecture

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

- Interactive diagram: https://gitdiagram.com/morerokk/mhgurecomp
- Repository: https://github.com/morerokk/mhgurecomp

## Overview

MHGU Recomp is a native port that statically recompiles the Switch game’s ARM code to C and runs it with host implementations of Switch services and NVN over Vulkan. The main workflow is to provide the game files, launch the runtime, and play; Android adds an import-and-launch path. Major branches include multiplayer, mods and engine modules, graphics/settings, and the separately runnable lobby server. The graph uses README statements and sampled caller references; unsampled feature links are omitted where their wiring is not shown.

Main entry points: [`runtime/main.c`](https://github.com/morerokk/mhgurecomp/blob/master/runtime/main.c) (Runtime entry), [`android/java/io/github/morerokk/mhgurecomp/ImportActivity.java`](https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/ImportActivity.java) (Game import), [`android/java/io/github/morerokk/mhgurecomp/MHGUActivity.java`](https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/MHGUActivity.java) (Android launcher), [`runtime/hle`](https://github.com/morerokk/mhgurecomp/tree/master/runtime/hle) (Guest HLE)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_recomp["Recompilation and runtime"]
  node_lifter["ARM lifter<br/>[lifter.py]"]
  node_generator["C generator<br/>[gen.py]"]
  node_entry["Runtime entry<br/>[main.c]"]
  node_loader["Game loader<br/>[loader.c]"]
  node_gamelib["Game library<br/>[gamelib.c]"]
  node_hle["Guest HLE"]
  node_kernel["Guest kernel<br/>[kernel.c]"]
  node_services["System services"]
  node_updater["Updater<br/>[updater.c]"]
end

subgraph group_graphics["Graphics and controls"]
  node_config["Settings<br/>[config.c]"]
  node_settingsui["Settings UI<br/>[settings_panel.cpp]"]
  node_input["Input support<br/>[host_input.c]"]
  node_nvn["NVN compatibility<br/>[objects.c]"]
  node_vulkan["Vulkan renderer<br/>[exec.c]"]
end

subgraph group_multiplayer["Multiplayer"]
  node_ldn["Local wireless<br/>[ldn.c]"]
  node_roomsrv["Lobby server<br/>[server.go]"]
  node_ryusrv["RyuLdn server<br/>[server.cpp]"]
end

subgraph group_extensions["Mods and extensions"]
  node_mods["Mods<br/>[mods.c]"]
  node_modules["Engine modules<br/>[engine_module.c]"]
end

subgraph group_android["Android app"]
  node_androidimport["Game import"]
  node_androidapp["Android launcher<br/>[MHGUActivity.java]"]
  node_androidlogs["Log viewer<br/>[LogActivity.java]"]
end

node_player(("Player"))
node_gamefiles["Game files"]

node_player -->|"imports files"| node_androidimport
node_androidimport -.->|"prepares files"| node_gamefiles
node_player -->|"launches game"| node_entry
node_gamefiles -->|"provides inputs"| node_entry
node_entry -->|"loads library"| node_gamelib
node_entry -->|"loads executable"| node_loader
node_lifter -->|"feeds generator"| node_generator
node_entry -->|"initializes features"| node_hle
node_entry -->|"sets up kernel"| node_kernel
node_hle -.->|"implements services"| node_services
node_player -->|"configures game"| node_settingsui
node_settingsui -.->|"saves settings"| node_config
node_player -->|"controls game"| node_input
node_nvn -->|"renders through"| node_vulkan
node_player -->|"joins multiplayer"| node_ldn
node_ldn -->|"uses lobby service"| node_roomsrv
node_player -->|"hosts lobby"| node_ryusrv
node_entry -->|"initializes mods"| node_mods
node_entry -->|"loads modules"| node_modules
node_androidapp -.->|"supports import"| node_androidimport
node_androidapp -->|"opens logs"| node_androidlogs
node_player -->|"updates runtime"| node_updater

click node_lifter "https://github.com/morerokk/mhgurecomp/blob/master/tools/lifter.py"
click node_generator "https://github.com/morerokk/mhgurecomp/blob/master/tools/gen.py"
click node_entry "https://github.com/morerokk/mhgurecomp/blob/master/runtime/main.c"
click node_loader "https://github.com/morerokk/mhgurecomp/blob/master/runtime/loader.c"
click node_gamelib "https://github.com/morerokk/mhgurecomp/blob/master/runtime/gamelib.c"
click node_hle "https://github.com/morerokk/mhgurecomp/tree/master/runtime/hle"
click node_kernel "https://github.com/morerokk/mhgurecomp/blob/master/runtime/kernel.c"
click node_services "https://github.com/morerokk/mhgurecomp/tree/master/runtime/services"
click node_config "https://github.com/morerokk/mhgurecomp/blob/master/runtime/config.c"
click node_settingsui "https://github.com/morerokk/mhgurecomp/blob/master/runtime/settings_panel.cpp"
click node_input "https://github.com/morerokk/mhgurecomp/blob/master/runtime/host_input.c"
click node_nvn "https://github.com/morerokk/mhgurecomp/blob/master/runtime/nvn/objects.c"
click node_vulkan "https://github.com/morerokk/mhgurecomp/blob/master/runtime/nvn/vulkan/exec.c"
click node_ldn "https://github.com/morerokk/mhgurecomp/blob/master/runtime/net/ldn.c"
click node_roomsrv "https://github.com/morerokk/mhgurecomp/blob/master/server/server.go"
click node_ryusrv "https://github.com/morerokk/mhgurecomp/blob/master/runtime/net/ryusrv/server.cpp"
click node_mods "https://github.com/morerokk/mhgurecomp/blob/master/runtime/mods.c"
click node_modules "https://github.com/morerokk/mhgurecomp/blob/master/runtime/engine_module.c"
click node_androidimport "https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/ImportActivity.java"
click node_androidapp "https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/MHGUActivity.java"
click node_androidlogs "https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/LogActivity.java"
click node_updater "https://github.com/morerokk/mhgurecomp/blob/master/updater/updater.c"

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_lifter,node_generator,node_entry,node_loader,node_gamelib,node_hle,node_kernel,node_services,node_updater toneBlue
class node_config,node_settingsui,node_input,node_nvn,node_vulkan toneAmber
class node_ldn,node_roomsrv,node_ryusrv toneMint
class node_mods,node_modules toneRose
class node_androidimport,node_androidapp,node_androidlogs,node_player,node_gamefiles toneIndigo
```

## Components

### Recompilation and runtime

- [ARM lifter](https://github.com/morerokk/mhgurecomp/blob/master/tools/lifter.py): `tools/lifter.py`
- [C generator](https://github.com/morerokk/mhgurecomp/blob/master/tools/gen.py): `tools/gen.py`
- [Runtime entry](https://github.com/morerokk/mhgurecomp/blob/master/runtime/main.c): `runtime/main.c`
- [Game loader](https://github.com/morerokk/mhgurecomp/blob/master/runtime/loader.c): `runtime/loader.c`
- [Game library](https://github.com/morerokk/mhgurecomp/blob/master/runtime/gamelib.c): `runtime/gamelib.c`
- [Guest HLE](https://github.com/morerokk/mhgurecomp/tree/master/runtime/hle): `runtime/hle`
- [Guest kernel](https://github.com/morerokk/mhgurecomp/blob/master/runtime/kernel.c): `runtime/kernel.c`
- [System services](https://github.com/morerokk/mhgurecomp/tree/master/runtime/services): `runtime/services`
- [Updater](https://github.com/morerokk/mhgurecomp/blob/master/updater/updater.c): `updater/updater.c`

### Graphics and controls

- [Settings](https://github.com/morerokk/mhgurecomp/blob/master/runtime/config.c): `runtime/config.c`
- [Settings UI](https://github.com/morerokk/mhgurecomp/blob/master/runtime/settings_panel.cpp): `runtime/settings_panel.cpp`
- [Input support](https://github.com/morerokk/mhgurecomp/blob/master/runtime/host_input.c): `runtime/host_input.c`
- [NVN compatibility](https://github.com/morerokk/mhgurecomp/blob/master/runtime/nvn/objects.c): `runtime/nvn/objects.c`
- [Vulkan renderer](https://github.com/morerokk/mhgurecomp/blob/master/runtime/nvn/vulkan/exec.c): `runtime/nvn/vulkan/exec.c`

### Multiplayer

- [Local wireless](https://github.com/morerokk/mhgurecomp/blob/master/runtime/net/ldn.c): `runtime/net/ldn.c`
- [Lobby server](https://github.com/morerokk/mhgurecomp/blob/master/server/server.go): `server/server.go`
- [RyuLdn server](https://github.com/morerokk/mhgurecomp/blob/master/runtime/net/ryusrv/server.cpp): `runtime/net/ryusrv/server.cpp`

### Mods and extensions

- [Mods](https://github.com/morerokk/mhgurecomp/blob/master/runtime/mods.c): `runtime/mods.c`
- [Engine modules](https://github.com/morerokk/mhgurecomp/blob/master/runtime/engine_module.c): `runtime/engine_module.c`

### Android app

- [Game import](https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/ImportActivity.java): `android/java/io/github/morerokk/mhgurecomp/ImportActivity.java`
- [Android launcher](https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/MHGUActivity.java): `android/java/io/github/morerokk/mhgurecomp/MHGUActivity.java`
- [Log viewer](https://github.com/morerokk/mhgurecomp/blob/master/android/java/io/github/morerokk/mhgurecomp/LogActivity.java): `android/java/io/github/morerokk/mhgurecomp/LogActivity.java`

### Other components

- **Player**
- **Game files**

## Connections

- Player → Game import: imports files
- Game import → Game files: prepares files
- Player → Runtime entry: launches game
- Game files → Runtime entry: provides inputs
- Runtime entry → Game library: loads library (evidence: `runtime/main.c`)
- Runtime entry → Game loader: loads executable (evidence: `runtime/main.c`)
- ARM lifter → C generator: feeds generator (evidence: `tools/lifter.py`)
- Runtime entry → Guest HLE: initializes features (evidence: `runtime/main.c`)
- Runtime entry → Guest kernel: sets up kernel (evidence: `runtime/main.c`)
- Guest HLE → System services: implements services
- Player → Settings UI: configures game
- Settings UI → Settings: saves settings
- Player → Input support: controls game
- NVN compatibility → Vulkan renderer: renders through
- Player → Local wireless: joins multiplayer
- Local wireless → Lobby server: uses lobby service (evidence: `runtime/net/ldn.c`)
- Player → RyuLdn server: hosts lobby
- Runtime entry → Mods: initializes mods (evidence: `runtime/main.c`)
- Runtime entry → Engine modules: loads modules (evidence: `runtime/main.c`)
- Android launcher → Game import: supports import
- Android launcher → Log viewer: opens logs (evidence: `android/java/io/github/morerokk/mhgurecomp/MHGUActivity.java`)
- Player → Updater: updates runtime
