Wrap access to settings->input.binds completely

This commit is contained in:
twinaphex 2017-04-25 18:50:49 +02:00
parent c68c8a8cfe
commit 53c9acacd6
3 changed files with 13 additions and 8 deletions

View File

@ -1242,10 +1242,11 @@ static void android_input_poll_memcpy(void *data)
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();
android_input_t *android = (android_input_t*)data;
settings_t *settings = config_get_ptr();
const struct retro_keybind *keyptr = input_config_get_specific_bind(0, key);
if( settings->input.binds[0][key].valid
if( keyptr->valid
&& android_keyboard_port_input_pressed(input_config_get_binds(0),
key))
return true;
@ -1254,9 +1255,9 @@ static bool android_input_key_pressed(void *data, int key)
joypad_info.auto_binds = input_autoconfigure_get_binds(0);
joypad_info.axis_threshold = settings->input.axis_threshold;
if (settings->input.binds[0][key].valid &&
if (keyptr->valid &&
input_joypad_pressed(android->joypad, joypad_info,
0, settings->input.binds[0], key))
0, input_config_get_binds(0), key))
return true;
return false;

View File

@ -1026,7 +1026,7 @@ bool input_driver_init(void)
settings_t *settings = config_get_ptr();
for (i = 0; i < MAX_USERS; i++)
libretro_input_binds[i] = settings->input.binds[i];
libretro_input_binds[i] = input_config_get_binds(i);
if (current_input)
current_input_data = current_input->init(settings->input.joypad_driver);

View File

@ -39,6 +39,7 @@
#include "../../gfx/video_shader_driver.h"
#include "../../input/input_config.h"
#include "../../input/input_remapping.h"
#ifndef BIND_ACTION_START
@ -109,8 +110,11 @@ static int action_start_input_desc(unsigned type, const char *label)
(void)label;
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] =
settings->input.binds[inp_desc_user][inp_desc_button_index_offset].id;
{
const struct retro_keybind *keyptr = input_config_get_specific_bind(inp_desc_user,
inp_desc_button_index_offset);
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] = keyptr->id;
}
else
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] =
inp_desc_button_index_offset - RARCH_FIRST_CUSTOM_BIND;