# xxxthedarkprogramerxxx/ps4_tools architecture

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

- Interactive diagram: https://gitdiagram.com/xxxthedarkprogramerxxx/ps4_tools
- Repository: https://github.com/xxxthedarkprogramerxxx/ps4_tools

## Overview

PS4_Tools is a .NET library of PS4 file-format and content utilities, with desktop and Android example applications. A principal workflow is for a caller to use the library to read or build a PKG, interpreting its project and metadata structures and producing a package. The README also describes PUP, image, media, trophy, and PS2 Classics capabilities. The map combines documented capabilities with source-index references; unsampled implementation details are grouped by subsystem, and edges are limited to documented or indexed relationships.

Main entry points: [`PS4_Tools/Util`](https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/Util) (Core utilities), [`PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgBuilder.cs) (PKG building), [`PS4_Tools/LibOrbis/PKG/Pkg.cs`](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/Pkg.cs) (PKG structures), [`PS4_Tools/LibOrbis/PKG/PkgReader.cs`](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgReader.cs) (PKG reading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Library and formats"]
  node_core["Core utilities"]
  node_gp4["GP4 projects<br/>[Gp4Project.cs]"]
end

subgraph group_pkg["Package handling"]
  node_pkgread["PKG reading<br/>[PkgReader.cs]"]
  node_pkgmodel["PKG structures<br/>[Pkg.cs]"]
  node_pkgbuild["PKG building<br/>[PkgBuilder.cs]"]
  node_pkgprops["PKG properties<br/>[PkgProperties.cs]"]
  node_pfs["PFS building"]
  node_sfo["SFO metadata<br/>[ParamSfo.cs]"]
  node_playgo["PlayGo chunks"]
  node_license["License data<br/>[LicenseDat.cs]"]
  node_crypto["Cryptography<br/>[Crypto.cs]"]
  node_keys["Key material<br/>[Keys.cs]"]
  node_streams["Stream utilities<br/>[SubStream.cs]"]
end

subgraph group_content["Content utilities"]
  node_pup["PUP tools<br/>[PUP.cs]"]
  node_self["SELF handling<br/>[llvm.cs]"]
  node_images["DDS images<br/>[DDSImage.cs]"]
  node_atrac["Atrac9 audio"]
  node_trophy["Trophy data<br/>[TROPUSR.cs]"]
  node_pkgutil["PKG utilities<br/>[PS4PkgUtil.cs]"]
end

subgraph group_apps["Applications"]
  node_androiddb[("Android SQLite<br/>[SQLite.cs]")]
  node_examples["Example applications"]
end

node_user(("Library user"))

node_user -->|"uses library"| node_core
node_core -->|"reads projects"| node_gp4
node_core -->|"reads packages"| node_pkgread
node_core -->|"builds packages"| node_pkgbuild
node_core -->|"unpacks PUP"| node_pup
node_core -->|"handles DDS"| node_images
node_core -->|"loads audio"| node_atrac
node_core -->|"handles trophies"| node_trophy
node_core -->|"handles SELF"| node_self
node_core -->|"uses utilities"| node_pkgutil
node_pkgread -->|"populates structure"| node_pkgmodel
node_pkgread -->|"reads metadata"| node_sfo
node_pkgbuild -->|"uses properties"| node_pkgprops
node_pkgbuild -->|"builds filesystem"| node_pfs
node_pkgbuild -->|"uses package"| node_pkgmodel
node_pkgbuild -->|"encrypts data"| node_crypto
node_pkgbuild -->|"uses keys"| node_keys
node_pkgbuild -->|"uses metadata"| node_sfo
node_pkgbuild -->|"uses streams"| node_streams
node_pkgbuild -->|"uses license data"| node_license
node_pkgbuild -->|"uses chunk data"| node_playgo
node_pkgmodel -->|"contains SFO"| node_sfo
node_pkgmodel -->|"contains license"| node_license
node_pkgmodel -->|"contains chunks"| node_playgo
node_gp4 -->|"provides project data"| node_pkgprops
node_examples -.->|"includes database"| node_androiddb

click node_core "https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/Util"
click node_gp4 "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/GP4/Gp4Project.cs"
click node_pkgread "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgReader.cs"
click node_pkgmodel "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/Pkg.cs"
click node_pkgbuild "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgBuilder.cs"
click node_pkgprops "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgProperties.cs"
click node_pfs "https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/LibOrbis/PFS"
click node_sfo "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/SFO/ParamSfo.cs"
click node_playgo "https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/LibOrbis/PlayGo"
click node_license "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/RIF/LicenseDat.cs"
click node_crypto "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/Util/Crypto.cs"
click node_keys "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/Util/Keys.cs"
click node_streams "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/Util/SubStream.cs"
click node_pup "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Files/PUP/PUP.cs"
click node_self "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Files/SELF/llvm.cs"
click node_images "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Util/DDS/DDSImage.cs"
click node_atrac "https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/Media/Atrac9"
click node_trophy "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/TROPHY/TROPUSR.cs"
click node_pkgutil "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Util/PS4PkgUtil.cs"
click node_androiddb "https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/Example%20Applications/Android/PS4_Tools_Android/CS/SQLite.cs"
click node_examples "https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/Example%20Applications"

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_core,node_gp4,node_user toneBlue
class node_pkgread,node_pkgmodel,node_pkgbuild,node_pkgprops,node_pfs,node_sfo,node_playgo,node_license,node_crypto,node_keys,node_streams toneAmber
class node_pup,node_self,node_images,node_atrac,node_trophy,node_pkgutil toneMint
class node_androiddb,node_examples toneRose
```

## Components

### Library and formats

- [Core utilities](https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/Util): `PS4_Tools/Util`
- [GP4 projects](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/GP4/Gp4Project.cs): `PS4_Tools/LibOrbis/GP4/Gp4Project.cs`

### Package handling

- [PKG reading](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgReader.cs): `PS4_Tools/LibOrbis/PKG/PkgReader.cs`
- [PKG structures](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/Pkg.cs): `PS4_Tools/LibOrbis/PKG/Pkg.cs`
- [PKG building](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgBuilder.cs): `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`
- [PKG properties](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/PKG/PkgProperties.cs): `PS4_Tools/LibOrbis/PKG/PkgProperties.cs`
- [PFS building](https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/LibOrbis/PFS): `PS4_Tools/LibOrbis/PFS`
- [SFO metadata](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/SFO/ParamSfo.cs): `PS4_Tools/LibOrbis/SFO/ParamSfo.cs`
- [PlayGo chunks](https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/LibOrbis/PlayGo): `PS4_Tools/LibOrbis/PlayGo`
- [License data](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/RIF/LicenseDat.cs): `PS4_Tools/LibOrbis/RIF/LicenseDat.cs`
- [Cryptography](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/Util/Crypto.cs): `PS4_Tools/LibOrbis/Util/Crypto.cs`
- [Key material](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/Util/Keys.cs): `PS4_Tools/LibOrbis/Util/Keys.cs`
- [Stream utilities](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/LibOrbis/Util/SubStream.cs): `PS4_Tools/LibOrbis/Util/SubStream.cs`

### Content utilities

- [PUP tools](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Files/PUP/PUP.cs): `PS4_Tools/Files/PUP/PUP.cs`
- [SELF handling](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Files/SELF/llvm.cs): `PS4_Tools/Files/SELF/llvm.cs`
- [DDS images](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Util/DDS/DDSImage.cs): `PS4_Tools/Util/DDS/DDSImage.cs`
- [Atrac9 audio](https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/PS4_Tools/Media/Atrac9): `PS4_Tools/Media/Atrac9`
- [Trophy data](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/TROPHY/TROPUSR.cs): `PS4_Tools/TROPHY/TROPUSR.cs`
- [PKG utilities](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/PS4_Tools/Util/PS4PkgUtil.cs): `PS4_Tools/Util/PS4PkgUtil.cs`

### Applications

- [Android SQLite](https://github.com/xxxthedarkprogramerxxx/ps4_tools/blob/master/Example%20Applications/Android/PS4_Tools_Android/CS/SQLite.cs): `Example Applications/Android/PS4_Tools_Android/CS/SQLite.cs`
- [Example applications](https://github.com/xxxthedarkprogramerxxx/ps4_tools/tree/master/Example%20Applications): `Example Applications`

### Other components

- **Library user**

## Connections

- Library user → Core utilities: uses library
- Core utilities → GP4 projects: reads projects (evidence: `PS4_Tools/Main.cs`)
- Core utilities → PKG reading: reads packages (evidence: `PS4_Tools/Main.cs`)
- Core utilities → PKG building: builds packages (evidence: `PS4_Tools/Main.cs`)
- Core utilities → PUP tools: unpacks PUP
- Core utilities → DDS images: handles DDS (evidence: `PS4_Tools/Util/DDS/DDSImage.cs`)
- Core utilities → Atrac9 audio: loads audio
- Core utilities → Trophy data: handles trophies
- Core utilities → SELF handling: handles SELF
- Core utilities → PKG utilities: uses utilities (evidence: `PS4_Tools/Main.cs`)
- PKG reading → PKG structures: populates structure (evidence: `PS4_Tools/LibOrbis/PKG/PkgReader.cs`)
- PKG reading → SFO metadata: reads metadata (evidence: `PS4_Tools/LibOrbis/PKG/PkgReader.cs`)
- PKG building → PKG properties: uses properties (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → PFS building: builds filesystem (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → PKG structures: uses package (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → Cryptography: encrypts data (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → Key material: uses keys (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → SFO metadata: uses metadata (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → Stream utilities: uses streams (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → License data: uses license data (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG building → PlayGo chunks: uses chunk data (evidence: `PS4_Tools/LibOrbis/PKG/PkgBuilder.cs`)
- PKG structures → SFO metadata: contains SFO (evidence: `PS4_Tools/LibOrbis/PKG/Pkg.cs`)
- PKG structures → License data: contains license (evidence: `PS4_Tools/LibOrbis/PKG/Pkg.cs`)
- PKG structures → PlayGo chunks: contains chunks (evidence: `PS4_Tools/LibOrbis/PKG/Pkg.cs`)
- GP4 projects → PKG properties: provides project data (evidence: `PS4_Tools/LibOrbis/PKG/PkgProperties.cs`)
- Example applications → Android SQLite: includes database
