From 9f4439958b1f32a180fbe6c0004d2af3e084fd6d Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Fri, 24 Feb 2023 23:08:44 +0100 Subject: [PATCH] Turn function static --- command.c | 61 ++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/command.c b/command.c index 0448d7ea94..4825327521 100644 --- a/command.c +++ b/command.c @@ -68,8 +68,6 @@ #define CMD_BUF_SIZE 4096 -void command_post_state_loaded(void); - #if defined(HAVE_COMMAND) /* Generic command parse utilities */ @@ -645,8 +643,32 @@ bool command_show_osd_msg(command_t *cmd, const char* arg) return true; } +static void command_post_state_loaded(void) +{ +#ifdef HAVE_CHEEVOS + if (rcheevos_hardcore_active()) + { + rcheevos_pause_hardcore(); + runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED), 0, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); + } +#endif +#ifdef HAVE_NETWORKING + netplay_driver_ctl(RARCH_NETPLAY_CTL_LOAD_SAVESTATE, NULL); +#endif + { + settings_t *settings = config_get_ptr(); + video_driver_state_t *video_st = + video_state_get_ptr(); + bool frame_time_counter_reset_after_load_state = + settings->bools.frame_time_counter_reset_after_load_state; + if (frame_time_counter_reset_after_load_state) + video_st->frame_time_count = 0; + } +} + bool command_load_state_slot(command_t *cmd, const char *arg) { + char state_path[16384]; retro_ctx_size_info_t info; char reply[128] = ""; runloop_state_t *runloop_st = runloop_state_get_ptr(); @@ -656,7 +678,6 @@ bool command_load_state_slot(command_t *cmd, const char *arg) char *reply_at = reply + snprintf(reply, sizeof(reply) - 1, "LOAD_STATE_SLOT %d", slot); bool savestates_enabled = core_info_current_supports_savestate(); bool ret = false; - char state_path[16384]; state_path[0] = '\0'; if (savestates_enabled) { @@ -668,8 +689,7 @@ bool command_load_state_slot(command_t *cmd, const char *arg) } if (savestates_enabled) { - ret = content_load_state(state_path, false, false); - if(ret) + if ((ret = content_load_state(state_path, false, false))) command_post_state_loaded(); } else @@ -786,7 +806,7 @@ static const rarch_memory_descriptor_t* command_memory_get_descriptor(const rarc { const unsigned tmp = (mask - 1) & ~mask; desc_offset = (desc_offset & tmp) | ((desc_offset >> 1) & ~tmp); - mask = (mask & (mask - 1)) >> 1; + mask = (mask & (mask - 1)) >> 1; } /* we've calculated the actual offset of the data within the descriptor */ @@ -892,9 +912,9 @@ bool command_read_memory(command_t *cmd, const char *arg) reply = (char*)malloc(alloc_size); reply_at = reply + snprintf(reply, alloc_size - 1, "READ_CORE_MEMORY %x", address); - data = command_memory_get_pointer(system, address, &max_bytes, 0, reply_at, alloc_size - strlen(reply)); - - if (data) + if ((data = command_memory_get_pointer( + system, address, &max_bytes, + 0, reply_at, alloc_size - strlen(reply)))) { if (nbytes > max_bytes) nbytes = max_bytes; @@ -1703,29 +1723,6 @@ void command_event_remove_current_config(enum override_type type) } #endif -void command_post_state_loaded(void) -{ -#ifdef HAVE_CHEEVOS - if (rcheevos_hardcore_active()) - { - rcheevos_pause_hardcore(); - runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED), 0, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - } -#endif -#ifdef HAVE_NETWORKING - netplay_driver_ctl(RARCH_NETPLAY_CTL_LOAD_SAVESTATE, NULL); -#endif - { - settings_t *settings = config_get_ptr(); - video_driver_state_t *video_st = - video_state_get_ptr(); - bool frame_time_counter_reset_after_load_state = - settings->bools.frame_time_counter_reset_after_load_state; - if (frame_time_counter_reset_after_load_state) - video_st->frame_time_count = 0; - } -} - bool command_event_main_state(unsigned cmd) { retro_ctx_size_info_t info;