all repos — mgba @ ca3050d76be99f4d635f4c45d790a199befc2f6c

mGBA Game Boy Advance Emulator

Core: Add mCoreCreate function for making a core based on platform type
Vicki Pfau vi@endrift.com
Thu, 14 Jan 2021 00:06:59 -0800
commit

ca3050d76be99f4d635f4c45d790a199befc2f6c

parent

fe4d4f986f2809c58dad0988929363daa5072e74

2 files changed, 14 insertions(+), 0 deletions(-)

jump to
M include/mgba/core/core.hinclude/mgba/core/core.h

@@ -186,6 +186,7 @@ #endif

struct mCore* mCoreFindVF(struct VFile* vf); enum mPlatform mCoreIsCompatible(struct VFile* vf); +struct mCore* mCoreCreate(enum mPlatform); bool mCoreSaveStateNamed(struct mCore* core, struct VFile* vf, int flags); bool mCoreLoadStateNamed(struct mCore* core, struct VFile* vf, int flags);
M src/core/core.csrc/core/core.c

@@ -73,6 +73,19 @@ }

return mPLATFORM_NONE; } +struct mCore* mCoreCreate(enum mPlatform platform) { + const struct mCoreFilter* filter; + for (filter = &_filters[0]; filter->filter; ++filter) { + if (filter->platform == platform) { + break; + } + } + if (filter->open) { + return filter->open(); + } + return NULL; +} + #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 #include <mgba-util/png-io.h>