bbport

bbport is a native Linux port of Bloodborne that translates graphics to Vulkan and supports temporal upscaling with FSR 3.1 and FSR 4.

README

THIS PROJECT IS NOT RELATED TO SHADPS4. ALL QUESTIONS RELATED TO THIS PROJECT SHOULD BE SENT TO THE DISCORD SERVER https://discord.gg/KYZRKk9CB, NOT TO THE SHADPS4 SERVER.

bbport — a native Linux and Windows port of Bloodborne

English · Русский

bbport is the counterpart of Wine + DXVK for a single game: Bloodborne for PlayStation 4 (CUSA03173, game version 1.09) on an x86-64 PC with Linux or Windows 10/11 (since 0.7, see Windows). The game's original executable runs directly on the PC:

  • as in Wine, the game's x86-64 code runs on the CPU directly, and a runtime written for this one game replaces the PS4 system libraries;
  • as in DXVK, the game's graphics are translated to Vulkan — by the port's own renderer and shader translator (they started from shadPS4's and were rewritten), including temporal upscaling with AMD FSR 3.1, FSR 4, FSR 4.1.1 and NVIDIA DLSS, and DLSS Frame Generation;
  • memory and the GPU's work follow the PC model on every GPU: the new memory and translation model is the only one (the default since 0.6; the old model of 0.3 was removed in 0.7).

No game files are included. You need your own dump of Bloodborne with update 1.09: any retail release (CUSA00900 in the US, CUSA03173 for the European Game of the Year edition, ...), as they share the same executable. This project is not affiliated with Sony Interactive Entertainment, FromSoftware or AMD.

Status: experimental, playable. The game boots, loads saves and plays (the Hunter's Dream and several areas of Yharnam were played with it) with sound, gamepad and saving. A full play-through has not been verified. Tested thoroughly: AMD Radeon RX 7800 XT (Linux with Mesa/RADV, and Windows 11), the Steam Deck; on Windows also two laptops with NVIDIA GTX 1050 and GeForce 930MX; other NVIDIA and Intel GPUs by players.

Highlights

  • Native execution. The eboot is converted offline into a flat memory image; PS4 libc and libSceFios2 are linked into it as native code. No CPU emulation and no per-instruction translation: the game code runs at full speed.

  • One memory and translation model (the model of 0.3 is gone):

    • The game's memory lives in system RAM and the GPU reads it where it is, as a PC game's buffers; data it reads often is kept in VRAM and given back when unused (textures after 20 s, buffers after 60 s). The layer's memory module tracks CPU writes to mirrored blocks to keep those copies coherent; it does not copy the whole GPU-visible memory. The PS4 command processor's work is translated into Vulkan commands rather than emulated on the CPU: memory writes (WRITE_DATA, DMA) are done by the GPU in command-stream order, and fences are written by the GPU itself at the end of the pipeline, at the same point of the stream as the PS4's command processor writes them. On every GPU the game's memory goes through the layer's memory module: bound in place, VRAM copies as separate buffers, no sparse binding (NVIDIA's sparse binding froze the GPU for seconds; on AMD the module is faster than the former sparse arena too); BB_LAYER_MEMORY=0 gives AMD's sparse arena. Tested thoroughly on an RX 7800 XT; on NVIDIA by testers. A driver that fails the startup checks stops the game with a line beginning STOP: the GPU driver cannot use the game's memory in place.

    The graphics heaps of the game grow as it takes memory and give it back when freed.

    Changes in 0.7, 0.6, 0.6-pre1, 0.51, 0.5.

    Unused textures are freed, so VRAM no longer grows with every area visited; Texture quality (full, half, quarter, auto = half on cards with up to 3 GB) skips the top levels of big textures on small cards.

  • Unlocked frame rate. Hooks in the game's code make the simulation use the real frame time (the community patches in patches/Bloodborne.xml remain for comparison, BB_FRAME_HOOKS=0); ~90 FPS at 4K with FSR 4 Balanced on an RX 7800 XT, ~150 FPS at 1440p with FSR 4 Quality. Also 30/60/90 FPS modes; F3 switches a 30 FPS limit on and off while playing (some cinematics, e.g. Laurence's, are safest at 30).

  • Any aspect ratio, live. 4:3, 16:10, 16:9, 21:9 and 32:9 with the HUD at the screen's edges, through hooks (the game's code is not patched); cinematics are wide too.

  • Keyboard and mouse. Mouse look turns the game's camera directly; a mouse pointer in the game's menus (F1 releases the mouse); a layout close to Dark Souls III's (Space dodge, Left Shift run, Shift+Space jump); movement keys ramp up like a stick; button prompts show the bound key, or the buttons of the gamepad in use (Xbox and others), PlayStation icons only with a PlayStation pad.

  • Online play and seamless co-op. Two pools on shadPS4 0.20's network stack: Seamless Hunt (default; bells, summons, messages, bloodstains and seamless co-op, BBSC, up to five hunters; an account from seamlesshunt.com) and The Hunter's Dream (sign-in with Discord; no BBSC).

  • Temporal upscaling built for this game. Bloodborne has no velocity buffer, so bbport computes motion vectors itself: camera motion from depth and the scene matrices, and object motion (characters, cloth, weapons) from the vertex positions of the previous frame. The scene is jittered sub-pixel (Halton) and rendered at a reduced resolution; the upscaler fills the output (720p for the Steam Deck, 1080p, 1440p or 2160p) and the UI is drawn natively at the output resolution.

    • FSR 3.1 (FireBurn/FSR-Vulkan).
    • FSR 4 (INT8, model v07) on GPUs exposing the required Vulkan shader features — RDNA2/3 included (see Requirements).
    • FSR 4.1.1: AMD's 4.1.1 DLL is recorded once under vkd3d-proton and its passes are replayed natively on Vulkan; the output is bit-exact with the DLL. Two variants, as in the DLL: INT8 on any GPU with the required shader features, and FP8 matrices on RDNA4 (RX 9000; picked automatically). The assets are built on your machine from one DLL of your own (4.1.x): the launcher's FSR 4.1.1 from your own AMD DLL → Choose DLL… button (2–5 minutes, twice that on RDNA4; needs a recent Proton), or tools/fsr4cap.
    • DLSS Super Resolution and DLSS Frame Generation (NVIDIA GeForce RTX) through an optional bridge built against NVIDIA's SDK (see Building). Frame generation makes the frames between two of the game's (2x on RTX 40, up to 4x on RTX 50) from the finished frame, the frame before its UI, the scene depth, the motion vectors and the game's camera matrices; Overlay menu → Frame generation, or the launcher.
    • FSR 4.1.2's models from the AMD driver (INT8 on RDNA2/3 and the Lite model), taken from the driver's amdxcffx64.dll with the upscaler DLL (FSR 4 model in the menus).
    • FSR 1 (spatial, no motion vectors) for weak GPUs, and FSR 3.1 frame generation (experimental, every GPU; the port's own optical-flow and interpolation shaders).
    • Anti-aliasing separate from the upscalers: auto (the game's AA only without an upscaler), the game's, FXAA (Kyo's Force FXAA2), SMAA 1x (the port's own, before the UI), off; sharpening (RCAS) also without an upscaler. GT-VBAO can replace the game's SSAO.
    • Faster than AMD's own shaders on RDNA3: the final passes of FSR 4 and 4.1.1 were rewritten to store through workgroup memory (3.5× and 2.3× faster, bit-exact); FSR 4 costs ~4 ms at 4K on an RX 7800 XT instead of ~6 ms.
  • Multi-threaded GPU command processing. The PS4 command stream is decoded on one thread and draws are bound and recorded on another (two-stage pipeline), with a Vulkan recording thread and helper threads for memory copies. Early on the single GPU thread capped the game at ~26 FPS; now it runs at 90–150 FPS depending on resolution and scene.

  • Settings inside the game's own menu: System → Display / Effects (after Screen/Sound), built and drawn by the game itself — output resolution, upscaler, preset, sharpness, FPS counter, model detail and the game's effects, in the game's language. Chromatic aberration, depth of field, motion blur, SSAO, the game's AA and dynamic-light shadows switch at once; screen-space reflections, the intro, free camera and the debug menu need a restart.

  • Overlay menu (Insert, or hold L3+R3), styled like the game's dialogs: everything above plus the advanced settings, with gamepad, keyboard and mouse.

  • Shaders before you play. A pack of shader recipes from players' caches (655 programs, 1149 pipelines) is compiled in the background at start, and the cache survives updates: a repeat session compiles nothing.

  • Launchers: GTK4 on Linux, WPF in the Windows 11 style on Windows (both with sections and descriptions); an AppImage for Linux and the Steam Deck, the same as a folder (tar.zst, Bloodborne.sh), a zip for Windows.

How it differs from shadPS4

shadPS4bbport
ScopeGeneral PS4 emulator, many gamesOne game: Bloodborne v1.09
LoadingIts own ELF loader and kernel emulation at run timeThe eboot is converted offline (scripts/) into an image with PS4 libc/Fios2 linked in; a C loader maps it and jumps into the game (loader and runtime: ~5k lines)
MemoryThe GPU's view of PS4 memory is kept in VRAM copies, synchronized through page-protection write trackingThe game's memory in system RAM, used by the GPU in place, frequently read data in VRAM, freed when unused
Command processorEmulated: memory writes, DMA and fences are done by the CPU while decodingTranslated into Vulkan commands that the GPU runs in stream order, fences written after the work has really finished
System librariesBroad HLE of the PS4 OSA small runtime (src/runtime_*.c) that implements exactly what Bloodborne calls: memory, threads, sync, files, audio (incl. ATRAC9), pad, saves, AppContent
GPUshadPS4 video core and shader recompilerIts own command processor, renderer, caches and shader translator (they started from shadPS4's, gpu/VENDOR.txt): two-stage draw pipeline, render-state and texture-set memoization, render-scale proxies, motion vectors, FSR 3.1/4/4.1.1, DLSS, frame capture and GPU profiler
GPU threadOne thread processes the whole command stream (the bottleneck in Bloodborne)Decode and draw recording run on separate threads; the work scales with the hardware threads (Steam Deck included)
Upscaling—Temporal (FSR 3.1, FSR 4, FSR 4.1.1/4.1.2, DLSS) with motion vectors computed for the game and jitter; frame generation (DLSS, FSR 3.1)
PlatformsLinux, Windows, macOSLinux and Windows (x86-64)
Game patchesPatch files applied by the emulatorThe same community patches, compiled at start (scripts/patches.py); render resolution, effects and FPS from the launcher

Without shadPS4 there would be no bbport: its renderer and shader recompiler were the starting point of the graphics side.

Wine + DXVK for one game
  • CPU. The PS4 CPU is x86-64, so the game's code runs directly on the PC's CPU, with no emulation and no instruction translation.
  • System libraries. As Wine replaces the Windows API, the bbport runtime (src/runtime_*.c) implements exactly the PS4 OS functions Bloodborne calls: memory, threads, files, audio, pad, saves.
  • Memory. As in a PC game (the default model): the game's data in system RAM, VRAM used the way a PC game uses it.
  • Graphics. The PS4 GPU's command stream (PM4) is a recording of the game's graphics API calls: it is written by 99 functions of the statically linked libGnm, so decoding the stream and translating the calls themselves come to the same thing. GCN shaders are translated to SPIR-V. In the new mode the command processor's work (memory writes, DMA, fences) is translated into Vulkan commands as well; fences are written by the GPU itself. Resource descriptors (textures, buffers) are read by the translator on the CPU, as DXVK reads resource bindings: a PS4 texture has to be converted from the PS4 tiling into a Vulkan image before the draw runs, so the CPU must know its descriptor beforehand — translation, not emulation. The descriptor tables (the constant engine's dumps) are read only by the translator, so the CPU performs them. The game's occlusion queries (~60 a frame) are Vulkan occlusion queries; predication, COPY_DATA and COND_EXEC are translated too (check: BB_PM4_SELFTEST=1). Details: docs/EMULATION_REMOVAL_PLAN.ru.md, "Шаг 4" (Russian).

"Port" here means a build for this one game, not a rewrite of its source code, which the project neither has nor includes.

Requirements

  • Linux x86-64 or Windows 10/11 x86-64, a Vulkan 1.3 GPU. Tested: AMD RX 7800 XT with Mesa 26 (RADV) and with AMD's Windows driver; NVIDIA and Intel by players (please report how they run). FSR 4 / 4.1.1 require shader Float16, Int8/Int16, integer dot products, linear compute derivatives and extended storage image formats; FSR 4.1.1 additionally requires VK_VALVE_shader_mixed_float_dot_product. Unsupported choices fall back to FSR 3.1 before the first frame and are disabled in the in-game menu.
  • Your decrypted game dump: the CUSA03173 folder (eboot.bin, sce_module, ...), version 1.09. A dumped update is a separate folder: copy it over the base game, replacing files. The base game alone (1.00) crashes at start (guest offset 0x20348b8); the launcher and run.sh check the executable and say what is missing (BB_SKIP_GAME_CHECK=1 skips the check). The other retail releases (the US CUSA00900, the Asian CUSA03023, ...) run the same 1.09 executable. Some dumps ship it with Lance McDonald's 60 fps patch baked in, which crashes when the gestures menu opens: the check asks for a clean eboot.bin then (bbport has its own 60 fps).
  • To build: GCC, CMake, Ninja, Python 3, glslang, SDL3, Vulkan headers and the libraries in shell.nix. With Nix everything comes from shell.nix automatically.

Build and run

git clone --recursive https://github.com/deadinside28/bloodborne_pc.git bbport && cd bbport
bash build.sh                        # builds out/bb-probe and out/gpu/libbbgpu.so
BB_GAME_DIR=/path/to/CUSA03173 bash run.sh

or the launcher (pick the game folder, settings, Start):

bash launcher/bb-launcher.sh         # launcher/install-desktop.sh adds it to the app menu

By default the game folder is expected next to the repository (../CUSA03173). Saves and the shader cache go to user/ (the launcher lets you choose another folder); settings to bbport.ini. A gamepad is used through SDL3 (the launcher's Controls → Controller picks one when several are connected; BB_GAMEPAD=<GUID or part of the name>). The keyboard works too, also next to a connected gamepad (the Steam Deck always has one); both are remapped in the launcher (Controls). The character name is typed on the keyboard in a box over the game. The touchpad: its left half (Tab, Back/Select) opens the gestures, the right half (Backspace) the key items. There is no PSN: the Play online / offline screen is skipped and the game opens its main menu offline (a game patch; the launcher's Game effects → Skip the “play online / offline” choice, BB_SKIP_NETWORK_CHOICE=0 shows it). With several monitors, Screen → Monitor in the launcher (BB_DISPLAY=<number or part of the name>) picks the one for the game.

Resolution and preset changes: the game starts at the scene size of the chosen output and preset (a patch at start, the fastest path); the output is the monitor's resolution by default (Auto). With Live resolution changes (on by default; bbport.ini live_resolution=0|1) the preset, the output resolution and the aspect ratio then switch while playing, to smaller and to larger sizes, at the same FPS as a start at that size; only another upscaler kind needs a restart. GPUs that cannot give the game's depth a proxy (no D32S8 blits and no shader stencil export, e.g. GTX 10xx) apply a change at the next start instead.

TAA: a separate native-resolution temporal AA mode in the launcher and overlay, switchable live without an FSR model. The saved FSR preset is restored when returning to FSR. FSR Native AA adds reconstruction on top of full-resolution rendering and can be slower than disabling AA. TAA also adds work compared with no temporal AA. The RCAS switch and the 0–2 sharpness control also work with TAA. Sharpening runs after temporal accumulation and leaves its history and HUD unchanged.

Mods: the launcher accepts separate loose-file mod folders (with dvdroot_ps4/, an extra wrapper folder, or the game folders such as chr/ directly; file name case does not matter), with enable switches and load order. A sibling CUSA03173-mods/ overlay also works. The original game is preserved; later mods override conflicting files. Texture packs with upscaled map textures (from the mods folder or already in the game folder) get larger graphics heaps by themselves (BB_LARGE_HEAPS=1/0 forces it on or off). Third-party patches: shadPS4-format XML patch files in the data directory's patches/, switched on and off in the launcher. See mods and patches. DLC: put your add-on dumps in user/addcont/<title id>/<entitlement label>/ (shadPS4's layout, e.g. user/addcont/CUSA03173/SPEXPANSIONDLC03 for The Old Hunters): each folder there is reported to the game as an installed add-on.

Launcher language: Russian, English, Brazilian Portuguese, Simplified Chinese or French (follows the system language by default). The game's own text language is chosen separately, from all 21 languages the game has. GPU choice: Mode → GPU picks the graphics card on machines with two (Auto prefers the discrete one; stored by name; BB_GPU_ID=N from the shell wins).

Free camera and game debug menu (v1.09): enable the corresponding switches in the launcher or in-game menu and restart. Free camera uses Lance McDonald's GoldHEN patch: hold Cross and press L3 to cycle modes (keyboard: hold F and press Left Ctrl). It needs no fonts and conflicts with Enemy Control. For the game debug menu, install DbgFont14h.ccm and DbgFont14h.tpf from Debug Menu and XML Patch into the game's dvdroot_ps4/font/ first. Startup rejects missing or empty font files instead of launching the unsafe patch. Open it with the left touchpad / Tab (with the debug menu on, the left half no longer opens the gestures); Backspace is the right touchpad. Touch coordinates are forwarded from SDL gamepads; Back/Select emulates a left click on pads without a touch surface. The port's settings menu remains Insert / holding L3+R3.

With the Restore Debug Camera patch the mouse turns the free camera. The game's occlusion queries are Vulkan occlusion queries in the default model (BB_OCCLUSION_QUERIES=0: everything counts as visible, as in the old model).

Upscaler assets (not included; FSR 3.1 needs none):

bash tools/fetch_fsr4_assets.sh      # FSR 4 v07 (MIT, built from AMD's source by Q2RTX)
# FSR 4.1.1, from your own AMD DLLs (e.g. OptiScaler's FSR4_LATEST), needs GE-Proton 10 or newer:
bash tools/fsr4cap/build_assets.sh <amd_fidelityfx_upscaler_dx12.dll>

FSR 4.1.1 from your own DLL. The easiest way is the launcher: Upscaler → FSR 4.1.1 from your own AMD DLL → Choose DLL…, then pick amd_fidelityfx_upscaler_dx12.dll version 4.1.x: from OptiScaler's FSR4_LATEST folder or from a game wit