all repos — mgba @ fea365678bf4ae81b38c4d2299913d7c0eeeba61

mGBA Game Boy Advance Emulator

DS: Allow booting homebrew
Vicki Pfau vi@endrift.com
Mon, 30 Jan 2017 16:36:40 -0800
commit

fea365678bf4ae81b38c4d2299913d7c0eeeba61

parent

37f1105fd9499f6a0eca7f3d4f8410c390165357

2 files changed, 5 insertions(+), 4 deletions(-)

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

@@ -28,14 +28,14 @@ bool (*filter)(struct VFile*);

struct mCore* (*open)(void); enum mPlatform platform; } _filters[] = { +#ifdef M_CORE_DS + { DSIsROM, DSCoreCreate, PLATFORM_DS }, +#endif #ifdef M_CORE_GBA { GBAIsROM, GBACoreCreate, PLATFORM_GBA }, #endif #ifdef M_CORE_GB { GBIsROM, GBCoreCreate, PLATFORM_GB }, -#endif -#ifdef M_CORE_DS - { DSIsROM, DSCoreCreate, PLATFORM_DS }, #endif { 0, 0, PLATFORM_NONE } };
M src/ds/ds.csrc/ds/ds.c

@@ -25,6 +25,7 @@ const uint32_t DS_COMPONENT_MAGIC = 0x1FF61FE;

static const size_t DS_ROM_MAGIC_OFFSET = 0x15C; static const uint8_t DS_ROM_MAGIC[] = { 0x56, 0xCF }; +static const uint8_t DS_ROM_MAGIC_2[] = { 0x1A, 0x9E }; enum { DS7_SP_BASE = 0x380FD80,

@@ -352,7 +353,7 @@ uint8_t signature[sizeof(DS_ROM_MAGIC)];

if (vf->read(vf, &signature, sizeof(signature)) != sizeof(signature)) { return false; } - return memcmp(signature, DS_ROM_MAGIC, sizeof(signature)) == 0; + return memcmp(signature, DS_ROM_MAGIC, sizeof(signature)) == 0 || memcmp(signature, DS_ROM_MAGIC_2, sizeof(signature)) == 0; } bool DSLoadBIOS(struct DS* ds, struct VFile* vf) {