all repos — mgba @ 742d08d182cc63fd535c1b163431822d5c7bcda2

mGBA Game Boy Advance Emulator

DS: Automatically load BIOS
Jeffrey Pfau jeffrey@endrift.com
Wed, 04 Jan 2017 12:36:23 -0800
commit

742d08d182cc63fd535c1b163431822d5c7bcda2

parent

c50cfc3b941963fbba6d48c9ec22ecd03b8c935c

1 files changed, 25 insertions(+), 0 deletions(-)

jump to
M src/ds/core.csrc/ds/core.c

@@ -159,6 +159,31 @@

static void _DSCoreReset(struct mCore* core) { struct DSCore* dscore = (struct DSCore*) core; struct DS* ds = (struct DS*) core->board; + +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 + struct VFile* bios7 = 0; + struct VFile* bios9 = 0; + if (core->opts.useBios) { + if (!core->opts.bios) { + char path[PATH_MAX]; + mCoreConfigDirectory(path, PATH_MAX); + strncat(path, PATH_SEP "ds7_bios.bin", PATH_MAX - strlen(path)); + bios7 = VFileOpen(path, O_RDONLY); + mCoreConfigDirectory(path, PATH_MAX); + strncat(path, PATH_SEP "ds9_bios.bin", PATH_MAX - strlen(path)); + bios9 = VFileOpen(path, O_RDONLY); + } else { + bios7 = VFileOpen(core->opts.bios, O_RDONLY); + } + } + if (bios7) { + DSLoadBIOS(ds, bios7); + } + if (bios9) { + DSLoadBIOS(ds, bios9); + } +#endif + ARMReset(ds->ds7.cpu); ARMReset(ds->ds9.cpu); }