Refactor away runloop_msg_queue_push_new

This commit is contained in:
twinaphex 2016-01-29 14:30:09 +01:00
parent 912b62dca9
commit b47caeb58b
9 changed files with 33 additions and 41 deletions

View File

@ -677,7 +677,7 @@ static bool event_save_core_config(void)
sizeof(config_dir));
else
{
runloop_msg_queue_push_new(MSG_CONFIG_DIRECTORY_NOT_SET, 1, 180, true);
runloop_msg_queue_push(msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET), 1, 180, true);
RARCH_ERR("%s\n", msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET));
return false;
}
@ -1047,7 +1047,7 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
break;
case EVENT_CMD_RESET:
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_RESET));
runloop_msg_queue_push_new(MSG_RESET, 1, 120, true);
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true);
#ifdef HAVE_CHEEVOS
cheevos_set_cheats();
@ -1571,8 +1571,8 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
}
}
else
runloop_msg_queue_push_new(
MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS,
runloop_msg_queue_push(
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS),
1, 120, true);
break;
case EVENT_CMD_DISK_NEXT:
@ -1591,8 +1591,8 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
event_check_disk_next(control);
}
else
runloop_msg_queue_push_new(
MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS,
runloop_msg_queue_push(
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS),
1, 120, true);
break;
case EVENT_CMD_DISK_PREV:
@ -1611,8 +1611,8 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
event_check_disk_prev(control);
}
else
runloop_msg_queue_push_new(
MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS,
runloop_msg_queue_push(
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS),
1, 120, true);
break;
case EVENT_CMD_RUMBLE_STOP:

View File

@ -267,8 +267,9 @@ static bool driver_update_system_av_info(const struct retro_system_av_info *info
* Take the easiest route out and just restart the recording. */
if (recording_driver_get_data_ptr())
{
runloop_msg_queue_push_new(
MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, 2, 180, false);
runloop_msg_queue_push(
msg_hash_to_str(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT),
2, 180, false);
event_cmd_ctl(EVENT_CMD_RECORD_DEINIT, NULL);
event_cmd_ctl(EVENT_CMD_RECORD_INIT, NULL);
}

View File

@ -327,7 +327,7 @@ static void bsv_movie_init_state(void)
}
bsv_movie_state.movie_playback = true;
runloop_msg_queue_push_new(MSG_STARTING_MOVIE_PLAYBACK, 2, 180, false);
runloop_msg_queue_push(msg_hash_to_str(MSG_STARTING_MOVIE_PLAYBACK), 2, 180, false);
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_STARTING_MOVIE_PLAYBACK));
settings->rewind_granularity = 1;
}
@ -342,7 +342,7 @@ static void bsv_movie_init_state(void)
if (!(bsv_movie_init_handle(bsv_movie_state.movie_start_path,
RARCH_MOVIE_RECORD)))
{
runloop_msg_queue_push_new(MSG_FAILED_TO_START_MOVIE_RECORD, 1, 180, true);
runloop_msg_queue_push(msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD), 1, 180, true);
RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD));
return;
}

View File

@ -1140,8 +1140,8 @@ bool init_netplay(void)
global->netplay.is_client = false;
RARCH_WARN("%s\n", msg_hash_to_str(MSG_NETPLAY_FAILED));
runloop_msg_queue_push_new(
MSG_NETPLAY_FAILED,
runloop_msg_queue_push(
msg_hash_to_str(MSG_NETPLAY_FAILED),
0, 180, false);
return false;
}

View File

@ -202,7 +202,9 @@ void recording_dump_frame(const void *data, unsigned width,
{
RARCH_WARN("%s\n", msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE));
runloop_msg_queue_push_new(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, 1, 180, true);
runloop_msg_queue_push(
msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE),
1, 180, true);
event_cmd_ctl(EVENT_CMD_RECORD_DEINIT, NULL);
return;
}

View File

@ -719,7 +719,8 @@ void state_manager_check_rewind(bool pressed)
state_manager_set_frame_is_reversed(true);
audio_driver_ctl(RARCH_AUDIO_CTL_SETUP_REWIND, NULL);
runloop_msg_queue_push_new(MSG_REWINDING, 0,
runloop_msg_queue_push(
msg_hash_to_str(MSG_REWINDING), 0,
runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL)
? 1 : 30, true);
@ -732,7 +733,8 @@ void state_manager_check_rewind(bool pressed)
bsv_movie_ctl(BSV_MOVIE_CTL_FRAME_REWIND, NULL);
}
else
runloop_msg_queue_push_new(MSG_REWIND_REACHED_END,
runloop_msg_queue_push(
msg_hash_to_str(MSG_REWIND_REACHED_END),
0, 30, true);
}
else

View File

@ -114,18 +114,6 @@ const char *runloop_msg_queue_pull(void)
return ret;
}
void runloop_msg_queue_push_new(uint32_t hash,
unsigned prio, unsigned duration,
bool flush)
{
const char *msg = msg_hash_to_str(hash);
if (!msg)
return;
runloop_msg_queue_push(msg, prio, duration, flush);
}
void runloop_msg_queue_push(const char *msg,
unsigned prio, unsigned duration,
bool flush)
@ -801,9 +789,9 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
video_driver_ctl(RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER, NULL);
if (state_manager_frame_is_reversed())
runloop_msg_queue_push_new(MSG_SLOW_MOTION_REWIND, 0, 30, true);
runloop_msg_queue_push(msg_hash_to_str(MSG_SLOW_MOTION_REWIND), 0, 30, true);
else
runloop_msg_queue_push_new(MSG_SLOW_MOTION, 0, 30, true);
runloop_msg_queue_push(msg_hash_to_str(MSG_SLOW_MOTION), 0, 30, true);
}
break;
case RUNLOOP_CTL_CHECK_MOVIE:
@ -816,8 +804,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
if (!bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
return false;
runloop_msg_queue_push_new(
MSG_MOVIE_RECORD_STOPPED, 2, 180, true);
runloop_msg_queue_push(
msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED), 2, 180, true);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED));
event_cmd_ctl(EVENT_CMD_BSV_MOVIE_DEINIT, NULL);
@ -856,8 +844,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
}
else
{
runloop_msg_queue_push_new(
MSG_FAILED_TO_START_MOVIE_RECORD,
runloop_msg_queue_push(
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD),
1, 180, true);
RARCH_ERR("%s\n",
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD));
@ -868,8 +856,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
if (!bsv_movie_ctl(BSV_MOVIE_CTL_END, NULL))
return false;
runloop_msg_queue_push_new(
MSG_MOVIE_PLAYBACK_ENDED, 1, 180, false);
runloop_msg_queue_push(
msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED), 1, 180, false);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED));
event_cmd_ctl(EVENT_CMD_BSV_MOVIE_DEINIT, NULL);

View File

@ -299,9 +299,6 @@ int runloop_iterate(unsigned *sleep_ms);
void runloop_msg_queue_push(const char *msg, unsigned prio,
unsigned duration, bool flush);
void runloop_msg_queue_push_new(uint32_t hash, unsigned prio,
unsigned duration, bool flush);
const char *runloop_msg_queue_pull(void);
bool runloop_ctl(enum runloop_ctl_state state, void *data);

View File

@ -534,7 +534,9 @@ static void rarch_dbscan_task_handler(rarch_task_t *task)
}
else
{
runloop_msg_queue_push_new(MSG_SCANNING_OF_DIRECTORY_FINISHED, 0, 180, true);
runloop_msg_queue_push(
msg_hash_to_str(MSG_SCANNING_OF_DIRECTORY_FINISHED),
0, 180, true);
goto task_finished;
}
break;