mirror of https://github.com/mgba-emu/mgba.git
GB: Add input information
This commit is contained in:
parent
34dc2ae6f5
commit
fb9df7270d
|
@ -0,0 +1,32 @@
|
||||||
|
/* 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 GB_INPUT_H
|
||||||
|
#define GB_INPUT_H
|
||||||
|
|
||||||
|
#include <mgba-util/common.h>
|
||||||
|
|
||||||
|
CXX_GUARD_START
|
||||||
|
|
||||||
|
#include <mgba/core/input.h>
|
||||||
|
|
||||||
|
extern const struct mInputPlatformInfo GBInputInfo;
|
||||||
|
|
||||||
|
enum GBKey {
|
||||||
|
GB_KEY_A = 0,
|
||||||
|
GB_KEY_B = 1,
|
||||||
|
GB_KEY_SELECT = 2,
|
||||||
|
GB_KEY_START = 3,
|
||||||
|
GB_KEY_RIGHT = 4,
|
||||||
|
GB_KEY_LEFT = 5,
|
||||||
|
GB_KEY_UP = 6,
|
||||||
|
GB_KEY_DOWN = 7,
|
||||||
|
GB_KEY_MAX,
|
||||||
|
GB_KEY_NONE = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
CXX_GUARD_END
|
||||||
|
|
||||||
|
#endif
|
|
@ -9,6 +9,7 @@
|
||||||
#include <mgba/internal/gb/cheats.h>
|
#include <mgba/internal/gb/cheats.h>
|
||||||
#include <mgba/internal/gb/extra/cli.h>
|
#include <mgba/internal/gb/extra/cli.h>
|
||||||
#include <mgba/internal/gb/gb.h>
|
#include <mgba/internal/gb/gb.h>
|
||||||
|
#include <mgba/internal/gb/input.h>
|
||||||
#include <mgba/internal/gb/mbc.h>
|
#include <mgba/internal/gb/mbc.h>
|
||||||
#include <mgba/internal/gb/overrides.h>
|
#include <mgba/internal/gb/overrides.h>
|
||||||
#include <mgba/internal/gb/renderers/software.h>
|
#include <mgba/internal/gb/renderers/software.h>
|
||||||
|
@ -68,7 +69,7 @@ static bool _GBCoreInit(struct mCore* core) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MINIMAL_CORE
|
#ifndef MINIMAL_CORE
|
||||||
core->inputInfo = &GBAInputInfo; // TODO: GBInputInfo
|
core->inputInfo = &GBInputInfo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* 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/gb/input.h>
|
||||||
|
|
||||||
|
#include <mgba/gb/interface.h>
|
||||||
|
|
||||||
|
const struct mInputPlatformInfo GBInputInfo = {
|
||||||
|
.platformName = "gb",
|
||||||
|
.keyId = (const char*[]) {
|
||||||
|
"A",
|
||||||
|
"B",
|
||||||
|
"Select",
|
||||||
|
"Start",
|
||||||
|
"Right",
|
||||||
|
"Left",
|
||||||
|
"Up",
|
||||||
|
"Down"
|
||||||
|
},
|
||||||
|
.nKeys = GB_KEY_MAX,
|
||||||
|
.hat = {
|
||||||
|
.up = GB_KEY_UP,
|
||||||
|
.left = GB_KEY_LEFT,
|
||||||
|
.down = GB_KEY_DOWN,
|
||||||
|
.right = GB_KEY_RIGHT
|
||||||
|
}
|
||||||
|
};
|
|
@ -47,6 +47,7 @@
|
||||||
#include <mgba/core/version.h>
|
#include <mgba/core/version.h>
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
#include <mgba/internal/gb/gb.h>
|
#include <mgba/internal/gb/gb.h>
|
||||||
|
#include <mgba/internal/gb/input.h>
|
||||||
#include <mgba/internal/gb/video.h>
|
#include <mgba/internal/gb/video.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef M_CORE_GBA
|
#ifdef M_CORE_GBA
|
||||||
|
@ -207,7 +208,7 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
|
||||||
m_inputController.addPlatform(PLATFORM_GBA, tr("Game Boy Advance"), &GBAInputInfo);
|
m_inputController.addPlatform(PLATFORM_GBA, tr("Game Boy Advance"), &GBAInputInfo);
|
||||||
#endif
|
#endif
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
m_inputController.addPlatform(PLATFORM_GB, tr("Game Boy"), &GBAInputInfo);
|
m_inputController.addPlatform(PLATFORM_GB, tr("Game Boy"), &GBInputInfo);
|
||||||
#endif
|
#endif
|
||||||
m_inputController.setupCallback(m_controller);
|
m_inputController.setupCallback(m_controller);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue