# xboxemulationhub/dusklight-uwp architecture

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

- Interactive diagram: https://gitdiagram.com/xboxemulationhub/dusklight-uwp
- Repository: https://github.com/xboxemulationhub/dusklight-uwp

## Overview

Dusklight is a reverse-engineered Twilight Princess reimplementation. The documented user flow is to launch the app, select a supported game dump, and play. The tree and excerpts indicate gameplay, process scheduling, events, controller input, audio, and rendering support, but most gameplay subsystems were not sampled; dashed links mark likely runtime relationships that cannot be verified here.

Main entry points: [`src/f_pc/f_pc_manager.cpp`](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/f_pc/f_pc_manager.cpp) (Process Manager), [`src/m_Do/m_Do_controller_pad.cpp`](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/m_Do/m_Do_controller_pad.cpp) (Gamepad Adapter), [`src/dusk/main.cpp`](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/dusk/main.cpp) (Game Entry), [`include/d/actor`](https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/d/actor) (Actors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_scheduler["Process Manager<br/>[f_pc_manager.cpp]"]
  node_game_loop["Game Entry<br/>[main.cpp]"]
end

subgraph group_gameplay["Gameplay Systems"]
  node_player["Player"]
  node_actors["Actors"]
  node_game_state["Game State"]
  node_events["Event Manager"]
end

subgraph group_platform["Platform Input"]
  node_game_pad["Gamepad Adapter"]
  node_controller_config["Controller Settings"]
  node_wii_input["Wii Input"]
  node_android_hid["Android HID"]
end

subgraph group_media["Audio and Rendering"]
  node_audio["Audio"]
  node_particles["Particles"]
  node_graphics["Graphics"]
end

node_user(("Player"))
node_game_dump["Game Dump"]

node_user -.->|"launches"| node_game_loop
node_user -->|"selects"| node_game_dump
node_game_dump -.->|"loads for play"| node_game_loop
node_game_loop -.->|"runs"| node_scheduler
node_scheduler -->|"executes"| node_actors
node_scheduler -->|"draws"| node_graphics
node_scheduler -->|"pauses"| node_audio
node_events -->|"reads resources"| node_game_state
node_player -.->|"reads controls"| node_game_pad
node_game_pad -->|"uses interface"| node_wii_input
node_controller_config -.->|"configures"| node_game_pad
node_android_hid -.->|"provides input"| node_game_pad
node_game_state -.->|"manages events"| node_events
node_actors -.->|"emits effects"| node_particles

click node_player "https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/d/actor"
click node_actors "https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/d/actor"
click node_game_state "https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/d"
click node_events "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/d/d_event_manager.cpp"
click node_scheduler "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/f_pc/f_pc_manager.cpp"
click node_game_loop "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/dusk/main.cpp"
click node_game_pad "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/m_Do/m_Do_controller_pad.cpp"
click node_controller_config "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/dusk/ui/controller_config.cpp"
click node_wii_input "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/m_Re/m_Re_controller_pad.cpp"
click node_android_hid "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/platforms/android/app/src/main/java/org/libsdl/app/HIDDeviceManager.java"
click node_audio "https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/Z2AudioLib"
click node_particles "https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/libs/JSystem/src/JParticle/JPAEmitterManager.cpp"
click node_graphics "https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/SSystem/SComponent"

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_scheduler,node_game_loop toneBlue
class node_player,node_actors,node_game_state,node_events toneAmber
class node_game_pad,node_controller_config,node_wii_input,node_android_hid toneMint
class node_audio,node_particles,node_graphics toneRose
class node_user,node_game_dump toneIndigo
```

## Components

### Game Runtime

- [Process Manager](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/f_pc/f_pc_manager.cpp): `src/f_pc/f_pc_manager.cpp`
- [Game Entry](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/dusk/main.cpp): `src/dusk/main.cpp`

### Gameplay Systems

- [Player](https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/d/actor): `include/d/actor`
- [Actors](https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/d/actor): `include/d/actor`
- [Game State](https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/d): `include/d`
- [Event Manager](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/d/d_event_manager.cpp): `src/d/d_event_manager.cpp`

### Platform Input

- [Gamepad Adapter](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/m_Do/m_Do_controller_pad.cpp): `src/m_Do/m_Do_controller_pad.cpp`
- [Controller Settings](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/dusk/ui/controller_config.cpp): `src/dusk/ui/controller_config.cpp`
- [Wii Input](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/src/m_Re/m_Re_controller_pad.cpp): `src/m_Re/m_Re_controller_pad.cpp`
- [Android HID](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/platforms/android/app/src/main/java/org/libsdl/app/HIDDeviceManager.java): `platforms/android/app/src/main/java/org/libsdl/app/HIDDeviceManager.java`

### Audio and Rendering

- [Audio](https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/Z2AudioLib): `include/Z2AudioLib`
- [Particles](https://github.com/xboxemulationhub/dusklight-uwp/blob/uwp-compat/libs/JSystem/src/JParticle/JPAEmitterManager.cpp): `libs/JSystem/src/JParticle/JPAEmitterManager.cpp`
- [Graphics](https://github.com/xboxemulationhub/dusklight-uwp/tree/uwp-compat/include/SSystem/SComponent): `include/SSystem/SComponent`

### Other components

- **Player**
- **Game Dump**

## Connections

- Player → Game Entry: launches
- Player → Game Dump: selects
- Game Dump → Game Entry: loads for play
- Game Entry → Process Manager: runs
- Process Manager → Actors: executes (evidence: `src/f_pc/f_pc_manager.cpp`)
- Process Manager → Graphics: draws (evidence: `src/f_pc/f_pc_manager.cpp`)
- Process Manager → Audio: pauses (evidence: `src/f_pc/f_pc_manager.cpp`)
- Event Manager → Game State: reads resources (evidence: `src/d/d_event_manager.cpp`)
- Player → Gamepad Adapter: reads controls
- Gamepad Adapter → Wii Input: uses interface (evidence: `src/m_Do/m_Do_controller_pad.cpp`)
- Controller Settings → Gamepad Adapter: configures
- Android HID → Gamepad Adapter: provides input
- Game State → Event Manager: manages events (evidence: `src/d/d_event_manager.cpp`)
- Actors → Particles: emits effects
