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
#ifndef MINIMAL_CORE
struct mInputMap inputMap;
const struct mInputPlatformInfo* inputInfo;
#endif
struct mCoreConfig config;
struct mCoreOptions opts;

View File

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

View File

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

View File

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