libretro frontend to play emulators for Windows, Mac, Linux, and the Web with raylib. The raylib-libretro.h allows integrating any raylib application with the libretro API. Still in early development.
- Multi-System Emulator for NES, SNES, GB, GBA, SMS/GG, PlayStation
- Shipped Cores: fceumm, snes9x, mgba, genesis_plus_gx, prboom, pcsx_rearmed, mednafen_psx_hw
- Hardware-accelerated OpenGL rendering for GPU-rendered cores
- Gamepad, Keyboard, On-Screen Controls
- Audio
- Fast Forward, Slow Motion, Rewind
- Save Slots and SRAM
- Shaders
- Menu Themes
- Core Options
- Zip File Support
| System | Core | Extensions |
|---|---|---|
| Nintendo Entertainment System (NES)** | fceumm |
.fds, .nes, .unf, .unif |
| Super Nintendo (SNES) | snes9x |
.smc, .sfc, .swc, .fig, .bs, .st |
| Game Boy / Color / Advance | mgba |
.gba, .gb, .gbc, .sgb |
| Sega Genesis / Mega Drive / Master System / Game Gear | genesis_plus_gx |
.bin, .gen, .smd, .md, .cue, .iso, .chd, .m3u, .sms, .gg, .sg |
| PC Engine / TurboGrafx-16 | mednafen_pce_fast |
.pce, .cue, .ccd, .chd, .toc, .m3u |
| WonderSwan / WonderSwan Color | mednafen_wswan |
.ws, .wsc, .pc2 |
| Doom (PrBoom Engine) | prboom |
.wad, .iwad, .pwad, .lmp, .m3u |
| PlayStation | pcsx_rearmed |
.bin, .cue, .img, .mdf, .pbp, .toc, .cbn, .m3u, .ccd, .chd, .iso |
| PlayStation (HW) | mednafen_psx_hw |
.cue, .toc, .m3u, .ccd, .exe, .pbp, .chd |
| PlayStation | mednafen_psx |
.cue, .toc, .m3u, .ccd, .exe, .pbp, .chd |
raylib-libretro [-L <core>] [game][game]can be a loose ROM file or a.ziparchive-L <core>is optional — path to the libretro core (.so/.dll/.dylib)
raylib-libretro -L ~/.config/retroarch/cores/fceumm_libretro.so smb.nes
raylib-libretro -L ~/.config/retroarch/cores/fceumm_libretro.so smb.zip
raylib-libretro smb.nes
CMake is used to build raylib-libretro...
git clone http://github.com/robloach/raylib-libretro.git
cd raylib-libretro
git submodule update --init
mkdir build
cd build
cmake ..
make- Make sure you have you have
cmake/xcode-cli-toolsinstalled - Run the above compile instructions
- After installing RetroArch and some cores, you should be able to run the below:
bin/raylib-libretro -L ~/Library/Application\ Support/RetroArch/cores/fceumm_libretro.dylib ~/Desktop/smb.nes
See raylib-libretro-basic.c for an example of using the API:
InitLibretro("fceumm.so");
LoadLibretroGame("mario.nes");
while (!WindowShouldClose()) {
UpdateLibretro();
BeginDrawing();
ClearBackground(BLACK);
DrawLibretro();
EndDrawing();
}
CloseLibretro();See the full API documentation for integration details, CMake setup, and function descriptions.
bool InitLibretro(const char* core);
bool LoadLibretroGame(const char* gameFile);
bool IsLibretroReady();
bool IsLibretroGameReady();
void UpdateLibretro();
bool LibretroShouldClose();
void DrawLibretro();
void DrawLibretroTint(Color tint);
void DrawLibretroEx(Vector2 position, float rotation, float scale, Color tint);
void DrawLibretroV(Vector2 position, Color tint);
void DrawLibretroTexture(int posX, int posY, Color tint);
void DrawLibretroPro(Rectangle destRec, Color tint);
const char* GetLibretroName();
const char* GetLibretroVersion();
unsigned GetLibretroWidth();
unsigned GetLibretroHeight();
unsigned GetLibretroRotation();
double GetLibretroFPS();
float GetLibretroAspectRatio();
Texture2D GetLibretroTexture();
bool IsLibretroGameRequired();
void ResetLibretro();
void UnloadLibretroGame();
void CloseLibretro();
void SetLibretroVolume(float volume);
float GetLibretroVolume();
bool SetLibretroCoreOption(const char* key, const char* value);
const char* GetLibretroCoreOption(const char* key);
void* GetLibretroSerializedData(unsigned int* size);
bool SetLibretroSerializedData(void* data, unsigned int size);
void SetLibretroMessage(const char* msg, float duration);
bool DrawLibretroMessage();
const char* GetLibretroDirectory(int directory);Update the dependencies through git submodules...
git submodule update --recursive --remote --init --forceUse clang-format to apply coding standards...
clang-format -i *.hBuild for web with emscripten...
mkdir build
cd build
emcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release
emmake makeTo build the Doxygen documentation...
doxygen .DoxyfileCores are downlownloaded straight from libretro's build bot, or libretro-wasm-cores.
See the individual files to see which license applies.
raylib-libretrothe application is licensed under GPL-3.0-or-laterraylib-libretro-basicthe sample application is licensed under zlib/libpngraylib-libretro.hthe API is licensed under zlib/libpng
