diff --git a/include/mgba/core/core.h b/include/mgba/core/core.h index fcd302279..3475c393d 100644 --- a/include/mgba/core/core.h +++ b/include/mgba/core/core.h @@ -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); diff --git a/src/core/core.c b/src/core/core.c index 082d547e2..fb706eb02 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -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