# philosoph228/reimu architecture

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

- Interactive diagram: https://gitdiagram.com/philosoph228/reimu
- Repository: https://github.com/philosoph228/reimu

## Overview

gfx is a Windows-oriented virtual GUI lab: it combines an in-process desktop/widget system with a deterministic headless window machine and a Win32 compatibility projection. The main interactive workflow sends pointer and key input through the sandbox viewer into virtual windows and Natsu’s docking interaction/controller logic; synchronized layout becomes a painted snapshot. A separate desktop path hosts shell applications, while the projection routes ordinary Win32 calls into virtual windows. The README documents these capabilities; several implementation links below are necessarily omitted because their source was not sampled.

Main entry points: [`gfx/src/gfx/dock/NatsuDockSandbox.cpp`](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockSandbox.cpp) (Dock sandbox), [`gfx/src/gfx/shell/GfxStart.hpp`](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxStart.hpp) (Start menu), [`gfx/src/gfx/shell/GfxShell.hpp`](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxShell.hpp) (Virtual desktop), [`gfx/src/gfx/dock/NatsuDockSandboxViewer.cpp`](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockSandboxViewer.cpp) (Sandbox viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vm["Virtual machine"]
  node_vmcore["GfxVM<br/>[GfxVM.hpp]"]
  node_vuser["Virtual User32<br/>[VirtualUser32.cpp]"]
end

subgraph group_dock["Docking"]
  node_viewer["Sandbox viewer"]
  node_sandbox["Dock sandbox"]
  node_scenario["Dock scenarios"]
  node_natsu["Natsu dock core"]
end

subgraph group_desktop["Desktop apps"]
  node_desktop["Virtual desktop<br/>[GfxShell.hpp]"]
  node_start["Start menu<br/>[GfxStart.hpp]"]
  node_taskbar["Taskbar<br/>[GfxTaskbar.hpp]"]
  node_dockapp["Dock app<br/>[NatsuDockApp.hpp]"]
  node_notepad["Notepad<br/>[NotepadApp.hpp]"]
  node_paint["Panit.ent<br/>[PanitentApp.hpp]"]
end

subgraph group_widgets["Widget system"]
  node_env["Widget environment<br/>[EnvBase.hpp]"]
  node_widgets["Widget toolkit<br/>[Widget.hpp]"]
  node_canvas["Canvas host<br/>[CanvasHost.hpp]"]
  node_graphics["Graphics context"]
end

subgraph group_compat["Win32 projection"]
  node_redirect["Win32 redirect<br/>[Win32Redirect.hpp]"]
  node_demo["Win32 demo<br/>[Win32DemoApp.hpp]"]
end

node_user(("User"))
node_native["Native Win32"]

node_user -->|"interacts with"| node_viewer
node_viewer -->|"routes input"| node_sandbox
node_sandbox -->|"executes commands"| node_natsu
node_sandbox -->|"reads layout"| node_natsu
node_sandbox -->|"creates windows"| node_vmcore
node_viewer -->|"paints snapshot"| node_sandbox
node_scenario -->|"drives scenarios"| node_sandbox
node_desktop -->|"hosts virtual UI"| node_vmcore
node_desktop -->|"shows"| node_start
node_desktop -->|"shows"| node_taskbar
node_start -->|"launches"| node_dockapp
node_start -->|"launches"| node_notepad
node_start -->|"launches"| node_paint
node_start -->|"launches"| node_demo
node_dockapp -->|"uses"| node_sandbox
node_demo -.->|"calls projected APIs"| node_redirect
node_redirect -->|"redirects calls"| node_vuser
node_vuser -->|"manages windows"| node_vmcore
node_native -.->|"runs natively"| node_demo
node_env -->|"manages widgets"| node_widgets
node_env -->|"draws through"| node_canvas
node_canvas -->|"renders with"| node_graphics
node_user -->|"uses"| node_desktop

click node_viewer "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockSandboxViewer.cpp"
click node_sandbox "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockSandbox.cpp"
click node_scenario "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockScenario.cpp"
click node_vmcore "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/GfxVM.hpp"
click node_vuser "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/win32emu/VirtualUser32.cpp"
click node_redirect "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/win32emu/Win32Redirect.hpp"
click node_desktop "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxShell.hpp"
click node_start "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxStart.hpp"
click node_taskbar "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxTaskbar.hpp"
click node_dockapp "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/apps/natsu_dock/NatsuDockApp.hpp"
click node_notepad "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/accessories/notepad/NotepadApp.hpp"
click node_paint "https://github.com/philosoph228/reimu/blob/main/gfx/src/panitent/PanitentApp.hpp"
click node_demo "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/apps/win32_demo/Win32DemoApp.hpp"
click node_env "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/ui/EnvBase.hpp"
click node_widgets "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/ui/Widget.hpp"
click node_canvas "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/ui/CanvasHost.hpp"
click node_graphics "https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/GraphicsContext.hpp"

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_vmcore,node_vuser,node_user toneBlue
class node_viewer,node_sandbox,node_scenario,node_natsu toneAmber
class node_desktop,node_start,node_taskbar,node_dockapp,node_notepad,node_paint toneMint
class node_env,node_widgets,node_canvas,node_graphics toneRose
class node_redirect,node_demo,node_native toneIndigo
```

## Components

### Virtual machine

- [GfxVM](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/GfxVM.hpp): `gfx/src/gfx/GfxVM.hpp`
- [Virtual User32](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/win32emu/VirtualUser32.cpp): `gfx/src/gfx/win32emu/VirtualUser32.cpp`

### Docking

- [Sandbox viewer](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockSandboxViewer.cpp): `gfx/src/gfx/dock/NatsuDockSandboxViewer.cpp`
- [Dock sandbox](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockSandbox.cpp): `gfx/src/gfx/dock/NatsuDockSandbox.cpp`
- [Dock scenarios](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/dock/NatsuDockScenario.cpp): `gfx/src/gfx/dock/NatsuDockScenario.cpp`
- **Natsu dock core**

### Desktop apps

- [Virtual desktop](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxShell.hpp): `gfx/src/gfx/shell/GfxShell.hpp`
- [Start menu](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxStart.hpp): `gfx/src/gfx/shell/GfxStart.hpp`
- [Taskbar](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/GfxTaskbar.hpp): `gfx/src/gfx/shell/GfxTaskbar.hpp`
- [Dock app](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/apps/natsu_dock/NatsuDockApp.hpp): `gfx/src/gfx/shell/apps/natsu_dock/NatsuDockApp.hpp`
- [Notepad](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/accessories/notepad/NotepadApp.hpp): `gfx/src/gfx/shell/accessories/notepad/NotepadApp.hpp`
- [Panit.ent](https://github.com/philosoph228/reimu/blob/main/gfx/src/panitent/PanitentApp.hpp): `gfx/src/panitent/PanitentApp.hpp`

### Widget system

- [Widget environment](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/ui/EnvBase.hpp): `gfx/src/gfx/ui/EnvBase.hpp`
- [Widget toolkit](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/ui/Widget.hpp): `gfx/src/gfx/ui/Widget.hpp`
- [Canvas host](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/ui/CanvasHost.hpp): `gfx/src/gfx/ui/CanvasHost.hpp`
- [Graphics context](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/GraphicsContext.hpp): `gfx/src/gfx/GraphicsContext.hpp`

### Win32 projection

- [Win32 redirect](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/win32emu/Win32Redirect.hpp): `gfx/src/gfx/win32emu/Win32Redirect.hpp`
- [Win32 demo](https://github.com/philosoph228/reimu/blob/main/gfx/src/gfx/shell/apps/win32_demo/Win32DemoApp.hpp): `gfx/src/gfx/shell/apps/win32_demo/Win32DemoApp.hpp`

### Other components

- **User**
- **Native Win32**

## Connections

- User → Sandbox viewer: interacts with
- Sandbox viewer → Dock sandbox: routes input
- Dock sandbox → Natsu dock core: executes commands
- Dock sandbox → Natsu dock core: reads layout
- Dock sandbox → GfxVM: creates windows
- Sandbox viewer → Dock sandbox: paints snapshot
- Dock scenarios → Dock sandbox: drives scenarios
- Virtual desktop → GfxVM: hosts virtual UI
- Virtual desktop → Start menu: shows
- Virtual desktop → Taskbar: shows
- Start menu → Dock app: launches
- Start menu → Notepad: launches
- Start menu → Panit.ent: launches
- Start menu → Win32 demo: launches
- Dock app → Dock sandbox: uses
- Win32 demo → Win32 redirect: calls projected APIs
- Win32 redirect → Virtual User32: redirects calls
- Virtual User32 → GfxVM: manages windows
- Native Win32 → Win32 demo: runs natively
- Widget environment → Widget toolkit: manages widgets
- Widget environment → Canvas host: draws through
- Canvas host → Graphics context: renders with
- User → Virtual desktop: uses
