OOPS SDK Complete API Reference

Clean-Room Freestanding C Runtime and Hardware Abstraction SDK for Orbis & Prospero.

This document provides a comprehensive technical API reference for all subsystems, data structures, and functions exposed by oops-sdk.


Table of Contents

  1. Display & Video Output (<oops/display.h>)
  2. 2D Software Drawing Canvas (<oops/draw.h>)
  3. Fixed-Function 3D Instrument (<GL/gl.h>)
  4. Hardware RDNA2 AGC Graphics (<oops/agc.h>, <oops/gpu.h>)
  5. Memory Management & Direct Memory (<oops/memory.h>)
  6. JIT & Dynamic Executable Memory (<oops/jit.h>)
  7. Controller & Input Devices (<oops/input.h>, <oops/keyboard.h>, <oops/mouse.h>)
  8. Audio Streaming (<oops/audio.h>)
  9. Hardware Media Codecs (<oops/audiodec.h>, <oops/videodec.h>)
  10. System UI: Dialogs & On-Screen IME (<oops/dialog.h>)
  11. Save Data Management (<oops/savedata.h>)
  12. Package & Application Management (<oops/pkg.h>)
  13. Privilege Escalation & Sandbox Escape (<oops/escalate.h>)
  14. Kernel Read/Write & Syscall Dispatcher (<oops/krw.h>, <oops/syscall.h>)
  15. System Modules & Dynamic Linking (<oops/sysmodule.h>)
  16. System Information & Telemetry (<oops/system.h>, <oops/offsets.h>)
  17. High-Resolution Timing (<oops/time.h>)
  18. Threading & Synchronization (<oops/thread.h>)
  19. BSD Sockets & Network Telemetry (<oops/net.h>, <oops/netctl.h>)
  20. Freestanding C Runtime Utilities (<oops/freestd.h>)
  21. Process Control & Code Injection (<oops/inject.h>)
  22. High-Level Filesystem Subsystem (<oops/fs.h>)
  23. Freestanding Userland Heap Allocator (<oops/heap.h>)
  24. Freestanding Math & 3D Linear Algebra (<oops/math.h>)
  25. Target Platform Identification (<oops/target.h>)
  26. On-Device ZIP Extractor (<oops/zip.h>)
  27. HTTP Client & URL Parsing (<oops/http.h>)
  28. Standalone JavaScript Engine (<oops/js.h>)
  29. Standalone HTML5/CSS Layout & Rendering (<oops/html.h>)
  30. Assembled Webview Browser (<oops/webview.h>)
  31. Performance Telemetry & Diagnostic Overlay (<oops/perf.h>)

1. Display & Video Output (<oops/display.h>)

The display subsystem opens exclusive HDMI video scanout on Bus 0 (OBS_VIDEO_BUS_MAIN), configures double-buffered direct video memory, and presents frames synchronized with hardware VBLANK.

oops_display_t *oops_display_open(oops_display_backend_t backend, unsigned int width, unsigned int height)

int oops_display_is_ready(const oops_display_t *disp)

int oops_display_is_gpu_accelerated(const oops_display_t *disp)

int oops_display_try_gpu_tiler(oops_display_t *disp)

uint32_t *oops_display_get_framebuffer(oops_display_t *disp)

unsigned int oops_display_get_width(const oops_display_t *disp)

unsigned int oops_display_get_height(const oops_display_t *disp)

uint64_t oops_display_get_flip_count(const oops_display_t *disp)

int oops_display_get_last_error(const oops_display_t *disp)

const char *oops_display_get_backend_name(const oops_display_t *disp)

int oops_display_get_video_handle(const oops_display_t *disp)

int oops_display_flip(oops_display_t *disp)

void oops_display_clear(oops_display_t *disp, uint32_t color)

int oops_display_present(oops_display_t *disp, const uint32_t *pixels)

int oops_display_read_shown(oops_display_t *disp, uint32_t *pixels)

Scanout buffers, for a renderer that draws them itself

void oops_display_close(oops_display_t *disp)


2. 2D Software Drawing Canvas (<oops/draw.h>)

High-performance 2D rasterizer operating on linear ARGB pixel surfaces. Supports clipping, alpha blending, antialiasing primitives, bitmap fonts, and sprite blitting.

oops_surface_t oops_display_get_surface(oops_display_t *disp)

Surface layouts (oops_surface_t.layout)

oops_display_scanout_layout_t oops_display_use_scanout(oops_display_t *disp)

