mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-30 06:29:46 +08:00
[VideoOut] Add Bink2 support via FFMPEG bridge (#527)
* [VideoOut] Add Bink2 support via FFMPEG bridge * [CMake] update commit * [CMake] update commit
This commit is contained in:
+32
-14
@@ -14,31 +14,49 @@ 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.
|
||||
The default path decodes through the bundled FFmpeg-backed native bridge
|
||||
(`native/bink2-bridge/sharpemu_bink2_bridge.c`); see "Supplying the adapter"
|
||||
below for where that binary comes from. Set `SHARPEMU_BINK_MODE=guest` to
|
||||
leave decoding to the Bink implementation statically linked into the game
|
||||
instead. Set `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.
|
||||
only; it does not decode the movie or alter its game logic.
|
||||
SHARPEMU_BINK_MODE=native is equivalent to the default and mainly useful for
|
||||
being explicit about it.
|
||||
|
||||
The experimental `SHARPEMU_BINK_MODE=ffmpeg` override forces a host FFmpeg
|
||||
source. SharpEmu searches
|
||||
`SHARPEMU_FFMPEG_PATH`, the executable directory, its `ffmpeg` subdirectory,
|
||||
and then `PATH`. The FFmpeg build must contain the Bink 2 decoder; stock FFmpeg
|
||||
builds that only recognize the Bink container are not sufficient.
|
||||
|
||||
## 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.
|
||||
The adapter (`native/bink2-bridge/sharpemu_bink2_bridge.c`) links against a
|
||||
custom FFmpeg build (`github.com/sharpemu/ffmpeg-core`, LGPL-2.1) that adds a
|
||||
Bink 2 decoder to FFmpeg 7.1.2; no proprietary RAD SDK is needed to build or
|
||||
run SharpEmu.
|
||||
|
||||
Place the resulting libsharpemu_bink2_bridge.dylib next to the SharpEmu
|
||||
executable, or point to it explicitly:
|
||||
`dotnet publish` builds it from source with CMake + Ninja + clang-cl (Windows)
|
||||
or the platform's default C compiler (Linux/macOS), targeting win-x64,
|
||||
linux-x64, osx-x64, or osx-arm64, then embeds the result in the published
|
||||
single-file executable. Publishing SharpEmu therefore requires that
|
||||
toolchain locally (the same one the CI runners already ship with); there is
|
||||
no prebuilt/download fallback. A downloaded release needs no such setup: the
|
||||
compiled adapter is already inside `SharpEmu.exe`.
|
||||
|
||||
SHARPEMU_BINK2_BRIDGE=/absolute/path/libsharpemu_bink2_bridge.dylib \
|
||||
To use a different build of the adapter, point to it explicitly:
|
||||
|
||||
SHARPEMU_BINK2_BRIDGE=/absolute/path/sharpemu_bink2_bridge.dll \
|
||||
./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
|
||||
sharpemu_bink2_open_scaled_utf8, sharpemu_bink2_decode_next_bgra, and
|
||||
sharpemu_bink2_close. The adapter opens one movie, optionally scaling it down
|
||||
to a maximum size, exposes BGRA pixels, and advances after each decoded
|
||||
frame. The managed side validates dimensions and retains ownership of the
|
||||
destination buffer.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user