# theofficialflow/adrenaline architecture

> Architecture diagram of the GitHub repository theofficialflow/adrenaline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/theofficialflow/adrenaline
- Repository: https://github.com/theofficialflow/adrenaline

## Overview

##### Project type and purpose
- This is a native-C, multi-module firmware hack for the PS Vita that patches the official PSP emulator (pspemu) via the taiHEN CFW framework to run a PSP 6.61 custom firmware.
- It consists of a Vita “bubble” app, kernel-mode plugin, user-mode plugin(s), VSH-mode plugin, and a suite of payload modules (the CEF folder) that perform various boot-time and runtime patches.

##### File structure
- Top-level directories:
- bubble/ – the Vita LiveArea “bubble” application that downloads the PSP firmware, packages all modules, and launches pspemu
- cef/ – “Custom Exploitation Framework” payload modules (payloadex, rebootex, systemctrl, inferno driver, recovery menu, updater, popcorn, vshctrl, etc.) each built with its own Makefile and linker script
- kernel/ – the kernel-mode hook module (adrenaline_kernel.skprx) built via CMake, injected at IPL via taiHEN
- user/ – the user-mode plugin (adrenaline_user.suprx) and supporting libraries/drivers (flashfs, msfs, lz4, menu, pops, USB, states, math_utils)
- vsh/ – VSH (shell) plugin (vshctrl) plus isofs_driver code to mount ISOs and virtual PBP files
- Build/config files: CMakeLists.txt, Makefiles, exports.yml/exports.exp, linkfile.x, various .h/.c/.S files

##### README for additional insights
- Describes injection points (inject code into IPL), install/update instructions copying modules into ux0:app/PSPEMUCFW/sce_module, reliance on taiHEN’s config.txt for kernel module loading.
- Lists high-level features implemented by the various modules (graphics filters, PS1 support, savestates, USB toggle, recovery menu, resolution patches).

##### Step-by-step sketch approach
- Hook points: “NID patch”, “syscall intercept”, “file-system hook”.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Frameworks and OS
    OS["PS Vita OS\n(LiveArea / VSH)"]:::external
    TH["taiHEN Loader"]:::external
    TH -->|loads| AK
    AK["adrenaline_kernel.skprx\n(Kernel Plugin)"]:::kernel
    AK -->|patch boot flow| OS
    click AK "https://github.com/theofficialflow/adrenaline/tree/master/kernel/"
    
    %% Bubble Application Layer
    OS --> BA
    BA["Bubble App\n(UX0:app/PSPEMUCFW)"]:::user
    click BA "https://github.com/theofficialflow/adrenaline/tree/master/bubble/"
    BA -->|launches| PE
    PE["pspemu Process"]:::external

    %% User-Mode PSP Plugins
    subgraph "User-Mode Plugins\n(pspemu Layer)"
        AUP["adrenaline_user.suprx"]:::user
        FileSrv["FlashFS, MSFS, LZ4,\nMenu, POPS, USB, States,\nMath Utils"]:::user
    end
    click AUP "https://github.com/theofficialflow/adrenaline/blob/master/bubble/pkg/sce_module/adrenaline_user.suprx"
    click FileSrv "https://github.com/theofficialflow/adrenaline/tree/master/user/"
    PE -->|inject plugin| AUP
    PE -->|file I/O hooks| FileSrv

    %% VSH Shell and Plugin
    OS --> VSH
    VSH["VSH Process"]:::external
    VSH --> VSHP
    VSHP["adrenaline_vsh.suprx\n(vshctrl + isofs_driver)"]:::user
    click VSHP "https://github.com/theofficialflow/adrenaline/blob/master/bubble/pkg/sce_module/adrenaline_vsh.suprx"

    %% CEF Payload Modules
    subgraph "CEF Payload Modules"
        PEX["payloadex"]:::payload
        REX["rebootex"]:::payload
        REC["recovery"]:::payload
        INF["inferno"]:::payload
        POP["popcorn"]:::payload
        SCT["systemctrl"]:::payload
        SAT["satelite"]:::payload
        UPD["updater"]:::payload
        BIN["binary"]:::payload
    end
    click PEX "https://github.com/theofficialflow/adrenaline/tree/master/cef/payloadex/"
    click REX "https://github.com/theofficialflow/adrenaline/tree/master/cef/rebootex/"
    click REC "https://github.com/theofficialflow/adrenaline/tree/master/cef/recovery/"
    click INF "https://github.com/theofficialflow/adrenaline/tree/master/cef/inferno/"
    click POP "https://github.com/theofficialflow/adrenaline/tree/master/cef/popcorn/"
    click SCT "https://github.com/theofficialflow/adrenaline/tree/master/cef/systemctrl/"
    click SAT "https://github.com/theofficialflow/adrenaline/tree/master/cef/satelite/"
    click UPD "https://github.com/theofficialflow/adrenaline/tree/master/cef/updater/"
    click BIN "https://github.com/theofficialflow/adrenaline/tree/master/cef/binary/"
    PEX -->|chains to| REX
    PEX -->|chains to| REC
    PEX -->|sets up| INF
    PEX -->|sets up| POP
    PEX -->|stages| BIN
    PEX -->|feeds| AK
    SCT -->|NID patches| AUP

    %% Storage Partitions
    FSF["flash0"]:::storage
    UX0["ux0"]:::storage
    ISO["isofs"]:::storage
    AK -->|kernel modules| FSF
    AUP -->|user modules| UX0
    VSHP -->|mounts ISOs| ISO

    %% Styles
    classDef kernel fill:#f88,stroke:#a00,color:#600;
    classDef user fill:#88f,stroke:#00a,color:#006;
    classDef payload fill:#8f8,stroke:#0a0,color:#060;
    classDef external fill:#ccc,stroke:#888,color:#444;
    classDef storage fill:#ff8,stroke:#aa0,color:#660;
```
