Core: Add mCoreCreate function for making a core based on platform type

This commit is contained in:
Vicki Pfau 2021-01-14 00:06:59 -08:00
parent fe4d4f986f
commit ca3050d76b
2 changed files with 14 additions and 0 deletions

View File

@ -186,6 +186,7 @@ void mCoreTakeScreenshot(struct mCore* core);
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);

View File

@ -73,6 +73,19 @@ enum mPlatform mCoreIsCompatible(struct VFile* vf) {
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>