Pc4 is an open-source PlayStation 4 emulator written in Rust and C++. It contains no Sony firmware, no Sony keys and no Sony libraries: everything is an independent high-level emulation (HLE) of the PS4 interfaces.
See LEGAL.md for the full compliance notes.
| Component | Implementation |
|---|---|
| CPU | AMD Jaguar x86-64 (8 cores), interpreter with an LLVM JIT backend behind a feature flag |
| GPU | Real Vulkan device, render passes and pipelines; PM4 type 3 packets decoded and executed as vkCmdDraw* calls, frames rendered on the GPU and read back |
| Kernel | Orbis OS HLE: syscalls reimplemented from public documentation, including mmap, mprotect, munmap and guest process exit |
| Audio | HLE libSceAudio (48 kHz stereo), resampled into a device-rate ring |
| Input | HLE libScePad for the DualShock 4, plus keyboard |
| Loader | Homebrew ELF, decrypted SELF, decrypted PKG, or a folder with the boot file |
| Preload | Loading-screen pass that reads maps, textures, shaders and audio into memory before the guest starts |
| VFS | Virtual file system; PS4 paths map to directories you own, served from memory when preloaded |
| GUI | Native desktop interface built with egui/eframe |
| Packages | Pkg entry table parsing and extraction; Self segment table; AES-CBC with AES-NI |
These files are never bundled, downloaded or required:
PS4UPDATE.PUP Sony firmware
PS4 BIOS Does not exist separately; the firmware contains everything
Cryptographic keys Sony property; distributing them is illegal
libSce*.prx Proprietary Sony libraries
Sony certificates Sony property
Orbis system files Proprietary Sony kernel
What the project does contain, all written from scratch:
- an independent HLE implementation of the PS4 syscalls;
- a GCN to SPIR-V shader compiler;
- a virtual file system that maps PS4 paths onto local directories;
- an ELF loader for unencrypted homebrew, plus Pkg extraction and AES-CBC for dumps you own.
Legal basis:
| Case | Principle |
|---|---|
| Sega v. Accolade (1992) | Reverse engineering for interoperability is lawful |
| Sony v. Connectix (2000) | Emulation itself is lawful |
| 17 U.S.C. § 107 | Fair use for reverse engineering |
| EU Directive 2009/24/EC | Decompilation for interoperability is lawful in the EU |
Every v* tag builds the three packages on their own runners and attaches them
to the release:
| Platform | File | How to run |
|---|---|---|
| Linux x86-64 | Pc4-<version>-x86_64.AppImage |
chmod +x it, then run it. No install step, no root. |
| Windows 10/11 x64 | Pc4-<version>-windows-x64.exe |
Double-click it. The C runtime is linked in, so there is nothing to install. |
| macOS 11+ | Pc4-<version>-macos-universal.dmg |
Open the image, drag Pc4 to Applications. Universal: Intel and Apple silicon. |
The binaries are not signed with a paid certificate. Windows SmartScreen asks for "More info" then "Run anyway"; on macOS the ad-hoc signature means the first launch needs a right-click then Open, or
xattr -dr com.apple.quarantine /Applications/Pc4.appSHA256SUMS.txt sits next to the packages. The macOS disk image contains a
universal binary (lipo of the arm64 and x86_64 builds); the AppImage is built
on Ubuntu 22.04 so it runs on anything with glibc 2.35 or newer.
Vulkan comes from the platform:
| Platform | Vulkan provider |
|---|---|
| Linux | the GPU driver (mesa-vulkan-drivers, nvidia), loaded from libvulkan.so.1 |
| Windows | the Vulkan loader (vulkan-1.dll) installed with the GPU driver |
| macOS | MoltenVK 1.3.0, bundled inside Pc4.app/Contents/Frameworks and loaded directly |
Each package is checked before it is published: pc4 --gpu-info prints the
device, and pc4 --gpu-selftest uploads a frame, draws a triangle through a
real pipeline and reads the pixels back. The Linux job runs both checks against
the built AppImage itself.
The same three commands the workflow runs also work by hand:
bash packaging/linux/appimage.sh # dist/Pc4-<version>-<arch>.AppImage
bash packaging/macos/dmg.sh # dist/Pc4-<version>-macos-universal.dmg, on a MacRequirements:
# Rust 1.88 or newer
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# C++ toolchain (GCC 12+ or Clang 15+)
sudo apt install build-essential clang cmake
# Vulkan: only the run-time loader, the build does not need headers
sudo apt install libvulkan1 vulkan-tools mesa-vulkan-drivers
# Optional: LLVM, only for the JIT backend
sudo apt install llvm-17-devThe GLSL in shaders/ is compiled ahead of time and the .spv files are
committed, so building needs no shader compiler. After editing a shader:
glslangValidator -V shaders/present.vert -o shaders/present.vert.spvCompile:
cargo build # debug build with symbols
cargo build --release # optimised build
cargo build --release --features jitRun:
./target/release/pc4 path/to/homebrew.elf
./target/release/pc4 --fullscreen game.elf
RUST_LOG=debug ./target/debug/pc4 --no-jit game.elf
./target/release/pc4 --null-gpu game.elf
./target/release/pc4 --gpu-info # which Vulkan device would be used
./target/release/pc4 --gpu-selftest # draw and read back a frame on the GPUCommand line options:
-f, --fullscreen Start in fullscreen
--no-jit Use the software interpreter instead of the LLVM JIT
--nogui Run without the GUI (headless CLI mode)
--opengl Use the OpenGL backend
--null-gpu Use the null GPU backend (testing)
--threads <N> Number of CPU threads (default: physical cores, max 8)
--render-scale <S> Render scale from 0.5 to 1.0 (default 1.0)
--print-plan Print detected hardware and the rendering plan, then exit
--gpu-info Print the Vulkan device and exit
--gpu-selftest Draw and read back a frame on the GPU, then exit
-h, --help Show help
Installer scripts are provided for Linux and macOS (install.sh) and for Windows
(install.ps1).
The desktop interface opens when no game path is given. It is a dark theme with a PlayStation-blue accent, built around the game library.
- Library with grid and list layouts, sorting, search and a compatibility filter.
- Game properties, launch and "show in folder" from the context menu.
- Settings window with the General, CPU, Graphics, Audio, Input, Folders and Advanced tabs.
- System log docked at the bottom, colour coded by level.
- Status bar with the emulator state and live frame metrics.
- Performance overlay, toggled from the View menu.
Keyboard shortcuts:
| Shortcut | Action |
|---|---|
| Ctrl+O | Open a game |
| F5 | Start |
| F6 | Pause or resume |
| F7 | Stop |
| F8 | Restart |
| F11 | Toggle fullscreen |
| F12 | Screenshot |
Pc4 renders at a fraction of the display resolution and scales the frame up before presenting it. The render scale is what buys frame rate; the filter and the sharpening pass decide how much image quality survives it.
$ pc4 --print-plan
Pc4 performance report
host 8 cores / 16 threads, 32 GB RAM, AMD (amdgpu), 16 GB VRAM
tier Mainstream
render 1496x842 -> 1920x1080 (78%), Catmull-Rom
target 60 fps (16.7 ms per frame)
sharpness 30%
dynamic on
preload 1/8 of RAM
threads 8
DLSS needs an NVIDIA GPU
Defaults follow the detected hardware:
| Tier | Condition | Render scale | Filter | Frame target |
|---|---|---|---|---|
| Entry | 4 physical cores or fewer, or under 8 GB of RAM | 67% | Bilinear | 30 fps |
| Mainstream | Up to 8 cores and up to 16 GB of RAM | 78% | Catmull-Rom | 60 fps |
| High end | More than 8 cores and more than 16 GB of RAM | 100% | Lanczos-2 | 60 fps |
pc4 --print-plan shows the same table for the machine it runs on. The Graphics
tab has a "Recommend for this PC" button that writes those values into the
settings, and every control stays editable afterwards.
Dynamic resolution reacts to the frame budget:
- three frames in a row over the budget drop the scale by 5%;
- ninety frames in a row under 85% of the budget raise it by 5%;
- changes are 30 frames apart;
- the scale never goes below 50% or above the value you configured.
Compatibility mode caps the scale at 75% and forces the cheapest filter, which
is what you want on an older laptop. All of the above lives in src/perf/ and is
covered by unit tests (cargo test).
A game that reads a map or a texture the moment it is needed stalls the frame that asked for it. Pc4 avoids that by reading the whole content folder during the loading screen, before the guest starts, and serving those reads from memory afterwards.
$ pc4 /games/demo --nogui
Game folder: booting eboot.bin
ELF loaded. Entry point: 0x400000
Preload: 237 files, 22.3 MiB in 20 ms (1137 MiB/s), 1 skipped, 0 unreadable
Main loop started
What it does:
src/preload/lists the assets withmanifest, sorts them by what a game touches first (executable, maps, textures, meshes, shaders, audio, video, data) and reads them in parallel, so a budget that runs out spends itself on the files likely to be needed soonest.- the bytes go into an
AssetCachethat the virtual file system consults on every open, so a cached file is never touched on disk again; - the budget defaults to an eighth of the installed RAM. Files larger than a
quarter of the budget (configurable in the Graphics tab, or with
--preload-budget) stay on disk: reading a 4 GB archive twice is worse than reading it once when it is needed; - the pass is cancellable: Cancel on the loading screen stops the remaining reads, and the game still runs with what has been cached so far;
--no-preloadturns it off entirely for comparison.
The win is the latency of the first touch, not the total bytes read. On the
corpus in benches/preload.rs (256 files, 64 KiB each, page cache warm) the
same 16 MiB costs 16.6 us from the cache and 3.8 ms from the file system, about
230 times less. On a cold disk the gap widens.
Caveat, stated plainly: nothing here makes a game load faster. It moves work from the frame that would have dropped to the loading screen you are already watching.
Be clear about the proportions: the emulator is Rust, and C++ is deliberately limited to the two inner loops where hand-written SIMD pays. Scaling 1286x724 to 1920x1080 every frame is a tight loop over pixels, so that loop is written twice and the fast copy runs when the CPU supports it. By line count C++ is under 1% of the project, and the language bar on GitHub reflects that.
- Rust builds the resampling tables, splits the frame into row bands, owns the threading, and holds the loader, the CPU, the kernel, the HLE and the GUI.
- C++ (
cpp/perf/upscale_kernels.*) runs both resampling passes and the sharpen with AVX2 intrinsics, one call per row. - C++ (
cpp/crypto/aes_cbc.*) decrypts container payloads with AES-NI, with a table-driven copy for CPUs that lack it. src/perf/native.rsis the FFI layer. When the library is missing or the CPU has no AVX2, the Rust reference kernels take over, so the build never depends on a particular CPU.PC4_UPSCALE=rustforces the reference path;PC4_UPSCALE=nativerefuses to fall back, which is how the equivalence test is kept honest.
Both paths are tested against each other byte for byte: cargo test renders the
same frame with both implementations for every filter and both sharpen
variants, and fails if a single byte differs.
cargo bench measures the pair on the host. On a 4-thread container CPU
(1286x724 to 1920x1080, both passes plus sharpening, 4 row bands):
| Filter | Rust reference | C++ AVX2 | Speed-up |
|---|---|---|---|
| Bilinear | 37.2 ms | 5.4 ms | 6.9x |
| Catmull-Rom | 42.9 ms | 6.1 ms | 7.1x |
| Lanczos-2 | 43.6 ms | 5.8 ms | 7.5x |
| Sharpen 1920x1080 (alone) | 25.5 ms | 2.4 ms | 10.4x |
The numbers include the Rust side of the pipeline, so they describe the real
frame cost rather than an isolated kernel. The C++ half is built by build.rs
through cc; CMakeLists.txt builds the same sources on their own for
profiling. pc4 --print-plan reports which path
this machine will use, and so does the Graphics tab.
pc4 --extract game.pkg --out dir unpacks a package and prints what came out;
--pkg-key and --pkg-iv (or PC4_PKG_KEY and PC4_PKG_IV) supply the key for
encrypted entries. Loading a package does the same in memory: parse the entry
table, take eboot.bin, find the ELF inside it and map that.
src/loader/pkg.rsreads the header, the entry table and the name table, and refuses anything that would write outside the output directory.src/loader/self_.rstakes the ELF from the segment table when the table is sane, and falls back to a scan that validates the ELF64 header.src/crypto/mod.rsholds a pure Rust AES-128/192/256, andcpp/crypto/aes_cbc.cppthe AES-NI path. All three implementations are held to the NIST SP 800-38A vectors and to each other, byte for byte.
Decrypting 1 MiB of payload, same host:
| Implementation | Throughput |
|---|---|
| C++ AES-NI | 2.5 GiB/s |
| Rust reference | 67 MiB/s |
| C++ portable tables | 50 MiB/s |
The C++ tables are slower than the Rust reference, so without AES-NI the Rust
implementation is the one that runs: the fast path is chosen by measurement, not
by language. PC4_AES=portable and PC4_AES=rust pin either side, which is how
the three are compared in CI.
Neither is implemented, and the interface says so instead of pretending:
- DLSS is proprietary NVIDIA code. It needs the NGX runtime plus per-frame depth, motion vectors and an optical-flow buffer supplied by the title. Pc4 does not produce those buffers yet, so the Graphics tab probes for the NGX runtime, reports what it found, and keeps the option disabled.
- FSR 2 and 3 are temporal upscalers with the same requirements: motion vectors and a jittered projection matrix. The renderer has neither.
- FSR 1 is spatial and MIT licensed, so it could be ported. The filters shipped here (bilinear, Catmull-Rom, Lanczos-2, then a sharpening pass clamped to the local 5-tap range) were written for this project and work today. A faithful EASU/RCAS port is future work, not something this release claims.
The higher-quality filters run on the CPU. The Vulkan presentation pipeline
scales frames on the GPU with the nearest or linear sampler, which is what the
plan asks for when rendering below native resolution; Catmull-Rom, Lanczos and
the sharpening pass remain on the CPU. perf::Upscaler documents the exact
behaviour both sides have to reproduce.
Pc4/
├── src/ Rust core
│ ├── main.rs Entry point, wires CLI and GUI
│ ├── cli.rs Command line parsing
│ ├── lib.rs Emulator struct and subsystem wiring
│ ├── cpu/mod.rs x86-64 interpreter and JIT front end
│ ├── gpu/ AMD GCN GPU
│ │ ├── mod.rs GPU orchestration
│ │ ├── pm4.rs PM4 packet decoder (type 3 headers, draws, registers)
│ │ ├── vulkan/ Vulkan backend
│ │ │ ├── mod.rs Device, PM4 dispatch, GPU self-test
│ │ │ ├── context.rs Instance, physical device, queue, memory types
│ │ │ ├── resources.rs Buffers and images
│ │ │ └── renderer.rs Render passes, pipelines, upload, readback
│ │ ├── shader.rs GCN to SPIR-V compiler
│ │ └── command_processor.rs Command processor front end
│ ├── memory/mod.rs Virtual memory, 8 GB user space
│ ├── kernel/ Kernel HLE
│ │ ├── mod.rs Syscall dispatcher
│ │ ├── file_system.rs Virtual file system
│ │ ├── thread.rs Thread HLE
│ │ ├── process.rs Process HLE
│ │ └── ipc.rs IPC stubs
│ ├── hle/ High level emulation of the PS4 libraries
│ │ ├── mod.rs HLE function registry
│ │ ├── libc.rs malloc, memset, printf
│ │ ├── libkernel.rs sceKernel* functions
│ │ ├── libscepad.rs DualShock 4
│ │ ├── libsceavplayer.rs Media player
│ │ └── libscengs.rs NGS audio
│ ├── perf/ Performance layer
│ │ ├── mod.rs Glue: profile, settings, plan, statistics
│ │ ├── hardware.rs CPU, RAM and GPU detection
│ │ ├── plan.rs Render scale, filter choice, dynamic resolution
│ │ ├── upscale.rs Resampling filters and sharpening
│ │ └── native.rs FFI to the C++ kernels, Rust fallback
│ ├── crypto/mod.rs AES-CBC reference and the FFI to the C++ path
│ ├── loader/
│ │ ├── mod.rs Loader: ELF, SELF and PKG entry point
│ │ ├── pkg.rs Pkg header, entry table, extraction
│ │ └── self_.rs Self segment table and inner ELF lookup
│ ├── audio/mod.rs Audio output
│ ├── input/mod.rs Controller and keyboard input
│ ├── utils/ Logging, timers, math helpers
│ └── ui/ egui interface
│ ├── theme.rs Design tokens: colours, type scale, spacing
│ ├── icons.rs Vector icon set
│ ├── app.rs Application state and frame loop
│ ├── menu_bar.rs Menu bar and toolbar
│ ├── game_library.rs Sidebar, search, grid and list views
│ ├── game_card.rs Grid card, list row, performance overlay
│ ├── properties.rs Game properties dialog
│ ├── settings.rs Settings window
│ ├── log_panel.rs Docked system log
│ ├── status_bar.rs Status bar
│ └── about.rs About dialog
├── benches/upscale.rs Criterion benchmark: backend and filter comparison
├── benches/crypto.rs Criterion benchmark: AES-NI against the references
├── shaders/ GLSL for the Vulkan pipelines, with the compiled .spv
├── cpp/perf/ AVX2 resampling and sharpen
├── cpp/crypto/ AES-CBC with AES-NI
├── Cargo.toml Rust dependencies
├── CMakeLists.txt Standalone build of the C++ half
├── build.rs Rust and C++ bridge
├── install.sh Installer for Linux and macOS
├── install.ps1 Installer for Windows
└── LEGAL.md Legal compliance
Be clear about where this stands: 0.1.0 does not draw a game yet. The
window, the library, the loaders, the kernel calls and the preload work. The
Vulkan backend is real: it opens an instance and a device, builds render passes
and pipelines, executes PM4 draws as vkCmdDraw* calls, presents frames on the
GPU and copies them back. What it cannot do yet is take a PS4 draw from a disc:
the GCN vertex-descriptor decoding and the shader translation are partial, so
guest draws run through the backend's own pipeline and a game still shows
nothing. The packages above are the same code, built for each platform, and CI
draws and reads back a frame on each of them.
| Component | Status | Notes |
|---|---|---|
| CPU interpreter | In progress | Register file and loop in place; the x86-64 decoder is incomplete |
| CPU JIT (LLVM) | Not started | Feature flag and call sites exist |
| Vulkan backend | Working | Real instance/device/queue, render passes, GraphicsPipeline, GPU readback; --gpu-selftest draws and checks pixels |
| PM4 command processor | In progress | Type 3 packets, INDEX_TYPE, NUM_INSTANCES, SET_*_REG shadowing, DRAW_INDEX_2 / DRAW_INDEX_AUTO as real draws |
| Vulkan packaging | Working | AppImage and .exe use the driver loader; the .dmg bundles MoltenVK 1.3.0 |
| GCN to SPIR-V | In progress | SOP2, VOP2, SMEM and EXP are decoded; emission is partial and no translated module drives a pipeline yet |
| Kernel HLE syscalls | In progress | read, write, mmap, munmap, mprotect, thr_self, thr_exit; guest exit stops the emulator instead of taking it down |
| Virtual file system | In progress | Works for homebrew paths |
| ELF loader | Working | PT_LOAD mapping |
| SELF loader | Working | Segment table first, validated scan as a fallback |
| PKG loader | Working | Entry table, extraction, AES-CBC for entries you own the key of |
| AES-CBC | Working | C++ AES-NI and portable tables plus a Rust reference, NIST vectors and cross-checks |
| Upscaling and render scale | Working | CPU resampling with tests; the Vulkan pipeline scales with the nearest/linear sampler |
| DLSS / FSR | Not implemented | Needs motion vectors; availability is detected and reported |
| Audio HLE | In progress | 48 kHz mixing, resampling and a drop-oldest ring with tests; the device callback is the next step |
| libc HLE | Working | malloc over a guest heap, memset, memcpy, strlen, printf and sprintf touch real guest memory |
| DualShock 4 input | In progress | scePadReadState copies the controller state into ScePadData; the GUI still has to publish it |
| GUI | Working | Library, settings, log and status bar |
| C++ kernels | Working | Both resampling passes and the sharpen, AVX2 with a scalar fallback; byte-identical to the Rust reference |
Pull requests are welcome. Read LEGAL.md before contributing.
Contributions are rejected if they contain:
- Sony firmware files;
- Sony cryptographic keys;
- code copied from decompiled Orbis OS binaries.
GPL-2.0, see LICENSE.