mirror of https://github.com/mgba-emu/mgba.git
Core: Add mCoreCreate function for making a core based on platform type
This commit is contained in:
parent
fe4d4f986f
commit
ca3050d76b
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue