mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Libretro) implement new environment callback RETRO_ENVIRONMENT_GET_INPUT_BITMASKS
This commit is contained in:
parent
20e8dfcba5
commit
023d2cb9a9
@ -1842,6 +1842,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
break;
|
||||
}
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_INPUT_BITMASKS:
|
||||
/* Just falldown, the function will return true */
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE:
|
||||
{
|
||||
/* Try to use the polled refresh rate first. */
|
||||
|
@ -202,6 +202,8 @@ extern "C" {
|
||||
#define RETRO_DEVICE_ID_JOYPAD_L3 14
|
||||
#define RETRO_DEVICE_ID_JOYPAD_R3 15
|
||||
|
||||
#define RETRO_DEVICE_ID_JOYPAD_MASK 256
|
||||
|
||||
/* Index / Id values for ANALOG device. */
|
||||
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
|
||||
#define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
|
||||
@ -1092,10 +1094,22 @@ enum retro_mod
|
||||
* refresh rate/framerate.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_INPUT_BITMASKS (51 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* bool * --
|
||||
* Boolean value that indicates whether or not the frontend supports
|
||||
* input bitmasks being returned by retro_input_state_t. The advantage
|
||||
* of this is that retro_input_state_t has to be only called once to
|
||||
* grab all button states instead of multiple times.
|
||||
*
|
||||
* If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id'
|
||||
* to retro_input_state_t (make sure 'device' is set to RETRO_DEVICE_JOYPAD).
|
||||
* It will return a bitmask of all the digital buttons.
|
||||
*/
|
||||
|
||||
/* VFS functionality */
|
||||
|
||||
/* File paths:
|
||||
* File paths passed as parameters when using this api shall be well formed UNIX-style,
|
||||
* File paths passed as parameters when using this API shall be well formed UNIX-style,
|
||||
* using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator.
|
||||
* Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead).
|
||||
* Other than the directory separator, cores shall not make assumptions about path format:
|
||||
|
11
retroarch.c
11
retroarch.c
@ -2541,6 +2541,17 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
is in action for that button*/
|
||||
bool reset_state = false;
|
||||
|
||||
if ( (device == RETRO_DEVICE_JOYPAD) &&
|
||||
(id == RETRO_DEVICE_ID_JOYPAD_MASK))
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
if (input_state(port, device, idx, i))
|
||||
res |= (1 << i);
|
||||
return res;
|
||||
}
|
||||
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
if (bsv_movie_get_input(&bsv_result))
|
||||
|
Loading…
x
Reference in New Issue
Block a user