Files
sharpemu/docs/bink2-bridge.md
T
Berk a030cb5a5d Gpu runtime stalls (#410)
* [runtime] restore default GC mode

* [cpu] add string leaf stubs

* [ampr] allow concurrent reads

* [bink] keep guest decode path

* [kernel] streamline host memory access

* [shader] add scalar memory fallback

* [gpu] bound guest data pool

* [gpu] reduce queue stalls

* [video] stabilize guest resources

* revert lock file
2026-07-19 00:31:50 +03:00

2.0 KiB

Bink 2 bridge

Demon's Souls plays Bink 2 (.bk2) files through a Bink implementation linked directly into eboot.bin. It does not use libSceVideodec, therefore an HLE video decoder cannot observe or replace those frames.

SharpEmu observes successful guest .bk2 opens and, when a Bink bridge is available, presents its decoded BGRA frames at the normal guest-flip boundary. This preserves the game's own timing and lets the host Vulkan presenter display the movie without trying to execute the PS5-specific Bink GPU decode path.

Without an adapter, Bink files remain visible to the guest and the game's statically linked decoder runs normally. Set SHARPEMU_BINK_MODE=skip only when explicitly testing a title whose cinematics are optional.

Set SHARPEMU_BINK_MODE=dummy to retain the open and show a built-in, non-decoded placeholder frame. This requires no SDK, but is a visual diagnostic only; it does not decode the movie or alter its game logic. Set SHARPEMU_BINK_MODE=native to force native bridge mode.

Supplying the adapter

Bink 2 is proprietary. Obtain a compatible Mac Bink 2 SDK from RAD Game Tools, then compile sharpemu_bink2_bridge.c against the SDK's bink.h and Mac library. The adapter deliberately contains only a three-function C ABI so the managed emulator never depends on RAD's private binary ABI.

Place the resulting libsharpemu_bink2_bridge.dylib next to the SharpEmu executable, or point to it explicitly:

SHARPEMU_BINK2_BRIDGE=/absolute/path/libsharpemu_bink2_bridge.dylib \
  ./SharpEmu /path/to/eboot.bin

The expected exports are sharpemu_bink2_open_utf8, sharpemu_bink2_decode_next_bgra, and sharpemu_bink2_close. The supplied adapter opens one movie, exposes BGRA pixels, and advances after each decoded frame. The managed side validates dimensions and retains ownership of the destination buffer.

If the bridge is absent in native mode, SharpEmu logs one informational line and retains the existing guest rendering path.