PlayStation 5-Specific Features Emulated by SharpEmu: PlayGo API Implementation

SharpEmu currently implements the complete PlayStation 5 PlayGo system API through the SharpEmu.Libs.PlayGo library, exposing initialization, chunk management, progress tracking, and ETA calculation functions that mirror native PS5 firmware behavior.

The par274/sharpemu repository provides an experimental emulator targeting PlayStation 5 system architecture. Among the PlayStation 5-specific features currently emulated, SharpEmu delivers a comprehensive implementation of the PlayGo service—the console's background installation and downloadable content management system. This implementation allows games dependent on PlayGo functionality to execute within the emulator by reproducing the exact syscall interfaces and error handling behavior found in Sony's official libraries.

PlayGo Initialization and Lifecycle Management

SharpEmu handles PlayGo setup through standardized initialization and termination procedures that validate system buffers and manage runtime state.

Initialization occurs via scePlayGoInitialize in PlayGoExports.cs:56‑84. This function establishes the PlayGo runtime environment, validates buffer allocations, and handles repeated initialization attempts gracefully. During this phase, the emulator loads a static PlayGoMetadata structure (lines 94‑99) that contains chunk ID lists and availability flags, mirroring how real PS5 firmware reads metadata from the executable.

Termination is handled by scePlayGoTerminate (lines 152‑167), which releases all allocated resources and clears the runtime state.

Handle Management and Resource Control

The emulator implements a simplified handle system for PlayGo session management. The scePlayGoOpen function (lines 107‑115) returns a constant virtual handle (PlayGoHandle = 1), while scePlayGoClose (lines 175‑189) manages resource cleanup. This approach ensures compatibility with games expecting standard PS5 handle behavior without requiring complex multi-session support.

Chunk ID and Metadata Queries

PlayGo organizes content into downloadable chunks, and SharpEmu provides full query support for these structures.

Chunk ID retrieval is implemented in scePlayGoGetChunkId (lines 201‑259). This function validates pointer arguments, enforces size limits using MaxPlayGoQueryEntries, and returns the list of chunk IDs composing the title's downloadable content. The implementation includes comprehensive bounds checking to prevent buffer overflows.

Language mask support via scePlayGoGetLanguageMask (lines 334‑350) returns a bit-mask indicating which languages are supported for the current title, enabling games to select appropriate audio and text assets based on availability.

Progress Tracking and Installation State

The emulator provides real-time installation status through several query functions:

  • Progress reporting: scePlayGoGetProgress (lines 434‑456) returns download completion percentages for each chunk
  • ETA calculation: scePlayGoGetEta (lines 266‑303) provides estimated arrival times based on current download speeds, implementing the same size validation checks as chunk-ID queries
  • Install speed control: scePlayGoGetInstallSpeed (lines 302‑321) reports the current installation state (suspended, trickle, or full speed)
  • Locus handling: scePlayGoGetLocus (lines 366‑426) reports where each chunk resides (not downloaded, local-slow, or local-fast) and supports sentinel values requesting all entries simultaneously

Error Handling and Orbis Compatibility

All PlayGo exports return proper Orbis error codes to maintain binary compatibility with retail PS5 software. The error constants—including OrbisPlayGoErrorInvalidArgument, OrbisPlayGoErrorBadPointer, and OrbisPlayGoErrorBadSize—are defined in PlayGoExports.cs (lines 12‑20) and returned throughout the API surface to mimic real firmware behavior when encountering invalid parameters or state conditions.

Key Implementation Files

Code Example: Using PlayGo in SharpEmu

// Initialize PlayGo runtime in emulated PS5 application
int result = PlayGoExports.PlayGoInitialize(cpuContext);
if (result != 0) {
    Console.WriteLine($"PlayGo init failed: 0x{result:X8}");
}

// Open PlayGo handle (always returns constant handle = 1)
int handle = PlayGoExports.PlayGoOpen(cpuContext);

// Query chunk IDs (request up to 10 entries)
ulong outChunkIds = 0x1000_0000;   // guest address for output
int getIdsResult = PlayGoExports.PlayGoGetChunkId(
    cpuContext,
    handle,
    outChunkIds,
    numberOfEntries: 10,
    outEntries: out ulong written);

// Retrieve ETA for download completion
ulong outEta = 0x2000_0000;
int etaResult = PlayGoExports.PlayGoGetEta(
    cpuContext,
    handle,
    outChunkIds,
    numberOfEntries: 10,
    outEta);

// Cleanup
PlayGoExports.PlayGoClose(cpuContext);
PlayGoExports.PlayGoTerminate(cpuContext);

Summary

SharpEmu provides a robust implementation of PlayStation 5 PlayGo functionality:

  • Complete lifecycle management through scePlayGoInitialize and scePlayGoTerminate
  • Virtual handle system using constant handle values compatible with PS5 game expectations
  • Full metadata query support including chunk IDs, language masks, and locus information
  • Installation tracking with progress percentages, ETA calculations, and speed state reporting
  • Accurate error handling using official Orbis error codes for parameter validation and state management

Frequently Asked Questions

What is PlayGo on PlayStation 5?

PlayGo is Sony's background installation and download management system for PS5 games. It allows titles to download and install content in prioritized chunks, enabling players to start games while additional data continues downloading in the background. SharpEmu emulates this system to support games that check installation progress or manage downloadable content.

Are Fiber and AMPR also emulated by SharpEmu?

According to the current source analysis of par274/sharpemu, the detailed implementation focuses specifically on the PlayGo API within SharpEmu.Libs.PlayGo. While Fiber (likely referring to CPU fiber/job scheduling) and AMPR (potentially Advanced Memory Management) are mentioned as PlayStation 5-specific technologies, the current publicly documented source code emphasizes PlayGo implementation. Fiber and AMPR support may be planned features or implemented in other modules not covered in the current analysis.

How does SharpEmu handle PlayGo metadata?

During the first initialization call, SharpEmu loads a static PlayGoMetadata structure (defined in PlayGoExports.cs:94‑99) that contains the list of chunk IDs and their availability flags. This metadata mimics the binary blob that real PS5 firmware extracts from the game's executable, allowing the emulator to report realistic chunk availability states to running applications.

What error codes does SharpEmu return for invalid PlayGo operations?

SharpEmu returns standard Orbis error codes defined in PlayGoExports.cs (lines 12‑20), including OrbisPlayGoErrorInvalidArgument for bad parameters, OrbisPlayGoErrorBadPointer for invalid memory addresses, and OrbisPlayGoErrorBadSize for buffer overflows. These constants ensure that games handle emulator responses identically to real PS5 hardware behavior.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →