Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
397727c
feat: add vector graphics primitives to SdiBackend trait
Mar 6, 2026
1a20fa3
feat: add oasis-vector crate -- vector graphics scene graph and Altim…
Mar 6, 2026
a393df0
feat: skin engine integration for vector graphics (Phase 3)
Mar 6, 2026
0e2f02a
feat: frame-driven vector icon animations (Phase 4)
Mar 6, 2026
8661abf
feat: PSP full SDI integration -- unified skin system for dashboard, …
Mar 6, 2026
23e5c03
fix: PSP hardware boot failure + SDI performance tuning
Mar 7, 2026
f1b1996
chore: pin rust-psp to main after weak-videocodec merge
Mar 7, 2026
3331170
feat: PSP TLS 1.3, in-memory video streaming, audio backpressure + do…
Mar 7, 2026
60378e4
fix: PSP TV Guide streaming -- disable sceHttp redirects, add TLS fal…
Mar 7, 2026
0c181d7
fix: PSP TV Guide TLS fallback -- try archive.org HTTPS before CDN
Mar 7, 2026
8b15c24
fix: PSP TV Guide download cancellation + stale command drain
Mar 7, 2026
19c1dc1
fix: DNS endianness bug -- pin rust-psp to resolve_hostname fix
Mar 7, 2026
15e98f8
fix: PSP TLS 1.3 -- privileged instruction crash, RSA support, flush
Mar 7, 2026
def5fd8
feat: TV Guide video player reliability and performance improvements
Mar 8, 2026
9fe9f42
chore: update PSP Cargo.lock for oasis-video log dependency
Mar 8, 2026
c3dcb70
chore: add TV Guide streaming decode test script
Mar 8, 2026
b40e140
feat: ffmpeg video decode backend with streaming optimizations
Mar 8, 2026
2993bdc
feat: streaming video decode -- eliminate full-file download, add loa…
Mar 8, 2026
67dd00c
fix: TV streaming probe hang and moov-at-end Range download
Mar 8, 2026
e5ec9d4
feat: ffmpeg-inspired streaming improvements -- stall reconnect, exac…
Mar 8, 2026
bf0fd6b
fix: streaming video decode -- linear seek estimate, diagnostic loggi…
Mar 8, 2026
c06890d
fix: streaming video throttle deadlock and CDN connection issues
Mar 8, 2026
3d86304
docs: update documentation for streaming video architecture
Mar 8, 2026
d9552db
fix: address AI review feedback (iteration 1)
Mar 8, 2026
730e070
fix: resolve CI pipeline failures
Mar 8, 2026
d3bb470
fix: address AI review feedback (iteration 3)
Mar 8, 2026
1986da9
fix: broken intra-doc links in registry.rs and tv_controller.rs
Mar 8, 2026
c3af936
fix: address Gemini review feedback (iterations 4-5)
Mar 8, 2026
98d7aac
fix: resolve CI pipeline failures
Mar 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

OASIS_OS is an embeddable operating system framework in Rust (edition 2024). It provides a skinnable shell with a scene-graph UI, command interpreter, virtual file system, browser engine (HTML/CSS/Gemini), plugin system, and remote terminal. It renders to any pixel buffer + input stream. Originally ported from a PSP homebrew shell (2006-2008). Seventeen skins are implemented (11 external TOML skins, 17 built-in; external skins also have built-in equivalents).
OASIS_OS is an embeddable operating system framework in Rust (edition 2024). It provides a skinnable shell with a scene-graph UI, command interpreter, virtual file system, browser engine (HTML/CSS/Gemini), plugin system, and remote terminal. It renders to any pixel buffer + input stream. Originally ported from a PSP homebrew shell (2006-2008). Eighteen skins are implemented (12 external TOML skins, 18 built-in; external skins also have built-in equivalents).

Default virtual resolution is 480x272 (PSP native). Skins may override this (e.g. modern=800x600, xp=1024x768); the backend canvas/window scales to match.

