This commit is contained in:
twinaphex 2019-06-16 17:05:06 +02:00
parent db87e050d5
commit 5b6ba1acf9

View File

@ -602,18 +602,16 @@ static bool bsv_movie_init_handle(const char *path,
bool bsv_movie_init(void) bool bsv_movie_init(void)
{ {
bool set_granularity = false; bool set_granularity = false;
bool ret = true;
if (bsv_movie_state.movie_start_playback) if (bsv_movie_state.movie_start_playback)
{ {
ret = bsv_movie_init_handle(bsv_movie_state.movie_start_path, if (!bsv_movie_init_handle(bsv_movie_state.movie_start_path,
RARCH_MOVIE_PLAYBACK); RARCH_MOVIE_PLAYBACK))
if (!ret)
{ {
RARCH_ERR("%s: \"%s\".\n", RARCH_ERR("%s: \"%s\".\n",
msg_hash_to_str(MSG_FAILED_TO_LOAD_MOVIE_FILE), msg_hash_to_str(MSG_FAILED_TO_LOAD_MOVIE_FILE),
bsv_movie_state.movie_start_path); bsv_movie_state.movie_start_path);
retroarch_fail(1, "event_init_movie()"); return false;
} }
bsv_movie_state.movie_playback = true; bsv_movie_state.movie_playback = true;
@ -626,15 +624,8 @@ bool bsv_movie_init(void)
} }
else if (bsv_movie_state.movie_start_recording) else if (bsv_movie_state.movie_start_recording)
{ {
char msg[8192]; if (!bsv_movie_init_handle(bsv_movie_state.movie_start_path,
snprintf(msg, sizeof(msg), RARCH_MOVIE_RECORD))
"%s \"%s\".",
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
bsv_movie_state.movie_start_path);
ret = bsv_movie_init_handle(bsv_movie_state.movie_start_path,
RARCH_MOVIE_RECORD);
if (!ret)
{ {
runloop_msg_queue_push( runloop_msg_queue_push(
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD), msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD),
@ -642,13 +633,21 @@ bool bsv_movie_init(void)
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_ERR("%s.\n", RARCH_ERR("%s.\n",
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD)); msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD));
return ret; return false;
} }
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); {
RARCH_LOG("%s \"%s\".\n", char msg[8192];
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO), snprintf(msg, sizeof(msg),
bsv_movie_state.movie_start_path); "%s \"%s\".",
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
bsv_movie_state.movie_start_path);
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s \"%s\".\n",
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
bsv_movie_state.movie_start_path);
}
set_granularity = true; set_granularity = true;
} }
@ -660,7 +659,7 @@ bool bsv_movie_init(void)
settings->uints.rewind_granularity, 1); settings->uints.rewind_granularity, 1);
} }
return ret; return true;
} }
bool bsv_movie_get_input(int16_t *bsv_data) bool bsv_movie_get_input(int16_t *bsv_data)
@ -747,38 +746,6 @@ void bsv_movie_deinit(void)
bsv_movie_state_handle = NULL; bsv_movie_state_handle = NULL;
} }
/* Checks if movie is being played back. */
static bool bsv_movie_check_movie_playback(void)
{
runloop_msg_queue_push(
msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED), 2, 180, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED));
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
bsv_movie_state.movie_end = false;
bsv_movie_state.movie_playback = false;
return true;
}
/* Checks if movie is being recorded. */
static bool runloop_check_movie_record(void)
{
if (!bsv_movie_state_handle)
return false;
runloop_msg_queue_push(
msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED), 2, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED));
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
return true;
}
static bool runloop_check_movie_init(void) static bool runloop_check_movie_init(void)
{ {
char msg[16384], path[8192]; char msg[16384], path[8192];
@ -831,12 +798,34 @@ bool bsv_movie_check(void)
if (bsv_movie_state.movie_playback) if (bsv_movie_state.movie_playback)
{ {
/* Checks if movie is being played back. */
if (!bsv_movie_state.movie_end) if (!bsv_movie_state.movie_end)
return false; return false;
return bsv_movie_check_movie_playback(); runloop_msg_queue_push(
msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED), 2, 180, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED));
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
bsv_movie_state.movie_end = false;
bsv_movie_state.movie_playback = false;
return true;
} }
return runloop_check_movie_record(); /* Checks if movie is being recorded. */
if (!bsv_movie_state_handle)
return false;
runloop_msg_queue_push(
msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED), 2, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED));
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
return true;
} }
/** /**