# updeshxp/rexglue-sdk-fork architecture

> Architecture diagram of the GitHub repository updeshxp/rexglue-sdk-fork, 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/updeshxp/rexglue-sdk-fork
- Repository: https://github.com/updeshxp/rexglue-sdk-fork

## Overview

ReXGlue is an Xbox 360 static recompilation toolkit: its documented core workflow accepts Xbox 360 PowerPC code and produces portable C++ for native execution. The excerpts show the CLI entry point and codegen-context loading of a configured XEX through the runtime, then binary decoding; the tree identifies analysis, instruction builders, emission, and output modules. The SDK also includes runtime services and graphics backends. Several codegen links and runtime capabilities are based on module names and the README rather than sampled implementations, so those relationships are marked unverified.

Main entry points: [`src/core/system_posix.cpp`](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/core/system_posix.cpp) (ReX Runtime), [`src/codegen/codegen_context.cpp`](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/codegen_context.cpp) (Codegen Context), [`src/codegen/builders/context.cpp`](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/builders/context.cpp) (Instruction Builders), [`src/codegen/project_recompiler.cpp`](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/project_recompiler.cpp) (Project Recompiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and Setup"]
  node_cli_entry["CLI Entry<br/>[main.cpp]"]
  node_init_command["Project Setup<br/>[init_command.cpp]"]
end

subgraph group_codegen["Recompilation"]
  node_codegen_context["Codegen Context"]
  node_binary_view["Binary View<br/>[binary_view.cpp]"]
  node_binary_decode["Binary Decode<br/>[decoded_binary.cpp]"]
  node_analysis["Function Analysis<br/>[analyze.cpp]"]
  node_function_scan["Function Scanning"]
  node_ppc_instruction["PPC Instructions<br/>[instruction.h]"]
  node_instruction_builders["Instruction Builders<br/>[context.cpp]"]
  node_builder_helpers["Builder Helpers<br/>[helpers.h]"]
  node_builder_context["Builder Context<br/>[builder_context.h]"]
  node_code_emitter["Code Emitter<br/>[code_emitter.cpp]"]
  node_codegen_writer["Output Writer<br/>[codegen_writer.cpp]"]
  node_project_recompiler["Project Recompiler"]
  node_manifest["Generation Manifest<br/>[manifest.cpp]"]
end

subgraph group_runtime["Runtime Services"]
  node_runtime_load["XEX Runtime Load<br/>[main.cpp]"]
  node_runtime["ReX Runtime<br/>[system_posix.cpp]"]
  node_kernel["Xbox Kernel APIs"]
  node_filesystem["Virtual Filesystem"]
  node_audio["Audio Services<br/>[audio_system.cpp]"]
  node_input["Input Services<br/>[input_system.cpp]"]
end

subgraph group_graphics["Graphics Backends"]
  node_graphics_system["Graphics System"]
  node_d3d12_backend["D3D12 Backend"]
  node_vulkan_backend["Vulkan Backend<br/>[pipeline_cache.cpp]"]
  node_d3d12_pipeline[("D3D12 Pipeline Cache<br/>[pipeline_cache.cpp]")]
  node_vulkan_pipeline[("Vulkan Pipeline Cache<br/>[pipeline_cache.cpp]")]
  node_shader_bytecode["D3D12 Shader Bytecode<br/>[adaptive_quad_hs.h]"]
end

node_user(("SDK User"))
node_cpp_result["Portable C++"]

node_user -->|"invokes"| node_cli_entry
node_user -.->|"configures project"| node_init_command
node_cli_entry -.->|"dispatches"| node_init_command
node_cli_entry -.->|"starts recompilation"| node_codegen_context
node_codegen_context -->|"loads XEX through"| node_runtime_load
node_runtime_load -.->|"uses runtime"| node_runtime
node_codegen_context -->|"creates view"| node_binary_view
node_codegen_context -->|"initializes decode"| node_binary_decode
node_binary_decode -->|"uses instructions"| node_ppc_instruction
node_binary_decode -.->|"feeds analysis"| node_analysis
node_analysis -.->|"scans functions"| node_function_scan
node_analysis -.->|"drives translation"| node_instruction_builders
node_instruction_builders -->|"uses context"| node_builder_context
node_instruction_builders -->|"uses helpers"| node_builder_helpers
node_instruction_builders -.->|"emits code"| node_code_emitter
node_project_recompiler -.->|"uses context"| node_codegen_context
node_project_recompiler -.->|"writes output"| node_codegen_writer
node_project_recompiler -.->|"records generation"| node_manifest
node_codegen_writer -.->|"writes C++"| node_cpp_result
node_runtime -.->|"provides APIs"| node_kernel
node_runtime -.->|"provides file access"| node_filesystem
node_runtime -.->|"provides audio"| node_audio
node_runtime -.->|"provides input"| node_input
node_runtime -.->|"provides graphics"| node_graphics_system
node_graphics_system -.->|"selects backend"| node_d3d12_backend
node_graphics_system -.->|"selects backend"| node_vulkan_backend
node_d3d12_backend -.->|"uses cache"| node_d3d12_pipeline
node_vulkan_backend -.->|"uses cache"| node_vulkan_pipeline
node_d3d12_pipeline -->|"loads bytecode"| node_shader_bytecode

click node_cli_entry "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/rexglue/main.cpp"
click node_init_command "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/rexglue/commands/init_command.cpp"
click node_codegen_context "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/codegen_context.cpp"
click node_runtime_load "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/rexglue/main.cpp"
click node_binary_view "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/binary_view.cpp"
click node_binary_decode "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/decoded_binary.cpp"
click node_analysis "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/analyze.cpp"
click node_function_scan "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/function_scanner.cpp"
click node_ppc_instruction "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/ppc/instruction.h"
click node_instruction_builders "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/builders/context.cpp"
click node_builder_helpers "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/builders/helpers.h"
click node_builder_context "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/builders/builder_context.h"
click node_code_emitter "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/code_emitter.cpp"
click node_codegen_writer "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/codegen_writer.cpp"
click node_project_recompiler "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/project_recompiler.cpp"
click node_manifest "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/manifest.cpp"
click node_runtime "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/core/system_posix.cpp"
click node_kernel "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/kernel/xboxkrnl/xboxkrnl_threading.cpp"
click node_filesystem "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/filesystem/virtual_file_system.cpp"
click node_audio "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/audio/audio_system.cpp"
click node_input "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/input/input_system.cpp"
click node_graphics_system "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/graphics_system.cpp"
click node_d3d12_backend "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/d3d12/graphics_system.cpp"
click node_vulkan_backend "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/vulkan/pipeline_cache.cpp"
click node_d3d12_pipeline "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/d3d12/pipeline_cache.cpp"
click node_vulkan_pipeline "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/vulkan/pipeline_cache.cpp"
click node_shader_bytecode "https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/shaders/bytecode/d3d12_5_1/adaptive_quad_hs.h"

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_entry,node_init_command,node_user toneBlue
class node_codegen_context,node_binary_view,node_binary_decode,node_analysis,node_function_scan,node_ppc_instruction,node_instruction_builders,node_builder_helpers,node_builder_context,node_code_emitter,node_codegen_writer,node_project_recompiler,node_manifest toneAmber
class node_runtime_load,node_runtime,node_kernel,node_filesystem,node_audio,node_input toneMint
class node_graphics_system,node_d3d12_backend,node_vulkan_backend,node_d3d12_pipeline,node_vulkan_pipeline,node_shader_bytecode toneRose
class node_cpp_result toneIndigo
```

## Components

### CLI and Setup

- [CLI Entry](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/rexglue/main.cpp): `src/rexglue/main.cpp`
- [Project Setup](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/rexglue/commands/init_command.cpp): `src/rexglue/commands/init_command.cpp`

### Recompilation

- [Codegen Context](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/codegen_context.cpp): `src/codegen/codegen_context.cpp`
- [Binary View](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/binary_view.cpp): `src/codegen/binary_view.cpp`
- [Binary Decode](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/decoded_binary.cpp): `src/codegen/decoded_binary.cpp`
- [Function Analysis](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/analyze.cpp): `src/codegen/analyze.cpp`
- [Function Scanning](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/function_scanner.cpp): `src/codegen/function_scanner.cpp`
- [PPC Instructions](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/ppc/instruction.h): `src/codegen/ppc/instruction.h`
- [Instruction Builders](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/builders/context.cpp): `src/codegen/builders/context.cpp`
- [Builder Helpers](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/builders/helpers.h): `src/codegen/builders/helpers.h`
- [Builder Context](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/builders/builder_context.h): `src/codegen/builders/builder_context.h`
- [Code Emitter](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/code_emitter.cpp): `src/codegen/code_emitter.cpp`
- [Output Writer](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/codegen_writer.cpp): `src/codegen/codegen_writer.cpp`
- [Project Recompiler](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/project_recompiler.cpp): `src/codegen/project_recompiler.cpp`
- [Generation Manifest](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/codegen/manifest.cpp): `src/codegen/manifest.cpp`

### Runtime Services

- [XEX Runtime Load](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/rexglue/main.cpp): `src/rexglue/main.cpp`
- [ReX Runtime](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/core/system_posix.cpp): `src/core/system_posix.cpp`
- [Xbox Kernel APIs](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/kernel/xboxkrnl/xboxkrnl_threading.cpp): `src/kernel/xboxkrnl/xboxkrnl_threading.cpp`
- [Virtual Filesystem](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/filesystem/virtual_file_system.cpp): `src/filesystem/virtual_file_system.cpp`
- [Audio Services](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/audio/audio_system.cpp): `src/audio/audio_system.cpp`
- [Input Services](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/input/input_system.cpp): `src/input/input_system.cpp`

### Graphics Backends

- [Graphics System](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/graphics_system.cpp): `src/graphics/graphics_system.cpp`
- [D3D12 Backend](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/d3d12/graphics_system.cpp): `src/graphics/d3d12/graphics_system.cpp`
- [Vulkan Backend](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/vulkan/pipeline_cache.cpp): `src/graphics/vulkan/pipeline_cache.cpp`
- [D3D12 Pipeline Cache](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/d3d12/pipeline_cache.cpp): `src/graphics/d3d12/pipeline_cache.cpp`
- [Vulkan Pipeline Cache](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/vulkan/pipeline_cache.cpp): `src/graphics/vulkan/pipeline_cache.cpp`
- [D3D12 Shader Bytecode](https://github.com/updeshxp/rexglue-sdk-fork/blob/main/src/graphics/shaders/bytecode/d3d12_5_1/adaptive_quad_hs.h): `src/graphics/shaders/bytecode/d3d12_5_1/adaptive_quad_hs.h`

### Other components

- **SDK User**
- **Portable C++**

## Connections

- SDK User → CLI Entry: invokes (evidence: `README.md`)
- SDK User → Project Setup: configures project
- CLI Entry → Project Setup: dispatches
- CLI Entry → Codegen Context: starts recompilation
- Codegen Context → XEX Runtime Load: loads XEX through (evidence: `src/codegen/codegen_context.cpp`)
- XEX Runtime Load → ReX Runtime: uses runtime
- Codegen Context → Binary View: creates view (evidence: `src/codegen/codegen_context.cpp`)
- Codegen Context → Binary Decode: initializes decode (evidence: `src/codegen/codegen_context.cpp`)
- Binary Decode → PPC Instructions: uses instructions
- Binary Decode → Function Analysis: feeds analysis
- Function Analysis → Function Scanning: scans functions
- Function Analysis → Instruction Builders: drives translation
- Instruction Builders → Builder Context: uses context (evidence: `src/codegen/builders/context.cpp`)
- Instruction Builders → Builder Helpers: uses helpers (evidence: `src/codegen/builders/helpers.h`)
- Instruction Builders → Code Emitter: emits code
- Project Recompiler → Codegen Context: uses context
- Project Recompiler → Output Writer: writes output
- Project Recompiler → Generation Manifest: records generation
- Output Writer → Portable C++: writes C++
- ReX Runtime → Xbox Kernel APIs: provides APIs
- ReX Runtime → Virtual Filesystem: provides file access
- ReX Runtime → Audio Services: provides audio
- ReX Runtime → Input Services: provides input
- ReX Runtime → Graphics System: provides graphics
- Graphics System → D3D12 Backend: selects backend
- Graphics System → Vulkan Backend: selects backend
- D3D12 Backend → D3D12 Pipeline Cache: uses cache
- Vulkan Backend → Vulkan Pipeline Cache: uses cache (evidence: `src/graphics/vulkan/pipeline_cache.cpp`)
- D3D12 Pipeline Cache → D3D12 Shader Bytecode: loads bytecode (evidence: `src/graphics/d3d12/pipeline_cache.cpp`)