Expand Down Expand Up @@ -88,6 +88,7 @@ oasis-types (foundation: Color, Button, InputEvent, backend traits, error ty
├── oasis-browser (HTML/CSS/Gemini: DOM, CSS cascade, layout engine, JS DOM bindings)
├── oasis-js (JavaScript engine: QuickJS-NG runtime, console API)
├── oasis-video (MP4/H.264+AAC decode; features: h264, no-std-demux, video-decode)
├── oasis-vector (vector graphics: scene graph, path ops, icons, frame-driven animations)
└── oasis-core (coordination: 16 apps, dashboard, agent, plugin, script)
├── oasis-backend-sdl (SDL2 desktop/Pi rendering + input + audio)
│ └── oasis-app (binary entry points: oasis-app, oasis-screenshot; oasis-video[video-decode])
Expand All @@ -106,11 +107,30 @@ The PSP deployment uses two binaries:

The PRX hooks `sceDisplaySetFrameBuf` to draw overlay UI into the game's framebuffer and claims a PSP audio channel for background MP3 playback. No dependency on oasis-core -- direct framebuffer rendering only (<64KB binary).

### PSP TLS 1.3

The PSP firmware's built-in SSL uses root CAs from 2008 and SSL 3.0, which cannot connect to modern HTTPS servers. The PSP backend implements native TLS 1.3 via `embedded-tls` (pure Rust, no C/asm) with `UnsecureProvider` (no certificate validation). The `alloc` feature is required to advertise RSA signature schemes (archive.org uses RSA certs). Raw TCP sockets (`sceNetInet*`) are wrapped with `embedded_io::Read + Write` adapters. RNG seeded from `sceKernelGetSystemTimeLow` (not `mfc0 $9` which is privileged on PSP Allegrex). DNS resolution via `psp::net::resolve_hostname` with `to_ne_bytes()` (network byte order fix for little-endian MIPS). HTTP→HTTPS redirect loops are detected automatically, triggering TLS fallback; HTTPS redirects (archive.org → CDN node) are followed within the TLS path. This enables HTTPS downloads for TV Guide video streaming from servers that enforce TLS.

### PSP Video Streaming

TV Guide on PSP uses in-memory streaming (no disk I/O). The I/O thread downloads HTTP(S) data, buffers the MP4 `moov` atom (~1-3MB), parses track tables via `demux_lite::Mp4Lite`, then extracts interleaved audio/video samples from the `mdat` stream in file-offset order. Video samples are skipped (H.264 decode requires real ME hardware, not available on PPSSPP). Audio AAC frames are decoded via `sceAudiocodec` hardware and output through `AudioChannel::output_blocking`. Backpressure is applied via retry-with-sleep when the audio command queue is full, naturally throttling the download to real-time playback speed.

### Desktop Video Streaming

TV Guide on desktop uses in-process progressive streaming via `StreamingBuffer` (in `tv_controller.rs`). A background download thread feeds an `Arc<StreamingInner>` sliding-window buffer while symphonia decodes from the same buffer via `Read + Seek`. Key mechanisms:

- **`probe_mode`** — During symphonia's probe phase, reads return zeros so mdat body is skipped instantly. `decoder_pos` is NOT updated during probe to prevent a throttle deadlock.
- **Deferred tail probe** — A separate thread fetches the last 8MB for moov-at-end files, but only launches after >8MB body data received without finding moov. Prevents CDN connection throttling.
- **`should_throttle()`** — Backpressure: `decoder_pos > 0 ? received > decoder_pos + 16MB : has_moov && buf_size > 16MB`
- **CDN failover** — Range requests route through the original archive.org URL (not cached CDN) to get a fresh 302 redirect, avoiding 401 errors from stale CDN nodes. `open_range_connection()` follows redirect chains.
- **Prebuffer gate** — Decoder waits for MIN_PREBUFFER (2MB) of body data before seeking, preventing reads into empty buffer regions.
- **Seek restart** — After probe discovers moov, the download restarts from the estimated byte offset via a Range request. Linear interpolation: `(seek_secs / duration) * file_size`.

### Key Abstraction: Backend Traits

`oasis-types/src/backend.rs` defines the only abstraction boundary between core and platform (re-exported by `oasis-core`):
- `SdiCore` -- required rendering (13 methods: init, clear, blit, fill_rect, draw_text, swap_buffers, load_texture, destroy_texture, set_clip_rect, reset_clip_rect, measure_text, read_pixels, shutdown)
- `SdiBackend` -- extends `SdiCore` with 30 optional accelerated primitives (shapes, gradients, text styling, batching)
- `SdiBackend` -- extends `SdiCore` with 30+ optional accelerated primitives (shapes, gradients, text styling, batching, vector graphics path operations)
- `InputBackend` -- input polling (returns `Vec<InputEvent>`)
- `NetworkBackend` -- TCP networking
- `AudioBackend` -- audio playback
Expand All @@ -119,11 +139,11 @@ Core code never calls platform APIs directly. All platform interaction goes thro

### Core Modules

The framework is split into 19 workspace crates. Each module below is its own crate (previously all in oasis-core):
The framework is split into 20 workspace crates. Each module below is its own crate (previously all in oasis-core):

- **oasis-types** -- Foundation types: `Color`, `Button`, `InputEvent`, backend traits (`SdiCore`, `SdiBackend`, `InputBackend`, `NetworkBackend`, `AudioBackend`), error types, TLS, bitmap font metrics
- **oasis-sdi** -- Scene Display Interface: named objects with position, size, color, texture, text, z-order, gradients, rounded corners, shadows
- **oasis-skin** -- Data-driven TOML skin system with 17 skins (11 external TOML in `skins/`, 17 built-in). Theme derivation from 9 base colors.
- **oasis-skin** -- Data-driven TOML skin system with 18 skins (12 external TOML in `skins/`, 18 built-in). Theme derivation from 9 base colors.
- **oasis-browser** -- Embeddable HTML/CSS/Gemini rendering engine: DOM parser, CSS cascade, block/inline/table layout, link navigation, reader mode, JavaScript DOM bindings
- **oasis-js** -- JavaScript engine wrapping QuickJS-NG via rquickjs: `console` API (log/warn/error/info), inline `<script>` execution, DOM manipulation (`document.getElementById`, `createElement`, `textContent`, attributes). Feature-gated (`javascript`)
- **oasis-ui** -- 27 reusable widgets: Button, Card, TabBar, Panel, TextField, ListView, ScrollView, ProgressBar, Toggle, NinePatch, flex layout, Accordion, Avatar, Badge, Checkbox, Dropdown, Modal, Slider, Spinner, Toast, Tooltip, TreeView, and more
Expand All @@ -133,7 +153,8 @@ The framework is split into 19 workspace crates. Each module below is its own cr
- **oasis-net** -- TCP networking with PSK authentication, remote terminal, FTP transfer
- **oasis-audio** -- Audio manager with playlist, shuffle/repeat modes, MP3 ID3 tag parsing
- **oasis-platform** -- Platform service traits: PowerService, TimeService, UsbService, NetworkService, OskService
- **oasis-video** -- MP4/H.264+AAC decode pipeline. Feature flags: `h264` (openh264 video decode + symphonia demux/AAC), `no-std-demux` (lightweight `demux_lite::Mp4Lite` parser, no symphonia/no std::sync::Once — PSP-safe), `video-decode` (re-exports `SoftwareVideoDecoder` for desktop/UE5). Streaming pipelines: desktop downloads MP4 then decodes in-process with PTS-based A/V sync; PSP uses `demux_lite` + `sceAudiocodec` AAC hardware decode + `sceVideocodec` H.264 (real HW only, audio-only on PPSSPP)
- **oasis-video** -- MP4/H.264+AAC decode pipeline. Feature flags: `h264` (openh264 video decode + symphonia demux/AAC), `no-std-demux` (lightweight `demux_lite::Mp4Lite` parser, no symphonia/no std::sync::Once — PSP-safe), `video-decode` (re-exports `SoftwareVideoDecoder` for desktop/UE5). Streaming pipelines: desktop uses `StreamingBuffer` sliding-window for progressive playback with deferred tail probe, CDN failover, and PTS-based A/V sync; PSP streams in-memory via `demux_lite` + `sceAudiocodec` AAC hardware decode + `sceVideocodec` H.264 (real HW only, audio-only on PPSSPP) with backpressure-throttled I/O
- **oasis-vector** -- Resolution-independent vector graphics: scene graph with path-based drawing operations (fill, stroke, arcs, beziers), Altimit-style dashboard icons, and frame-driven animations. Integrates via `SdiBackend` vector graphics trait extensions
- **oasis-core** -- Coordination layer: app runner with 16 apps (File Manager, Settings, Network, Music Player, Photo Viewer, Package Manager, Browser, System Monitor, TV Guide, Internet Radio, Terminal, Text Editor, Calculator, Clock, Paint, Games), dashboard, agent/MCP, plugin, scripting, status/bottom bars

### Font Rendering
Expand Down
Loading