mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Cleanups/silence warnings
This commit is contained in:
parent
295e39300c
commit
0ba8597041
94
command.c
94
command.c
@ -117,12 +117,14 @@ struct cmd_map
|
||||
unsigned id;
|
||||
};
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
struct cmd_action_map
|
||||
{
|
||||
const char *str;
|
||||
bool (*action)(const char *arg);
|
||||
const char *arg_desc;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct command
|
||||
{
|
||||
@ -137,9 +139,48 @@ struct command
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool command_version(const char *arg);
|
||||
#if defined(HAVE_COMMAND)
|
||||
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||
static enum cmd_source_t lastcmd_source;
|
||||
static int lastcmd_net_fd;
|
||||
static struct sockaddr_storage lastcmd_net_source;
|
||||
static socklen_t lastcmd_net_source_len;
|
||||
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
static void command_reply(const char * data, size_t len)
|
||||
{
|
||||
switch (lastcmd_source)
|
||||
{
|
||||
case CMD_STDIN:
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
fwrite(data, 1,len, stdout);
|
||||
#endif
|
||||
break;
|
||||
case CMD_NETWORK:
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
sendto(lastcmd_net_fd, data, len, 0,
|
||||
(struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len);
|
||||
#endif
|
||||
break;
|
||||
case CMD_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
static bool command_version(const char* arg)
|
||||
{
|
||||
char reply[256] = {0};
|
||||
|
||||
sprintf(reply, "%s\n", PACKAGE_VERSION);
|
||||
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||
command_reply(reply, strlen(reply));
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(HAVE_CHEEVOS)
|
||||
static bool command_read_ram(const char *arg);
|
||||
static bool command_write_ram(const char *arg);
|
||||
#endif
|
||||
@ -147,7 +188,7 @@ static bool command_write_ram(const char *arg);
|
||||
static const struct cmd_action_map action_map[] = {
|
||||
{ "SET_SHADER", command_set_shader, "<shader path>" },
|
||||
{ "VERSION", command_version, "No argument"},
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
#if defined(HAVE_CHEEVOS)
|
||||
{ "READ_CORE_RAM", command_read_ram, "<address> <number of bytes>" },
|
||||
{ "WRITE_CORE_RAM", command_write_ram, "<address> <byte1> <byte2> ..." },
|
||||
#endif
|
||||
@ -198,41 +239,9 @@ static const struct cmd_map map[] = {
|
||||
{ "MENU_B", RETRO_DEVICE_ID_JOYPAD_B },
|
||||
{ "MENU_B", RETRO_DEVICE_ID_JOYPAD_B },
|
||||
};
|
||||
|
||||
static enum cmd_source_t lastcmd_source;
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
static int lastcmd_net_fd;
|
||||
static struct sockaddr_storage lastcmd_net_source;
|
||||
static socklen_t lastcmd_net_source_len;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||
static bool command_reply(const char * data, size_t len)
|
||||
{
|
||||
switch (lastcmd_source)
|
||||
{
|
||||
case CMD_NONE:
|
||||
break;
|
||||
case CMD_STDIN:
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
fwrite(data, 1,len, stdout);
|
||||
return true;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
case CMD_NETWORK:
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
sendto(lastcmd_net_fd, data, len, 0,
|
||||
(struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len);
|
||||
return true;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool command_set_shader(const char *arg)
|
||||
{
|
||||
@ -261,17 +270,6 @@ bool command_set_shader(const char *arg)
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool command_version(const char* arg)
|
||||
{
|
||||
char reply[256] = {0};
|
||||
|
||||
sprintf(reply, "%s\n", PACKAGE_VERSION);
|
||||
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||
command_reply(reply, strlen(reply));
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
#define SMY_CMD_STR "READ_CORE_RAM"
|
||||
@ -646,7 +644,7 @@ bool command_network_new(
|
||||
|
||||
return true;
|
||||
|
||||
#if (defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)) || defined(HAVE_STDIN_CMD)
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND) || defined(HAVE_STDIN_CMD)
|
||||
error:
|
||||
command_free(handle);
|
||||
return false;
|
||||
@ -1670,7 +1668,7 @@ static bool command_event_main_state(unsigned cmd)
|
||||
{
|
||||
retro_ctx_size_info_t info;
|
||||
char msg[128];
|
||||
size_t state_path_size = 8192 * sizeof(char);
|
||||
size_t state_path_size = 16384 * sizeof(char);
|
||||
char *state_path = (char*)malloc(state_path_size);
|
||||
global_t *global = global_get_ptr();
|
||||
bool ret = false;
|
||||
|
@ -147,7 +147,9 @@ static int pending_subsystem_id = 0;
|
||||
static unsigned pending_subsystem_rom_id = 0;
|
||||
|
||||
static char pending_subsystem_ident[255];
|
||||
#if 0
|
||||
static char pending_subsystem_extensions[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
static char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS];
|
||||
|
||||
|
||||
|
@ -597,7 +597,8 @@ static void task_save_handler(retro_task_t *task)
|
||||
|
||||
if (!state->file)
|
||||
{
|
||||
state->file = intfstream_open_file(state->path, RETRO_VFS_FILE_ACCESS_WRITE,
|
||||
state->file = intfstream_open_file(
|
||||
state->path, RETRO_VFS_FILE_ACCESS_WRITE,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!state->file)
|
||||
@ -605,21 +606,15 @@ static void task_save_handler(retro_task_t *task)
|
||||
}
|
||||
|
||||
if (!state->data)
|
||||
{
|
||||
state->data = get_serialized_data(state->path, state->size) ;
|
||||
}
|
||||
state->data = get_serialized_data(state->path, state->size) ;
|
||||
|
||||
remaining = MIN(state->size - state->written, SAVE_STATE_CHUNK);
|
||||
|
||||
if ( state->data )
|
||||
{
|
||||
written = (int)intfstream_write(state->file,
|
||||
(uint8_t*)state->data + state->written, remaining);
|
||||
}
|
||||
else
|
||||
{
|
||||
written = 0 ;
|
||||
}
|
||||
written = 0;
|
||||
|
||||
state->written += written;
|
||||
|
||||
@ -627,7 +622,7 @@ static void task_save_handler(retro_task_t *task)
|
||||
|
||||
if (task_get_cancelled(task) || written != remaining)
|
||||
{
|
||||
char err[256];
|
||||
char err[8192];
|
||||
|
||||
err[0] = '\0';
|
||||
|
||||
@ -642,7 +637,9 @@ static void task_save_handler(retro_task_t *task)
|
||||
"RAM");
|
||||
}
|
||||
else
|
||||
snprintf(err, sizeof(err), "%s %s", msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO), state->path);
|
||||
snprintf(err, sizeof(err),
|
||||
"%s %s",
|
||||
msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO), state->path);
|
||||
|
||||
task_set_error(task, strdup(err));
|
||||
task_save_handler_finished(task, state);
|
||||
@ -845,30 +842,26 @@ static void task_load_handler(retro_task_t *task)
|
||||
|
||||
if (state->bytes_read == state->size)
|
||||
{
|
||||
char *msg = (char*)malloc(1024 * sizeof(char));
|
||||
size_t sizeof_msg = 8192;
|
||||
char *msg = (char*)malloc(sizeof_msg * sizeof(char));
|
||||
|
||||
msg[0] = '\0';
|
||||
msg[0] = '\0';
|
||||
|
||||
task_free_title(task);
|
||||
|
||||
if (state->autoload)
|
||||
{
|
||||
snprintf(msg,
|
||||
1024 * sizeof(char),
|
||||
snprintf(msg, sizeof_msg,
|
||||
"%s \"%s\" %s.",
|
||||
msg_hash_to_str(MSG_AUTOLOADING_SAVESTATE_FROM),
|
||||
state->path,
|
||||
msg_hash_to_str(MSG_SUCCEEDED));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state->state_slot < 0)
|
||||
strlcpy(msg, msg_hash_to_str(MSG_LOADED_STATE_FROM_SLOT_AUTO),
|
||||
1024 * sizeof(char)
|
||||
);
|
||||
sizeof_msg);
|
||||
else
|
||||
snprintf(msg,
|
||||
1024 * sizeof(char),
|
||||
snprintf(msg, sizeof_msg,
|
||||
msg_hash_to_str(MSG_LOADED_STATE_FROM_SLOT),
|
||||
state->state_slot);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user