How shadps4-emu/shadps4 works
shadPS4 is a cross-platform PlayStation 4 emulator. The documented user workflow is to launch a game by title ID or provide a PS4 ELF; the command-line entry point then starts emulation. The architecture separates guest execution, PS4-compatible services, host input and rendering, and persistent configuration/cache. Edges are limited to relationships visible in the README, the main.cpp reference index, or sampled Vulkan/cache excerpts; unsampled runtime wiring is left unconnected or marked unverified.
Main entry points: main.cpp CLI Entry · emulator.cpp Emulator Runtime · vk_pipeline_cache.cpp Pipeline Cache · ipc.cpp Guest IPC
Components 18
Launch and Control
- CLI Entry
src/main.cpp - Emulator Settings
src/core/emulator_settings.h
Guest Execution
- Emulator Runtime
src/emulator.cpp - Emulator State
src/core/emulator_state.cpp - Guest Address Space
src/core/address_space.cpp - ELF Metadata
src/common/elf_info.h
PS4 Services
- Virtual Filesystem
src/core/file_sys/fs.cpp - Guest IPC
src/core/ipc/ipc.cpp - PS4 Libraries
src/core/libraries/libs.cpp - User Services
src/core/libraries/system/userservice.h
Graphics
- Shader Compiler
src/shader_recompiler/ir/program.cpp - Vulkan Pipelines
src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp - Pipeline Cache
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp - Cache Storage
src/video_core/cache_storage.cpp
Host Integration
- Controller Input
src/input/controller.cpp - SDL Window
src/sdl_window.cpp - Debugger
src/core/debugger.cpp
Other components
- Player
Connections 16
- Player → CLI Entry: launches
README.md - CLI Entry → Emulator Runtime: starts
src/main.cpp - CLI Entry → Virtual Filesystem: configures
src/main.cpp - CLI Entry → Emulator Settings: configures
src/main.cpp - CLI Entry → Debugger: configures
src/main.cpp - Emulator Runtime → Emulator State: uses
- Emulator Runtime → Guest Address Space: uses
- Emulator Runtime → ELF Metadata: reads metadata
- Emulator Runtime → Guest IPC: dispatches
- Guest IPC → PS4 Libraries: dispatches
- PS4 Libraries → User Services: provides
- Controller Input → User Services: uses user IDs
src/input/controller.cpp - Pipeline Cache → Shader Compiler: requests compilation
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp - Pipeline Cache → Cache Storage: loads and saves
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp - Pipeline Cache → Vulkan Pipelines: creates pipelines
- Player → SDL Window: interacts