Libretro: BIOS loading
Jeffrey Pfau jeffrey@endrift.com
Fri, 17 Jul 2015 20:48:23 -0700
2 files changed,
16 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -27,6 +27,7 @@ - Configurable display driver, between software and OpenGL
- Undo-able savestate loading and saving - Controller profiles now store shortcut settings - Default controller profiles for several common controllers + - Libretro now supports BIOS and rumble Bugfixes: - ARM7: Fix SWI and IRQ timings - GBA Audio: Force audio FIFOs to 32-bit
M
src/platform/libretro/libretro.c
→
src/platform/libretro/libretro.c
@@ -39,6 +39,7 @@ static struct VFile* rom;
static void* data; static struct VFile* save; static void* savedata; +static struct VFile* bios; static struct GBAAVStream stream; static int rumbleLevel; static struct CircleBuffer rumbleHistory;@@ -152,6 +153,16 @@ gba.rumble = &rumble;
} rom = 0; + const char* sysDir = 0; + if (environCallback(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &sysDir)) { + char biosPath[PATH_MAX]; + snprintf(biosPath, sizeof(biosPath), "%s%s%s", sysDir, PATH_SEP, "gba_bios.bin"); + bios = VFileOpen(biosPath, O_RDONLY); + if (bios) { + GBALoadBIOS(&gba, bios); + } + } + GBAVideoSoftwareRendererCreate(&renderer); renderer.outputBuffer = malloc(256 * VIDEO_VERTICAL_PIXELS * BYTES_PER_PIXEL); renderer.outputBufferStride = 256;@@ -166,6 +177,10 @@ #endif
} void retro_deinit(void) { + if (bios) { + bios->close(bios); + bios = 0; + } GBADestroy(&gba); }