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->fname = 0;
|
||||||
context->save = 0;
|
context->save = 0;
|
||||||
context->renderer = 0;
|
context->renderer = 0;
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
GBADirectorySetInit(&context->dirs);
|
GBADirectorySetInit(&context->dirs);
|
||||||
|
#endif
|
||||||
memset(context->components, 0, sizeof(context->components));
|
memset(context->components, 0, sizeof(context->components));
|
||||||
|
|
||||||
if (!context->gba || !context->cpu) {
|
if (!context->gba || !context->cpu) {
|
||||||
|
@ -79,11 +81,17 @@ void GBAContextDeinit(struct GBAContext* context) {
|
||||||
mappedMemoryFree(context->gba, 0);
|
mappedMemoryFree(context->gba, 0);
|
||||||
mappedMemoryFree(context->cpu, 0);
|
mappedMemoryFree(context->cpu, 0);
|
||||||
GBAConfigDeinit(&context->config);
|
GBAConfigDeinit(&context->config);
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
GBADirectorySetDeinit(&context->dirs);
|
GBADirectorySetDeinit(&context->dirs);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GBAContextLoadROM(struct GBAContext* context, const char* path, bool autoloadSave) {
|
bool GBAContextLoadROM(struct GBAContext* context, const char* path, bool autoloadSave) {
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
context->rom = GBADirectorySetOpenPath(&context->dirs, path, GBAIsROM);
|
context->rom = GBADirectorySetOpenPath(&context->dirs, path, GBAIsROM);
|
||||||
|
#else
|
||||||
|
context->rom = VFileOpen(path, O_RDONLY);
|
||||||
|
#endif
|
||||||
if (!context->rom) {
|
if (!context->rom) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +114,9 @@ bool GBAContextLoadROM(struct GBAContext* context, const char* path, bool autolo
|
||||||
|
|
||||||
void GBAContextUnloadROM(struct GBAContext* context) {
|
void GBAContextUnloadROM(struct GBAContext* context) {
|
||||||
GBAUnloadROM(context->gba);
|
GBAUnloadROM(context->gba);
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
GBADirectorySetDetachBase(&context->dirs);
|
GBADirectorySetDetachBase(&context->dirs);
|
||||||
|
#endif
|
||||||
if (context->rom) {
|
if (context->rom) {
|
||||||
context->rom->close(context->rom);
|
context->rom->close(context->rom);
|
||||||
context->rom = 0;
|
context->rom = 0;
|
||||||
|
|
|
@ -21,7 +21,9 @@ struct GBAContext {
|
||||||
const char* fname;
|
const char* fname;
|
||||||
struct VFile* save;
|
struct VFile* save;
|
||||||
struct VFile* bios;
|
struct VFile* bios;
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
struct GBADirectorySet dirs;
|
struct GBADirectorySet dirs;
|
||||||
|
#endif
|
||||||
struct ARMComponent* components[GBA_COMPONENT_MAX];
|
struct ARMComponent* components[GBA_COMPONENT_MAX];
|
||||||
struct GBAConfig config;
|
struct GBAConfig config;
|
||||||
struct GBAOptions opts;
|
struct GBAOptions opts;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "gba/context/config.h"
|
#include "gba/context/config.h"
|
||||||
#include "util/vfs.h"
|
#include "util/vfs.h"
|
||||||
|
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
void GBADirectorySetInit(struct GBADirectorySet* dirs) {
|
void GBADirectorySetInit(struct GBADirectorySet* dirs) {
|
||||||
dirs->base = 0;
|
dirs->base = 0;
|
||||||
dirs->archive = 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"
|
#include "util/common.h"
|
||||||
|
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
struct VDir;
|
struct VDir;
|
||||||
|
|
||||||
struct GBADirectorySet {
|
struct GBADirectorySet {
|
||||||
|
@ -29,5 +30,6 @@ struct VFile* GBADirectorySetOpenPath(struct GBADirectorySet* dirs, const char*
|
||||||
|
|
||||||
struct GBAOptions;
|
struct GBAOptions;
|
||||||
void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOptions* opts);
|
void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOptions* opts);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -48,7 +48,9 @@ struct GBAThread {
|
||||||
struct GBAVideoRenderer* renderer;
|
struct GBAVideoRenderer* renderer;
|
||||||
struct GBASIODriverSet sioDrivers;
|
struct GBASIODriverSet sioDrivers;
|
||||||
struct ARMDebugger* debugger;
|
struct ARMDebugger* debugger;
|
||||||
|
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||||
struct GBADirectorySet dirs;
|
struct GBADirectorySet dirs;
|
||||||
|
#endif
|
||||||
struct VFile* rom;
|
struct VFile* rom;
|
||||||
struct VFile* save;
|
struct VFile* save;
|
||||||
struct VFile* bios;
|
struct VFile* bios;
|
||||||
|
|
Loading…
Reference in New Issue