oops_surface_t oops_surface_from_sprite(const oops_sprite_t *sprite)

void oops_draw_clear(oops_surface_t *surf, oops_color_t color)

void oops_draw_pixel(oops_surface_t *surf, int x, int y, oops_color_t color)

void oops_draw_rect(oops_surface_t *surf, int x, int y, int w, int h, oops_color_t color)

void oops_draw_rect_blend(oops_surface_t *surf, int x, int y, int w, int h, oops_color_t color)

void oops_draw_rect_gradient(oops_surface_t *surf, int x, int y, int w, int h, oops_color_t color_a, oops_color_t color_b, int vertical)

void oops_draw_line(oops_surface_t *surf, int x0, int y0, int x1, int y1, oops_color_t color)

void oops_draw_circle(oops_surface_t *surf, int cx, int cy, int radius, oops_color_t color, int filled)

Blended variants

int oops_draw_text(oops_surface_t *surf, int x, int y, const char *text, oops_color_t color, int scale)

int oops_draw_text_width(const char *text, int scale)

void oops_draw_blit(oops_surface_t *dst, int dx, int dy, const oops_surface_t *src, int sx, int sy, int sw, int sh)

void oops_draw_blit_blend(oops_surface_t *dst, int dx, int dy, const oops_surface_t *src, int sx, int sy, int sw, int sh)

int oops_png_decode(const void *png_data, size_t png_size, uint32_t *out_pixels, uint32_t target_w, uint32_t target_h, uint32_t *out_orig_w, uint32_t *out_orig_h)


3. Fixed-Function 3D Instrument (<GL/gl.h>)

oops-gl is a clean-room, hardware-accelerated fixed-function 3D pipeline that maps GL-shaped calls directly to RDNA2 AGC command buffers (PM4 DCBs) with no vendor graphics driver underneath.

It is not an OpenGL version, and it is not the GL to write an application against. D007 scoped it to OpenGL 1.1-class fixed function; D008 (2026-09-17) superseded that instrument-only scope and grew it toward 1.x and 2.x. As of this writing its surface includes immediate mode, vertex arrays, buffer objects (GL 1.5), one 2D texture unit, lighting and materials, the matrix stacks, blend/depth/cull, alpha test, and display lists. Multitexturing, GLSL shaders (GL 2.0), stencil, and fog are still absent - each needs a shader-interface change that risks the pinned gl-cube oracle frame and has to be re-recorded on hardware (D009). Points, lines, and glPolygonMode wireframe are measured shut: the hardware's primitive assembler stalls rather than draws them. See docs/GL_ROADMAP.md for the measured, not remembered, gap against Mesa's declared entry points.

What it is for is evidence: because nothing sits between the call and the packet, its command stream is readable as a hardware record. docs/hardware/agc-gl-cube-oracle-fw1240.md is one such record, and orbistoun checks its own RDNA2 translation against it.

For applications, use oops-mesa, which provides OpenGL 3.3 Core and GLSL 3.30 through upstream Mesa and radeonsi. The two never link into the same title.

Context Lifecycle

void *glContextCreate(struct oops_display *disp)

void glContextMakeCurrent(void *ctx)

void glSwapBuffers(void)

void glContextDestroy(void *ctx)

Standard Fixed-Function APIs

Hardware Telemetry Extensions


4. Hardware RDNA2 AGC Graphics (<oops/agc.h>, <oops/gpu.h>)

Low-level bare-metal access to Prospero RDNA2 GFX10.3 hardware command queues, compute dispatchers, and tile micro-swizzling.

Queues and shaders (<oops/gpu.h>)

int oops_gpu_available(void)

oops_gpu_queue_t *oops_gpu_create_compute_queue(void)

oops_gpu_queue_t *oops_gpu_create_graphics_queue(void)

void oops_gpu_destroy_queue(oops_gpu_queue_t *queue)

oops_gpu_shader_t *oops_gpu_create_shader(const void *container_hdr, size_t hdr_size, const void *payload, size_t payload_size)

void oops_gpu_destroy_shader(oops_gpu_shader_t *shader)

int oops_gpu_dispatch(oops_gpu_queue_t *queue, const oops_gpu_dispatch_t *dispatch)

uint32_t oops_gpu_get_last_fence(const oops_gpu_queue_t *queue)

static inline int oops_agc_dispatch_compute(oops_gpu_queue_t *queue, const oops_gpu_shader_t *shader, uint32_t grid_x, uint32_t grid_y, uint32_t grid_z, const uint32_t *user_data, uint32_t user_data_count) (<oops/agc.h>)

int oops_agc_draw_primitive(oops_gpu_queue_t *queue, const oops_agc_draw_desc_t *desc) (<oops/agc.h>)

Micro-Tile Swizzling (<agc/tiler.h>, not <oops/agc_tiler.h> — the tiler lives under agc/, and its functions carry no oops_ prefix)


5. Memory Management & Direct Memory (<oops/memory.h>)

Prospero divides memory between CPU-cached coherent system RAM and GPU write-combined video memory. This subsystem manages direct physical allocations without glibc.

Memory Types (oops_mem_type_t)

void *oops_mem_alloc(size_t size, size_t alignment, oops_mem_type_t type)

void oops_mem_free(void *ptr)

int64_t oops_mem_get_phys(const void *ptr)

Low-Level Primitives


6. JIT & Dynamic Executable Memory (<oops/jit.h>)

Enables runtime code generation (compilers, emulators, recompilers) with W^X enforcement and progressive fallback across firmware environments.

int oops_jit_is_available(void)

int oops_jit_get_method(void)

int oops_jit_alloc(size_t size, oops_jit_memory_t *out_mem)

int oops_jit_flush_icache(const void *addr, size_t size)

int oops_jit_free(oops_jit_memory_t *mem)


7. Controller & Input Devices (<oops/input.h>, <oops/keyboard.h>, <oops/mouse.h>)

Provides low-latency polling for DualSense gamepads, motion sensors, adaptive triggers, and USB/Bluetooth keyboards and mice.

DualSense Gamepads (<oops/input.h>)

int oops_input_init(void)

int oops_input_poll(unsigned int port, oops_pad_state_t *out_state)

int oops_input_poll_batch(unsigned int port, oops_pad_state_t *out_states, unsigned int max_samples)

int oops_input_set_rumble(unsigned int port, uint8_t small_motor, uint8_t large_motor)

int oops_input_set_lightbar(unsigned int port, uint8_t r, uint8_t g, uint8_t b)

int oops_input_reset_orientation(unsigned int port)

int oops_input_adaptive_triggers_available(unsigned int port)

int oops_input_set_trigger_effect(unsigned int port, unsigned int triggers, int mode, uint8_t position, uint8_t position_end, uint8_t strength, uint8_t frequency)

void oops_input_close(void)

Keyboard (<oops/keyboard.h>)

Mouse (<oops/mouse.h>)


8. Audio Streaming (<oops/audio.h>)

Direct stereo 16-bit PCM streaming. One port, 16-bit signed interleaved stereo only — a channel count the write path can't honour is refused rather than stored.

oops_audio_port_t *oops_audio_open(int sample_rate, int channels, int buffer_frames)

int oops_audio_get_last_error(void)

int oops_audio_get_chunk_frames(const oops_audio_port_t *port)

int oops_audio_write(oops_audio_port_t *port, const int16_t *pcm_samples, size_t frame_count)

int oops_audio_flush(oops_audio_port_t *port)

int oops_audio_set_volume(oops_audio_port_t *port, float left, float right)

void oops_audio_close(oops_audio_port_t *port)


9. Hardware Media Codecs (<oops/audiodec.h>, <oops/videodec.h>)

Hardware acceleration for video decompression (H.264 / HEVC) and audio decode (AJM coprocessor).

Video Decode (<oops/videodec.h>)

Audio Decode (<oops/audiodec.h>)


10. System UI: Dialogs & On-Screen IME (<oops/dialog.h>)

Native system overlays that render directly over the application using the OS compositor.

On-Screen Virtual Keyboard (IME)

oops_ime_param_t param = {
    .user_id = -1,
    .type = OOPS_IME_TYPE_DEFAULT,
    .title = "Enter Server Address",
    .max_text_len = 64
};
oops_dialog_ime_open(&param);

while (oops_dialog_ime_poll() == OOPS_IME_STATUS_RUNNING) {
    // Continue running frame loop / flip
}

char result_buf[64];
oops_ime_result_t result;
oops_dialog_ime_get_result(result_buf, sizeof(result_buf), &result);
if (result == OOPS_IME_RESULT_OK) {
    oops_klog("IME", result_buf);
}
oops_dialog_ime_close();

oops_ime_param_t also has placeholder (UTF-8 placeholder text, or NULL) and pos_x/pos_y fields not shown above. void oops_dialog_ime_abort(void) cancels a running IME session without waiting for the user.

