From c9fa9cd78dc702db67d05cdb0dc84b3e7ceda698 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 23 Mar 2017 19:52:57 -0700 Subject: [PATCH] Core: Have per-core input information --- include/mgba/core/core.h | 1 + src/gb/core.c | 10 +++++++++- src/gba/core.c | 8 ++++++++ src/platform/sdl/main.c | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/mgba/core/core.h b/include/mgba/core/core.h index 82ee3d6d6..c3a56f4ac 100644 --- a/include/mgba/core/core.h +++ b/include/mgba/core/core.h @@ -50,6 +50,7 @@ struct mCore { #endif #ifndef MINIMAL_CORE struct mInputMap inputMap; + const struct mInputPlatformInfo* inputInfo; #endif struct mCoreConfig config; struct mCoreOptions opts; diff --git a/src/gb/core.c b/src/gb/core.c index f7f552914..1ad3a39c8 100644 --- a/src/gb/core.c +++ b/src/gb/core.c @@ -20,6 +20,10 @@ #include #include +#ifndef MINIMAL_CORE +#include +#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; } diff --git a/src/gba/core.c b/src/gba/core.c index 2ed68e435..ea53474fc 100644 --- a/src/gba/core.c +++ b/src/gba/core.c @@ -22,6 +22,10 @@ #include #include +#ifndef MINIMAL_CORE +#include +#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; } diff --git a/src/platform/sdl/main.c b/src/platform/sdl/main.c index a5d960b23..d5188d32d 100644 --- a/src/platform/sdl/main.c +++ b/src/platform/sdl/main.c @@ -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);