- C++ 58.4%
- C 36.7%
- Rust 2.2%
- HLSL 0.7%
- GLSL 0.6%
- Other 1.2%
The audio path used to be:
- common/audio_stream.h declared an abstract AudioStream base with
one pure virtual (FramesAvailable) and shared non-virtual
BeginWrite/EndWrite/Reconfigure/Shutdown.
- libretro/libretro_audio_stream.{h,cpp} overrode FramesAvailable
with the real libretro frontend drain.
- common/null_audio_stream.{h,cpp} overrode FramesAvailable to
discard, and was constructed only to feed the SPU during
internal-runahead replay so audio from those frames never reached
the frontend. The SPU pointer-swapped between the host stream and
the null stream around DoRunahead's replay loop.
The base class buys nothing here. There is exactly one runtime audio
stream in swanstation - LibretroAudioStream - and the second subclass
exists only to express 'discard everything' behaviour, which is
trivially representable as a flag on the real one. EndWrite ran a
virtual call to FramesAvailable on every SPU update (~150-300 times
per frame), the indirection resolving to the same place every time.
Drop the base class and the null subclass:
- Delete common/audio_stream.{h,cpp} and common/null_audio_stream.{h,cpp}.
- LibretroAudioStream becomes a plain class with no inheritance,
absorbing the BeginWrite/EndWrite/Reconfigure/Shutdown bodies and
the SampleType/MaxSamples/etc. constants from the old base.
- FramesAvailable's contents are inlined into EndWrite (it was the
only caller), with an early-return for fast-hook mode that
matches the previous behaviour exactly.
- The 'discard' role of NullAudioStream becomes a m_silent_mode flag
and a SetSilentMode() setter on LibretroAudioStream. EndWrite
drains the FIFO immediately when silent, so the SPU keeps ticking
state-machines (envelope counters, ADPCM phase, etc.) for
correctness, the FIFO does not build up backpressure across the
runahead window, and nothing reaches the frontend.
- System::DoRunahead replaces the SPU pointer-swap with a
SetSilentMode(true)/SetSilentMode(false) toggle on the host's
existing LibretroAudioStream. s_runahead_audio_stream
(std::unique_ptr<AudioStream>) and the matching reset() in
System::Shutdown go away entirely.
- HostInterface drops the virtual CreateAudioStream() factory
method; its single override in LibretroHostInterface returned
std::make_unique<LibretroAudioStream>() which is now inlined at
the only call site (HostInterface::BootSystem).
- HostInterface::m_audio_stream and HostInterface::GetAudioStream
become typed as LibretroAudioStream (forward-declared in
host_interface.h, the libretro header included from the cpp).
SPU::SetAudioStream and SPU::m_audio_stream similarly get the
concrete type. The static_cast in retro_run_frame's
UploadToFrontend call goes away.
- Makefile.libretro and src/common/CMakeLists.txt drop the deleted
source files from their lists.
Linux x64 build still warning-clean. .so size drops from 8047800 to
8046184 bytes (-1616) - the AudioStream and NullAudioStream
vtables/typeinfo, the virtual destructor and FramesAvailable, the
indirect-call sites in EndWrite, and the second runahead audio
stream instance and its construction code are all gone. 25 retro_*
exports unchanged. Behaviour is identical: the SetSilentMode toggle
produces exactly the same observable result as the
swap-to-NullAudioStream pattern (the SPU's frame output is
discarded during the replay window in both cases).
|
||
|---|---|---|
| CMakeModules | ||
| dep | ||
| src | ||
| .clang-format | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| CMakeLists.txt | ||
| libretro.osx.def | ||
| LICENSE | ||
| link.T | ||
| Makefile.libretro | ||
| README.md | ||
| TODO | ||
SwanStation - PlayStation 1, aka. PSX Emulator
Features | System Requirements | Disclaimers
SwanStation is a hard fork and open-source Libretro core implementation of DuckStation, which is an emulator of the Sony PlayStation(TM) console, focusing on playability, speed, and long-term maintainability. The goal is to be as accurate as possible while maintaining performance suitable for low-end devices. "Hack" options are discouraged, the default configuration should support all playable games with only some of the enhancements having compatibility issues.
A "BIOS" ROM image can be used, but is not required. You can use an image from any hardware version or region, although mismatching game regions and BIOS regions may have compatibility issues. A ROM image is not provided with the emulator for legal reasons, you should dump this from your own console using Caetla or other means. If no ROM image is provided, OpenBIOS will be used instead.
Features
SwanStation features include:
- CPU Recompiler/JIT (x86-64, armv7/AArch32 and AArch64)
- Hardware (D3D11, OpenGL, Vulkan) and software rendering
- Upscaling, texture filtering, and true colour (24-bit) in hardware renderers
- PGXP for geometry precision, texture correction, and depth buffer emulation
- Adaptive downsampling filter
- Post processing shader chains
- "Fast boot" for skipping BIOS splash/intro
- Save state support
- Supports bin/cue images, raw bin/img files, MAME CHD, single-track ECM, MDS/MDF, and unencrypted PBP formats.
- Direct booting of homebrew executables
- Direct loading of Portable Sound Format (psf) files
- Digital and analog controllers for input (rumble is forwarded to host)
- Namco GunCon lightgun support (simulated with mouse)
- NeGcon support
- Emulated CPU overclocking
- Multitap controllers (up to 8 devices)
- RetroAchievements
- Automatic loading/applying of PPF patches
System Requirements
- A CPU faster than a potato. But it needs to be x86_64, AArch32/armv7, or AArch64/ARMv8, otherwise you won't get a recompiler and it'll be slow.
- For the hardware renderers, a GPU capable of OpenGL 3.1/OpenGL ES 3.0/Direct3D 11 Feature Level 10.0 (or Vulkan 1.0) and above. So, basically anything made in 2013 or later.
Region detection and BIOS images
By default, SwanStation will emulate the region check present in the CD-ROM controller of the console. This means that when the region of the console does not match the disc, it will refuse to boot, giving a "Please insert PlayStation CD-ROM" message. SwanStation supports automatic detection disc regions, and if you set the console region to auto-detect as well, this should never be a problem.
The region checking can be disabled in the console options tab. This is the only way to play unlicensed games or homebrew which does not supply a correct region string on the disc, aside from using fastboot which skips the check entirely.
Mismatching the disc and console regions with the check disabled is supported, but may break games if they are patching the BIOS and expecting specific content.
LibCrypt protection and SBI files
A number of PAL region games use LibCrypt protection, requiring additional CD subchannel information to run properly. libcrypt not functioning usually manifests as hanging or crashing, but can sometimes affect gameplay too, depending on how the game implemented it.
For these games, make sure that the CD image and its corresponding SBI (.sbi) file have the same name and are placed in the same directory. SwanStation will automatically load the SBI file when it is found next to the CD image.
For example, if your disc image was named Spyro3.cue, you would place the SBI file in the same directory, and name it Spyro3.sbi.
Tests
- Passes amidog's CPU and GTE tests in both interpreter and recompiler modes, partial passing of CPX tests
Disclaimers
"PlayStation" and "PSX" are registered trademarks of Sony Interactive Entertainment Europe Limited. This project is not affiliated in any way with Sony Interactive Entertainment.