- C++ 57.9%
- C 36.4%
- Rust 2.8%
- HLSL 0.7%
- GLSL 0.6%
- Other 1.5%
A new pattern this round: dead flag constants where the checks
remain inside the implementing module but no caller passes them.
These look alive on a simple keyword grep because each constant
has 1-2 references, but every reference is inside the function
that checks the flag - never anywhere that SETS it. Result:
unconditional branches in the find loop.
Plus one straightforward file-static helper find.
== src/core/cheats.cpp ==
static bool IsValidScanAddress(PhysicalMemoryAddress address)
File-static, defined once at line 18, zero callers anywhere in
the tree. Looks like a remnant from an old cheat-scan code path
that's been refactored elsewhere - the cheat engine now resolves
scan addresses through the standard CPU/Bus address-mapping helpers
instead.
19 lines removed.
== src/common/file_system.h flag constants ==
Four flag constants in the FileSystem namespace that no caller in
the tree ever passes:
FILESYSTEM_FILE_ATTRIBUTE_READ_ONLY - SET in the Windows FindFiles
path on FILE_ATTRIBUTE_READONLY but never tested by any consumer
of FILESYSTEM_FIND_DATA::Attributes.
FILESYSTEM_FILE_ATTRIBUTE_COMPRESSED - never set, never tested.
FILESYSTEM_FIND_FOLDERS - checked in the Windows and
POSIX directory branches via 'if (!(Flags & FOLDERS))', but the
only two FindFiles callers in the tree (host_interface.cpp:141
and texture_replacements.cpp:177) pass FILES, not FOLDERS. The
directory branch therefore always continues; the
'outData.Attributes |= DIRECTORY' line was unreachable.
FILESYSTEM_FIND_KEEP_ARRAY - checked once to suppress
the pResults->clear() at the top of FindFiles. Never set.
pResults is always cleared.
Dropped constants, dropped the matching checks/sets inside
file_system.cpp, simplified the directory branches in both the
Windows and POSIX variants of RecursiveFindFiles to just recurse
(if FIND_RECURSIVE is set) and continue.
The FILESYSTEM_FIND_DATA::Attributes field is now dead too - the
only set was via FILE_ATTRIBUTE_READ_ONLY (dropped) and the unreachable
DIRECTORY assignment (dropped). The two 'outData.Attributes = 0;'
init lines are now dead writes. Dropped the field along with both
inits.
== src/core/texture_replacements.cpp ==
if (fd.Attributes & FILESYSTEM_FILE_ATTRIBUTE_DIRECTORY)
continue;
Defensive check at TextureReplacements::FindTextures was already
unreachable - the caller passes FILES (not FOLDERS), so FindFiles
never emits a directory entry. Drop the check (and it'd no longer
compile after the Attributes field removal anyway).
Build clean on Makefile.libretro platform=unix at each step.
swanstation_libretro.so size: 7,910,928 -> 7,910,928 bytes (unchanged).
25 retro_* exports preserved.
The size is unchanged because both flag constants and dead branches
optimize away to nothing under -O2 anyway. The value of this commit
is source-level clarity: removing 'half-dead' surface that grep
turned up but inspection showed was inert.
== Methodology note ==
New pattern: dead flag constants where the test remains but the
set is missing. The grep signature is:
CONST: appears N times in the source tree (small N, 1-3)
Every appearance is either:
- the declaration itself
- a check inside the function that consumes the flag
If NO grep hit is on a caller passing the flag in (e.g., as part
of a '|'-joined argument), the constant is dead. The check that
references it always takes the same branch and can be deleted
unconditionally. This compounds: when a now-unconditional branch
drops a write to an output field, the field's other writes need
re-auditing too, since they may now be the only writes - and if
nobody reads the field, it's dead.
Caveat: this pattern trims defensive code that might be helpful
when a future caller wants to use the flag. The trade is source
clarity now vs. having to re-add the branch later. For this
codebase's FindFiles flags, the surface area has been stable
since import and the two callers don't suggest imminent need.
Build: Makefile.libretro platform=unix - clean.
swanstation_libretro.so size: 7,910,928 -> 7,910,928 bytes (unchanged).
retro_* exports: 25 (unchanged).
4 files changed, 7 insertions(+), 45 deletions(-).
|
||
|---|---|---|
| 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.