System Message Dialogs


11. Save Data Management (<oops/savedata.h>)

Safe, encrypted title save data mounting via libSceSaveData.

int oops_savedata_init(void)

int oops_savedata_mount(const char *dir_name, oops_savedata_mode_t mode, char *out_mount_path, size_t max_path_len)

int oops_savedata_unmount(const char *mount_path, bool commit)

void oops_savedata_term(void)


12. Package & Application Management (<oops/pkg.h>)

Asynchronous package installation and title management via libSceAppInstUtil.


13. Privilege Escalation & Sandbox Escape (<oops/escalate.h>)

Low-level kernel credential escalation and filesystem jailbreak.

[!NOTE] Standard Big App homebrew (games, emulators) run with full GPU and display privileges out of the box and do not require privilege escalation. These functions are intended for background maintenance utilities, FTP daemons, and system tools.

int oops_kernel_rw_init(void)

int oops_kernel_pipe_init(int rwpipe[2], int rwpair[2], uint64_t kpipe_addr, ...)

uint64_t oops_kernel_get_current_proc(void)

int oops_jailbreak_process(int pid)

int oops_escalate_to_system_authid(void)

int oops_has_system_authid(void)

int oops_system_escape_sandbox(void) (<oops/system.h>)

int oops_system_unescape_sandbox(void) (<oops/system.h>)

int oops_escape_jail(void)


14. Kernel Read/Write & Syscall Dispatcher (<oops/krw.h>, <oops/syscall.h>)

Primitives for interacting directly with kernel memory and dispatching system calls through verified libkernel trampolines.

Syscall Trampoline (<oops/syscall.h>)

Kernel Memory & Process Directory Operations (<oops/krw.h>)

krw.h is the largest header in the SDK and most of it was previously undocumented. Its functions carry a krw_/klog_ prefix, not oops_krw_.

Setup and base addresses

Raw kernel memory access

Process and credential lookup

Elevation helpers

Dynamic linking resolution

Kernel-side logging

Legacy Escalation Primitives (<oops/escalate.h>)


15. System Modules & Dynamic Linking (<oops/sysmodule.h>)

Dynamically load internal PRX modules at runtime using libSceSysmodule.

Module Identifiers

oops_sysmodule_load/unload/is_loaded take a plain uint16_t — there is no oops_sysmodule_id_t enum type. include/oops/sysmodule.h #defines the full set (OOPS_SYSMODULE_PERF through OOPS_SYSMODULE_SHARE); the ones this SDK's own subsystems load are:

int oops_sysmodule_load(uint16_t id)

int oops_sysmodule_unload(uint16_t id)

int oops_sysmodule_is_loaded(uint16_t id)


16. System Information & Telemetry (<oops/system.h>, <oops/offsets.h>)

Query hardware metrics, console firmware versions, user identity, and kernel offset tables. There is no oops_system_get_telemetry/oops_hw_telemetry_t — telemetry is split across oops_system_get_info (firmware/console identity) and oops_system_get_hw_info (live sensors) below.

int oops_system_get_info(oops_system_info_t *out_info)

int oops_user_get_initial_user_id(void)

int oops_user_get_name(int32_t user_id, char *out_name, size_t max_len)

int oops_user_get_logged_in_users(int32_t *out_user_ids, size_t max_users, size_t *out_count)

int oops_system_notify(const char *text)

Kernel Log & Telemetry Output (/dev/klog on target, stderr on host)

Crash-Resilient Disk Logging Sink

System Service Controls (libSceSystemService)

Hardware Telemetry & Diagnostics

int oops_system_get_hw_info(oops_hw_info_t *out_hw)

Sandbox and namespace

Firmware Offset Tables (<oops/offsets.h>)


17. High-Resolution Timing (<oops/time.h>)

Monotonic timestamps and microsecond sleeps based on x86 invariant TSC frequency.


18. Threading & Synchronization (<oops/thread.h>)

Clean-room POSIX-compatible threading primitives backed by kernel sys_thr_* syscalls.

Threads

Mutexes and condition variables

Semaphores

Exception handling


19. BSD Sockets & Network Telemetry (<oops/net.h>, <oops/netctl.h>)

POSIX socket wrappers for networking, paired with libSceNetCtl interface telemetry and freestanding RFC 1035 DNS resolution.

Socket Interface (<oops/net.h>)

DNS Hostname Resolution (<oops/net.h>)

Network Control (<oops/netctl.h>)


