input_device_names no longer part of settings struct

This commit is contained in:
twinaphex 2017-04-27 21:35:31 +02:00
parent 79f28f2985
commit 1bf7cbccbe
6 changed files with 16 additions and 24 deletions

View File

@ -275,7 +275,6 @@ typedef struct settings
char driver[32];
char joypad_driver[32];
char keyboard_layout[64];
char device_names[MAX_USERS][64];
unsigned remap_ids[MAX_USERS][RARCH_BIND_LIST_END];

View File

@ -34,7 +34,6 @@
#include "../input_driver.h"
#include "../common/epoll_common.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../../tasks/tasks_internal.h"
@ -99,10 +98,8 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p
if (pad->fd >= 0)
{
settings_t *settings = config_get_ptr();
if (ioctl(pad->fd,
JSIOCGNAME(sizeof(settings->input.device_names[0])), pad->ident) >= 0)
JSIOCGNAME(sizeof(input_device_names[0])), pad->ident) >= 0)
{
RARCH_LOG("[Device]: Found pad: %s on %s.\n", pad->ident, path);
}
@ -240,12 +237,11 @@ static bool linuxraw_joypad_init(void *data)
{
char path[PATH_MAX_LENGTH];
struct linuxraw_joypad *pad = (struct linuxraw_joypad*)&linuxraw_pads[i];
settings_t *settings = config_get_ptr();
path[0] = '\0';
pad->fd = -1;
pad->ident = settings->input.device_names[i];
pad->ident = input_device_names[i];
snprintf(path, sizeof(path), "/dev/input/js%u", i);

View File

@ -134,8 +134,6 @@ static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad
if (pad->fd >= 0)
{
settings_t *settings = config_get_ptr();
RARCH_LOG("[Joypad]: Found parallel port: %s\n", path);
/* Parport driver does not log failures with RARCH_ERR because they could be
@ -188,7 +186,7 @@ static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad
if (!set_control)
RARCH_WARN("[Joypad]: Failed to clear nStrobe and nIRQ bits on %s\n", path);
strlcpy(pad->ident, path, sizeof(settings->input.device_names[0]));
strlcpy(pad->ident, path, sizeof(input_device_names[0]));
for (i = 0; i < PARPORT_NUM_BUTTONS; i++)
pad->button_enable[i] = true;
@ -240,7 +238,6 @@ static bool parport_joypad_init(void *data)
bool found_disabled_button = false;
char buf[PARPORT_NUM_BUTTONS * 3 + 1] = {0};
char pin[3 + 1] = {0};
settings_t *settings = config_get_ptr();
(void)data;
@ -252,7 +249,7 @@ static bool parport_joypad_init(void *data)
struct parport_joypad *pad = &parport_pads[i];
pad->fd = -1;
pad->ident = settings->input.device_names[i];
pad->ident = input_device_names[i];
snprintf(path, sizeof(path), "/dev/parport%u", i);

View File

@ -38,7 +38,6 @@
#include "../common/udev_common.h"
#include "../../configuration.h"
#include "../../verbosity.h"
/* Udev/evdev Linux joypad driver.
@ -213,9 +212,8 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char
unsigned long keybit[NBITS(KEY_MAX)] = {0};
unsigned long absbit[NBITS(ABS_MAX)] = {0};
unsigned long ffbit[NBITS(FF_MAX)] = {0};
settings_t *settings = config_get_ptr();
strlcpy(pad->ident, settings->input.device_names[p], sizeof(pad->ident));
strlcpy(pad->ident, input_device_names[p], sizeof(pad->ident));
if (ioctl(fd, EVIOCGNAME(sizeof(pad->ident)), pad->ident) < 0)
{

View File

@ -81,6 +81,7 @@ static const char *bind_user_prefix[MAX_USERS] = {
static int input_config_vid[MAX_USERS];
static int input_config_pid[MAX_USERS];
char input_device_names[MAX_USERS][64];
struct retro_keybind input_config_binds[MAX_USERS][RARCH_BIND_LIST_END];
struct retro_keybind input_autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END];
const struct retro_keybind *libretro_input_binds[MAX_USERS];
@ -490,27 +491,24 @@ void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
const char *input_config_get_device_name(unsigned port)
{
settings_t *settings = config_get_ptr();
if (string_is_empty(settings->input.device_names[port]))
if (string_is_empty(input_device_names[port]))
return NULL;
return settings->input.device_names[port];
return input_device_names[port];
}
void input_config_set_device_name(unsigned port, const char *name)
{
if (!string_is_empty(name))
{
settings_t *settings = config_get_ptr();
strlcpy(settings->input.device_names[port],
strlcpy(input_device_names[port],
name,
sizeof(settings->input.device_names[port]));
sizeof(input_device_names[port]));
}
}
void input_config_clear_device_name(unsigned port)
{
settings_t *settings = config_get_ptr();
settings->input.device_names[port][0] = '\0';
input_device_names[port][0] = '\0';
}
unsigned *input_config_get_device_ptr(unsigned port)
@ -577,7 +575,7 @@ int32_t input_config_get_vid(unsigned port)
void input_config_reset(void)
{
unsigned i;
unsigned i, j;
retro_assert(sizeof(input_config_binds[0]) >= sizeof(retro_keybinds_1));
retro_assert(sizeof(input_config_binds[1]) >= sizeof(retro_keybinds_rest));
@ -593,5 +591,8 @@ void input_config_reset(void)
input_config_vid[i] = 0;
input_config_pid[i] = 0;
libretro_input_binds[i] = input_config_binds[i];
for (j = 0; j < 64; j++)
input_device_names[i][j] = 0;
}
}

View File

@ -24,6 +24,7 @@
extern struct retro_keybind input_config_binds[MAX_USERS][RARCH_BIND_LIST_END];
extern struct retro_keybind input_autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END];
extern const struct retro_keybind *libretro_input_binds[MAX_USERS];
extern char input_device_names[MAX_USERS][64];
const char *input_config_bind_map_get_base(unsigned i);