mirror of https://github.com/mgba-emu/mgba.git
Core: Have per-core input information
This commit is contained in:
parent
aaeef69d96
commit
908b0a425e
|
@ -54,6 +54,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;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/* Copyright (c) 2013-2017 Jeffrey Pfau
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
#ifndef DS_INPUT_H
|
||||||
|
#define DS_INPUT_H
|
||||||
|
|
||||||
|
#include <mgba-util/common.h>
|
||||||
|
|
||||||
|
CXX_GUARD_START
|
||||||
|
|
||||||
|
#include <mgba/core/input.h>
|
||||||
|
|
||||||
|
extern const struct mInputPlatformInfo DSInputInfo;
|
||||||
|
|
||||||
|
enum GBAKey {
|
||||||
|
DS_KEY_A = 0,
|
||||||
|
DS_KEY_B = 1,
|
||||||
|
DS_KEY_SELECT = 2,
|
||||||
|
DS_KEY_START = 3,
|
||||||
|
DS_KEY_RIGHT = 4,
|
||||||
|
DS_KEY_LEFT = 5,
|
||||||
|
DS_KEY_UP = 6,
|
||||||
|
DS_KEY_DOWN = 7,
|
||||||
|
DS_KEY_R = 8,
|
||||||
|
DS_KEY_L = 9,
|
||||||
|
DS_KEY_X = 10,
|
||||||
|
DS_KEY_Y = 11,
|
||||||
|
DS_KEY_MAX,
|
||||||
|
DS_KEY_NONE = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
CXX_GUARD_END
|
||||||
|
|
||||||
|
#endif
|
|
@ -11,8 +11,9 @@
|
||||||
#include <mgba/internal/arm/debugger/debugger.h>
|
#include <mgba/internal/arm/debugger/debugger.h>
|
||||||
#include <mgba/internal/ds/ds.h>
|
#include <mgba/internal/ds/ds.h>
|
||||||
#include <mgba/internal/ds/extra/cli.h>
|
#include <mgba/internal/ds/extra/cli.h>
|
||||||
#include <mgba/internal/ds/renderers/software.h>
|
|
||||||
#include <mgba/internal/ds/gx/software.h>
|
#include <mgba/internal/ds/gx/software.h>
|
||||||
|
#include <mgba/internal/ds/input.h>
|
||||||
|
#include <mgba/internal/ds/renderers/software.h>
|
||||||
#include <mgba-util/memory.h>
|
#include <mgba-util/memory.h>
|
||||||
#include <mgba-util/patch.h>
|
#include <mgba-util/patch.h>
|
||||||
#include <mgba-util/vfs.h>
|
#include <mgba-util/vfs.h>
|
||||||
|
@ -76,6 +77,10 @@ static bool _DSCoreInit(struct mCore* core) {
|
||||||
mDirectorySetInit(&core->dirs);
|
mDirectorySetInit(&core->dirs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MINIMAL_CORE
|
||||||
|
core->inputInfo = &DSInputInfo; // TODO: GBInputInfo
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* Copyright (c) 2013-2017 Jeffrey Pfau
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
#include <mgba/internal/ds/input.h>
|
||||||
|
|
||||||
|
const struct mInputPlatformInfo DSInputInfo = {
|
||||||
|
.platformName = "ds",
|
||||||
|
.keyId = (const char*[]) {
|
||||||
|
"A",
|
||||||
|
"B",
|
||||||
|
"Select",
|
||||||
|
"Start",
|
||||||
|
"Right",
|
||||||
|
"Left",
|
||||||
|
"Up",
|
||||||
|
"Down",
|
||||||
|
"R",
|
||||||
|
"L",
|
||||||
|
"X",
|
||||||
|
"Y"
|
||||||
|
},
|
||||||
|
.nKeys = DS_KEY_MAX,
|
||||||
|
.hat = {
|
||||||
|
.up = DS_KEY_UP,
|
||||||
|
.left = DS_KEY_LEFT,
|
||||||
|
.down = DS_KEY_DOWN,
|
||||||
|
.right = DS_KEY_RIGHT
|
||||||
|
}
|
||||||
|
};
|
|
@ -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;
|
||||||
|
@ -61,6 +65,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -74,6 +78,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue