mirror of https://github.com/mgba-emu/mgba.git
Libretro: Allow blocking opposing directional input
This commit is contained in:
parent
089e692bd1
commit
5147a5160f
1
CHANGES
1
CHANGES
|
@ -10,6 +10,7 @@ Features:
|
|||
- Support for VBA-style cheat codes
|
||||
- Savestates now store creation timestamps
|
||||
- Key autofire
|
||||
- Libretro: Allow blocking opposing directional input
|
||||
Bugfixes:
|
||||
- Util: Fix PowerPC PNG read/write pixel order
|
||||
- VFS: Fix VFileReadline and remove _vfdReadline
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#define RUMBLE_PWM 35
|
||||
|
||||
#define SOLAR_SENSOR_LEVEL "mgba_solar_sensor_level"
|
||||
#define ALLOW_OPPOSING_DIRECTIONS "mgba_allow_opposing_directions"
|
||||
|
||||
static retro_environment_t environCallback;
|
||||
static retro_video_refresh_t videoCallback;
|
||||
|
@ -58,6 +59,7 @@ void retro_set_environment(retro_environment_t env) {
|
|||
|
||||
struct retro_variable vars[] = {
|
||||
{ SOLAR_SENSOR_LEVEL, "Solar sensor level; 0|1|2|3|4|5|6|7|8|9|10" },
|
||||
{ ALLOW_OPPOSING_DIRECTIONS, "Allow opposing directional input; no|yes" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -212,6 +214,18 @@ void retro_run(void) {
|
|||
uint16_t keys;
|
||||
inputPollCallback();
|
||||
|
||||
struct retro_variable var = {
|
||||
.key = ALLOW_OPPOSING_DIRECTIONS,
|
||||
.value = 0
|
||||
};
|
||||
|
||||
bool updated = false;
|
||||
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated) {
|
||||
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
|
||||
context.gba->allowOpposingDirections = strcmp(var.value, "yes") == 0;
|
||||
}
|
||||
}
|
||||
|
||||
keys = 0;
|
||||
keys |= (!!inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A)) << 0;
|
||||
keys |= (!!inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B)) << 1;
|
||||
|
|
Loading…
Reference in New Issue