mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Create input_driver_get_float
This commit is contained in:
parent
e0c0815f42
commit
ef8094836f
@ -32,6 +32,7 @@
|
||||
|
||||
#include "file_path_special.h"
|
||||
#include "audio/audio_driver.h"
|
||||
#include "input/input_driver.h"
|
||||
#include "configuration.h"
|
||||
#include "content.h"
|
||||
#include "config.def.h"
|
||||
@ -1283,7 +1284,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
|
||||
SETTING_FLOAT("video_font_size", &settings->floats.video_font_size, true, font_size, false);
|
||||
SETTING_FLOAT("fastforward_ratio", &settings->floats.fastforward_ratio, true, fastforward_ratio, false);
|
||||
SETTING_FLOAT("slowmotion_ratio", &settings->floats.slowmotion_ratio, true, slowmotion_ratio, false);
|
||||
SETTING_FLOAT("input_axis_threshold", &settings->floats.input_axis_threshold, true, axis_threshold, false);
|
||||
SETTING_FLOAT("input_axis_threshold", input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD), true, axis_threshold, false);
|
||||
|
||||
*size = count;
|
||||
|
||||
|
@ -231,7 +231,6 @@ typedef struct settings
|
||||
float audio_max_timing_skew;
|
||||
float audio_volume; /* dB scale. */
|
||||
|
||||
float input_axis_threshold;
|
||||
float input_overlay_opacity;
|
||||
float input_overlay_scale;
|
||||
|
||||
|
@ -1243,7 +1243,6 @@ static bool android_input_key_pressed(void *data, int key)
|
||||
{
|
||||
rarch_joypad_info_t joypad_info;
|
||||
android_input_t *android = (android_input_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_keybind *keyptr = (const struct retro_keybind*)
|
||||
&input_config_binds[0][key];
|
||||
|
||||
@ -1254,7 +1253,7 @@ static bool android_input_key_pressed(void *data, int key)
|
||||
|
||||
joypad_info.joy_idx = 0;
|
||||
joypad_info.auto_binds = input_autoconf_binds[0];
|
||||
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
|
||||
joypad_info.axis_threshold = *(input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD));
|
||||
|
||||
if (keyptr->valid &&
|
||||
input_joypad_pressed(android->joypad, joypad_info,
|
||||
|
@ -123,6 +123,7 @@ static bool input_driver_block_libretro_input = false;
|
||||
static bool input_driver_nonblock_state = false;
|
||||
static bool input_driver_flushing_input = false;
|
||||
static bool input_driver_data_own = false;
|
||||
static float input_driver_axis_threshold = 0.0f;
|
||||
|
||||
/**
|
||||
* input_driver_find_handle:
|
||||
@ -271,7 +272,6 @@ void input_poll(void)
|
||||
size_t i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned max_users = settings->uints.input_max_users;
|
||||
float axis_threshold = settings->floats.input_axis_threshold;
|
||||
|
||||
current_input->poll(current_input_data);
|
||||
|
||||
@ -285,7 +285,7 @@ void input_poll(void)
|
||||
libretro_input_binds[i][RARCH_TURBO_ENABLE].valid)
|
||||
{
|
||||
rarch_joypad_info_t joypad_info;
|
||||
joypad_info.axis_threshold = axis_threshold;
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
joypad_info.joy_idx = settings->uints.input_joypad_map[i];
|
||||
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
||||
|
||||
@ -304,7 +304,7 @@ void input_poll(void)
|
||||
overlay_ptr,
|
||||
settings->floats.input_overlay_opacity,
|
||||
settings->uints.input_analog_dpad_mode[0],
|
||||
axis_threshold);
|
||||
input_driver_axis_threshold);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
@ -380,7 +380,7 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
{
|
||||
rarch_joypad_info_t joypad_info;
|
||||
|
||||
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
|
||||
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
||||
|
||||
@ -497,7 +497,7 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2)
|
||||
if (!input_driver_block_libretro_input)
|
||||
{
|
||||
rarch_joypad_info_t joypad_info;
|
||||
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
|
||||
for (i = 4; i < 16; i++)
|
||||
{
|
||||
@ -558,7 +558,7 @@ static INLINE bool input_menu_keys_pressed_internal(
|
||||
|
||||
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
|
||||
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
||||
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
|
||||
if (sec && input_joypad_pressed(sec,
|
||||
joypad_info, port, input_config_binds[0], i))
|
||||
@ -694,7 +694,7 @@ uint64_t input_menu_keys_pressed(
|
||||
|
||||
joypad_info.joy_idx = 0;
|
||||
joypad_info.auto_binds = NULL;
|
||||
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
|
||||
input_driver_block_libretro_input = false;
|
||||
input_driver_block_hotkey = false;
|
||||
@ -841,7 +841,7 @@ static INLINE bool input_keys_pressed_internal(
|
||||
|
||||
joypad_info.joy_idx = settings->uints.input_joypad_map[0];
|
||||
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
||||
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
|
||||
if (bind_valid && current_input->input_state(current_input_data,
|
||||
joypad_info, &binds,
|
||||
@ -919,7 +919,7 @@ uint64_t input_keys_pressed(
|
||||
|
||||
joypad_info.joy_idx = 0;
|
||||
joypad_info.auto_binds = NULL;
|
||||
joypad_info.axis_threshold = settings->floats.input_axis_threshold;
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
|
||||
input_driver_block_libretro_input = false;
|
||||
input_driver_block_hotkey = false;
|
||||
@ -1244,6 +1244,20 @@ bool input_driver_grab_mouse(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
float *input_driver_get_float(enum input_action action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case INPUT_ACTION_AXIS_THRESHOLD:
|
||||
return &input_driver_axis_threshold;
|
||||
default:
|
||||
case INPUT_ACTION_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool input_driver_ungrab_mouse(void)
|
||||
{
|
||||
if (!current_input || !current_input->grab_mouse)
|
||||
|
@ -48,6 +48,12 @@ enum input_toggle_type
|
||||
INPUT_TOGGLE_LAST
|
||||
};
|
||||
|
||||
enum input_action
|
||||
{
|
||||
INPUT_ACTION_NONE = 0,
|
||||
INPUT_ACTION_AXIS_THRESHOLD
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
{
|
||||
bool valid;
|
||||
@ -336,6 +342,8 @@ bool input_driver_grab_mouse(void);
|
||||
|
||||
bool input_driver_ungrab_mouse(void);
|
||||
|
||||
float *input_driver_get_float(enum input_action action);
|
||||
|
||||
bool input_driver_is_data_ptr_same(void *data);
|
||||
|
||||
extern input_driver_t input_android;
|
||||
|
@ -4286,7 +4286,7 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_FLOAT(
|
||||
list, list_info,
|
||||
&settings->floats.input_axis_threshold,
|
||||
input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD),
|
||||
MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD,
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD,
|
||||
axis_threshold,
|
||||
|
Loading…
Reference in New Issue
Block a user