Core: Have per-core input information

This commit is contained in:
Vicki Pfau 2017-03-23 19:52:57 -07:00
parent aff1486ec5
commit c9fa9cd78d
4 changed files with 19 additions and 2 deletions

View File

@ -50,6 +50,7 @@ struct mCore {
#endif #endif
#ifndef MINIMAL_CORE #ifndef MINIMAL_CORE
struct mInputMap inputMap; struct mInputMap inputMap;
const struct mInputPlatformInfo* inputInfo;
#endif #endif
struct mCoreConfig config; struct mCoreConfig config;
struct mCoreOptions opts; struct mCoreOptions opts;

View File

@ -20,6 +20,10 @@
#include <mgba-util/patch.h> #include <mgba-util/patch.h>
#include <mgba-util/vfs.h> #include <mgba-util/vfs.h>
#ifndef MINIMAL_CORE
#include <mgba/internal/gba/input.h>
#endif
struct GBCore { struct GBCore {
struct mCore d; struct mCore d;
struct GBVideoSoftwareRenderer renderer; struct GBVideoSoftwareRenderer renderer;
@ -63,6 +67,10 @@ static bool _GBCoreInit(struct mCore* core) {
mDirectorySetInit(&core->dirs); mDirectorySetInit(&core->dirs);
#endif #endif
#ifndef MINIMAL_CORE
core->inputInfo = &GBAInputInfo; // TODO: GBInputInfo
#endif
return true; return true;
} }

View File

@ -22,6 +22,10 @@
#include <mgba-util/patch.h> #include <mgba-util/patch.h>
#include <mgba-util/vfs.h> #include <mgba-util/vfs.h>
#ifndef MINIMAL_CORE
#include <mgba/internal/gba/input.h>
#endif
struct GBACore { struct GBACore {
struct mCore d; struct mCore d;
struct GBAVideoSoftwareRenderer renderer; struct GBAVideoSoftwareRenderer renderer;
@ -76,6 +80,10 @@ static bool _GBACoreInit(struct mCore* core) {
mDirectorySetInit(&core->dirs); mDirectorySetInit(&core->dirs);
#endif #endif
#ifndef MINIMAL_CORE
core->inputInfo = &GBAInputInfo;
#endif
return true; return true;
} }

View File

@ -98,7 +98,7 @@ int main(int argc, char** argv) {
return 1; return 1;
} }
mInputMapInit(&renderer.core->inputMap, &GBAInputInfo); mInputMapInit(&renderer.core->inputMap, renderer.core->inputInfo);
mCoreInitConfig(renderer.core, PORT); mCoreInitConfig(renderer.core, PORT);
applyArguments(&args, &subparser, &renderer.core->config); applyArguments(&args, &subparser, &renderer.core->config);