# kaezzey/gt4-staticrecomp architecture

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

- Interactive diagram: https://gitdiagram.com/kaezzey/gt4-staticrecomp
- Repository: https://github.com/kaezzey/gt4-staticrecomp

## Overview

GT4Recomp is a learning-first, GT4-specific static reconstruction and inspection project, not an executable game port: the README explicitly says guest execution is not implemented. Its main native workflows verify the pinned CORE, reconstruct an executable image, then either export an analysis ELF or disassemble a selected text range. A separate Python workflow verifies a selected disc against pinned metadata. The graph also preserves reference inspection and native-image verification utilities. Evidence is limited to the README, SOURCE INDEX references, and sampled source; uncertain internal connections are omitted.

Main entry points: [`tools/gt4core/main.cpp`](https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4core/main.cpp) (CORE analysis CLI), [`tools/gt4disasm/main.cpp`](https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4disasm/main.cpp) (Disassembly CLI), [`src/ee/disassemble.cpp`](https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/ee/disassemble.cpp) (Region disassembler), [`tools/common/verified_core.cpp`](https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/common/verified_core.cpp) (Verified CORE reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input verification"]
  node_disc_verify["Disc verifier<br/>[gt4disc.py]"]
  node_manifest["Pinned disc manifest<br/>[usa-v2.00.json]"]
  node_core_reader["Verified CORE reader<br/>[verified_core.cpp]"]
end

subgraph group_image["Image reconstruction"]
  node_core_cli["CORE analysis CLI<br/>[main.cpp]"]
  node_image_parser["CORE image parser<br/>[core_image.cpp]"]
  node_elf_export["Analysis ELF exporter<br/>[analysis_elf.cpp]"]
end

subgraph group_inspection["Instruction inspection"]
  node_disasm_cli["Disassembly CLI<br/>[main.cpp]"]
  node_decoder["R5900 decoder<br/>[decode.cpp]"]
  node_disassembler["Region disassembler<br/>[disassemble.cpp]"]
end

subgraph group_reference["Reference analysis"]
  node_reference_inspector["Reference inspector"]
  node_native_verifier["Native image verifier"]
  node_project_stub["Project identity stub<br/>[main.cpp]"]
end

node_user(("Engineer"))
node_core_file["CORE input"]
node_elf_file["Analysis ELF"]
node_listing["Instruction listing"]

node_user -->|"runs verification"| node_disc_verify
node_disc_verify -->|"checks against"| node_manifest
node_user -->|"requests analysis"| node_core_cli
node_core_cli -->|"verifies input"| node_core_reader
node_core_cli -->|"reconstructs image"| node_image_parser
node_core_cli -->|"creates analysis ELF"| node_elf_export
node_core_file -->|"supplies bytes"| node_core_reader
node_elf_export -->|"writes output"| node_elf_file
node_user -->|"selects text range"| node_disasm_cli
node_disasm_cli -->|"verifies input"| node_core_reader
node_disasm_cli -->|"reconstructs image"| node_image_parser
node_disasm_cli -->|"disassembles range"| node_disassembler
node_disassembler -->|"decodes words"| node_decoder
node_disassembler -->|"writes listing"| node_listing
node_native_verifier -->|"imports helper"| node_reference_inspector
node_user -.->|"inspects reference"| node_reference_inspector

click node_disc_verify "https://github.com/kaezzey/gt4-staticrecomp/blob/main/scripts/gt4disc.py"
click node_manifest "https://github.com/kaezzey/gt4-staticrecomp/blob/main/docs/inputs/usa-v2.00.json"
click node_core_reader "https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/common/verified_core.cpp"
click node_core_cli "https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4core/main.cpp"
click node_image_parser "https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/executable/core_image.cpp"
click node_elf_export "https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/executable/analysis_elf.cpp"
click node_disasm_cli "https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4disasm/main.cpp"
click node_decoder "https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/ee/decode.cpp"
click node_disassembler "https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/ee/disassemble.cpp"
click node_reference_inspector "https://github.com/kaezzey/gt4-staticrecomp/blob/main/scripts/inspect_reference.py"
click node_native_verifier "https://github.com/kaezzey/gt4-staticrecomp/blob/main/scripts/verify_native_image.py"
click node_project_stub "https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4recomp/main.cpp"

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_disc_verify,node_manifest,node_core_reader toneBlue
class node_core_cli,node_image_parser,node_elf_export toneAmber
class node_disasm_cli,node_decoder,node_disassembler toneMint
class node_reference_inspector,node_native_verifier,node_project_stub toneRose
class node_user,node_core_file,node_elf_file,node_listing toneIndigo
```

## Components

### Input verification

- [Disc verifier](https://github.com/kaezzey/gt4-staticrecomp/blob/main/scripts/gt4disc.py): `scripts/gt4disc.py`
- [Pinned disc manifest](https://github.com/kaezzey/gt4-staticrecomp/blob/main/docs/inputs/usa-v2.00.json): `docs/inputs/usa-v2.00.json`
- [Verified CORE reader](https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/common/verified_core.cpp): `tools/common/verified_core.cpp`

### Image reconstruction

- [CORE analysis CLI](https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4core/main.cpp): `tools/gt4core/main.cpp`
- [CORE image parser](https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/executable/core_image.cpp): `src/executable/core_image.cpp`
- [Analysis ELF exporter](https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/executable/analysis_elf.cpp): `src/executable/analysis_elf.cpp`

### Instruction inspection

- [Disassembly CLI](https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4disasm/main.cpp): `tools/gt4disasm/main.cpp`
- [R5900 decoder](https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/ee/decode.cpp): `src/ee/decode.cpp`
- [Region disassembler](https://github.com/kaezzey/gt4-staticrecomp/blob/main/src/ee/disassemble.cpp): `src/ee/disassemble.cpp`

### Reference analysis

- [Reference inspector](https://github.com/kaezzey/gt4-staticrecomp/blob/main/scripts/inspect_reference.py): `scripts/inspect_reference.py`
- [Native image verifier](https://github.com/kaezzey/gt4-staticrecomp/blob/main/scripts/verify_native_image.py): `scripts/verify_native_image.py`
- [Project identity stub](https://github.com/kaezzey/gt4-staticrecomp/blob/main/tools/gt4recomp/main.cpp): `tools/gt4recomp/main.cpp`

### Other components

- **Engineer**
- **CORE input**
- **Analysis ELF**
- **Instruction listing**

## Connections

- Engineer → Disc verifier: runs verification (evidence: `README.md`)
- Disc verifier → Pinned disc manifest: checks against (evidence: `README.md`)
- Engineer → CORE analysis CLI: requests analysis (evidence: `README.md`)
- CORE analysis CLI → Verified CORE reader: verifies input (evidence: `tools/gt4core/main.cpp`)
- CORE analysis CLI → CORE image parser: reconstructs image (evidence: `tools/gt4core/main.cpp`)
- CORE analysis CLI → Analysis ELF exporter: creates analysis ELF (evidence: `tools/gt4core/main.cpp`)
- CORE input → Verified CORE reader: supplies bytes (evidence: `tools/common/verified_core.cpp`)
- Analysis ELF exporter → Analysis ELF: writes output (evidence: `README.md`)
- Engineer → Disassembly CLI: selects text range (evidence: `README.md`)
- Disassembly CLI → Verified CORE reader: verifies input (evidence: `tools/gt4disasm/main.cpp`)
- Disassembly CLI → CORE image parser: reconstructs image (evidence: `tools/gt4disasm/main.cpp`)
- Disassembly CLI → Region disassembler: disassembles range (evidence: `tools/gt4disasm/main.cpp`)
- Region disassembler → R5900 decoder: decodes words (evidence: `src/ee/disassemble.cpp`)
- Region disassembler → Instruction listing: writes listing (evidence: `README.md`)
- Native image verifier → Reference inspector: imports helper (evidence: `scripts/verify_native_image.py`)
- Engineer → Reference inspector: inspects reference
