mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
move driver->remote and driver->command to input_driver.c
This commit is contained in:
parent
0b24618cd5
commit
22d64ae3dc
@ -56,20 +56,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
static void event_init_remote(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings->network_remote_enable)
|
||||
{
|
||||
if (!(driver->remote = rarch_remote_new(settings->network_remote_base_port)))
|
||||
RARCH_ERR("Failed to initialize remote gamepad interface.\n");
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void event_save_files(void)
|
||||
@ -1576,18 +1562,11 @@ bool event_command(enum event_command cmd)
|
||||
input_driver_ctl(RARCH_INPUT_CTL_COMMAND_INIT, NULL);
|
||||
break;
|
||||
case EVENT_CMD_REMOTE_DEINIT:
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
if (driver->remote)
|
||||
rarch_remote_free(driver->remote);
|
||||
driver->remote = NULL;
|
||||
#endif
|
||||
input_driver_ctl(RARCH_INPUT_CTL_REMOTE_DEINIT, NULL);
|
||||
break;
|
||||
case EVENT_CMD_REMOTE_INIT:
|
||||
event_command(EVENT_CMD_REMOTE_DEINIT);
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
event_init_remote();
|
||||
#endif
|
||||
input_driver_ctl(RARCH_INPUT_CTL_REMOTE_INIT, NULL);
|
||||
break;
|
||||
case EVENT_CMD_TEMPORARY_CONTENT_DEINIT:
|
||||
content_temporary_free();
|
||||
|
12
driver.h
12
driver.h
@ -46,14 +46,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
#include "command.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
#include "remote.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -241,10 +233,6 @@ typedef struct driver
|
||||
#ifdef HAVE_MENU
|
||||
bool menu_data_own;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
rarch_remote_t *remote;
|
||||
#endif
|
||||
} driver_t;
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,14 @@
|
||||
#include "../string_list_special.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
#include "../command.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
#include "../remote.h"
|
||||
#endif
|
||||
|
||||
static const input_driver_t *input_drivers[] = {
|
||||
#ifdef __CELLOS_LV2__
|
||||
&input_ps3,
|
||||
@ -85,6 +93,9 @@ struct turbo_buttons
|
||||
#ifdef HAVE_COMMAND
|
||||
static rarch_cmd_t *input_driver_command;
|
||||
#endif
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
static rarch_remote_t *input_driver_remote;
|
||||
#endif
|
||||
static bool input_driver_keyboard_linefeed_enable;
|
||||
static bool input_driver_osk_enabled;
|
||||
static bool input_driver_data_own;
|
||||
@ -260,9 +271,6 @@ static retro_input_t input_driver_keys_pressed(void)
|
||||
{
|
||||
int key;
|
||||
retro_input_t ret = 0;
|
||||
#if defined(HAVE_COMMAND) || defined(HAVE_NETWORK_GAMEPAD)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
#endif
|
||||
|
||||
for (key = 0; key < RARCH_BIND_LIST_END; key++)
|
||||
{
|
||||
@ -284,7 +292,7 @@ static retro_input_t input_driver_keys_pressed(void)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
if (driver->remote)
|
||||
if (input_driver_remote)
|
||||
state |= input_remote_key_pressed(key,0);
|
||||
#endif
|
||||
|
||||
@ -419,9 +427,6 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
||||
**/
|
||||
void input_poll(void)
|
||||
{
|
||||
#ifdef HAVE_COMMAND
|
||||
driver_t *driver = driver_get_ptr();
|
||||
#endif
|
||||
#ifdef HAVE_OVERLAY
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
@ -438,8 +443,8 @@ void input_poll(void)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
if (driver->remote)
|
||||
rarch_remote_poll(driver->remote);
|
||||
if (input_driver_remote)
|
||||
rarch_remote_poll(input_driver_remote);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -640,7 +645,6 @@ bool input_driver_data_ptr_is_same(void *data)
|
||||
#ifdef HAVE_COMMAND
|
||||
static void input_driver_command_init(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings->stdin_cmd_enable && !settings->network_cmd_enable)
|
||||
@ -659,6 +663,20 @@ static void input_driver_command_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
static void input_driver_remote_init(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings->network_remote_enable)
|
||||
{
|
||||
if (!(input_driver_remote = rarch_remote_new(settings->network_remote_base_port)))
|
||||
RARCH_ERR("Failed to initialize remote gamepad interface.\n");
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -784,6 +802,18 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
if (input_driver_command)
|
||||
rarch_cmd_free(input_driver_command);
|
||||
input_driver_command = NULL;
|
||||
#endif
|
||||
break;
|
||||
case RARCH_INPUT_CTL_REMOTE_DEINIT:
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
if (input_driver_remote)
|
||||
rarch_remote_free(input_driver_remote);
|
||||
input_driver_remote = NULL;
|
||||
#endif
|
||||
break;
|
||||
case RARCH_INPUT_CTL_REMOTE_INIT:
|
||||
#ifdef HAVE_NETWORK_GAMEPAD
|
||||
input_driver_remote_init();
|
||||
#endif
|
||||
break;
|
||||
case RARCH_INPUT_CTL_NONE:
|
||||
|
@ -76,7 +76,9 @@ enum rarch_input_ctl_state
|
||||
RARCH_INPUT_CTL_UNSET_KEYBOARD_LINEFEED_ENABLED,
|
||||
RARCH_INPUT_CTL_IS_KEYBOARD_LINEFEED_ENABLED,
|
||||
RARCH_INPUT_CTL_COMMAND_INIT,
|
||||
RARCH_INPUT_CTL_COMMAND_DEINIT
|
||||
RARCH_INPUT_CTL_COMMAND_DEINIT,
|
||||
RARCH_INPUT_CTL_REMOTE_INIT,
|
||||
RARCH_INPUT_CTL_REMOTE_DEINIT
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
|
Loading…
x
Reference in New Issue
Block a user