CoreDownloader class downloads libretro cores from the official buildbot on demand and stores them in the app-managed cores directory. It provides metadata about available cores, tracks installation status, and emits progress events during downloads.
Currently only macOS ARM64 is supported. Windows and Linux support will be added in future releases.
Constructor
userData/cores.
Methods
Directory management
getCoresDirectory
Example
Core information
getPreferredCore
System identifier (e.g.,
'snes', 'genesis', 'gba')The preferred core name for the system, or
null if the system is unknowndownloadCoreForSystem().
Supported systems
| System ID | Preferred Core | Display Name |
|---|---|---|
nes | fceumm_libretro | FCEUmm |
snes | snes9x_libretro | Snes9x |
genesis | genesis_plus_gx_libretro | Genesis Plus GX |
gb | gambatte_libretro | Gambatte |
gbc | gambatte_libretro | Gambatte |
gba | mgba_libretro | mGBA |
n64 | mupen64plus_next_libretro | Mupen64Plus |
psx | pcsx_rearmed_libretro | PCSX ReARMed |
saturn | mednafen_saturn_libretro | Beetle Saturn |
psp | ppsspp_libretro | PPSSPP |
nds | desmume_libretro | DeSmuME |
arcade | mame_libretro | MAME |
Example
getCoresForSystem
System identifier (e.g.,
'snes', 'psx')Array of core information objects
Example
Installation status
hasCoreForSystem
System identifier
Absolute path to the installed core, or
null if not installedisCoreInstalled
Internal core name (e.g.,
'snes9x_libretro')true if the specified core is installed.
getCorePath
Internal core name
Absolute path to the core file, or
null if not installedExample
Downloading cores
downloadCoreForSystem
System identifier (e.g.,
'snes', 'gba')Absolute path to the downloaded core file
progress events during the download.
Example
downloadCore
Internal core name (e.g.,
'bsnes_libretro')System identifier (for progress events)
Absolute path to the downloaded core file
progress events during the download.
If the core is already installed, this method returns the existing path immediately without downloading.
Duplicate download prevention
If a download is already in progress for a core, subsequent calls todownloadCore() will wait for the existing download to complete instead of starting a new one.
Example
Events
Inherits fromEventEmitter and emits the following events:
progress
Emitted during core downloads with status updates.CoreDownloadProgress structure
Example
Download phases
- downloading (0-85%) — Fetching the .zip file from the buildbot
- extracting (90%) — Unzipping the core file
- done (100%) — Download complete, core is ready to use
- error — Download or extraction failed
The download phase progresses from 0-85% to reserve 85-100% for extraction and verification.
Buildbot URLs
Cores are downloaded from the official libretro buildbot:- macOS ARM64:
apple/osx/arm64→.dylib
Error handling
Download errors are emitted asprogress events with phase: 'error'. Common errors:
- Network errors — Connection failed or timeout
- HTTP errors — 404 (core not found), 500 (buildbot error)
- Extraction errors — Corrupt .zip file or missing
unzipbinary - Too many redirects — More than 5 redirects (possible buildbot issue)
Example
Core descriptions
Some cores include important notes about requirements or tradeoffs:SNES cores
- Snes9x: Fast, highly compatible. Best for most games.
- bsnes: Cycle-accurate. Perfect accuracy, higher CPU usage.
Saturn cores
- Beetle Saturn: Accurate Saturn emulation. Requires BIOS files (
sega_101.bin,mpr-17933.bin). - Yabause: Saturn emulation with lower accuracy but lighter hardware requirements.
Related
- LibretroNativeCore — Native core wrapper with path validation
- EmulationWorkerClient — Worker process client for running emulation