# jerwingubat/wand-enhancer architecture

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

- Interactive diagram: https://gitdiagram.com/jerwingubat/wand-enhancer
- Repository: https://github.com/jerwingubat/wand-enhancer

## Overview

WandEnhancer is a local Wand client patcher with an optional LAN remote-control panel. The main workflow is selecting and patching a local installation: the WPF interface delegates to the enhancer, which modifies the ASAR and can install the panel bridge and renderer scripts. Separately, a phone browser connects to the bridge over HTTP/WebSocket to view app and trainer state and issue commands or cheat-value changes. The README also documents client-side configuration, compatibility adjustments, layout/theme customization, and AI features; their internal implementation is not established by the sampled excerpts. Edges are limited to relationships shown by excerpts, SOURCE INDEX references, or README statements.

Main entry points: [`WandEnhancer/Core/Enhancer.cs`](https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/Enhancer.cs) (Enhancer), [`web-panel/bridge/src/server.ts`](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/server.ts) (Bridge server), [`AsarSharp/AsarFileSystem/Disk.cs`](https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarFileSystem/Disk.cs) (Archive access), [`web-panel/src/app/app.tsx`](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/app/app.tsx) (Remote panel app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patching["Local patching"]
  node_enhancer["Enhancer<br/>[Enhancer.cs]"]
  node_patch_config["Patch configuration<br/>[EnhancerConfig.cs]"]
  node_we_mod_config["Client configuration<br/>[WeModConfig.cs]"]
  node_native_fuse["ASAR fuse proxy<br/>[library.c]"]
end

subgraph group_asar["ASAR archive"]
  node_asar_extractor["ASAR extraction<br/>[AsarExtractor.cs]"]
  node_asar_creator["ASAR creation<br/>[AsarCreator.cs]"]
  node_asar_disk["Archive access<br/>[Disk.cs]"]
  node_asar_entries["Archive entries<br/>[FilesystemEntry.cs]"]
  node_integrity["Integrity hashing<br/>[IntegrityHelper.cs]"]
  node_pickle["Pickle encoding<br/>[Pickle.cs]"]
end

subgraph group_bridge["Remote bridge"]
  node_remote_bridge["Bridge server<br/>[server.ts]"]
  node_bridge_state["Bridge state<br/>[bridge-state.ts]"]
  node_protocol_router["Protocol validation<br/>[protocol-router.ts]"]
  node_wire_protocol["Wire messages<br/>[messages.ts]"]
  node_normalizers["State normalizers<br/>[index.ts]"]
  node_wand_runtime["Wand integration<br/>[runtime.ts]"]
end

subgraph group_panel["Remote web panel"]
  node_remote_app["Remote panel app<br/>[app.tsx]"]
  node_remote_hook["Remote session client"]
  node_session_client["WebSocket client"]
  node_trainer_controls["Trainer controls<br/>[CheatControl.tsx]"]
  node_panel_storage[("Panel preferences<br/>[storage.ts]")]
end

subgraph group_desktop["Desktop experience"]
  node_desktop_ui["Patcher UI<br/>[MainWindowVm.cs]"]
  node_localization["Localization"]
  node_settings[("Desktop settings<br/>[SettingsManager.cs]")]
end

node_user(("Wand user"))
node_phone_user(("Phone user"))

node_user -->|"uses"| node_desktop_ui
node_desktop_ui -->|"invokes patching"| node_enhancer
node_enhancer -->|"uses configuration"| node_patch_config
node_enhancer -->|"reads configuration"| node_we_mod_config
node_enhancer -->|"extracts archive"| node_asar_extractor
node_enhancer -->|"creates archive"| node_asar_creator
node_asar_extractor -->|"reads archive"| node_asar_disk
node_asar_disk -->|"uses entries"| node_asar_entries
node_asar_disk -->|"encodes headers"| node_pickle
node_asar_disk -->|"hashes files"| node_integrity
node_enhancer -.->|"installs fuse proxy"| node_native_fuse
node_enhancer -->|"bundles bridge"| node_remote_bridge
node_phone_user -->|"opens panel"| node_remote_app
node_remote_app -->|"uses remote hook"| node_remote_hook
node_remote_hook -.->|"connects session"| node_session_client
node_session_client -->|"WebSocket messages"| node_remote_bridge
node_remote_bridge -->|"validates messages"| node_protocol_router
node_protocol_router -->|"checks contract"| node_wire_protocol
node_remote_bridge -->|"routes state"| node_bridge_state
node_bridge_state -->|"normalizes data"| node_normalizers
node_remote_bridge -.->|"dispatches commands"| node_wand_runtime
node_remote_app -.->|"renders controls"| node_trainer_controls
node_trainer_controls -.->|"sends value changes"| node_session_client
node_remote_app -.->|"stores preferences"| node_panel_storage
node_localization -->|"loads and saves language"| node_settings
node_user -.->|"selects language"| node_localization

click node_desktop_ui "https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/View/MainWindow/MainWindowVm.cs"
click node_enhancer "https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/Enhancer.cs"
click node_patch_config "https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/EnhancerConfig.cs"
click node_we_mod_config "https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Models/WeModConfig.cs"
click node_asar_extractor "https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarExtractor.cs"
click node_asar_creator "https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarCreator.cs"
click node_asar_disk "https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarFileSystem/Disk.cs"
click node_asar_entries "https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarFileSystem/FilesystemEntry.cs"
click node_integrity "https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/Integrity/IntegrityHelper.cs"
click node_pickle "https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/PickleTools/Pickle.cs"
click node_native_fuse "https://github.com/jerwingubat/wand-enhancer/blob/master/tools/asar-fuses-bypass/library.c"
click node_remote_bridge "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/server.ts"
click node_bridge_state "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/bridge-state.ts"
click node_protocol_router "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/protocol-router.ts"
click node_wire_protocol "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/protocol/messages.ts"
click node_normalizers "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/normalizers/index.ts"
click node_wand_runtime "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/wand/runtime.ts"
click node_remote_app "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/app/app.tsx"
click node_remote_hook "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/app/use-remote-panel.ts"
click node_session_client "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/remote-session/remote-session.client.ts"
click node_trainer_controls "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/trainer/controls/CheatControl.tsx"
click node_panel_storage "https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/shared/storage.ts"
click node_localization "https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/Services/LocalizationManager.cs"
click node_settings "https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/Services/SettingsManager.cs"

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_enhancer,node_patch_config,node_we_mod_config,node_native_fuse,node_user,node_phone_user toneBlue
class node_asar_extractor,node_asar_creator,node_asar_disk,node_asar_entries,node_integrity,node_pickle toneAmber
class node_remote_bridge,node_bridge_state,node_protocol_router,node_wire_protocol,node_normalizers,node_wand_runtime toneMint
class node_remote_app,node_remote_hook,node_session_client,node_trainer_controls,node_panel_storage toneRose
class node_desktop_ui,node_localization,node_settings toneIndigo
```

## Components

### Local patching

- [Enhancer](https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/Enhancer.cs): `WandEnhancer/Core/Enhancer.cs`
- [Patch configuration](https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/EnhancerConfig.cs): `WandEnhancer/Core/EnhancerConfig.cs`
- [Client configuration](https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Models/WeModConfig.cs): `WandEnhancer/Models/WeModConfig.cs`
- [ASAR fuse proxy](https://github.com/jerwingubat/wand-enhancer/blob/master/tools/asar-fuses-bypass/library.c): `tools/asar-fuses-bypass/library.c`

### ASAR archive

- [ASAR extraction](https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarExtractor.cs): `AsarSharp/AsarExtractor.cs`
- [ASAR creation](https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarCreator.cs): `AsarSharp/AsarCreator.cs`
- [Archive access](https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarFileSystem/Disk.cs): `AsarSharp/AsarFileSystem/Disk.cs`
- [Archive entries](https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/AsarFileSystem/FilesystemEntry.cs): `AsarSharp/AsarFileSystem/FilesystemEntry.cs`
- [Integrity hashing](https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/Integrity/IntegrityHelper.cs): `AsarSharp/Integrity/IntegrityHelper.cs`
- [Pickle encoding](https://github.com/jerwingubat/wand-enhancer/blob/master/AsarSharp/PickleTools/Pickle.cs): `AsarSharp/PickleTools/Pickle.cs`

### Remote bridge

- [Bridge server](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/server.ts): `web-panel/bridge/src/server.ts`
- [Bridge state](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/bridge-state.ts): `web-panel/bridge/src/bridge-state.ts`
- [Protocol validation](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/protocol-router.ts): `web-panel/bridge/src/protocol-router.ts`
- [Wire messages](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/protocol/messages.ts): `web-panel/protocol/messages.ts`
- [State normalizers](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/normalizers/index.ts): `web-panel/bridge/src/normalizers/index.ts`
- [Wand integration](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/bridge/src/wand/runtime.ts): `web-panel/bridge/src/wand/runtime.ts`

### Remote web panel

- [Remote panel app](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/app/app.tsx): `web-panel/src/app/app.tsx`
- [Remote session client](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/app/use-remote-panel.ts): `web-panel/src/app/use-remote-panel.ts`
- [WebSocket client](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/remote-session/remote-session.client.ts): `web-panel/src/remote-session/remote-session.client.ts`
- [Trainer controls](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/trainer/controls/CheatControl.tsx): `web-panel/src/trainer/controls/CheatControl.tsx`
- [Panel preferences](https://github.com/jerwingubat/wand-enhancer/blob/master/web-panel/src/shared/storage.ts): `web-panel/src/shared/storage.ts`

### Desktop experience

- [Patcher UI](https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/View/MainWindow/MainWindowVm.cs): `WandEnhancer/View/MainWindow/MainWindowVm.cs`
- [Localization](https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/Services/LocalizationManager.cs): `WandEnhancer/Core/Services/LocalizationManager.cs`
- [Desktop settings](https://github.com/jerwingubat/wand-enhancer/blob/master/WandEnhancer/Core/Services/SettingsManager.cs): `WandEnhancer/Core/Services/SettingsManager.cs`

### Other components

- **Wand user**
- **Phone user**

## Connections

- Wand user → Patcher UI: uses (evidence: `README.md`)
- Patcher UI → Enhancer: invokes patching (evidence: `WandEnhancer/View/MainWindow/MainWindowVm.cs`)
- Enhancer → Patch configuration: uses configuration (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Enhancer → Client configuration: reads configuration (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Enhancer → ASAR extraction: extracts archive (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Enhancer → ASAR creation: creates archive (evidence: `WandEnhancer/Core/Enhancer.cs`)
- ASAR extraction → Archive access: reads archive (evidence: `AsarSharp/AsarExtractor.cs`)
- Archive access → Archive entries: uses entries (evidence: `AsarSharp/AsarFileSystem/Disk.cs`)
- Archive access → Pickle encoding: encodes headers (evidence: `AsarSharp/AsarFileSystem/Disk.cs`)
- Archive access → Integrity hashing: hashes files (evidence: `AsarSharp/AsarFileSystem/Disk.cs`)
- Enhancer → ASAR fuse proxy: installs fuse proxy (evidence: `README.md`)
- Enhancer → Bridge server: bundles bridge (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Phone user → Remote panel app: opens panel (evidence: `README.md`)
- Remote panel app → Remote session client: uses remote hook (evidence: `web-panel/src/app/app.tsx`)
- Remote session client → WebSocket client: connects session
- WebSocket client → Bridge server: WebSocket messages (evidence: `web-panel/src/remote-session/remote-session.client.ts`)
- Bridge server → Protocol validation: validates messages (evidence: `web-panel/bridge/src/server.ts`)
- Protocol validation → Wire messages: checks contract (evidence: `web-panel/bridge/src/protocol-router.ts`)
- Bridge server → Bridge state: routes state (evidence: `web-panel/bridge/src/server.ts`)
- Bridge state → State normalizers: normalizes data (evidence: `web-panel/bridge/src/bridge-state.ts`)
- Bridge server → Wand integration: dispatches commands
- Remote panel app → Trainer controls: renders controls
- Trainer controls → WebSocket client: sends value changes
- Remote panel app → Panel preferences: stores preferences
- Localization → Desktop settings: loads and saves language (evidence: `WandEnhancer/Core/Services/LocalizationManager.cs`)
- Wand user → Localization: selects language
