mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Use input_config_set_device
This commit is contained in:
parent
b4cdad1a6f
commit
aa59b33931
@ -495,6 +495,14 @@ void input_config_set_device_name(unsigned port, const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
void input_config_set_device(unsigned port, unsigned id)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings)
|
||||
settings->input.libretro_device[port] = id;
|
||||
}
|
||||
|
||||
bool input_config_get_bind_idx(unsigned port, unsigned *joy_idx_real)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -519,3 +527,4 @@ const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned i
|
||||
return &settings->input.autoconf_binds[joy_idx][id];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,8 @@ void input_config_parse_joy_axis(void *data, const char *prefix,
|
||||
|
||||
void input_config_set_device_name(unsigned port, const char *name);
|
||||
|
||||
void input_config_set_device(unsigned port, unsigned id);
|
||||
|
||||
const char *input_config_get_device_name(unsigned port);
|
||||
|
||||
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);
|
||||
|
@ -1022,7 +1022,6 @@ static int setting_action_start_libretro_device_type(void *data)
|
||||
unsigned devices[128], types = 0, port = 0;
|
||||
const struct retro_controller_info *desc = NULL;
|
||||
rarch_system_info_t *system = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
|
||||
if (setting_generic_action_start_default(setting) != 0)
|
||||
@ -1062,7 +1061,7 @@ static int setting_action_start_libretro_device_type(void *data)
|
||||
|
||||
current_device = RETRO_DEVICE_JOYPAD;
|
||||
|
||||
settings->input.libretro_device[port] = current_device;
|
||||
input_config_set_device(port, current_device);
|
||||
|
||||
pad.port = port;
|
||||
pad.device = current_device;
|
||||
@ -1176,7 +1175,7 @@ static int setting_action_left_libretro_device_type(
|
||||
current_device = devices
|
||||
[(current_idx + types - 1) % types];
|
||||
|
||||
settings->input.libretro_device[port] = current_device;
|
||||
input_config_set_device(port, current_device);
|
||||
|
||||
pad.port = port;
|
||||
pad.device = current_device;
|
||||
@ -1243,7 +1242,7 @@ static int setting_action_right_libretro_device_type(
|
||||
current_device = devices
|
||||
[(current_idx + 1) % types];
|
||||
|
||||
settings->input.libretro_device[port] = current_device;
|
||||
input_config_set_device(port, current_device);
|
||||
|
||||
pad.port = port;
|
||||
pad.device = current_device;
|
||||
|
81
retroarch.c
81
retroarch.c
@ -67,6 +67,7 @@
|
||||
#include "core_info.h"
|
||||
#include "dynamic.h"
|
||||
#include "driver.h"
|
||||
#include "input/input_config.h"
|
||||
#include "msg_hash.h"
|
||||
#include "movie.h"
|
||||
#include "dirs.h"
|
||||
@ -401,7 +402,6 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
{
|
||||
const char *optstring = NULL;
|
||||
bool explicit_menu = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
const struct option opts[] = {
|
||||
@ -545,7 +545,8 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
retroarch_fail(1, "retroarch_parse_input()");
|
||||
}
|
||||
new_port = port -1;
|
||||
settings->input.libretro_device[new_port] = id;
|
||||
|
||||
input_config_set_device(new_port, id);
|
||||
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port);
|
||||
@ -564,7 +565,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
}
|
||||
new_port = port - 1;
|
||||
|
||||
settings->input.libretro_device[new_port] = RETRO_DEVICE_ANALOG;
|
||||
input_config_set_device(new_port, RETRO_DEVICE_ANALOG);
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port);
|
||||
}
|
||||
@ -606,7 +607,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
retroarch_fail(1, "retroarch_parse_input()");
|
||||
}
|
||||
new_port = port - 1;
|
||||
settings->input.libretro_device[port - 1] = RETRO_DEVICE_NONE;
|
||||
input_config_set_device(port - 1, RETRO_DEVICE_NONE);
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port);
|
||||
}
|
||||
@ -631,6 +632,8 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
case 'L':
|
||||
if (path_is_directory(optarg))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
path_clear(RARCH_PATH_CORE);
|
||||
strlcpy(settings->directory.libretro, optarg,
|
||||
sizeof(settings->directory.libretro));
|
||||
@ -698,31 +701,43 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_MODE, NULL);
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_IP_ADDRESS, NULL);
|
||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
|
||||
strlcpy(settings->netplay.server, optarg,
|
||||
sizeof(settings->netplay.server));
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_MODE, NULL);
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_IP_ADDRESS, NULL);
|
||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
|
||||
strlcpy(settings->netplay.server, optarg,
|
||||
sizeof(settings->netplay.server));
|
||||
}
|
||||
break;
|
||||
|
||||
case RA_OPT_STATELESS:
|
||||
settings->netplay.stateless_mode = true;
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_STATELESS_MODE, NULL);
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings->netplay.stateless_mode = true;
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_STATELESS_MODE, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case RA_OPT_CHECK_FRAMES:
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL);
|
||||
settings->netplay.check_frames = strtoul(optarg, NULL, 0);
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL);
|
||||
settings->netplay.check_frames = strtoul(optarg, NULL, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RA_OPT_PORT:
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT, NULL);
|
||||
settings->netplay.port = strtoul(optarg, NULL, 0);
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT, NULL);
|
||||
settings->netplay.port = strtoul(optarg, NULL, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(HAVE_NETWORK_CMD)
|
||||
@ -772,9 +787,12 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case RA_OPT_NICK:
|
||||
rarch_ctl(RARCH_CTL_USERNAME_SET, NULL);
|
||||
strlcpy(settings->username, optarg,
|
||||
sizeof(settings->username));
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_ctl(RARCH_CTL_USERNAME_SET, NULL);
|
||||
strlcpy(settings->username, optarg,
|
||||
sizeof(settings->username));
|
||||
}
|
||||
break;
|
||||
|
||||
case RA_OPT_APPENDCONFIG:
|
||||
@ -1109,7 +1127,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
static bool rarch_bps_pref = false;
|
||||
static bool rarch_ips_pref = false;
|
||||
static bool rarch_patch_blocked = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef HAVE_THREAD_STORAGE
|
||||
static sthread_tls_t rarch_tls;
|
||||
const void *MAGIC_POINTER = (void*)0xB16B00B5;
|
||||
@ -1239,7 +1256,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
settings->input.libretro_device[i] = RETRO_DEVICE_JOYPAD;
|
||||
input_config_set_device(i, RETRO_DEVICE_JOYPAD);
|
||||
}
|
||||
runloop_ctl(RUNLOOP_CTL_HTTPSERVER_INIT, NULL);
|
||||
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_INIT, NULL);
|
||||
@ -1306,8 +1323,11 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_TOGGLE, NULL);
|
||||
#endif
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (settings->input.overlay_hide_in_menu)
|
||||
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings->input.overlay_hide_in_menu)
|
||||
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case RARCH_CTL_MENU_RUNNING_FINISHED:
|
||||
@ -1316,8 +1336,11 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
#endif
|
||||
video_driver_set_texture_enable(false, false);
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (settings && settings->input.overlay_hide_in_menu)
|
||||
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings && settings->input.overlay_hide_in_menu)
|
||||
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case RARCH_CTL_IS_MAIN_THREAD:
|
||||
|
Loading…
x
Reference in New Issue
Block a user