Rewrite libretro-common task_queue, use flags
This commit is contained in:
parent
36bcbefc96
commit
f4ed638347
|
@ -2854,7 +2854,7 @@ static void rcheevos_start_session_async(retro_task_t* task)
|
|||
else if (rcheevos_locals.hardcore_active)
|
||||
runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION;
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (rcheevos_end_load_state() == 0)
|
||||
rcheevos_fetch_badges();
|
||||
|
@ -3585,7 +3585,7 @@ static void rcheevos_validate_initial_disc_handler(retro_task_t* task)
|
|||
}
|
||||
|
||||
free(new_disc_path);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
void rcheevos_change_disc(const char* new_disc_path, bool initial_disc)
|
||||
|
|
|
@ -762,7 +762,7 @@ static void rcheevos_async_retry_request(retro_task_t* task)
|
|||
task->user_data;
|
||||
|
||||
/* the timer task has done its job. let it dispose itself */
|
||||
task_set_finished(task, 1);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
/* start a new task for the HTTP call */
|
||||
rcheevos_async_begin_http_request(request);
|
||||
|
@ -801,12 +801,12 @@ static bool rcheevos_async_request_failed(rcheevos_async_io_request* request, co
|
|||
/* timer will ping again */
|
||||
case CHEEVOS_ASYNC_RICHPRESENCE:
|
||||
/* fallback to the placeholder image */
|
||||
case CHEEVOS_ASYNC_FETCH_BADGE:
|
||||
case CHEEVOS_ASYNC_FETCH_BADGE:
|
||||
return false;
|
||||
|
||||
case CHEEVOS_ASYNC_RESOLVE_HASH:
|
||||
case CHEEVOS_ASYNC_LOGIN:
|
||||
/* make a maximum of four attempts
|
||||
/* make a maximum of four attempts
|
||||
(0ms -> 250ms -> 500ms -> 1s) */
|
||||
if (request->attempt_count == 3)
|
||||
return false;
|
||||
|
@ -878,7 +878,7 @@ static void rcheevos_async_http_task_callback(
|
|||
else
|
||||
{
|
||||
/* indicate success unless handler provides error */
|
||||
buffer[0] = '\0';
|
||||
buffer[0] = '\0';
|
||||
|
||||
/* Call appropriate handler to process the response */
|
||||
/* NOTE: data->data is not null-terminated. Most handlers assume the
|
||||
|
@ -1013,7 +1013,7 @@ static void rcheevos_async_begin_request(
|
|||
rcheevos_async_begin_http_request(request);
|
||||
}
|
||||
|
||||
static bool rcheevos_async_succeeded(int result,
|
||||
static bool rcheevos_async_succeeded(int result,
|
||||
const rc_api_response_t* response, char buffer[],
|
||||
size_t buffer_size)
|
||||
{
|
||||
|
@ -1212,7 +1212,7 @@ static void rcheevos_client_copy_achievements(
|
|||
rcheevos_racheevo_t *achievement;
|
||||
rcheevos_locals_t *rcheevos_locals = get_rcheevos_locals();
|
||||
const settings_t *settings = config_get_ptr();
|
||||
|
||||
|
||||
rcheevos_locals->game.achievements = (rcheevos_racheevo_t*)
|
||||
calloc(runtime_data->game_data.num_achievements,
|
||||
sizeof(rcheevos_racheevo_t));
|
||||
|
@ -1253,13 +1253,13 @@ static void rcheevos_client_copy_achievements(
|
|||
achievement->active = RCHEEVOS_ACTIVE_SOFTCORE
|
||||
| RCHEEVOS_ACTIVE_HARDCORE;
|
||||
|
||||
for (j = 0; j <
|
||||
for (j = 0; j <
|
||||
runtime_data->hardcore_unlocks.num_achievement_ids; ++j)
|
||||
{
|
||||
if (runtime_data->hardcore_unlocks.achievement_ids[j]
|
||||
if (runtime_data->hardcore_unlocks.achievement_ids[j]
|
||||
== definition->id)
|
||||
{
|
||||
achievement->active &= ~(RCHEEVOS_ACTIVE_HARDCORE
|
||||
achievement->active &= ~(RCHEEVOS_ACTIVE_HARDCORE
|
||||
| RCHEEVOS_ACTIVE_SOFTCORE);
|
||||
break;
|
||||
}
|
||||
|
@ -1267,7 +1267,7 @@ static void rcheevos_client_copy_achievements(
|
|||
|
||||
if ((achievement->active & RCHEEVOS_ACTIVE_SOFTCORE) != 0)
|
||||
{
|
||||
for (j = 0; j <
|
||||
for (j = 0; j <
|
||||
runtime_data->non_hardcore_unlocks.num_achievement_ids;
|
||||
++j)
|
||||
{
|
||||
|
@ -1286,19 +1286,19 @@ static void rcheevos_client_copy_achievements(
|
|||
achievement->badge = strdup(definition->badge_name);
|
||||
achievement->points = definition->points;
|
||||
|
||||
/* If an achievement has been fully unlocked,
|
||||
/* If an achievement has been fully unlocked,
|
||||
* we don't need to keep the definition around
|
||||
* as it won't be reactivated. Otherwise,
|
||||
* as it won't be reactivated. Otherwise,
|
||||
* we do have to keep a copy of it. */
|
||||
if ((achievement->active & (
|
||||
RCHEEVOS_ACTIVE_HARDCORE
|
||||
RCHEEVOS_ACTIVE_HARDCORE
|
||||
| RCHEEVOS_ACTIVE_SOFTCORE)) != 0)
|
||||
achievement->memaddr = strdup(definition->definition);
|
||||
|
||||
++achievement;
|
||||
}
|
||||
|
||||
rcheevos_locals->game.achievement_count = (unsigned)(achievement
|
||||
rcheevos_locals->game.achievement_count = (unsigned)(achievement
|
||||
- rcheevos_locals->game.achievements);
|
||||
}
|
||||
|
||||
|
@ -1313,7 +1313,7 @@ static void rcheevos_client_copy_leaderboards(
|
|||
rcheevos_locals->game.leaderboards = (rcheevos_ralboard_t*)
|
||||
calloc(runtime_data->game_data.num_leaderboards,
|
||||
sizeof(rcheevos_ralboard_t));
|
||||
rcheevos_locals->game.leaderboard_count =
|
||||
rcheevos_locals->game.leaderboard_count =
|
||||
runtime_data->game_data.num_leaderboards;
|
||||
|
||||
leaderboard = rcheevos_locals->game.leaderboards;
|
||||
|
@ -1341,9 +1341,9 @@ static void rcheevos_client_initialize_runtime_rich_presence(
|
|||
{
|
||||
rcheevos_locals_t* rcheevos_locals = get_rcheevos_locals();
|
||||
|
||||
/* Just activate the rich presence script now.
|
||||
/* Just activate the rich presence script now.
|
||||
* It can't be toggled on or off,
|
||||
* so there's no reason to keep the unparsed version
|
||||
* so there's no reason to keep the unparsed version
|
||||
* around any longer than necessary, and we can avoid
|
||||
* making a copy in the process. */
|
||||
int result = rc_runtime_activate_richpresence(
|
||||
|
@ -1487,7 +1487,7 @@ static void rcheevos_async_fetch_user_unlocks_callback(
|
|||
struct rcheevos_async_io_request* request,
|
||||
http_transfer_data_t* data, char buffer[], size_t buffer_size)
|
||||
{
|
||||
rcheevos_async_initialize_runtime_data_t* runtime_data =
|
||||
rcheevos_async_initialize_runtime_data_t* runtime_data =
|
||||
(rcheevos_async_initialize_runtime_data_t*)request->callback_data;
|
||||
int result;
|
||||
|
||||
|
@ -1513,7 +1513,7 @@ static void rcheevos_async_fetch_game_data_callback(
|
|||
struct rcheevos_async_io_request* request,
|
||||
http_transfer_data_t* data, char buffer[], size_t buffer_size)
|
||||
{
|
||||
rcheevos_async_initialize_runtime_data_t* runtime_data =
|
||||
rcheevos_async_initialize_runtime_data_t* runtime_data =
|
||||
(rcheevos_async_initialize_runtime_data_t*)request->callback_data;
|
||||
|
||||
#ifdef CHEEVOS_SAVE_JSON
|
||||
|
@ -1527,7 +1527,7 @@ static void rcheevos_async_fetch_game_data_callback(
|
|||
rcheevos_locals_t* rcheevos_locals = get_rcheevos_locals();
|
||||
rcheevos_locals->game.title = strdup(
|
||||
runtime_data->game_data.title);
|
||||
rcheevos_locals->game.console_id =
|
||||
rcheevos_locals->game.console_id =
|
||||
runtime_data->game_data.console_id;
|
||||
|
||||
snprintf(rcheevos_locals->game.badge_name, sizeof(rcheevos_locals->game.badge_name),
|
||||
|
@ -1546,7 +1546,7 @@ void rcheevos_client_initialize_runtime(unsigned game_id,
|
|||
rcheevos_async_io_request* request;
|
||||
const settings_t *settings = config_get_ptr();
|
||||
const rcheevos_locals_t *rcheevos_locals = get_rcheevos_locals();
|
||||
rcheevos_async_initialize_runtime_data_t *data =
|
||||
rcheevos_async_initialize_runtime_data_t *data =
|
||||
(rcheevos_async_initialize_runtime_data_t*)
|
||||
malloc(sizeof(rcheevos_async_initialize_runtime_data_t));
|
||||
|
||||
|
@ -1728,7 +1728,7 @@ static void rcheevos_async_ping_handler(retro_task_t* task)
|
|||
"Stopping periodic rich presence update task for game %u\n", request->id);
|
||||
/* game changed; stop the recurring task - a new one will
|
||||
* be scheduled if a new game is loaded */
|
||||
task_set_finished(task, 1);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
/* request->request was destroyed
|
||||
* in rcheevos_async_http_task_callback */
|
||||
free(request);
|
||||
|
@ -1849,7 +1849,7 @@ static void rcheevos_end_fetch_badges(rcheevos_fetch_badge_state* state)
|
|||
|
||||
static void rcheevos_async_download_next_badge(void* userdata)
|
||||
{
|
||||
rcheevos_fetch_badge_data* badge_data =
|
||||
rcheevos_fetch_badge_data* badge_data =
|
||||
(rcheevos_fetch_badge_data*)userdata;
|
||||
rcheevos_fetch_next_badge(badge_data->state);
|
||||
|
||||
|
@ -1896,7 +1896,7 @@ static void rcheevos_async_write_badge(retro_task_t* task)
|
|||
badge_data->data = NULL;
|
||||
badge_data->data_len = 0;
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
rcheevos_async_fetch_badge_complete(badge_data);
|
||||
}
|
||||
|
@ -1945,7 +1945,7 @@ static bool rcheevos_client_fetch_badge(
|
|||
state->badge_directory, sizeof(badge_fullpath));
|
||||
fill_pathname_slash(badge_fullpath, sizeof(badge_fullpath));
|
||||
badge_fullname = badge_fullpath + strlen(badge_fullpath);
|
||||
badge_fullname_size = sizeof(badge_fullpath) -
|
||||
badge_fullname_size = sizeof(badge_fullpath) -
|
||||
(badge_fullname - badge_fullpath);
|
||||
|
||||
snprintf(badge_fullname,
|
||||
|
@ -1978,8 +1978,8 @@ static bool rcheevos_client_fetch_badge(
|
|||
|
||||
if (found_index == -1)
|
||||
{
|
||||
/* unexpected - but if it happens,
|
||||
* the queue is full. Pretend we found
|
||||
/* unexpected - but if it happens,
|
||||
* the queue is full. Pretend we found
|
||||
* a match to prevent an exception */
|
||||
if (request_index == -1)
|
||||
found_index = 0;
|
||||
|
@ -2018,8 +2018,8 @@ static bool rcheevos_client_fetch_badge(
|
|||
|
||||
memset(&api_params, 0, sizeof(api_params));
|
||||
api_params.image_name = badge_name;
|
||||
api_params.image_type = locked
|
||||
? RC_IMAGE_TYPE_ACHIEVEMENT_LOCKED
|
||||
api_params.image_type = locked
|
||||
? RC_IMAGE_TYPE_ACHIEVEMENT_LOCKED
|
||||
: RC_IMAGE_TYPE_ACHIEVEMENT;
|
||||
|
||||
result = rc_api_init_fetch_image_request(&request->request, &api_params);
|
||||
|
@ -2059,7 +2059,7 @@ static bool rcheevos_fetch_next_badge(rcheevos_fetch_badge_state* state)
|
|||
#ifdef HAVE_THREADS
|
||||
slock_lock(rcheevos_locals->load_info.request_lock);
|
||||
#endif
|
||||
if ( state->locked_badge_fetch_index
|
||||
if ( state->locked_badge_fetch_index
|
||||
< rcheevos_locals->game.achievement_count)
|
||||
cheevo = &rcheevos_locals->game.achievements[state->locked_badge_fetch_index++];
|
||||
else
|
||||
|
@ -2071,7 +2071,7 @@ static bool rcheevos_fetch_next_badge(rcheevos_fetch_badge_state* state)
|
|||
if (!cheevo)
|
||||
break;
|
||||
|
||||
active = (cheevo->active
|
||||
active = (cheevo->active
|
||||
& (RCHEEVOS_ACTIVE_HARDCORE | RCHEEVOS_ACTIVE_SOFTCORE));
|
||||
if (rcheevos_client_fetch_badge(cheevo->badge, active, state))
|
||||
return true;
|
||||
|
@ -2214,7 +2214,7 @@ void rcheevos_client_award_achievement(unsigned achievement_id)
|
|||
CHEEVOS_LOG(RCHEEVOS_TAG "Failed to allocate unlock request for achievement %u\n",
|
||||
achievement_id);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
const rcheevos_locals_t* rcheevos_locals = get_rcheevos_locals();
|
||||
rc_api_award_achievement_request_t api_params;
|
||||
|
@ -2231,7 +2231,7 @@ void rcheevos_client_award_achievement(unsigned achievement_id)
|
|||
&api_params);
|
||||
|
||||
rcheevos_async_begin_request(request, result,
|
||||
rcheevos_async_award_achievement_callback,
|
||||
rcheevos_async_award_achievement_callback,
|
||||
CHEEVOS_ASYNC_AWARD_ACHIEVEMENT, achievement_id,
|
||||
"Awarded achievement",
|
||||
"Error awarding achievement");
|
||||
|
@ -2269,7 +2269,7 @@ void rcheevos_client_submit_lboard_entry(unsigned leaderboard_id,
|
|||
"Failed to allocate request for lboard %u submit\n",
|
||||
leaderboard_id);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
const rcheevos_locals_t* rcheevos_locals = get_rcheevos_locals();
|
||||
rc_api_submit_lboard_entry_request_t api_params;
|
||||
|
@ -2286,7 +2286,7 @@ void rcheevos_client_submit_lboard_entry(unsigned leaderboard_id,
|
|||
&api_params);
|
||||
|
||||
rcheevos_async_begin_request(request, result,
|
||||
rcheevos_async_submit_lboard_entry_callback,
|
||||
rcheevos_async_submit_lboard_entry_callback,
|
||||
CHEEVOS_ASYNC_SUBMIT_LBOARD, leaderboard_id,
|
||||
"Submitted leaderboard",
|
||||
"Error submitting leaderboard");
|
||||
|
|
|
@ -243,6 +243,8 @@ void gfx_widgets_msg_queue_push(
|
|||
|
||||
if (task)
|
||||
{
|
||||
uint8_t flg = task_get_flags(task);
|
||||
|
||||
title = msg_widget->msg = strdup(task->title);
|
||||
msg_widget->msg_new = strdup(title);
|
||||
title_length = strlen(title);
|
||||
|
@ -250,9 +252,9 @@ void gfx_widgets_msg_queue_push(
|
|||
|
||||
if (!string_is_empty(task->error))
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_ERROR;
|
||||
if (task->cancelled)
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_CANCELLED;
|
||||
if (task->finished)
|
||||
if ((flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_FINISHED;
|
||||
msg_widget->task_progress = task->progress;
|
||||
msg_widget->task_ident = task->ident;
|
||||
|
@ -379,7 +381,7 @@ void gfx_widgets_msg_queue_push(
|
|||
msg_widget->msg_len = len;
|
||||
msg_widget->msg_transition_animation = 0;
|
||||
|
||||
if (!task->alternative_look)
|
||||
if (!((task->flags & RETRO_TASK_FLG_ALTERNATIVE_LOOK) > 0))
|
||||
{
|
||||
gfx_animation_ctx_entry_t entry;
|
||||
|
||||
|
@ -403,9 +405,9 @@ void gfx_widgets_msg_queue_push(
|
|||
|
||||
if (!string_is_empty(task->error))
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_ERROR;
|
||||
if (task->cancelled)
|
||||
if ((task->flags & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_CANCELLED;
|
||||
if (task->finished)
|
||||
if ((task->flags & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_FINISHED;
|
||||
msg_widget->task_progress = task->progress;
|
||||
}
|
||||
|
|
|
@ -93,6 +93,36 @@ typedef struct
|
|||
char *source_file;
|
||||
} decompress_task_data_t;
|
||||
|
||||
enum retro_task_flags
|
||||
{
|
||||
/**
|
||||
* If \c true, the frontend should use some alternative means
|
||||
* of displaying this task's progress or messages.
|
||||
* Not used within cores.
|
||||
*/
|
||||
RETRO_TASK_FLG_ALTERNATIVE_LOOK = (1 << 0),
|
||||
/**
|
||||
* Set to \c true by \c handler to indicate that this task has finished.
|
||||
* At this point the task queue will call \c callback and \c cleanup,
|
||||
* then deallocate the task.
|
||||
*/
|
||||
RETRO_TASK_FLG_FINISHED = (1 << 1),
|
||||
/**
|
||||
* Set to true by the task queue to signal that this task \em must end.
|
||||
* \c handler should check to see if this is set,
|
||||
* aborting or completing its work as soon as possible afterward.
|
||||
* \c callback and \c cleanup will still be called as normal.
|
||||
*
|
||||
* @see task_queue_reset
|
||||
*/
|
||||
RETRO_TASK_FLG_CANCELLED = (1 << 2),
|
||||
/**
|
||||
* If set, the task queue will not call \c progress_cb
|
||||
* and will not display any messages from this task.
|
||||
*/
|
||||
RETRO_TASK_FLG_MUTE = (1 << 3)
|
||||
};
|
||||
|
||||
/**
|
||||
* A unit of work executed by the task system,
|
||||
* spread across one or more frames.
|
||||
|
@ -245,35 +275,7 @@ struct retro_task
|
|||
enum task_type type;
|
||||
enum task_style style;
|
||||
|
||||
/**
|
||||
* If \c true, the frontend should use some alternative means
|
||||
* of displaying this task's progress or messages.
|
||||
* Not used within cores.
|
||||
*/
|
||||
bool alternative_look;
|
||||
|
||||
/**
|
||||
* Set to \c true by \c handler to indicate that this task has finished.
|
||||
* At this point the task queue will call \c callback and \c cleanup,
|
||||
* then deallocate the task.
|
||||
*/
|
||||
bool finished;
|
||||
|
||||
/**
|
||||
* Set to true by the task queue to signal that this task \em must end.
|
||||
* \c handler should check to see if this is set,
|
||||
* aborting or completing its work as soon as possible afterward.
|
||||
* \c callback and \c cleanup will still be called as normal.
|
||||
*
|
||||
* @see task_queue_reset
|
||||
*/
|
||||
bool cancelled;
|
||||
|
||||
/**
|
||||
* If set, the task queue will not call \c progress_cb
|
||||
* and will not display any messages from this task.
|
||||
*/
|
||||
bool mute;
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -405,27 +407,7 @@ void task_queue_retriever_info_free(task_retriever_info_t *list);
|
|||
*/
|
||||
void task_queue_cancel_task(void *task);
|
||||
|
||||
/**
|
||||
* Sets \c task::finished to the given value.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
*
|
||||
* @param task The task to modify.
|
||||
* Behavior is undefined if \c NULL.
|
||||
* @param finished Whether the task should be considered finished.
|
||||
* @see retro_task::finished
|
||||
*/
|
||||
void task_set_finished(retro_task_t *task, bool finished);
|
||||
|
||||
/**
|
||||
* Sets \c task::mute to the given value.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
*
|
||||
* @param task The task to modify.
|
||||
* Behavior is undefined if \c NULL.
|
||||
* @param mute Whether the task should be considered muted.
|
||||
* @see retro_task::mute
|
||||
*/
|
||||
void task_set_mute(retro_task_t *task, bool mute);
|
||||
void task_set_flags(retro_task_t *task, uint8_t flags, bool set);
|
||||
|
||||
/**
|
||||
* Sets \c task::error to the given value.
|
||||
|
@ -476,17 +458,6 @@ void task_set_title(retro_task_t *task, char *title);
|
|||
*/
|
||||
void task_set_data(retro_task_t *task, void *data);
|
||||
|
||||
/**
|
||||
* Sets \c task::cancelled to the given value.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
*
|
||||
* @param task The task to modify.
|
||||
* Behavior is undefined if \c NULL.
|
||||
* @param cancelled Whether the task should be considered cancelled.
|
||||
* @see retro_task::cancelled
|
||||
*/
|
||||
void task_set_cancelled(retro_task_t *task, bool cancelled);
|
||||
|
||||
/**
|
||||
* Frees the \c task's title, if any.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
|
@ -496,39 +467,6 @@ void task_set_cancelled(retro_task_t *task, bool cancelled);
|
|||
*/
|
||||
void task_free_title(retro_task_t *task);
|
||||
|
||||
/**
|
||||
* Returns \c task::cancelled.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
*
|
||||
* @param task The task to query.
|
||||
* Behavior is undefined if \c NULL.
|
||||
* @return The value of \c task::cancelled.
|
||||
* @see retro_task::cancelled
|
||||
*/
|
||||
bool task_get_cancelled(retro_task_t *task);
|
||||
|
||||
/**
|
||||
* Returns \c task::finished.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
*
|
||||
* @param task The task to query.
|
||||
* Behavior is undefined if \c NULL.
|
||||
* @return The value of \c task::finished.
|
||||
* @see retro_task::finished
|
||||
*/
|
||||
bool task_get_finished(retro_task_t *task);
|
||||
|
||||
/**
|
||||
* Returns \c task::mute.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
*
|
||||
* @param task The task to query.
|
||||
* Behavior is undefined if \c NULL.
|
||||
* @return The value of \c task::mute.
|
||||
* @see retro_task::mute
|
||||
*/
|
||||
bool task_get_mute(retro_task_t *task);
|
||||
|
||||
/**
|
||||
* Returns \c task::error.
|
||||
* Thread-safe if the task queue is threaded.
|
||||
|
@ -644,6 +582,8 @@ void task_queue_retrieve(task_retriever_data_t *data);
|
|||
*/
|
||||
void task_queue_check(void);
|
||||
|
||||
uint8_t task_get_flags(retro_task_t *task);
|
||||
|
||||
/**
|
||||
* Schedules a task to start running.
|
||||
* If \c task::when is 0, it will start as soon as possible.
|
||||
|
|
|
@ -98,9 +98,9 @@ static void task_queue_push_progress(retro_task_t *task)
|
|||
slock_lock(property_lock);
|
||||
#endif
|
||||
|
||||
if (task->title && !task->mute)
|
||||
if (task->title && (!((task->flags & RETRO_TASK_FLG_MUTE) > 0)))
|
||||
{
|
||||
if (task->finished)
|
||||
if ((task->flags & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
{
|
||||
if (task->error)
|
||||
task_queue_msg_push(task, 1, 60, true, "%s: %s",
|
||||
|
@ -205,7 +205,7 @@ static void retro_task_regular_push_running(retro_task_t *task)
|
|||
static void retro_task_regular_cancel(void *task)
|
||||
{
|
||||
retro_task_t *t = (retro_task_t*)task;
|
||||
t->cancelled = true;
|
||||
t->flags |= RETRO_TASK_FLG_CANCELLED;
|
||||
}
|
||||
|
||||
static void retro_task_regular_gather(void)
|
||||
|
@ -231,7 +231,7 @@ static void retro_task_regular_gather(void)
|
|||
task_queue_push_progress(task);
|
||||
}
|
||||
|
||||
if (task->finished)
|
||||
if ((task->flags & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
task_queue_put(&tasks_finished, task);
|
||||
else
|
||||
task_queue_put(&tasks_running, task);
|
||||
|
@ -251,7 +251,7 @@ static void retro_task_regular_reset(void)
|
|||
retro_task_t *task = tasks_running.front;
|
||||
|
||||
for (; task; task = task->next)
|
||||
task->cancelled = true;
|
||||
task->flags |= RETRO_TASK_FLG_CANCELLED;
|
||||
}
|
||||
|
||||
static void retro_task_regular_init(void) { }
|
||||
|
@ -391,7 +391,7 @@ static void retro_task_threaded_cancel(void *task)
|
|||
{
|
||||
if (t == task)
|
||||
{
|
||||
t->cancelled = true;
|
||||
t->flags |= RETRO_TASK_FLG_CANCELLED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ static void retro_task_threaded_reset(void)
|
|||
|
||||
slock_lock(running_lock);
|
||||
for (task = tasks_running.front; task; task = task->next)
|
||||
task->cancelled = true;
|
||||
task->flags |= RETRO_TASK_FLG_CANCELLED;
|
||||
slock_unlock(running_lock);
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ static void threaded_worker(void *userdata)
|
|||
task->handler(task);
|
||||
|
||||
slock_lock(property_lock);
|
||||
finished = task->finished;
|
||||
finished = ((task->flags & RETRO_TASK_FLG_FINISHED) > 0) ? true : false;
|
||||
slock_unlock(property_lock);
|
||||
|
||||
/* Update queue */
|
||||
|
@ -762,28 +762,6 @@ bool task_is_on_main_thread(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void task_set_finished(retro_task_t *task, bool finished)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(property_lock);
|
||||
#endif
|
||||
task->finished = finished;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(property_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void task_set_mute(retro_task_t *task, bool mute)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(property_lock);
|
||||
#endif
|
||||
task->mute = mute;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(property_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void task_set_error(retro_task_t *task, char *error)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
|
@ -828,17 +806,6 @@ void task_set_data(retro_task_t *task, void *data)
|
|||
#endif
|
||||
}
|
||||
|
||||
void task_set_cancelled(retro_task_t *task, bool cancelled)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(running_lock);
|
||||
#endif
|
||||
task->cancelled = cancelled;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(running_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void task_free_title(retro_task_t *task)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
|
@ -867,49 +834,31 @@ void* task_get_data(retro_task_t *task)
|
|||
return data;
|
||||
}
|
||||
|
||||
bool task_get_cancelled(retro_task_t *task)
|
||||
void task_set_flags(retro_task_t *task, uint8_t flags, bool set)
|
||||
{
|
||||
bool cancelled = false;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(running_lock);
|
||||
#endif
|
||||
cancelled = task->cancelled;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(running_lock);
|
||||
#endif
|
||||
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
bool task_get_finished(retro_task_t *task)
|
||||
{
|
||||
bool finished = false;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(property_lock);
|
||||
#endif
|
||||
finished = task->finished;
|
||||
if (set)
|
||||
task->flags |= (flags);
|
||||
else
|
||||
task->flags &= ~(flags);
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(property_lock);
|
||||
#endif
|
||||
|
||||
return finished;
|
||||
}
|
||||
|
||||
bool task_get_mute(retro_task_t *task)
|
||||
uint8_t task_get_flags(retro_task_t *task)
|
||||
{
|
||||
bool mute = false;
|
||||
|
||||
uint8_t _flags = 0;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(property_lock);
|
||||
#endif
|
||||
mute = task->mute;
|
||||
_flags = task->flags;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(property_lock);
|
||||
#endif
|
||||
|
||||
return mute;
|
||||
return _flags;
|
||||
}
|
||||
|
||||
char* task_get_error(retro_task_t *task)
|
||||
|
@ -969,9 +918,7 @@ retro_task_t *task_init(void)
|
|||
task->handler = NULL;
|
||||
task->callback = NULL;
|
||||
task->cleanup = NULL;
|
||||
task->finished = false;
|
||||
task->cancelled = false;
|
||||
task->mute = false;
|
||||
task->flags = 0;
|
||||
task->task_data = NULL;
|
||||
task->user_data = NULL;
|
||||
task->state = NULL;
|
||||
|
@ -983,7 +930,6 @@ retro_task_t *task_init(void)
|
|||
task->style = TASK_STYLE_NONE;
|
||||
task->ident = task_count++;
|
||||
task->frontend_userdata = NULL;
|
||||
task->alternative_look = false;
|
||||
task->next = NULL;
|
||||
task->when = 0;
|
||||
|
||||
|
|
|
@ -7318,7 +7318,7 @@ void runloop_task_msg_queue_push(
|
|||
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();
|
||||
bool widgets_active = p_dispwidget->active;
|
||||
|
||||
if (widgets_active && task->title && !task->mute)
|
||||
if (widgets_active && task->title && (!((task->flags & RETRO_TASK_FLG_MUTE) > 0)))
|
||||
{
|
||||
RUNLOOP_MSG_QUEUE_LOCK(runloop_st);
|
||||
ui_companion_driver_msg_queue_push(msg,
|
||||
|
|
|
@ -421,12 +421,13 @@ bool task_audio_mixer_load_handler(retro_task_t *task)
|
|||
{
|
||||
nbio_handle_t *nbio = (nbio_handle_t*)task->state;
|
||||
struct audio_mixer_handle *mixer = (struct audio_mixer_handle*)nbio->data;
|
||||
uint8_t flg = task_get_flags(task);
|
||||
|
||||
if (
|
||||
nbio->is_finished
|
||||
&& (mixer && !mixer->is_finished)
|
||||
&& (mixer->copy_data_over)
|
||||
&& (!task_get_cancelled(task)))
|
||||
&& (!((flg & RETRO_TASK_FLG_CANCELLED) > 0)))
|
||||
{
|
||||
nbio_buf_t *img = (nbio_buf_t*)malloc(sizeof(*img));
|
||||
|
||||
|
@ -521,7 +522,7 @@ bool task_push_audio_mixer_load_and_play(
|
|||
nbio->type = NBIO_TYPE_FLAC;
|
||||
t->callback = task_audio_mixer_handle_upload_flac_and_play;
|
||||
}
|
||||
else if (
|
||||
else if (
|
||||
string_is_equal(ext_lower, "mod") ||
|
||||
string_is_equal(ext_lower, "s3m") ||
|
||||
string_is_equal(ext_lower, "xm"))
|
||||
|
@ -648,7 +649,7 @@ bool task_push_audio_mixer_load(
|
|||
nbio->type = NBIO_TYPE_FLAC;
|
||||
t->callback = task_audio_mixer_handle_upload_flac;
|
||||
}
|
||||
else if (
|
||||
else if (
|
||||
string_is_equal(ext_lower, "mod") ||
|
||||
string_is_equal(ext_lower, "s3m") ||
|
||||
string_is_equal(ext_lower, "xm"))
|
||||
|
|
|
@ -735,7 +735,7 @@ static void input_autoconfigure_connect_handler(retro_task_t *task)
|
|||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static bool autoconfigure_connect_finder(retro_task_t *task, void *user_data)
|
||||
|
@ -889,10 +889,10 @@ bool input_autoconfigure_connect(
|
|||
|
||||
task->handler = input_autoconfigure_connect_handler;
|
||||
task->state = autoconfig_handle;
|
||||
task->mute = false;
|
||||
task->title = NULL;
|
||||
task->callback = cb_input_autoconfigure_connect;
|
||||
task->cleanup = input_autoconfigure_free;
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
|
@ -981,7 +981,7 @@ static void input_autoconfigure_disconnect_handler(retro_task_t *task)
|
|||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static bool autoconfigure_disconnect_finder(retro_task_t *task, void *user_data)
|
||||
|
|
|
@ -29,7 +29,7 @@ static void task_bluetooth_scan_handler(retro_task_t *task)
|
|||
task_set_progress(task, 100);
|
||||
task_free_title(task);
|
||||
task_set_title(task, strdup(msg_hash_to_str(MSG_BLUETOOTH_SCAN_COMPLETE)));
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
bool task_push_bluetooth_scan(retro_task_callback_t cb)
|
||||
|
|
|
@ -94,7 +94,7 @@ static void task_cloud_sync_begin_handler(void *user_data, const char *path, boo
|
|||
{
|
||||
RARCH_WARN(CSPFX "begin failed\n");
|
||||
task_set_title(task, strdup("Cloud Sync failed"));
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
slock_lock(tcs_running_lock);
|
||||
sync_state->waiting = 0;
|
||||
|
@ -1070,7 +1070,7 @@ static void task_cloud_sync_end_handler(void *user_data, const char *path, bool
|
|||
(end_time - sync_state->start_time) % (1000 * 1000),
|
||||
sync_state->uploads, sync_state->downloads);
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_cloud_sync_task_handler(retro_task_t *task)
|
||||
|
@ -1134,7 +1134,7 @@ static void task_cloud_sync_task_handler(retro_task_t *task)
|
|||
|
||||
task_finished:
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_cloud_sync_cb(retro_task_t *task, void *task_data,
|
||||
|
|
|
@ -106,7 +106,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
|
|||
state->file = NULL;
|
||||
state->output_file = NULL;
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
RARCH_LOG("[CDROM]: Dump finished.\n");
|
||||
|
||||
|
|
|
@ -185,17 +185,16 @@ static bool task_core_backup_finder(retro_task_t *task, void *user_data)
|
|||
|
||||
static void task_core_backup_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
core_backup_handle_t *backup_handle = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
backup_handle = (core_backup_handle_t*)task->state;
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (!backup_handle)
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if (!backup_handle || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (backup_handle->status)
|
||||
|
@ -522,7 +521,7 @@ static void task_core_backup_handler(retro_task_t *task)
|
|||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
free_core_backup_handle(backup_handle);
|
||||
}
|
||||
|
@ -621,11 +620,15 @@ void *task_push_core_backup(
|
|||
/* Configure task */
|
||||
task->handler = task_core_backup_handler;
|
||||
task->state = backup_handle;
|
||||
task->mute = mute;
|
||||
task->title = strdup(task_title);
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
|
||||
if (mute)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
|
||||
/* Push task */
|
||||
task_queue_push(task);
|
||||
|
||||
|
@ -666,57 +669,56 @@ static void cb_task_core_restore(
|
|||
|
||||
static void task_core_restore_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
core_backup_handle_t *backup_handle = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
if (!(backup_handle = (core_backup_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
backup_handle = (core_backup_handle_t*)task->state;
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if (!backup_handle || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (backup_handle->status)
|
||||
{
|
||||
case CORE_RESTORE_GET_CORE_CRC:
|
||||
/* If core file already exists, get its current
|
||||
* CRC value */
|
||||
if (path_is_valid(backup_handle->core_path))
|
||||
{
|
||||
/* If core file already exists, get its current
|
||||
* CRC value */
|
||||
if (path_is_valid(backup_handle->core_path))
|
||||
/* Open core file for reading */
|
||||
backup_handle->core_file = intfstream_open_file(
|
||||
backup_handle->core_path, RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!backup_handle->core_file)
|
||||
{
|
||||
/* Open core file for reading */
|
||||
backup_handle->core_file = intfstream_open_file(
|
||||
backup_handle->core_path, RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!backup_handle->core_file)
|
||||
{
|
||||
RARCH_ERR("[core restore] Failed to open core file: %s\n",
|
||||
backup_handle->core_path);
|
||||
backup_handle->status = CORE_RESTORE_END;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get CRC value */
|
||||
if (!intfstream_get_crc(backup_handle->core_file,
|
||||
&backup_handle->core_crc))
|
||||
{
|
||||
RARCH_ERR("[core restore] Failed to determine CRC of core file: %s\n",
|
||||
backup_handle->core_path);
|
||||
backup_handle->status = CORE_RESTORE_END;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Close core file */
|
||||
intfstream_close(backup_handle->core_file);
|
||||
free(backup_handle->core_file);
|
||||
backup_handle->core_file = NULL;
|
||||
RARCH_ERR("[core restore] Failed to open core file: %s\n",
|
||||
backup_handle->core_path);
|
||||
backup_handle->status = CORE_RESTORE_END;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Go to next CRC gathering phase */
|
||||
backup_handle->status = CORE_RESTORE_GET_BACKUP_CRC;
|
||||
/* Get CRC value */
|
||||
if (!intfstream_get_crc(backup_handle->core_file,
|
||||
&backup_handle->core_crc))
|
||||
{
|
||||
RARCH_ERR("[core restore] Failed to determine CRC of core file: %s\n",
|
||||
backup_handle->core_path);
|
||||
backup_handle->status = CORE_RESTORE_END;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Close core file */
|
||||
intfstream_close(backup_handle->core_file);
|
||||
free(backup_handle->core_file);
|
||||
backup_handle->core_file = NULL;
|
||||
}
|
||||
|
||||
/* Go to next CRC gathering phase */
|
||||
backup_handle->status = CORE_RESTORE_GET_BACKUP_CRC;
|
||||
break;
|
||||
case CORE_RESTORE_GET_BACKUP_CRC:
|
||||
/* Get CRC value of backup file */
|
||||
|
@ -931,7 +933,7 @@ static void task_core_restore_handler(retro_task_t *task)
|
|||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
free_core_backup_handle(backup_handle);
|
||||
}
|
||||
|
@ -1072,9 +1074,9 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
|
|||
task->handler = task_core_restore_handler;
|
||||
task->state = backup_handle;
|
||||
task->title = strdup(task_title);
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->callback = cb_task_core_restore;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
|
||||
/* If core to be restored is currently loaded, must
|
||||
* unload it before pushing the task */
|
||||
|
|
|
@ -285,15 +285,16 @@ static void free_core_updater_list_handle(
|
|||
|
||||
static void task_core_updater_get_list_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
core_updater_list_handle_t *list_handle = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
if (!(list_handle = (core_updater_list_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
list_handle = (core_updater_list_handle_t*)task->state;
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if (!list_handle || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (list_handle->status)
|
||||
|
@ -363,10 +364,16 @@ static void task_core_updater_get_list_handler(retro_task_t *task)
|
|||
/* Otherwise, check if HTTP task is still running */
|
||||
else if (!list_handle->http_task_finished)
|
||||
{
|
||||
uint8_t _flg = task_get_flags(list_handle->http_task);
|
||||
|
||||
if ((_flg & (RETRO_TASK_FLG_FINISHED)) > 0)
|
||||
list_handle->http_task_finished = true;
|
||||
else
|
||||
list_handle->http_task_finished = false;
|
||||
|
||||
/* If HTTP task is running, copy current
|
||||
* progress value to *this* task */
|
||||
if (!(list_handle->http_task_finished =
|
||||
task_get_finished(list_handle->http_task)))
|
||||
if (!list_handle->http_task_finished)
|
||||
task_set_progress(
|
||||
task, task_get_progress(list_handle->http_task));
|
||||
}
|
||||
|
@ -423,7 +430,7 @@ static void task_core_updater_get_list_handler(retro_task_t *task)
|
|||
|
||||
task_finished:
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (list_handle)
|
||||
free_core_updater_list_handle(list_handle);
|
||||
|
@ -490,10 +497,13 @@ void *task_push_get_core_updater_list(
|
|||
/* Configure task */
|
||||
task->handler = task_core_updater_get_list_handler;
|
||||
task->state = list_handle;
|
||||
task->mute = mute;
|
||||
task->title = strdup(msg_hash_to_str(MSG_FETCHING_CORE_LIST));
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
if (mute)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
/* Push task */
|
||||
task_queue_push(task);
|
||||
|
@ -682,15 +692,16 @@ static void free_core_updater_download_handle(core_updater_download_handle_t *do
|
|||
|
||||
static void task_core_updater_download_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
core_updater_download_handle_t *download_handle = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
if (!(download_handle = (core_updater_download_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
download_handle = (core_updater_download_handle_t*)task->state;
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if (!download_handle || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (download_handle->status)
|
||||
|
@ -783,7 +794,12 @@ static void task_core_updater_download_handler(retro_task_t *task)
|
|||
* by definition */
|
||||
if (download_handle->backup_task)
|
||||
{
|
||||
backup_complete = task_get_finished(download_handle->backup_task);
|
||||
uint8_t _flg = task_get_flags(download_handle->backup_task);
|
||||
|
||||
if ((_flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
backup_complete = true;
|
||||
else
|
||||
backup_complete = false;
|
||||
|
||||
/* If backup task is running, copy current
|
||||
* progress value to *this* task */
|
||||
|
@ -853,8 +869,12 @@ static void task_core_updater_download_handler(retro_task_t *task)
|
|||
/* Otherwise, check if HTTP task is still running */
|
||||
else if (!download_handle->http_task_finished)
|
||||
{
|
||||
download_handle->http_task_finished =
|
||||
task_get_finished(download_handle->http_task);
|
||||
uint8_t _flg = task_get_flags(download_handle->http_task);
|
||||
|
||||
if ((_flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
download_handle->http_task_finished = true;
|
||||
else
|
||||
download_handle->http_task_finished = false;
|
||||
|
||||
/* If HTTP task is running, copy current
|
||||
* progress value to *this* task */
|
||||
|
@ -907,8 +927,12 @@ static void task_core_updater_download_handler(retro_task_t *task)
|
|||
if (download_handle->decompress_task &&
|
||||
!download_handle->decompress_task_finished)
|
||||
{
|
||||
download_handle->decompress_task_finished =
|
||||
task_get_finished(download_handle->decompress_task);
|
||||
uint8_t _flg = task_get_flags(download_handle->decompress_task);
|
||||
|
||||
if ((_flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
download_handle->decompress_task_finished = true;
|
||||
else
|
||||
download_handle->decompress_task_finished = false;
|
||||
|
||||
/* If decompression task is running, copy
|
||||
* current progress value to *this* task */
|
||||
|
@ -981,7 +1005,7 @@ static void task_core_updater_download_handler(retro_task_t *task)
|
|||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (download_handle)
|
||||
free_core_updater_download_handle(download_handle);
|
||||
|
@ -1117,11 +1141,14 @@ void *task_push_core_updater_download(
|
|||
|
||||
task->handler = task_core_updater_download_handler;
|
||||
task->state = download_handle;
|
||||
task->mute = mute;
|
||||
task->title = strdup(task_title);
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->callback = cb_task_core_updater_download;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
if (mute)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
/* Push task */
|
||||
task_queue_push(task);
|
||||
|
@ -1165,17 +1192,16 @@ static void free_update_installed_cores_handle(
|
|||
|
||||
static void task_update_installed_cores_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
update_installed_cores_handle_t *update_installed_handle = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
update_installed_handle = (update_installed_cores_handle_t*)task->state;
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (!update_installed_handle)
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if (!update_installed_handle || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (update_installed_handle->status)
|
||||
|
@ -1204,9 +1230,15 @@ static void task_update_installed_cores_handler(retro_task_t *task)
|
|||
* > If task is NULL, then it is finished
|
||||
* by definition */
|
||||
if (update_installed_handle->list_task)
|
||||
list_available = task_get_finished(update_installed_handle->list_task);
|
||||
{
|
||||
uint8_t _flg = task_get_flags(update_installed_handle->list_task);
|
||||
if ((_flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
list_available = true;
|
||||
else
|
||||
list_available = false;
|
||||
}
|
||||
else
|
||||
list_available = true;
|
||||
list_available = true;
|
||||
|
||||
/* If list is available, make sure it isn't empty
|
||||
* (error will message will be displayed when
|
||||
|
@ -1382,7 +1414,13 @@ static void task_update_installed_cores_handler(retro_task_t *task)
|
|||
* > If task is NULL, then it is finished
|
||||
* by definition */
|
||||
if (update_installed_handle->download_task)
|
||||
download_complete = task_get_finished(update_installed_handle->download_task);
|
||||
{
|
||||
uint8_t _flg = task_get_flags(update_installed_handle->download_task);
|
||||
if ((_flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
download_complete = true;
|
||||
else
|
||||
download_complete = false;
|
||||
}
|
||||
else
|
||||
download_complete = true;
|
||||
|
||||
|
@ -1453,7 +1491,7 @@ static void task_update_installed_cores_handler(retro_task_t *task)
|
|||
|
||||
task_finished:
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (update_installed_handle)
|
||||
free_update_installed_cores_handle(update_installed_handle);
|
||||
|
@ -1549,7 +1587,7 @@ static void task_update_single_core_handler(retro_task_t *task)
|
|||
case UPDATE_SINGLE_CORE_END:
|
||||
default:
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1633,8 +1671,8 @@ void task_push_update_installed_cores(
|
|||
task->handler = task_update_installed_cores_handler;
|
||||
task->state = update_installed_handle;
|
||||
task->title = strdup(msg_hash_to_str(MSG_FETCHING_CORE_LIST));
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
|
||||
/* Push task */
|
||||
task_queue_push(task);
|
||||
|
@ -1745,16 +1783,16 @@ static void free_play_feature_delivery_install_handle(
|
|||
static void task_play_feature_delivery_core_install_handler(
|
||||
retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
play_feature_delivery_install_handle_t *pfd_install_handle = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
if (!(pfd_install_handle =
|
||||
(play_feature_delivery_install_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
pfd_install_handle =
|
||||
(play_feature_delivery_install_handle_t*)task->state;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if (!pfd_install_handle || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (pfd_install_handle->status)
|
||||
|
@ -1886,6 +1924,7 @@ static void task_play_feature_delivery_core_install_handler(
|
|||
case PLAY_FEATURE_DELIVERY_INSTALL_END:
|
||||
{
|
||||
size_t _len;
|
||||
uint8_t _flg;
|
||||
char task_title[128];
|
||||
const char *msg_str = msg_hash_to_str(MSG_CORE_INSTALL_FAILED);
|
||||
|
||||
|
@ -1928,8 +1967,10 @@ static void task_play_feature_delivery_core_install_handler(
|
|||
/* If task is muted and install failed, set
|
||||
* error string (allows status to be checked
|
||||
* externally) */
|
||||
if (!pfd_install_handle->success &&
|
||||
task_get_mute(task))
|
||||
_flg = task_get_flags(task);
|
||||
|
||||
if ( !pfd_install_handle->success
|
||||
&& ((_flg & RETRO_TASK_FLG_MUTE) > 0))
|
||||
task_set_error(task, strdup(task_title));
|
||||
}
|
||||
/* fall-through */
|
||||
|
@ -1943,7 +1984,7 @@ static void task_play_feature_delivery_core_install_handler(
|
|||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (pfd_install_handle)
|
||||
free_play_feature_delivery_install_handle(pfd_install_handle);
|
||||
|
@ -2073,16 +2114,17 @@ static void free_play_feature_delivery_switch_cores_handle(
|
|||
static void task_play_feature_delivery_switch_cores_handler(
|
||||
retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
play_feature_delivery_switch_cores_handle_t *pfd_switch_cores_handle = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
if (!(pfd_switch_cores_handle =
|
||||
(play_feature_delivery_switch_cores_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
pfd_switch_cores_handle =
|
||||
(play_feature_delivery_switch_cores_handle_t*)task->state;
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if (!pfd_switch_cores_handle || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (pfd_switch_cores_handle->status)
|
||||
|
@ -2260,10 +2302,12 @@ static void task_play_feature_delivery_switch_cores_handler(
|
|||
* definition */
|
||||
if (pfd_switch_cores_handle->install_task)
|
||||
{
|
||||
uint8_t _flg = task_get_flags(pfd_switch_cores_handle->install_task);
|
||||
|
||||
error_msg = task_get_error(
|
||||
pfd_switch_cores_handle->install_task);
|
||||
install_complete = task_get_finished(
|
||||
pfd_switch_cores_handle->install_task);
|
||||
if ((_flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
install_complete = true;
|
||||
}
|
||||
else
|
||||
install_complete = true;
|
||||
|
@ -2321,7 +2365,7 @@ static void task_play_feature_delivery_switch_cores_handler(
|
|||
|
||||
task_finished:
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (pfd_switch_cores_handle)
|
||||
free_play_feature_delivery_switch_cores_handle(pfd_switch_cores_handle);
|
||||
|
|
|
@ -1218,6 +1218,7 @@ static void task_database_cleanup_state(
|
|||
|
||||
static void task_database_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
const char *name = NULL;
|
||||
database_info_handle_t *dbinfo = NULL;
|
||||
database_state_handle_t *dbstate = NULL;
|
||||
|
@ -1253,8 +1254,9 @@ static void task_database_handler(retro_task_t *task)
|
|||
|
||||
dbinfo = db->handle;
|
||||
dbstate = &db->state;
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (!dbinfo || task_get_cancelled(task))
|
||||
if (!dbinfo || ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
goto task_finished;
|
||||
|
||||
switch (dbinfo->status)
|
||||
|
@ -1382,7 +1384,7 @@ static void task_database_handler(retro_task_t *task)
|
|||
|
||||
task_finished:
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (dbstate)
|
||||
{
|
||||
|
@ -1415,7 +1417,7 @@ static void task_database_progress_cb(retro_task_t *task)
|
|||
{
|
||||
if (task)
|
||||
video_display_server_set_window_progress(task->progress,
|
||||
task->finished);
|
||||
((task->flags & RETRO_TASK_FLG_FINISHED) > 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1441,8 +1443,7 @@ bool task_push_dbscan(
|
|||
t->callback = cb;
|
||||
t->title = strdup(msg_hash_to_str(
|
||||
MSG_PREPARING_FOR_CONTENT_SCAN));
|
||||
t->alternative_look = true;
|
||||
|
||||
t->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
#ifdef RARCH_INTERNAL
|
||||
t->progress_cb = task_database_progress_cb;
|
||||
if (settings->bools.scan_without_core_match)
|
||||
|
|
|
@ -128,9 +128,11 @@ error:
|
|||
static void task_decompress_handler_finished(retro_task_t *task,
|
||||
decompress_state_t *dec)
|
||||
{
|
||||
task_set_finished(task, true);
|
||||
uint8_t flg;
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (!task_get_error(task) && task_get_cancelled(task))
|
||||
if (!task_get_error(task) && ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
task_set_error(task, strdup("Task canceled"));
|
||||
|
||||
if (task_get_error(task))
|
||||
|
@ -157,9 +159,9 @@ static void task_decompress_handler_finished(retro_task_t *task,
|
|||
static void task_decompress_handler(retro_task_t *task)
|
||||
{
|
||||
int ret;
|
||||
bool retdec = false;
|
||||
decompress_state_t *dec = (decompress_state_t*)
|
||||
task->state;
|
||||
uint8_t flg;
|
||||
bool retdec = false;
|
||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||
|
||||
dec->userdata->dec = dec;
|
||||
strlcpy(dec->userdata->archive_path,
|
||||
|
@ -173,7 +175,9 @@ static void task_decompress_handler(retro_task_t *task)
|
|||
task_set_progress(task,
|
||||
file_archive_parse_file_progress(&dec->archive));
|
||||
|
||||
if (task_get_cancelled(task) || ret != 0)
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (((flg & RETRO_TASK_FLG_CANCELLED) > 0) || ret != 0)
|
||||
{
|
||||
task_set_error(task, dec->callback_error);
|
||||
file_archive_parse_file_iterate_stop(&dec->archive);
|
||||
|
@ -184,10 +188,10 @@ static void task_decompress_handler(retro_task_t *task)
|
|||
|
||||
static void task_decompress_handler_target_file(retro_task_t *task)
|
||||
{
|
||||
bool retdec;
|
||||
int ret;
|
||||
decompress_state_t *dec = (decompress_state_t*)
|
||||
task->state;
|
||||
uint8_t flg;
|
||||
bool retdec;
|
||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||
|
||||
strlcpy(dec->userdata->archive_path,
|
||||
dec->source_file, sizeof(dec->userdata->archive_path));
|
||||
|
@ -199,7 +203,9 @@ static void task_decompress_handler_target_file(retro_task_t *task)
|
|||
task_set_progress(task,
|
||||
file_archive_parse_file_progress(&dec->archive));
|
||||
|
||||
if (task_get_cancelled(task) || ret != 0)
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (((flg & RETRO_TASK_FLG_CANCELLED) > 0) || ret != 0)
|
||||
{
|
||||
task_set_error(task, dec->callback_error);
|
||||
file_archive_parse_file_iterate_stop(&dec->archive);
|
||||
|
@ -211,10 +217,11 @@ static void task_decompress_handler_target_file(retro_task_t *task)
|
|||
static void task_decompress_handler_subdir(retro_task_t *task)
|
||||
{
|
||||
int ret;
|
||||
uint8_t flg;
|
||||
bool retdec;
|
||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||
|
||||
dec->userdata->dec = dec;
|
||||
dec->userdata->dec = dec;
|
||||
strlcpy(dec->userdata->archive_path,
|
||||
dec->source_file,
|
||||
sizeof(dec->userdata->archive_path));
|
||||
|
@ -227,7 +234,9 @@ static void task_decompress_handler_subdir(retro_task_t *task)
|
|||
task_set_progress(task,
|
||||
file_archive_parse_file_progress(&dec->archive));
|
||||
|
||||
if (task_get_cancelled(task) || ret != 0)
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (((flg & RETRO_TASK_FLG_CANCELLED) > 0) || ret != 0)
|
||||
{
|
||||
task_set_error(task, dec->callback_error);
|
||||
file_archive_parse_file_iterate_stop(&dec->archive);
|
||||
|
@ -350,7 +359,10 @@ void *task_push_decompress(
|
|||
tmp[++_len] = '\0';
|
||||
|
||||
t->title = strdup(tmp);
|
||||
t->mute = mute;
|
||||
if (mute)
|
||||
t->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
t->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(t);
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ static int task_file_transfer_iterate_parse(nbio_handle_t *nbio)
|
|||
|
||||
void task_file_load_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
nbio_handle_t *nbio = (nbio_handle_t*)task->state;
|
||||
|
||||
if (nbio)
|
||||
|
@ -80,12 +81,12 @@ void task_file_load_handler(retro_task_t *task)
|
|||
return;
|
||||
}
|
||||
|
||||
task_set_cancelled(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
}
|
||||
break;
|
||||
case NBIO_STATUS_TRANSFER_PARSE:
|
||||
if (!nbio || task_file_transfer_iterate_parse(nbio) == -1)
|
||||
task_set_cancelled(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
nbio->status = NBIO_STATUS_TRANSFER_FINISHED;
|
||||
break;
|
||||
case NBIO_STATUS_TRANSFER:
|
||||
|
@ -103,7 +104,7 @@ void task_file_load_handler(retro_task_t *task)
|
|||
case NBIO_TYPE_TGA:
|
||||
case NBIO_TYPE_BMP:
|
||||
if (!task_image_load_handler(task))
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
break;
|
||||
case NBIO_TYPE_MP3:
|
||||
case NBIO_TYPE_FLAC:
|
||||
|
@ -112,20 +113,22 @@ void task_file_load_handler(retro_task_t *task)
|
|||
case NBIO_TYPE_WAV:
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (!task_audio_mixer_load_handler(task))
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
#endif
|
||||
break;
|
||||
case NBIO_TYPE_NONE:
|
||||
default:
|
||||
if (nbio->is_finished)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
{
|
||||
task_set_error(task, strldup("Task canceled.", sizeof("Task canceled.")));
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,8 +143,9 @@ static void task_http_transfer_handler(retro_task_t *task)
|
|||
{
|
||||
http_transfer_data_t *data = NULL;
|
||||
http_handle_t *http = (http_handle_t*)task->state;
|
||||
uint8_t flg = task_get_flags(task);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
switch (http->status)
|
||||
|
@ -172,7 +173,7 @@ static void task_http_transfer_handler(retro_task_t *task)
|
|||
|
||||
return;
|
||||
task_finished:
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (http->handle)
|
||||
{
|
||||
|
@ -186,7 +187,7 @@ task_finished:
|
|||
if (!tmp)
|
||||
tmp = (char*)net_http_data(http->handle, &len, true);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
{
|
||||
if (tmp)
|
||||
free(tmp);
|
||||
|
@ -197,6 +198,7 @@ task_finished:
|
|||
}
|
||||
else
|
||||
{
|
||||
bool mute;
|
||||
data = (http_transfer_data_t*)malloc(sizeof(*data));
|
||||
data->data = tmp;
|
||||
data->headers = headers;
|
||||
|
@ -205,7 +207,9 @@ task_finished:
|
|||
|
||||
task_set_data(task, data);
|
||||
|
||||
if (!task->mute && net_http_error(http->handle))
|
||||
mute = ((task->flags & RETRO_TASK_FLG_MUTE) > 0);
|
||||
|
||||
if (!mute && net_http_error(http->handle))
|
||||
task_set_error(task, strldup("Download failed.",
|
||||
sizeof("Download failed.")));
|
||||
}
|
||||
|
@ -257,7 +261,8 @@ static void http_transfer_progress_cb(retro_task_t *task)
|
|||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
if (task)
|
||||
video_display_server_set_window_progress(task->progress, task->finished);
|
||||
video_display_server_set_window_progress(task->progress,
|
||||
((task->flags & RETRO_TASK_FLG_FINISHED) > 0));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -320,12 +325,15 @@ static void *task_push_http_transfer_generic(
|
|||
|
||||
t->handler = task_http_transfer_handler;
|
||||
t->state = http;
|
||||
t->mute = mute;
|
||||
t->callback = cb;
|
||||
t->progress_cb = http_transfer_progress_cb;
|
||||
t->cleanup = task_http_transfer_cleanup;
|
||||
t->user_data = user_data;
|
||||
t->progress = -1;
|
||||
if (mute)
|
||||
t->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
t->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(t);
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ static int task_image_iterate_process_transfer(struct nbio_image_handle *image)
|
|||
{
|
||||
if ((retval = task_image_process(image, &width, &height)) != IMAGE_PROCESS_NEXT)
|
||||
break;
|
||||
}while (cpu_features_get_time_usec() - start_time
|
||||
}while (cpu_features_get_time_usec() - start_time
|
||||
< image->frame_duration);
|
||||
|
||||
if (retval == IMAGE_PROCESS_NEXT)
|
||||
|
@ -279,6 +279,7 @@ static bool upscale_image(
|
|||
|
||||
bool task_image_load_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
nbio_handle_t *nbio = (nbio_handle_t*)task->state;
|
||||
struct nbio_image_handle *image = (struct nbio_image_handle*)nbio->data;
|
||||
|
||||
|
@ -303,7 +304,7 @@ bool task_image_load_handler(retro_task_t *task)
|
|||
image->status = IMAGE_STATUS_PROCESS_TRANSFER;
|
||||
break;
|
||||
case IMAGE_STATUS_TRANSFER:
|
||||
if ( !(image->flags & IMAGE_FLAG_IS_BLOCKING)
|
||||
if ( !(image->flags & IMAGE_FLAG_IS_BLOCKING)
|
||||
&& !(image->flags & IMAGE_FLAG_IS_FINISHED))
|
||||
{
|
||||
retro_time_t start_time = cpu_features_get_time_usec();
|
||||
|
@ -314,7 +315,7 @@ bool task_image_load_handler(retro_task_t *task)
|
|||
image->status = IMAGE_STATUS_TRANSFER_PARSE;
|
||||
break;
|
||||
}
|
||||
}while (cpu_features_get_time_usec() - start_time
|
||||
}while (cpu_features_get_time_usec() - start_time
|
||||
< image->frame_duration);
|
||||
}
|
||||
break;
|
||||
|
@ -330,9 +331,11 @@ bool task_image_load_handler(retro_task_t *task)
|
|||
}
|
||||
}
|
||||
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ( nbio->is_finished
|
||||
&& (image && (image->flags & IMAGE_FLAG_IS_FINISHED))
|
||||
&& (!task_get_cancelled(task)))
|
||||
&& ((!((flg & RETRO_TASK_FLG_CANCELLED) > 0))))
|
||||
{
|
||||
struct texture_image *img = (struct texture_image*)malloc(sizeof(struct texture_image));
|
||||
|
||||
|
@ -386,7 +389,7 @@ bool task_image_load_handler(retro_task_t *task)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool task_push_image_load(const char *fullpath,
|
||||
bool task_push_image_load(const char *fullpath,
|
||||
bool supports_rgba, unsigned upscale_threshold,
|
||||
retro_task_callback_t cb, void *user_data)
|
||||
{
|
||||
|
|
|
@ -188,6 +188,7 @@ static void task_manual_content_scan_free(retro_task_t *task)
|
|||
|
||||
static void task_manual_content_scan_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
manual_scan_handle_t *manual_scan = NULL;
|
||||
|
||||
if (!task)
|
||||
|
@ -196,7 +197,9 @@ static void task_manual_content_scan_handler(retro_task_t *task)
|
|||
if (!(manual_scan = (manual_scan_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
switch (manual_scan->status)
|
||||
|
@ -508,9 +511,8 @@ static void task_manual_content_scan_handler(retro_task_t *task)
|
|||
return;
|
||||
|
||||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static bool task_manual_content_scan_finder(retro_task_t *task, void *user_data)
|
||||
|
@ -611,10 +613,10 @@ bool task_push_manual_content_scan(
|
|||
task->handler = task_manual_content_scan_handler;
|
||||
task->state = manual_scan;
|
||||
task->title = strdup(task_title);
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->callback = cb_task_manual_content_scan;
|
||||
task->cleanup = task_manual_content_scan_free;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
|
||||
/* > Push task */
|
||||
task_queue_push(task);
|
||||
|
|
|
@ -135,7 +135,9 @@ static void task_menu_explore_init_handler(retro_task_t *task)
|
|||
menu_explore_init_handle_t *menu_explore = NULL;
|
||||
if ((menu_explore = (menu_explore_init_handle_t*)task->state))
|
||||
{
|
||||
if (!task_get_cancelled(task))
|
||||
uint8_t flg = task_get_flags(task);
|
||||
|
||||
if (!((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
{
|
||||
/* TODO/FIXME: It could be beneficial to
|
||||
* initialise the explore menu iteratively,
|
||||
|
@ -152,7 +154,7 @@ static void task_menu_explore_init_handler(retro_task_t *task)
|
|||
}
|
||||
}
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,11 +199,11 @@ bool task_push_menu_explore_init(const char *directory_playlist,
|
|||
* and no user notification messages */
|
||||
task->handler = task_menu_explore_init_handler;
|
||||
task->state = menu_explore;
|
||||
task->mute = true;
|
||||
task->title = NULL;
|
||||
task->progress = 0;
|
||||
task->callback = cb_task_menu_explore_init;
|
||||
task->cleanup = task_menu_explore_init_free;
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
|
|
|
@ -315,14 +315,16 @@ typedef struct bsv_state moviectl_task_state_t;
|
|||
|
||||
static void task_moviectl_playback_handler(retro_task_t *task)
|
||||
{
|
||||
/* trivial handler */
|
||||
task_set_finished(task, true);
|
||||
if (!task_get_error(task) && task_get_cancelled(task))
|
||||
task_set_error(task, strdup("Task canceled"));
|
||||
uint8_t flg;
|
||||
/* trivial handler */
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
flg = task_get_flags(task);
|
||||
if (!task_get_error(task) && ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
task_set_error(task, strdup("Task canceled"));
|
||||
|
||||
task_set_data(task, task->state);
|
||||
task->state = NULL;
|
||||
/* no need to free state here since I'm recycling it as data */
|
||||
task_set_data(task, task->state);
|
||||
task->state = NULL;
|
||||
/* no need to free state here since I'm recycling it as data */
|
||||
}
|
||||
|
||||
static void moviectl_start_playback_cb(retro_task_t *task,
|
||||
|
@ -338,13 +340,15 @@ static void moviectl_start_playback_cb(retro_task_t *task,
|
|||
|
||||
static void task_moviectl_record_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
/* Hang on until the state is loaded */
|
||||
if (content_load_state_in_progress(NULL))
|
||||
return;
|
||||
|
||||
/* trivial handler */
|
||||
task_set_finished(task, true);
|
||||
if (!task_get_error(task) && task_get_cancelled(task))
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
flg = task_get_flags(task);
|
||||
if (!task_get_error(task) && ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
task_set_error(task, strdup("Task canceled"));
|
||||
|
||||
task_set_data(task, task->state);
|
||||
|
|
|
@ -443,7 +443,7 @@ finished:
|
|||
task_set_title(task, strdup(title));
|
||||
}
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
#ifndef HAVE_DYNAMIC
|
||||
|
|
|
@ -70,7 +70,7 @@ finished:
|
|||
deinit_netplay_discovery();
|
||||
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_netplay_lan_scan_callback(retro_task_t *task,
|
||||
|
|
|
@ -293,7 +293,7 @@ static void task_netplay_nat_traversal_handler(retro_task_t *task)
|
|||
|
||||
finished:
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_netplay_nat_traversal_callback(retro_task_t *task,
|
||||
|
|
|
@ -580,7 +580,7 @@ static void task_overlay_resolve_iterate(retro_task_t *task)
|
|||
loader->resolve_pos, loader->size))
|
||||
{
|
||||
RARCH_ERR("[Overlay]: Failed to resolve next targets.\n");
|
||||
task_set_cancelled(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
loader->state = OVERLAY_STATUS_DEFERRED_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ static void task_overlay_deferred_loading(retro_task_t *task)
|
|||
{
|
||||
RARCH_ERR("[Overlay]: Failed to load overlay descs for overlay #%u.\n",
|
||||
(unsigned)overlay->pos);
|
||||
task_set_cancelled(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
loader->state = OVERLAY_STATUS_DEFERRED_ERROR;
|
||||
break;
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ static void task_overlay_deferred_loading(retro_task_t *task)
|
|||
loader->loading_status = OVERLAY_IMAGE_TRANSFER_NONE;
|
||||
break;
|
||||
case OVERLAY_IMAGE_TRANSFER_ERROR:
|
||||
task_set_cancelled(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
loader->state = OVERLAY_STATUS_DEFERRED_ERROR;
|
||||
break;
|
||||
}
|
||||
|
@ -942,7 +942,8 @@ static void task_overlay_deferred_load(retro_task_t *task)
|
|||
return;
|
||||
|
||||
error:
|
||||
task_set_cancelled(task, true);
|
||||
if (task)
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
loader->pos = 0;
|
||||
loader->state = OVERLAY_STATUS_DEFERRED_ERROR;
|
||||
}
|
||||
|
@ -952,8 +953,9 @@ static void task_overlay_free(retro_task_t *task)
|
|||
unsigned i;
|
||||
overlay_loader_t *loader = (overlay_loader_t*)task->state;
|
||||
struct overlay *overlay = &loader->overlays[loader->pos];
|
||||
uint8_t flg = task_get_flags(task);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
{
|
||||
if (loader->overlay_path)
|
||||
free(loader->overlay_path);
|
||||
|
@ -978,6 +980,7 @@ static void task_overlay_free(retro_task_t *task)
|
|||
|
||||
static void task_overlay_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
overlay_loader_t *loader = (overlay_loader_t*)task->state;
|
||||
|
||||
switch (loader->state)
|
||||
|
@ -992,16 +995,19 @@ static void task_overlay_handler(retro_task_t *task)
|
|||
task_overlay_resolve_iterate(task);
|
||||
break;
|
||||
case OVERLAY_STATUS_DEFERRED_ERROR:
|
||||
task_set_cancelled(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
break;
|
||||
case OVERLAY_STATUS_DEFERRED_DONE:
|
||||
default:
|
||||
case OVERLAY_STATUS_NONE:
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
break;
|
||||
}
|
||||
|
||||
if (task_get_finished(task) && !task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ( ((flg & RETRO_TASK_FLG_FINISHED) > 0)
|
||||
&& (!((flg & RETRO_TASK_FLG_CANCELLED) > 0)))
|
||||
{
|
||||
overlay_task_data_t *data = (overlay_task_data_t*)
|
||||
calloc(1, sizeof(*data));
|
||||
|
@ -1020,17 +1026,10 @@ static void task_overlay_handler(retro_task_t *task)
|
|||
static bool task_overlay_finder(retro_task_t *task, void *user_data)
|
||||
{
|
||||
overlay_loader_t *loader = NULL;
|
||||
|
||||
if (!task || (task->handler != task_overlay_handler))
|
||||
if (!task || (task->handler != task_overlay_handler) || !user_data)
|
||||
return false;
|
||||
|
||||
if (!user_data)
|
||||
if (!(loader = (overlay_loader_t*)task->state))
|
||||
return false;
|
||||
|
||||
loader = (overlay_loader_t*)task->state;
|
||||
if (!loader)
|
||||
return false;
|
||||
|
||||
return string_is_equal(loader->overlay_path, (const char*)user_data);
|
||||
}
|
||||
|
||||
|
|
|
@ -367,6 +367,7 @@ static void free_pl_thumb_handle(pl_thumb_handle_t *pl_thumb)
|
|||
|
||||
static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
pl_thumb_handle_t *pl_thumb = NULL;
|
||||
enum playlist_thumbnail_name_flags next_flag = PLAYLIST_THUMBNAIL_FLAG_INVALID;
|
||||
|
||||
|
@ -376,7 +377,9 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
|||
if (!(pl_thumb = (pl_thumb_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
switch (pl_thumb->status)
|
||||
|
@ -493,7 +496,7 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
|||
|
||||
task_finished:
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
if (pl_thumb)
|
||||
free_pl_thumb_handle(pl_thumb);
|
||||
}
|
||||
|
@ -573,8 +576,8 @@ bool task_push_pl_thumbnail_download(
|
|||
task->handler = task_pl_thumbnail_download_handler;
|
||||
task->state = pl_thumb;
|
||||
task->title = strdup(system);
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
|
@ -692,6 +695,7 @@ static void task_pl_entry_thumbnail_free(retro_task_t *task)
|
|||
|
||||
static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
pl_thumb_handle_t *pl_thumb = NULL;
|
||||
|
||||
if (!task)
|
||||
|
@ -700,7 +704,9 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
|
|||
if (!(pl_thumb = (pl_thumb_handle_t*)task->state))
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
switch (pl_thumb->status)
|
||||
|
@ -797,9 +803,8 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
|
|||
return;
|
||||
|
||||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static bool task_pl_entry_thumbnail_finder(retro_task_t *task, void *user_data)
|
||||
|
@ -924,11 +929,14 @@ bool task_push_pl_entry_thumbnail_download(
|
|||
task->handler = task_pl_entry_thumbnail_download_handler;
|
||||
task->state = pl_thumb;
|
||||
task->title = strdup(system);
|
||||
task->alternative_look = true;
|
||||
task->mute = mute;
|
||||
task->progress = 0;
|
||||
task->callback = cb_task_pl_entry_thumbnail_refresh_menu;
|
||||
task->cleanup = task_pl_entry_thumbnail_free;
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
if (mute)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ static void task_pl_manager_free(retro_task_t *task)
|
|||
|
||||
static void task_pl_manager_reset_cores_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
pl_manager_handle_t *pl_manager = NULL;
|
||||
|
||||
if (!task)
|
||||
|
@ -159,7 +160,9 @@ static void task_pl_manager_reset_cores_handler(retro_task_t *task)
|
|||
if (!pl_manager)
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
switch (pl_manager->status)
|
||||
|
@ -254,9 +257,8 @@ static void task_pl_manager_reset_cores_handler(retro_task_t *task)
|
|||
return;
|
||||
|
||||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static bool task_pl_manager_reset_cores_finder(
|
||||
|
@ -328,11 +330,12 @@ bool task_push_pl_manager_reset_cores(const playlist_config_t *playlist_config)
|
|||
task->handler = task_pl_manager_reset_cores_handler;
|
||||
task->state = pl_manager;
|
||||
task->title = strdup(task_title);
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->callback = cb_task_pl_manager;
|
||||
task->cleanup = task_pl_manager_free;
|
||||
|
||||
task->flags |= (RETRO_TASK_FLG_ALTERNATIVE_LOOK);
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
return true;
|
||||
|
@ -426,6 +429,7 @@ reset_core:
|
|||
|
||||
static void task_pl_manager_clean_playlist_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
pl_manager_handle_t *pl_manager = NULL;
|
||||
|
||||
if (!task)
|
||||
|
@ -436,7 +440,9 @@ static void task_pl_manager_clean_playlist_handler(retro_task_t *task)
|
|||
if (!pl_manager)
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
switch (pl_manager->status)
|
||||
|
@ -676,9 +682,8 @@ static void task_pl_manager_clean_playlist_handler(retro_task_t *task)
|
|||
return;
|
||||
|
||||
task_finished:
|
||||
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static bool task_pl_manager_clean_playlist_finder(
|
||||
|
@ -755,11 +760,12 @@ bool task_push_pl_manager_clean_playlist(
|
|||
task->handler = task_pl_manager_clean_playlist_handler;
|
||||
task->state = pl_manager;
|
||||
task->title = strdup(task_title);
|
||||
task->alternative_look = true;
|
||||
task->progress = 0;
|
||||
task->callback = cb_task_pl_manager;
|
||||
task->cleanup = task_pl_manager_free;
|
||||
|
||||
task->flags |= RETRO_TASK_FLG_ALTERNATIVE_LOOK;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -67,7 +67,7 @@ static void task_powerstate_handler(retro_task_t *task)
|
|||
}
|
||||
|
||||
task_set_data(task, powerstate);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
void task_push_get_powerstate(void)
|
||||
|
@ -77,8 +77,8 @@ void task_push_get_powerstate(void)
|
|||
|
||||
if (!task)
|
||||
return;
|
||||
state = (powerstate_t*)calloc(1, sizeof(*state));
|
||||
if (!state)
|
||||
|
||||
if (!(state = (powerstate_t*)calloc(1, sizeof(*state))))
|
||||
{
|
||||
free(task);
|
||||
return;
|
||||
|
@ -88,7 +88,7 @@ void task_push_get_powerstate(void)
|
|||
task->state = state;
|
||||
task->handler = task_powerstate_handler;
|
||||
task->callback = task_powerstate_cb;
|
||||
task->mute = true;
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(task);
|
||||
}
|
||||
|
|
|
@ -306,14 +306,17 @@ static void undo_save_state_cb(retro_task_t *task,
|
|||
static void task_save_handler_finished(retro_task_t *task,
|
||||
save_task_state_t *state)
|
||||
{
|
||||
uint8_t flg;
|
||||
save_task_state_t *task_data = NULL;
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
intfstream_close(state->file);
|
||||
free(state->file);
|
||||
|
||||
if (!task_get_error(task) && task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (!task_get_error(task) && ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
task_set_error(task, strdup("Task canceled"));
|
||||
|
||||
task_data = (save_task_state_t*)calloc(1, sizeof(*task_data));
|
||||
|
@ -499,6 +502,7 @@ static void *content_get_serialized_data(size_t* serial_size)
|
|||
**/
|
||||
static void task_save_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
ssize_t remaining;
|
||||
int written = 0;
|
||||
save_task_state_t *state = (save_task_state_t*)task->state;
|
||||
|
@ -535,7 +539,9 @@ static void task_save_handler(retro_task_t *task)
|
|||
|
||||
task_set_progress(task, (state->written / (float)state->size) * 100);
|
||||
|
||||
if (task_get_cancelled(task) || written != remaining)
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (((flg & RETRO_TASK_FLG_CANCELLED) > 0) || written != remaining)
|
||||
{
|
||||
char msg[128];
|
||||
|
||||
|
@ -583,7 +589,7 @@ static void task_save_handler(retro_task_t *task)
|
|||
msg = strdup(new_msg);
|
||||
}
|
||||
|
||||
if (!task_get_mute(task) && msg)
|
||||
if (!((flg & RETRO_TASK_FLG_MUTE) > 0) && msg)
|
||||
{
|
||||
task_set_title(task, msg);
|
||||
msg = NULL;
|
||||
|
@ -636,7 +642,11 @@ static bool task_push_undo_save_state(const char *path, void *data, size_t size)
|
|||
task->handler = task_save_handler;
|
||||
task->callback = undo_save_state_cb;
|
||||
task->title = strdup(msg_hash_to_str(MSG_UNDOING_SAVE_STATE));
|
||||
task->mute = (state->flags & SAVE_TASK_FLAG_MUTE) ? true : false;
|
||||
|
||||
if (state->flags & SAVE_TASK_FLAG_MUTE)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
|
@ -681,9 +691,10 @@ bool content_undo_save_state(void)
|
|||
static void task_load_handler_finished(retro_task_t *task,
|
||||
save_task_state_t *state)
|
||||
{
|
||||
uint8_t flg;
|
||||
load_task_data_t *task_data = NULL;
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (state->file)
|
||||
{
|
||||
|
@ -691,7 +702,9 @@ static void task_load_handler_finished(retro_task_t *task,
|
|||
free(state->file);
|
||||
}
|
||||
|
||||
if (!task_get_error(task) && task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (!task_get_error(task) && ((flg & RETRO_TASK_FLG_CANCELLED) > 0))
|
||||
task_set_error(task, strdup("Task canceled"));
|
||||
|
||||
if (!(task_data = (load_task_data_t*)calloc(1, sizeof(*task_data))))
|
||||
|
@ -712,6 +725,7 @@ static void task_load_handler_finished(retro_task_t *task,
|
|||
**/
|
||||
static void task_load_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
ssize_t remaining, bytes_read;
|
||||
save_task_state_t *state = (save_task_state_t*)task->state;
|
||||
|
||||
|
@ -740,7 +754,7 @@ static void task_load_handler(retro_task_t *task)
|
|||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
if (rcheevos_hardcore_active())
|
||||
task_set_cancelled(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_CANCELLED, true);
|
||||
#endif
|
||||
|
||||
remaining = MIN(state->size - state->bytes_read, SAVE_STATE_CHUNK);
|
||||
|
@ -751,7 +765,9 @@ static void task_load_handler(retro_task_t *task)
|
|||
if (state->size > 0)
|
||||
task_set_progress(task, (state->bytes_read / (float)state->size) * 100);
|
||||
|
||||
if (task_get_cancelled(task) || bytes_read != remaining)
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if (((flg & RETRO_TASK_FLG_CANCELLED) > 0) || bytes_read != remaining)
|
||||
{
|
||||
if (state->flags & SAVE_TASK_FLAG_AUTOLOAD)
|
||||
{
|
||||
|
@ -774,7 +790,7 @@ static void task_load_handler(retro_task_t *task)
|
|||
{
|
||||
task_free_title(task);
|
||||
|
||||
if (!task_get_mute(task))
|
||||
if (!((flg & RETRO_TASK_FLG_MUTE) > 0))
|
||||
{
|
||||
char msg[128];
|
||||
|
||||
|
@ -1184,7 +1200,11 @@ static void task_push_save_state(const char *path, void *data, size_t size, bool
|
|||
task->handler = task_save_handler;
|
||||
task->callback = save_state_cb;
|
||||
task->title = strdup(msg_hash_to_str(MSG_SAVING_STATE));
|
||||
task->mute = (state->flags & SAVE_TASK_FLAG_MUTE) ? true : false;
|
||||
|
||||
if (state->flags & SAVE_TASK_FLAG_MUTE)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
if (!task_queue_push(task))
|
||||
{
|
||||
|
@ -1290,7 +1310,11 @@ static void task_push_load_and_save_state(const char *path, void *data,
|
|||
task->handler = task_load_handler;
|
||||
task->callback = content_load_and_save_state_cb;
|
||||
task->title = strdup(msg_hash_to_str(MSG_LOADING_STATE));
|
||||
task->mute = (state->flags & SAVE_TASK_FLAG_MUTE) ? true : false;
|
||||
|
||||
if (state->flags & SAVE_TASK_FLAG_MUTE)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
if (!task_queue_push(task))
|
||||
{
|
||||
|
@ -1575,7 +1599,11 @@ bool content_load_state(const char *path,
|
|||
task->handler = task_load_handler;
|
||||
task->callback = content_load_state_cb;
|
||||
task->title = strdup(msg_hash_to_str(MSG_LOADING_STATE));
|
||||
task->mute = (state->flags & SAVE_TASK_FLAG_MUTE) ? true : false;
|
||||
|
||||
if (state->flags & SAVE_TASK_FLAG_MUTE)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ static bool screenshot_dump_direct(screenshot_task_state_t *state)
|
|||
**/
|
||||
static void task_screenshot_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
screenshot_task_state_t *state = NULL;
|
||||
bool ret = false;
|
||||
|
||||
|
@ -125,7 +126,10 @@ static void task_screenshot_handler(retro_task_t *task)
|
|||
|
||||
if (!(state = (screenshot_task_state_t*)task->state))
|
||||
goto task_finished;
|
||||
if (task_get_cancelled(task))
|
||||
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
if (task_get_progress(task) == 100)
|
||||
goto task_finished;
|
||||
|
@ -167,8 +171,8 @@ static void task_screenshot_handler(retro_task_t *task)
|
|||
return;
|
||||
|
||||
task_finished:
|
||||
|
||||
task_set_finished(task, true);
|
||||
if (task)
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (task->title)
|
||||
task_free_title(task);
|
||||
|
@ -371,12 +375,15 @@ static bool screenshot_dump(
|
|||
task->type = TASK_TYPE_BLOCKING;
|
||||
task->state = state;
|
||||
task->handler = task_screenshot_handler;
|
||||
task->mute = savestate;
|
||||
if (savestate)
|
||||
task->flags |= RETRO_TASK_FLG_MUTE;
|
||||
else
|
||||
task->flags &= ~RETRO_TASK_FLG_MUTE;
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
/* This callback is only required when
|
||||
* widgets are enabled */
|
||||
if (state->flags & SS_TASK_FLAG_WIDGETS_READY)
|
||||
task->callback = task_screenshot_callback;
|
||||
task->callback = task_screenshot_callback;
|
||||
|
||||
if ((state->flags & SS_TASK_FLAG_WIDGETS_READY) && !savestate)
|
||||
task_free_title(task);
|
||||
|
|
|
@ -28,6 +28,7 @@ typedef struct steam_core_dlc_install_state
|
|||
|
||||
static void task_steam_core_dlc_install_handler(retro_task_t *task)
|
||||
{
|
||||
uint8_t flg;
|
||||
int8_t progress;
|
||||
steam_core_dlc_install_state_t *state = NULL;
|
||||
MistResult result = MistResult_Success;
|
||||
|
@ -41,7 +42,9 @@ static void task_steam_core_dlc_install_handler(retro_task_t *task)
|
|||
if (!(state = (steam_core_dlc_install_state_t*)task->state))
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
flg = task_get_flags(task);
|
||||
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
result = mist_steam_apps_get_dlc_download_progress(state->app_id, &downloading, &bytes_downloaded, &bytes_total);
|
||||
|
@ -70,7 +73,7 @@ static void task_steam_core_dlc_install_handler(retro_task_t *task)
|
|||
return;
|
||||
task_finished:
|
||||
if (task)
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
/* If finished successfully */
|
||||
if (MIST_IS_SUCCESS(result))
|
||||
|
|
|
@ -58,8 +58,9 @@ static void task_auto_translate_handler(retro_task_t *task)
|
|||
#ifdef HAVE_ACCESSIBILITY
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
uint8_t flg = task_get_flags(task);
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
|
||||
goto task_finished;
|
||||
|
||||
switch (*mode_ptr)
|
||||
|
@ -87,7 +88,7 @@ task_finished:
|
|||
if (access_st->ai_service_auto == 1)
|
||||
access_st->ai_service_auto = 2;
|
||||
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
|
||||
if (*mode_ptr == 1 || *mode_ptr == 2)
|
||||
{
|
||||
|
@ -124,7 +125,7 @@ static void call_auto_translate_task(
|
|||
|
||||
t->user_data = NULL;
|
||||
t->handler = task_auto_translate_handler;
|
||||
t->mute = true;
|
||||
t->flags |= RETRO_TASK_FLG_MUTE;
|
||||
|
||||
if (mode)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ static void task_wifi_scan_handler(retro_task_t *task)
|
|||
task_set_progress(task, 100);
|
||||
task_free_title(task);
|
||||
task_set_title(task, strdup(msg_hash_to_str(MSG_WIFI_SCAN_COMPLETE)));
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_wifi_enable_handler(retro_task_t *task)
|
||||
|
@ -62,7 +62,7 @@ static void task_wifi_enable_handler(retro_task_t *task)
|
|||
driver_wifi_enable(true);
|
||||
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_wifi_disable_handler(retro_task_t *task)
|
||||
|
@ -73,7 +73,7 @@ static void task_wifi_disable_handler(retro_task_t *task)
|
|||
driver_wifi_enable(false);
|
||||
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_wifi_disconnect_handler(retro_task_t *task)
|
||||
|
@ -86,7 +86,7 @@ static void task_wifi_disconnect_handler(retro_task_t *task)
|
|||
driver_wifi_disconnect_ssid(&netinfo);
|
||||
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
static void task_wifi_connect_handler(retro_task_t *task)
|
||||
|
@ -98,7 +98,7 @@ static void task_wifi_connect_handler(retro_task_t *task)
|
|||
free(task->user_data);
|
||||
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
task_set_flags(task, RETRO_TASK_FLG_FINISHED, true);
|
||||
}
|
||||
|
||||
bool task_push_wifi_connect(retro_task_callback_t cb, void *netptr)
|
||||
|
@ -108,7 +108,7 @@ bool task_push_wifi_connect(retro_task_callback_t cb, void *netptr)
|
|||
wifi_network_info_t *netinfo = (wifi_network_info_t*)netptr;
|
||||
if (!task)
|
||||
return false;
|
||||
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_WIFI_CONNECTING_TO), netinfo->ssid);
|
||||
|
||||
task->type = TASK_TYPE_BLOCKING;
|
||||
|
|
Loading…
Reference in New Issue