mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Take out libretro_device from global struct
This commit is contained in:
parent
2dcc5b8e43
commit
4567fdef52
@ -1131,11 +1131,9 @@ static void config_set_defaults(void)
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
settings->input.joypad_map[i] = i;
|
||||
settings->input.analog_dpad_mode[i] = ANALOG_DPAD_NONE;
|
||||
if (!global->has_set.libretro_device[i])
|
||||
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &i))
|
||||
settings->input.libretro_device[i] = RETRO_DEVICE_JOYPAD;
|
||||
}
|
||||
|
||||
@ -1874,7 +1872,7 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
snprintf(buf, sizeof(buf), "input_player%u_analog_dpad_mode", i + 1);
|
||||
CONFIG_GET_INT_BASE(conf, settings, input.analog_dpad_mode[i], buf);
|
||||
|
||||
if (!global->has_set.libretro_device[i])
|
||||
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &i))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1);
|
||||
CONFIG_GET_INT_BASE(conf, settings, input.libretro_device[i], buf);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "input_remapping.h"
|
||||
#include "../configuration.h"
|
||||
#include "../paths.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../runloop.h"
|
||||
|
||||
/**
|
||||
@ -36,7 +37,6 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
unsigned i, j;
|
||||
config_file_t *conf = (config_file_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!conf || string_is_empty(path))
|
||||
return false;
|
||||
@ -88,7 +88,7 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
snprintf(buf, sizeof(buf), "input_player%u_analog_dpad_mode", i + 1);
|
||||
CONFIG_GET_INT_BASE(conf, settings, input.analog_dpad_mode[i], buf);
|
||||
|
||||
if (!global->has_set.libretro_device[i])
|
||||
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &i))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1);
|
||||
CONFIG_GET_INT_BASE(conf, settings, input.libretro_device[i], buf);
|
||||
|
45
retroarch.c
45
retroarch.c
@ -393,9 +393,11 @@ static void retroarch_print_help(const char *arg0)
|
||||
static void retroarch_parse_input(int argc, char *argv[])
|
||||
{
|
||||
const char *optstring = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool explicit_menu = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef HAVE_NETWORKING
|
||||
global_t *global = global_get_ptr();
|
||||
#endif
|
||||
|
||||
const struct option opts[] = {
|
||||
#ifdef HAVE_DYNAMIC
|
||||
@ -519,6 +521,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
|
||||
case 'd':
|
||||
{
|
||||
unsigned new_port;
|
||||
unsigned id = 0;
|
||||
struct string_list *list = string_split(optarg, ":");
|
||||
|
||||
@ -537,12 +540,17 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
retroarch_print_help(argv[0]);
|
||||
retroarch_fail(1, "retroarch_parse_input()");
|
||||
}
|
||||
settings->input.libretro_device[port - 1] = id;
|
||||
global->has_set.libretro_device[port - 1] = true;
|
||||
new_port = port -1;
|
||||
settings->input.libretro_device[new_port] = id;
|
||||
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'A':
|
||||
{
|
||||
unsigned new_port;
|
||||
port = strtol(optarg, NULL, 0);
|
||||
if (port < 1 || port > MAX_USERS)
|
||||
{
|
||||
@ -550,8 +558,12 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
retroarch_print_help(argv[0]);
|
||||
retroarch_fail(1, "retroarch_parse_input()");
|
||||
}
|
||||
settings->input.libretro_device[port - 1] = RETRO_DEVICE_ANALOG;
|
||||
global->has_set.libretro_device[port - 1] = true;
|
||||
new_port = port - 1;
|
||||
|
||||
settings->input.libretro_device[new_port] = RETRO_DEVICE_ANALOG;
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port);
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
@ -577,16 +589,21 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
port = strtol(optarg, NULL, 0);
|
||||
if (port < 1 || port > MAX_USERS)
|
||||
{
|
||||
RARCH_ERR("%s\n",
|
||||
msg_hash_to_str(MSG_VALUE_DISCONNECT_DEVICE_FROM_A_VALID_PORT));
|
||||
retroarch_print_help(argv[0]);
|
||||
retroarch_fail(1, "retroarch_parse_input()");
|
||||
unsigned new_port;
|
||||
port = strtol(optarg, NULL, 0);
|
||||
if (port < 1 || port > MAX_USERS)
|
||||
{
|
||||
RARCH_ERR("%s\n",
|
||||
msg_hash_to_str(MSG_VALUE_DISCONNECT_DEVICE_FROM_A_VALID_PORT));
|
||||
retroarch_print_help(argv[0]);
|
||||
retroarch_fail(1, "retroarch_parse_input()");
|
||||
}
|
||||
new_port = port - 1;
|
||||
settings->input.libretro_device[port - 1] = RETRO_DEVICE_NONE;
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port);
|
||||
}
|
||||
settings->input.libretro_device[port - 1] = RETRO_DEVICE_NONE;
|
||||
global->has_set.libretro_device[port - 1] = true;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
|
Loading…
x
Reference in New Issue
Block a user