20. Freestanding C Runtime Utilities (<oops/freestd.h>)

Zero-libc implementations of memory, string, formatting, and hashing primitives.


21. Process Control & Code Injection (<oops/inject.h>)

Cross-process debugging, process hooking, and remote dynamic ELF loading. Everything in this section is declared in <oops/inject.h> itself — there are no separate procctl.h/procparam.h headers; the procctl_* functions below are just this header's own ptrace-style layer, unprefixed with oops_.

Target resolution

Ptrace-style remote control (procctl_*)

ELF loading

There is no oops_proc_kill or oops_proc_get_name in this SDK.


22. High-Level Filesystem Subsystem (<oops/fs.h>)

Freestanding POSIX-conforming filesystem layer wrapping kernel syscalls (SYS_open, SYS_close, SYS_read, SYS_write, SYS_lseek, SYS_mkdir, SYS_unlink, SYS_stat).

Core Functions

Application Persistent Storage Resolution


23. Freestanding Userland Heap Allocator (<oops/heap.h>)

Clean-room segregated-fit slab and anonymous virtual memory allocator.

Category 65536 & Direct Memory Independence

On Prospero, System Applications (Category 65536 titles, e.g. UI overlays, background daemons, and system launch payloads) are allocated 0 bytes of Direct Memory (DMEM) by the OS. Standard vendor SDK memory calls fail instantly in this environment. oops-sdk's heap allocator solves this by backing allocations with anonymous virtual memory (SYS_mmap 477 with MAP_PRIVATE | MAP_ANON 0x1002). It operates identically in game titles (gd), system titles, and elfldr payloads.

Allocator Functions


24. Freestanding Math & 3D Linear Algebra (<oops/math.h>)

Clean-room, zero-libc scalar mathematics, 3D vector operations, and 4x4 transform matrices matching RDNA2 PM4 uniform layout.

Scalar Operations

3D Vector Operations (oops_vec3_t)

4x4 Matrix Transforms (oops_mat4_t)


25. Target Platform Identification (<oops/target.h>)

Compile-time platform selection. Pulled into every other header through the unified <oops/oops.h>, but previously had no section of its own here.


26. On-Device ZIP Extractor (<oops/zip.h>)

Freestanding ZIP archive extractor supporting uncompressed (STORED, method 0) and Deflate-compressed (DEFLATED, method 8) entries. Implements RFC 1951 Deflate decompression with zero libc dependency. Files and directories are created using <oops/fs.h>.

Error Codes

Functions


27. HTTP/HTTPS Client & URL Parsing (<oops/http.h>)

Lightweight HTTP and HTTPS client engine for fetching remote payloads, REST API responses, and streaming package archives directly to storage. Supports plain HTTP/1.1 over BSD sockets and native HTTPS (TLS 1.2/1.3) via platform system modules (libSceHttp, libSceSsl, libSceNet) with automatic redirect following.

Error Codes

Data Structures

Functions


28. Standalone JavaScript Engine (<oops/js.h>)

Standalone, high-performance JavaScript engine based on QuickJS (ES2020 specification). Completely decoupled from rendering, layout, or DOM dependencies; suitable for game logic, dynamic configuration, scripting, and live-data handling.

Types and Data Structures

Functions


29. Standalone HTML5/CSS Layout & Rendering (<oops/html.h>)

Standalone HTML5 and CSS layout engine based on litehtml with Gumbo parser. Parses document structures, cascades CSS stylesheets, computes box layouts, and paints directly to an oops_surface_t (linear CPU buffer or GL texture) with zero JavaScript dependencies.

Types and Data Structures

Functions


30. Assembled Webview Browser (<oops/webview.h>)

Full-fledged webview component binding oops/js.h and oops/html.h together. Provides a live DOM bridge, host runtime environment (fetch(), console.log, setTimeout/setInterval), input event dispatch, and automatic layout reflow on DOM/style mutations.

Types and Data Structures

Functions


31. Performance Telemetry & Diagnostic Overlay (<oops/perf.h>)

On-device performance monitoring and composable diagnostic overlay subsystem. Collects real-time frame pacing, min/max/average frame times, instantaneous/smoothed FPS, 60-sample frametime history sparkline, and userland heap allocation telemetry. Provides zero-code activation (OOPS_PERF=1), hardware gamepad chord toggle (L3 + R3), and composable rendering delegates for both 3D scenes (<oops/hud.h>) and 2D software surfaces (<oops/draw.h>).

Types and Data Structures

Functions