mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
Rename rarch_cmd to command
This commit is contained in:
parent
1e87fed448
commit
3c74031c2f
30
command.c
30
command.c
@ -46,7 +46,7 @@
|
|||||||
#define COMMAND_EXT_SLANG 0x105ce63aU
|
#define COMMAND_EXT_SLANG 0x105ce63aU
|
||||||
#define COMMAND_EXT_SLANGP 0x1bf9adeaU
|
#define COMMAND_EXT_SLANGP 0x1bf9adeaU
|
||||||
|
|
||||||
struct rarch_cmd
|
struct command
|
||||||
{
|
{
|
||||||
#ifdef HAVE_STDIN_CMD
|
#ifdef HAVE_STDIN_CMD
|
||||||
bool stdin_enable;
|
bool stdin_enable;
|
||||||
@ -121,7 +121,7 @@ static const struct cmd_map map[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||||
static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
static bool cmd_init_network(command_t *handle, uint16_t port)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct addrinfo *res = NULL;
|
struct addrinfo *res = NULL;
|
||||||
@ -156,7 +156,7 @@ error:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STDIN_CMD
|
#ifdef HAVE_STDIN_CMD
|
||||||
static bool cmd_init_stdin(rarch_cmd_t *handle)
|
static bool cmd_init_stdin(command_t *handle)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#ifdef HAVE_NETPLAY
|
#ifdef HAVE_NETPLAY
|
||||||
@ -170,10 +170,10 @@ static bool cmd_init_stdin(rarch_cmd_t *handle)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rarch_cmd_t *rarch_cmd_new(bool stdin_enable,
|
command_t *command_new(bool stdin_enable,
|
||||||
bool network_enable, uint16_t port)
|
bool network_enable, uint16_t port)
|
||||||
{
|
{
|
||||||
rarch_cmd_t *handle = (rarch_cmd_t*)calloc(1, sizeof(*handle));
|
command_t *handle = (command_t*)calloc(1, sizeof(*handle));
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ rarch_cmd_t *rarch_cmd_new(bool stdin_enable,
|
|||||||
|
|
||||||
#if (defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)) || defined(HAVE_STDIN_CMD)
|
#if (defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)) || defined(HAVE_STDIN_CMD)
|
||||||
error:
|
error:
|
||||||
rarch_cmd_free(handle);
|
command_free(handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ static bool command_get_arg(const char *tok,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_sub_msg(rarch_cmd_t *handle, const char *tok)
|
static void parse_sub_msg(command_t *handle, const char *tok)
|
||||||
{
|
{
|
||||||
const char *arg = NULL;
|
const char *arg = NULL;
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
@ -299,7 +299,7 @@ static void parse_sub_msg(rarch_cmd_t *handle, const char *tok)
|
|||||||
msg_hash_to_str(MSG_RECEIVED));
|
msg_hash_to_str(MSG_RECEIVED));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_msg(rarch_cmd_t *handle, char *buf)
|
static void parse_msg(command_t *handle, char *buf)
|
||||||
{
|
{
|
||||||
char *save = NULL;
|
char *save = NULL;
|
||||||
const char *tok = strtok_r(buf, "\n", &save);
|
const char *tok = strtok_r(buf, "\n", &save);
|
||||||
@ -312,7 +312,7 @@ static void parse_msg(rarch_cmd_t *handle, char *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||||
static void network_cmd_poll(rarch_cmd_t *handle)
|
static void network_cmd_poll(command_t *handle)
|
||||||
{
|
{
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
struct timeval tmp_tv = {0};
|
struct timeval tmp_tv = {0};
|
||||||
@ -451,7 +451,7 @@ static size_t read_stdin(char *buf, size_t size)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void stdin_cmd_poll(rarch_cmd_t *handle)
|
static void stdin_cmd_poll(command_t *handle)
|
||||||
{
|
{
|
||||||
char *last_newline;
|
char *last_newline;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
@ -564,7 +564,7 @@ static bool verify_command(const char *cmd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rarch_cmd_send(const char *cmd_)
|
bool command_send(const char *cmd_)
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
char *command = NULL;
|
char *command = NULL;
|
||||||
@ -609,7 +609,7 @@ bool rarch_cmd_send(const char *cmd_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool rarch_cmd_poll(rarch_cmd_t *handle)
|
bool command_poll(command_t *handle)
|
||||||
{
|
{
|
||||||
memset(handle->state, 0, sizeof(handle->state));
|
memset(handle->state, 0, sizeof(handle->state));
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ bool rarch_cmd_poll(rarch_cmd_t *handle)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rarch_cmd_set(rarch_cmd_handle_t *handle)
|
bool command_set(command_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (!handle || !handle->handle)
|
if (!handle || !handle->handle)
|
||||||
return false;
|
return false;
|
||||||
@ -633,7 +633,7 @@ bool rarch_cmd_set(rarch_cmd_handle_t *handle)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rarch_cmd_free(rarch_cmd_t *handle)
|
bool command_free(command_t *handle)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||||
if (handle && handle->net_fd >= 0)
|
if (handle && handle->net_fd >= 0)
|
||||||
@ -645,7 +645,7 @@ bool rarch_cmd_free(rarch_cmd_t *handle)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rarch_cmd_get(rarch_cmd_handle_t *handle)
|
bool command_get(command_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (!handle || !handle->handle)
|
if (!handle || !handle->handle)
|
||||||
return false;
|
return false;
|
||||||
|
20
command.h
20
command.h
@ -28,28 +28,28 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct rarch_cmd rarch_cmd_t;
|
typedef struct command command_t;
|
||||||
|
|
||||||
typedef struct rarch_cmd_handle
|
typedef struct command_handle
|
||||||
{
|
{
|
||||||
rarch_cmd_t *handle;
|
command_t *handle;
|
||||||
unsigned id;
|
unsigned id;
|
||||||
} rarch_cmd_handle_t;
|
} command_handle_t;
|
||||||
|
|
||||||
rarch_cmd_t *rarch_cmd_new(bool stdin_enable,
|
command_t *command_new(bool stdin_enable,
|
||||||
bool network_enable, uint16_t port);
|
bool network_enable, uint16_t port);
|
||||||
|
|
||||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||||
bool rarch_cmd_send(const char *cmd_);
|
bool command_send(const char *cmd_);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool rarch_cmd_poll(rarch_cmd_t *handle);
|
bool command_poll(command_t *handle);
|
||||||
|
|
||||||
bool rarch_cmd_set(rarch_cmd_handle_t *handle);
|
bool command_set(command_handle_t *handle);
|
||||||
|
|
||||||
bool rarch_cmd_get(rarch_cmd_handle_t *handle);
|
bool command_get(command_handle_t *handle);
|
||||||
|
|
||||||
bool rarch_cmd_free(rarch_cmd_t *handle);
|
bool command_free(command_t *handle);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ struct turbo_buttons
|
|||||||
|
|
||||||
static turbo_buttons_t input_driver_turbo_btns;
|
static turbo_buttons_t input_driver_turbo_btns;
|
||||||
#ifdef HAVE_COMMAND
|
#ifdef HAVE_COMMAND
|
||||||
static rarch_cmd_t *input_driver_command = NULL;
|
static command_t *input_driver_command = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_NETWORK_GAMEPAD
|
#ifdef HAVE_NETWORK_GAMEPAD
|
||||||
static input_remote_t *input_driver_remote = NULL;
|
static input_remote_t *input_driver_remote = NULL;
|
||||||
@ -275,12 +275,12 @@ static retro_input_t input_driver_keys_pressed(void)
|
|||||||
#ifdef HAVE_COMMAND
|
#ifdef HAVE_COMMAND
|
||||||
if (input_driver_command)
|
if (input_driver_command)
|
||||||
{
|
{
|
||||||
rarch_cmd_handle_t handle;
|
command_handle_t handle;
|
||||||
|
|
||||||
handle.handle = input_driver_command;
|
handle.handle = input_driver_command;
|
||||||
handle.id = key;
|
handle.id = key;
|
||||||
|
|
||||||
state |= rarch_cmd_get(&handle);
|
state |= command_get(&handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ void input_poll(void)
|
|||||||
|
|
||||||
#ifdef HAVE_COMMAND
|
#ifdef HAVE_COMMAND
|
||||||
if (input_driver_command)
|
if (input_driver_command)
|
||||||
rarch_cmd_poll(input_driver_command);
|
command_poll(input_driver_command);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NETWORK_GAMEPAD
|
#ifdef HAVE_NETWORK_GAMEPAD
|
||||||
@ -849,7 +849,7 @@ bool input_driver_init_command(void)
|
|||||||
"Cannot use this command interface.\n");
|
"Cannot use this command interface.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
input_driver_command = rarch_cmd_new(settings->stdin_cmd_enable
|
input_driver_command = command_new(settings->stdin_cmd_enable
|
||||||
&& !input_driver_grab_stdin(),
|
&& !input_driver_grab_stdin(),
|
||||||
settings->network_cmd_enable, settings->network_cmd_port);
|
settings->network_cmd_enable, settings->network_cmd_port);
|
||||||
|
|
||||||
@ -869,7 +869,7 @@ void input_driver_deinit_command(void)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_COMMAND
|
#ifdef HAVE_COMMAND
|
||||||
if (input_driver_command)
|
if (input_driver_command)
|
||||||
rarch_cmd_free(input_driver_command);
|
command_free(input_driver_command);
|
||||||
input_driver_command = NULL;
|
input_driver_command = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -952,7 +952,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
|||||||
|
|
||||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||||
case RA_OPT_COMMAND:
|
case RA_OPT_COMMAND:
|
||||||
if (rarch_cmd_send((const char*)optarg))
|
if (command_send((const char*)optarg))
|
||||||
exit(0);
|
exit(0);
|
||||||
else
|
else
|
||||||
retroarch_fail(1, "network_cmd_send()");
|
retroarch_fail(1, "network_cmd_send()");
|
||||||
|
Loading…
Reference in New Issue
Block a user