# danielsant0s/athenaenv architecture

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

- Interactive diagram: https://gitdiagram.com/danielsant0s/athenaenv
- Repository: https://github.com/danielsant0s/athenaenv

## Overview

AthenaEnv is a JavaScript runtime for PlayStation 2: developers run JavaScript through a modified QuickJS interpreter and use built-in APIs to create graphics, games, and system/network applications. A representative user-to-result path is script execution, drawing through Screen/Font/Render APIs, then presenting the frame. The README also documents input, audio, video, file/archive, IOP, and network capabilities. Several subsystem links are documented capabilities rather than inspected call sites; the graph does not infer internal calls between them.

Main entry points: [`src/js_api/ath_env.c`](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_env.c) (Built-in JS APIs), [`src/quickjs/quickjs.h`](https://github.com/danielsant0s/athenaenv/blob/main/src/quickjs/quickjs.h) (QuickJS engine), [`src/net/ath_http.c`](https://github.com/danielsant0s/athenaenv/blob/main/src/net/ath_http.c) (HTTP and TLS), [`src/native_compiler/native_compiler.c`](https://github.com/danielsant0s/athenaenv/blob/main/src/native_compiler/native_compiler.c) (Native compiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and APIs"]
  node_quickjs["QuickJS engine<br/>[quickjs.h]"]
  node_jsapi["Built-in JS APIs<br/>[ath_env.c]"]
  node_native["Native compiler<br/>[native_compiler.c]"]
end

subgraph group_graphics["Graphics and media"]
  node_render["3D rendering<br/>[ath_render.c]"]
  node_screen["Screen control<br/>[ath_screen.c]"]
  node_draw["2D drawing<br/>[graphics.c]"]
  node_images["Images and textures<br/>[image_loaders.c]"]
  node_tilemap["Tile maps<br/>[tile_render.h]"]
  node_font["Font rendering<br/>[fntsys.c]"]
  node_shadows["Shadow projection<br/>[shadows.h]"]
  node_sound["Audio<br/>[ath_sound.c]"]
  node_video["MPEG video<br/>[mpeg_player.c]"]
end

subgraph group_system["System and input"]
  node_system["System and files<br/>[ath_system.c]"]
  node_archive["Archive extraction<br/>[ath_archive.c]"]
  node_iop["IOP management<br/>[iop_manager.c]"]
  node_pads["Gamepad input<br/>[ath_pads.c]"]
  node_keyboard["Keyboard input<br/>[ath_keyboard.c]"]
  node_mouse["Mouse input<br/>[ath_mouse.c]"]
end

subgraph group_connectivity["Connectivity"]
  node_network["HTTP and TLS<br/>[ath_http.c]"]
  node_bearssl["TLS implementation<br/>[ssl_engine.c]"]
  node_sockets["Sockets and WebSockets<br/>[ath_ws.c]"]
end

node_developer(("JavaScript developer"))

node_developer -->|"runs scripts"| node_quickjs
node_quickjs -->|"exposes APIs"| node_jsapi
node_jsapi -->|"provides rendering"| node_render
node_jsapi -->|"provides screen control"| node_screen
node_jsapi -->|"provides drawing"| node_draw
node_jsapi -->|"provides images"| node_images
node_jsapi -->|"provides tile maps"| node_tilemap
node_jsapi -->|"provides text"| node_font
node_jsapi -->|"provides shadows"| node_shadows
node_jsapi -->|"provides audio"| node_sound
node_jsapi -->|"provides video"| node_video
node_jsapi -->|"provides system access"| node_system
node_jsapi -->|"provides extraction"| node_archive
node_jsapi -->|"provides IOP control"| node_iop
node_jsapi -->|"provides gamepad input"| node_pads
node_jsapi -->|"provides keyboard input"| node_keyboard
node_jsapi -->|"provides mouse input"| node_mouse
node_jsapi -->|"provides web requests"| node_network
node_network -->|"uses TLS"| node_bearssl
node_jsapi -->|"provides sockets"| node_sockets
node_jsapi -->|"offers compilation"| node_native

click node_quickjs "https://github.com/danielsant0s/athenaenv/blob/main/src/quickjs/quickjs.h"
click node_jsapi "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_env.c"
click node_native "https://github.com/danielsant0s/athenaenv/blob/main/src/native_compiler/native_compiler.c"
click node_render "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_render.c"
click node_screen "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_screen.c"
click node_draw "https://github.com/danielsant0s/athenaenv/blob/main/src/graphics.c"
click node_images "https://github.com/danielsant0s/athenaenv/blob/main/src/image_loaders.c"
click node_tilemap "https://github.com/danielsant0s/athenaenv/blob/main/src/include/tile_render.h"
click node_font "https://github.com/danielsant0s/athenaenv/blob/main/src/fntsys.c"
click node_shadows "https://github.com/danielsant0s/athenaenv/blob/main/src/include/shadows.h"
click node_sound "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_sound.c"
click node_video "https://github.com/danielsant0s/athenaenv/blob/main/src/mpeg_player.c"
click node_system "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_system.c"
click node_archive "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_archive.c"
click node_iop "https://github.com/danielsant0s/athenaenv/blob/main/src/iop_manager.c"
click node_pads "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_pads.c"
click node_keyboard "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_keyboard.c"
click node_mouse "https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_mouse.c"
click node_network "https://github.com/danielsant0s/athenaenv/blob/main/src/net/ath_http.c"
click node_bearssl "https://github.com/danielsant0s/athenaenv/blob/main/src/BearSSL/src/ssl/ssl_engine.c"
click node_sockets "https://github.com/danielsant0s/athenaenv/blob/main/src/net/ath_ws.c"

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_quickjs,node_jsapi,node_native toneBlue
class node_render,node_screen,node_draw,node_images,node_tilemap,node_font,node_shadows,node_sound,node_video toneAmber
class node_system,node_archive,node_iop,node_pads,node_keyboard,node_mouse toneMint
class node_network,node_bearssl,node_sockets toneRose
class node_developer toneIndigo
```

## Components

### Runtime and APIs

- [QuickJS engine](https://github.com/danielsant0s/athenaenv/blob/main/src/quickjs/quickjs.h): `src/quickjs/quickjs.h`
- [Built-in JS APIs](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_env.c): `src/js_api/ath_env.c`
- [Native compiler](https://github.com/danielsant0s/athenaenv/blob/main/src/native_compiler/native_compiler.c): `src/native_compiler/native_compiler.c`

### Graphics and media

- [3D rendering](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_render.c): `src/js_api/ath_render.c`
- [Screen control](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_screen.c): `src/js_api/ath_screen.c`
- [2D drawing](https://github.com/danielsant0s/athenaenv/blob/main/src/graphics.c): `src/graphics.c`
- [Images and textures](https://github.com/danielsant0s/athenaenv/blob/main/src/image_loaders.c): `src/image_loaders.c`
- [Tile maps](https://github.com/danielsant0s/athenaenv/blob/main/src/include/tile_render.h): `src/include/tile_render.h`
- [Font rendering](https://github.com/danielsant0s/athenaenv/blob/main/src/fntsys.c): `src/fntsys.c`
- [Shadow projection](https://github.com/danielsant0s/athenaenv/blob/main/src/include/shadows.h): `src/include/shadows.h`
- [Audio](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_sound.c): `src/js_api/ath_sound.c`
- [MPEG video](https://github.com/danielsant0s/athenaenv/blob/main/src/mpeg_player.c): `src/mpeg_player.c`

### System and input

- [System and files](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_system.c): `src/js_api/ath_system.c`
- [Archive extraction](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_archive.c): `src/js_api/ath_archive.c`
- [IOP management](https://github.com/danielsant0s/athenaenv/blob/main/src/iop_manager.c): `src/iop_manager.c`
- [Gamepad input](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_pads.c): `src/js_api/ath_pads.c`
- [Keyboard input](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_keyboard.c): `src/js_api/ath_keyboard.c`
- [Mouse input](https://github.com/danielsant0s/athenaenv/blob/main/src/js_api/ath_mouse.c): `src/js_api/ath_mouse.c`

### Connectivity

- [HTTP and TLS](https://github.com/danielsant0s/athenaenv/blob/main/src/net/ath_http.c): `src/net/ath_http.c`
- [TLS implementation](https://github.com/danielsant0s/athenaenv/blob/main/src/BearSSL/src/ssl/ssl_engine.c): `src/BearSSL/src/ssl/ssl_engine.c`
- [Sockets and WebSockets](https://github.com/danielsant0s/athenaenv/blob/main/src/net/ath_ws.c): `src/net/ath_ws.c`

### Other components

- **JavaScript developer**

## Connections

- JavaScript developer → QuickJS engine: runs scripts (evidence: `README.md`)
- QuickJS engine → Built-in JS APIs: exposes APIs (evidence: `README.md`)
- Built-in JS APIs → 3D rendering: provides rendering (evidence: `README.md`)
- Built-in JS APIs → Screen control: provides screen control (evidence: `README.md`)
- Built-in JS APIs → 2D drawing: provides drawing (evidence: `README.md`)
- Built-in JS APIs → Images and textures: provides images (evidence: `README.md`)
- Built-in JS APIs → Tile maps: provides tile maps (evidence: `README.md`)
- Built-in JS APIs → Font rendering: provides text (evidence: `README.md`)
- Built-in JS APIs → Shadow projection: provides shadows (evidence: `README.md`)
- Built-in JS APIs → Audio: provides audio (evidence: `README.md`)
- Built-in JS APIs → MPEG video: provides video (evidence: `README.md`)
- Built-in JS APIs → System and files: provides system access (evidence: `README.md`)
- Built-in JS APIs → Archive extraction: provides extraction (evidence: `README.md`)
- Built-in JS APIs → IOP management: provides IOP control (evidence: `README.md`)
- Built-in JS APIs → Gamepad input: provides gamepad input (evidence: `README.md`)
- Built-in JS APIs → Keyboard input: provides keyboard input (evidence: `README.md`)
- Built-in JS APIs → Mouse input: provides mouse input (evidence: `README.md`)
- Built-in JS APIs → HTTP and TLS: provides web requests (evidence: `README.md`)
- HTTP and TLS → TLS implementation: uses TLS (evidence: `README.md`)
- Built-in JS APIs → Sockets and WebSockets: provides sockets (evidence: `README.md`)
- Built-in JS APIs → Native compiler: offers compilation (evidence: `README.md`)
