all repos — mgba @ f1fba591524169276a95043354601b969d4deeb4

mGBA Game Boy Advance Emulator

GBA Context: Add additional constraints on MINIMAL_CORE==2
Jeffrey Pfau jeffrey@endrift.com
Thu, 28 Jan 2016 22:52:45 -0800
commit

f1fba591524169276a95043354601b969d4deeb4

parent

7436a5afef25fcb9160aa1884cc31503bc739f2b

M src/gba/context/context.csrc/gba/context/context.c

@@ -21,7 +21,9 @@ context->bios = 0;

context->fname = 0; context->save = 0; context->renderer = 0; +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 GBADirectorySetInit(&context->dirs); +#endif memset(context->components, 0, sizeof(context->components)); if (!context->gba || !context->cpu) {

@@ -79,11 +81,17 @@ }

mappedMemoryFree(context->gba, 0); mappedMemoryFree(context->cpu, 0); GBAConfigDeinit(&context->config); +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 GBADirectorySetDeinit(&context->dirs); +#endif } bool GBAContextLoadROM(struct GBAContext* context, const char* path, bool autoloadSave) { +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 context->rom = GBADirectorySetOpenPath(&context->dirs, path, GBAIsROM); +#else + context->rom = VFileOpen(path, O_RDONLY); +#endif if (!context->rom) { return false; }

@@ -106,7 +114,9 @@ }

void GBAContextUnloadROM(struct GBAContext* context) { GBAUnloadROM(context->gba); +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 GBADirectorySetDetachBase(&context->dirs); +#endif if (context->rom) { context->rom->close(context->rom); context->rom = 0;
M src/gba/context/context.hsrc/gba/context/context.h

@@ -21,7 +21,9 @@ struct VFile* rom;

const char* fname; struct VFile* save; struct VFile* bios; +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 struct GBADirectorySet dirs; +#endif struct ARMComponent* components[GBA_COMPONENT_MAX]; struct GBAConfig config; struct GBAOptions opts;
M src/gba/context/directories.csrc/gba/context/directories.c

@@ -8,6 +8,7 @@

#include "gba/context/config.h" #include "util/vfs.h" +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 void GBADirectorySetInit(struct GBADirectorySet* dirs) { dirs->base = 0; dirs->archive = 0;

@@ -142,3 +143,4 @@ dirs->patch = dir;

} } } +#endif
M src/gba/context/directories.hsrc/gba/context/directories.h

@@ -8,6 +8,7 @@ #define DIRECTORIES_H

#include "util/common.h" +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 struct VDir; struct GBADirectorySet {

@@ -29,5 +30,6 @@ struct VFile* GBADirectorySetOpenPath(struct GBADirectorySet* dirs, const char* path, bool (*filter)(struct VFile*));

struct GBAOptions; void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOptions* opts); +#endif #endif
M src/gba/supervisor/thread.hsrc/gba/supervisor/thread.h

@@ -48,7 +48,9 @@ // Input

struct GBAVideoRenderer* renderer; struct GBASIODriverSet sioDrivers; struct ARMDebugger* debugger; +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 struct GBADirectorySet dirs; +#endif struct VFile* rom; struct VFile* save; struct VFile* bios;