# doubleghosty/cool_fox architecture

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

- Interactive diagram: https://gitdiagram.com/doubleghosty/cool_fox
- Repository: https://github.com/doubleghosty/cool_fox

## Overview

cool_fox is an experimental Xbox Series x64 compatibility layer and shader-translation runtime for native Windows D3D12. Its main workflow launches a title, supplies console runtime APIs and graphics behavior, translates console shaders, and submits rendering work to the host GPU. Separate CLI commands inspect and translate shader inputs or pre-warm caches; GPU capture and replay support diagnostics. The graph preserves the major documented rendering, residency, pipeline, and DirectStorage areas. Some connections are documented or indexed rather than visible in the excerpts; uncertain implementation links are omitted.

Main entry points: [`apps/victory/src/main.rs`](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/main.rs) (Victory CLI), [`crates/victory-gpu/src/draw.rs`](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/draw.rs) (Draw translation), [`apps/victory/src/run.rs`](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/run.rs) (Title runner), [`apps/victory/src/translate.rs`](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/translate.rs) (Batch translation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Launch and tools"]
  node_cli["Victory CLI<br/>[main.rs]"]
  node_run["Title runner<br/>[run.rs]"]
  node_inspect["Inspect commands<br/>[inspect.rs]"]
  node_shadercmd["Shader commands<br/>[shader.rs]"]
  node_translatecmd["Batch translation<br/>[translate.rs]"]
  node_warm["Pipeline warming<br/>[warm.rs]"]
end

subgraph group_compat["Console compatibility"]
  node_title["Xbox title"]
  node_loader["Executable loader<br/>[prepare.rs]"]
  node_hle["Console API runtime<br/>[runtime.rs]"]
  node_runtimeapi["Game runtime APIs<br/>[xgameruntime.rs]"]
  node_asyncapi["Async queues<br/>[xasync.rs]"]
  node_dstorage["DirectStorage<br/>[dstorage.rs]"]
  node_storage["Persistent storage<br/>[storage.rs]"]
end

subgraph group_translation["Shader translation"]
  node_shaderinput["Console shader input<br/>[mod.rs]"]
  node_ir["Shader IR<br/>[ir.rs]"]
  node_resourceshader["Shader resources<br/>[resource.rs]"]
  node_emitter["DXIL emitter<br/>[mod.rs]"]
end

subgraph group_rendering["GPU rendering"]
  node_pipelinecache[("Pipeline cache<br/>[cache.rs]")]
  node_gpuobjects["GPU objects<br/>[object.rs]"]
  node_resources["GPU resources<br/>[resource.rs]"]
  node_descriptors["Descriptor heaps<br/>[host.rs]"]
  node_pipelines["Host pipelines<br/>[pipeline.rs]"]
  node_draw["Draw translation<br/>[draw.rs]"]
  node_submission["GPU submission<br/>[queue.rs]"]
end

subgraph group_diagnostics["Diagnostics"]
  node_capture["Capture and replay<br/>[capture.rs]"]
  node_replay["Replay analysis<br/>[play.rs]"]
end

node_user(("Title operator"))

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches run"| node_run
node_cli -->|"dispatches inspect"| node_inspect
node_cli -->|"dispatches shaders"| node_shadercmd
node_cli -->|"dispatches translate"| node_translatecmd
node_cli -->|"dispatches warm"| node_warm
node_run -->|"runs executable"| node_title
node_run -.->|"uses compatibility runtime"| node_hle
node_run -.->|"renders through"| node_pipelines
node_title -->|"calls console APIs"| node_hle
node_hle -->|"registers APIs"| node_runtimeapi
node_runtimeapi -->|"exposes async APIs"| node_asyncapi
node_title -->|"submits storage requests"| node_dstorage
node_title -->|"uses save storage"| node_storage
node_storage -->|"completes requests"| node_asyncapi
node_shadercmd -->|"uses translation flow"| node_translatecmd
node_translatecmd -->|"finds shader inputs"| node_shaderinput
node_shaderinput -->|"decodes into"| node_ir
node_ir -->|"tracks resources"| node_resourceshader
node_resourceshader -->|"feeds emission"| node_emitter
node_emitter -.->|"caches translated shaders"| node_pipelinecache
node_warm -->|"prewarms pipelines"| node_pipelinecache
node_gpuobjects -->|"backs resources"| node_resources
node_resources -->|"provides views"| node_descriptors
node_draw -->|"reads descriptors"| node_descriptors
node_draw -->|"uses resources"| node_resources
node_draw -->|"selects pipeline"| node_pipelines
node_pipelines -.->|"uses cache"| node_pipelinecache
node_draw -.->|"records commands"| node_submission
node_capture -->|"captures work"| node_submission
node_replay -->|"reads captures"| node_capture

click node_cli "https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/main.rs"
click node_run "https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/run.rs"
click node_inspect "https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/inspect.rs"
click node_shadercmd "https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/shader.rs"
click node_translatecmd "https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/translate.rs"
click node_warm "https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/warm.rs"
click node_loader "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-loader/src/prepare.rs"
click node_hle "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/runtime.rs"
click node_runtimeapi "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/xgameruntime.rs"
click node_asyncapi "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/xasync.rs"
click node_dstorage "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/dstorage.rs"
click node_storage "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/storage.rs"
click node_shaderinput "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/gfx10/mod.rs"
click node_ir "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/ir.rs"
click node_resourceshader "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/resource.rs"
click node_emitter "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/emit/mod.rs"
click node_pipelinecache "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-pipeline/src/cache.rs"
click node_gpuobjects "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/object.rs"
click node_resources "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/resource.rs"
click node_descriptors "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/descriptor/host.rs"
click node_pipelines "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/pipeline.rs"
click node_draw "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/draw.rs"
click node_submission "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/queue.rs"
click node_capture "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/capture.rs"
click node_replay "https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/replay/play.rs"

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_cli,node_run,node_inspect,node_shadercmd,node_translatecmd,node_warm toneBlue
class node_title,node_loader,node_hle,node_runtimeapi,node_asyncapi,node_dstorage,node_storage toneAmber
class node_shaderinput,node_ir,node_resourceshader,node_emitter toneMint
class node_pipelinecache,node_gpuobjects,node_resources,node_descriptors,node_pipelines,node_draw,node_submission toneRose
class node_capture,node_replay,node_user toneIndigo
```

## Components

### Launch and tools

- [Victory CLI](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/main.rs): `apps/victory/src/main.rs`
- [Title runner](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/run.rs): `apps/victory/src/run.rs`
- [Inspect commands](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/inspect.rs): `apps/victory/src/inspect.rs`
- [Shader commands](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/shader.rs): `apps/victory/src/shader.rs`
- [Batch translation](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/translate.rs): `apps/victory/src/translate.rs`
- [Pipeline warming](https://github.com/doubleghosty/cool_fox/blob/main/apps/victory/src/warm.rs): `apps/victory/src/warm.rs`

### Console compatibility

- **Xbox title**
- [Executable loader](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-loader/src/prepare.rs): `crates/victory-loader/src/prepare.rs`
- [Console API runtime](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/runtime.rs): `crates/victory-hle/src/runtime.rs`
- [Game runtime APIs](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/xgameruntime.rs): `crates/victory-hle/src/modules/xgameruntime.rs`
- [Async queues](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/xasync.rs): `crates/victory-hle/src/modules/xasync.rs`
- [DirectStorage](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/dstorage.rs): `crates/victory-hle/src/modules/dstorage.rs`
- [Persistent storage](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-hle/src/modules/storage.rs): `crates/victory-hle/src/modules/storage.rs`

### Shader translation

- [Console shader input](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/gfx10/mod.rs): `crates/victory-shader/src/gfx10/mod.rs`
- [Shader IR](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/ir.rs): `crates/victory-shader/src/ir.rs`
- [Shader resources](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/resource.rs): `crates/victory-shader/src/resource.rs`
- [DXIL emitter](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-shader/src/emit/mod.rs): `crates/victory-shader/src/emit/mod.rs`

### GPU rendering

- [Pipeline cache](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-pipeline/src/cache.rs): `crates/victory-pipeline/src/cache.rs`
- [GPU objects](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/object.rs): `crates/victory-gpu/src/object.rs`
- [GPU resources](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/resource.rs): `crates/victory-gpu/src/resource.rs`
- [Descriptor heaps](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/descriptor/host.rs): `crates/victory-gpu/src/descriptor/host.rs`
- [Host pipelines](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/pipeline.rs): `crates/victory-gpu/src/pipeline.rs`
- [Draw translation](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/draw.rs): `crates/victory-gpu/src/draw.rs`
- [GPU submission](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/queue.rs): `crates/victory-gpu/src/queue.rs`

### Diagnostics

- [Capture and replay](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/capture.rs): `crates/victory-gpu/src/capture.rs`
- [Replay analysis](https://github.com/doubleghosty/cool_fox/blob/main/crates/victory-gpu/src/replay/play.rs): `crates/victory-gpu/src/replay/play.rs`

### Other components

- **Title operator**

## Connections

- Title operator → Victory CLI: runs commands
- Victory CLI → Title runner: dispatches run (evidence: `apps/victory/src/main.rs`)
- Victory CLI → Inspect commands: dispatches inspect (evidence: `apps/victory/src/main.rs`)
- Victory CLI → Shader commands: dispatches shaders (evidence: `apps/victory/src/main.rs`)
- Victory CLI → Batch translation: dispatches translate (evidence: `apps/victory/src/main.rs`)
- Victory CLI → Pipeline warming: dispatches warm (evidence: `apps/victory/src/main.rs`)
- Title runner → Xbox title: runs executable
- Title runner → Console API runtime: uses compatibility runtime
- Title runner → Host pipelines: renders through
- Xbox title → Console API runtime: calls console APIs
- Console API runtime → Game runtime APIs: registers APIs
- Game runtime APIs → Async queues: exposes async APIs (evidence: `crates/victory-hle/src/modules/xgameruntime.rs`)
- Xbox title → DirectStorage: submits storage requests (evidence: `crates/victory-hle/src/modules/dstorage.rs`)
- Xbox title → Persistent storage: uses save storage (evidence: `crates/victory-hle/src/modules/storage.rs`)
- Persistent storage → Async queues: completes requests (evidence: `crates/victory-hle/src/modules/storage.rs`)
- Shader commands → Batch translation: uses translation flow (evidence: `apps/victory/src/translate.rs`)
- Batch translation → Console shader input: finds shader inputs
- Console shader input → Shader IR: decodes into (evidence: `crates/victory-shader/src/gfx10/mod.rs`)
- Shader IR → Shader resources: tracks resources (evidence: `crates/victory-shader/src/resource.rs`)
- Shader resources → DXIL emitter: feeds emission (evidence: `crates/victory-shader/src/emit/mod.rs`)
- DXIL emitter → Pipeline cache: caches translated shaders
- Pipeline warming → Pipeline cache: prewarms pipelines
- GPU objects → GPU resources: backs resources (evidence: `crates/victory-gpu/src/resource.rs`)
- GPU resources → Descriptor heaps: provides views (evidence: `crates/victory-gpu/src/descriptor/host.rs`)
- Draw translation → Descriptor heaps: reads descriptors (evidence: `crates/victory-gpu/src/draw.rs`)
- Draw translation → GPU resources: uses resources (evidence: `crates/victory-gpu/src/draw.rs`)
- Draw translation → Host pipelines: selects pipeline (evidence: `crates/victory-gpu/src/draw.rs`)
- Host pipelines → Pipeline cache: uses cache
- Draw translation → GPU submission: records commands (evidence: `crates/victory-gpu/src/draw.rs`)
- Capture and replay → GPU submission: captures work (evidence: `crates/victory-gpu/src/capture.rs`)
- Replay analysis → Capture and replay: reads captures (evidence: `crates/victory-gpu/src/replay/play.rs`)
