A Rust and egui based front-end for the SwanStation PS1 Libretro core
  • C++ 58.4%
  • C 36.7%
  • Rust 2.2%
  • HLSL 0.7%
  • GLSL 0.6%
  • Other 1.2%
Find a file
LibretroAdmin 64e22faf7f common, core: dead-code sweep, round 5
Four small zero-caller drops, all decl-only inlines / decl-only
function prototypes / decl-only constants. No codegen change
expected, and indeed the .so size is unchanged at 7,922,816
bytes. Build clean on Makefile.libretro platform=unix.

Smaller than rounds 2-4 because the obvious decl-level finds in
core/ headers are largely exhausted; what remains is either
already-deleted, hardware-register documentation that should not
be touched (e.g. IRQ7/SIO/IRQ10 enum values, DMADirection enum,
GPUSTAT bitfields), tightly self-coupled (recompiler subsystem
where every helper has 4+ internal callers), or under build
guards (D3D11/D3D12 not compiled on platform=unix).

25 retro_* exports preserved.

== core/gpu ==

  static constexpr uint32_t GPU::MAX_RESOLUTION_SCALE = 32
    One of four constants in a comma-separated declaration on
    gpu.h:41. Zero callers anywhere in the tree. The actual
    resolution-scale cap flows through Settings::gpu_resolution_scale
    (clamped against display capabilities, not against this
    constant). MAX_FIFO_SIZE (HeapFIFOQueue template parameter,
    1 use at gpu.h:490), DOT_TIMER_INDEX (4 callers), and
    HBLANK_TIMER_INDEX (9 callers) all stay.

== core/gpu_types ==

  ALWAYS_INLINE void GPUBackendDrawPolygonCommand::Vertex::Set(
      int32_t x_, int32_t y_, uint32_t color_, uint16_t texcoord_)
    Decl-only inline. Zero callers - the polygon-vertex fill site
    in gpu_hw.cpp:NewDrawPolygonCommand assigns vert->x, vert->y,
    vert->texcoord, vert->color directly via the per-vertex
    field accesses rather than through this Set() helper. The
    sibling GPUBackendDrawLineCommand::Vertex::Set(x, y, color)
    stays (4 callers in gpu_hw.cpp), and GPU_HW::BatchVertex::Set
    (the 8-arg packed_texcoord overload AND the 9-arg separate-u/v
    overload) both stay - the 9-arg one is exercised by
    AddNewVertex<Args...> perfect-forwarding (6 callers at
    gpu_hw.cpp:703-709).

== core/cpu_core_private ==

Two zero-caller inline helpers:

  ALWAYS_INLINE uint32_t GetICacheFillTagForAddress(
      VirtualMemoryAddress address)
    Decl-only inline returning
    GetICacheTagForAddress(address) | invalid_bits[(address >> 2) & 0x03u].
    Zero callers. The icache-fill path uses CheckAndUpdateICacheTags
    (in cpu_core.cpp) which writes the tag-with-invalid-bits
    pattern via its own local code; this helper was never used.
    Sibling icache helpers (GetICacheTagForAddress, GetICacheLine,
    GetICacheLineOffset, GetICacheTagMaskForAddress,
    CompareICacheTag) all stay.

  ALWAYS_INLINE VirtualMemoryAddress PhysicalAddressToVirtual(
      PhysicalMemoryAddress address, Segment segment)
    Decl-only inline that ORs the physical address with a
    segment base (0x00000000 / 0x80000000 / 0xA0000000 / 0xE0000000)
    from a 4-element std::array. Zero callers. The reverse
    direction (VirtualAddressToPhysical) is alive at 3 callers,
    used by the cache hot path. Going the other way (turning a
    physical address back into a virtual one) never came up.
    The Segment enum survives (used by GetSegmentForAddress and
    by cpu_recompiler_code_generator_{x64,aarch32,aarch64}.cpp at
    one site each).

== core/cpu_recompiler_thunks ==

  void Recompiler::Thunks::CheckAndUpdateICache(uint32_t pc, uint32_t line_count)
    Decl only, no impl, no callers. The actual JIT-side icache
    handling goes through EmitICacheCheckAndUpdate (a code-emitter
    method, not a thunk) which performs the check-and-update
    inline; the trampoline declared here was either never written
    or removed at the same time as its caller.

Build: Makefile.libretro platform=unix - clean.
swanstation_libretro.so size: 7922816 -> 7922816 bytes (unchanged).
retro_* exports: 25 (unchanged).

4 files changed, 1 insertion(+), 21 deletions(-).
2026-05-14 21:14:59 +02:00
CMakeModules Remove unused files 2023-03-25 17:43:35 +01:00
dep Make OpenBIOS a built-in fallback. 2026-03-28 10:43:30 +00:00
src common, core: dead-code sweep, round 5 2026-05-14 21:14:59 +02:00
.clang-format clang-format: Enable brace wrapping after case label 2020-01-24 14:49:43 +10:00
.gitattributes Initial commit 2019-09-11 14:00:42 +10:00
.gitignore Sync Android strings 2021-07-17 20:14:40 +10:00
.gitlab-ci.yml Merge pull request #167 from cscd98/webos-ci 2026-04-10 05:12:17 +02:00
CMakeLists.txt build: add MSB_FIRST opt-in flag for big-endian hosts 2026-05-08 00:32:03 +02:00
libretro.osx.def libretro: add static Makefile.libretro build 2026-05-07 21:32:02 +02:00
LICENSE Initial commit 2019-09-11 14:00:42 +10:00
link.T libretro: add static Makefile.libretro build 2026-05-07 21:32:02 +02:00
Makefile.libretro audio: devirtualize AudioStream, fold NullAudioStream into LibretroAudioStream 2026-05-08 15:07:36 +02:00
README.md Documentation OpenBIOS usage in the README. 2026-04-02 10:46:10 +01:00
TODO Update TODO (#132) 2025-01-17 16:28:45 +01:00

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.