mirror of https://github.com/mgba-emu/mgba.git
GBA Context: Add additional constraints on MINIMAL_CORE==2
This commit is contained in:
parent
7436a5afef
commit
f1fba59152
|
@ -21,7 +21,9 @@ bool GBAContextInit(struct GBAContext* context, const char* port) {
|
|||
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 @@ void GBAContextDeinit(struct GBAContext* context) {
|
|||
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 @@ bool GBAContextLoadROM(struct GBAContext* context, const char* path, bool autolo
|
|||
|
||||
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;
|
||||
|
|
|
@ -21,7 +21,9 @@ struct GBAContext {
|
|||
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;
|
||||
|
|
|
@ -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 @@ void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOpt
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#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*
|
|||
|
||||
struct GBAOptions;
|
||||
void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOptions* opts);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,9 @@ struct GBAThread {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue