(menu widgets backport) Re-commit task queue changes

This commit is contained in:
twinaphex 2019-02-08 08:00:32 +01:00
parent 894f3b7aef
commit 386657a366
26 changed files with 128 additions and 65 deletions

View File

@ -1406,7 +1406,8 @@ static void audio_driver_mixer_play_stream_internal(unsigned i, unsigned type)
audio_mixer_streams[i].state = (enum audio_mixer_state)type;
}
static void audio_driver_load_menu_bgm_callback(void *task_data, void *user_data, const char *error)
static void audio_driver_load_menu_bgm_callback(retro_task_t *task,
void *task_data, void *user_data, const char *error)
{
bool contentless = false;
bool is_inited = false;

View File

@ -1589,7 +1589,8 @@ static void cheevos_make_unlock_url(const cheevo_t *cheevo,
#endif
}
static void cheevos_unlocked(void *task_data, void *user_data,
static void cheevos_unlocked(retro_task_t *task,
void *task_data, void *user_data,
const char *error)
{
cheevo_t *cheevo = (cheevo_t *)user_data;
@ -1818,7 +1819,8 @@ static void cheevos_make_lboard_url(const cheevos_leaderboard_t *lboard,
#endif
}
static void cheevos_lboard_submit(void *task_data, void *user_data,
static void cheevos_lboard_submit(retro_task_t *task,
void *task_data, void *user_data,
const char *error)
{
cheevos_leaderboard_t *lboard = (cheevos_leaderboard_t *)user_data;

View File

@ -182,7 +182,8 @@ static void handle_discord_error(int errcode, const char* message)
RARCH_LOG("[discord] error (%d: %s)\n", errcode, message);
}
static void handle_discord_join_cb(void *task_data, void *user_data, const char *err)
static void handle_discord_join_cb(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
struct netplay_room *room;
char join_hostname[PATH_MAX_LENGTH];

View File

@ -595,7 +595,8 @@ void input_overlay_free(input_overlay_t *ol)
}
/* task_data = overlay_task_data_t* */
void input_overlay_loaded(void *task_data, void *user_data, const char *err)
void input_overlay_loaded(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
size_t i;
overlay_task_data_t *data = (overlay_task_data_t*)task_data;

View File

@ -23,6 +23,7 @@
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#include <formats/image.h>
#include <queues/task_queue.h>
#include "input_driver.h"
@ -256,7 +257,8 @@ bool input_overlay_key_pressed(input_overlay_t *ol, unsigned key);
bool input_overlay_is_alive(input_overlay_t *ol);
void input_overlay_loaded(void *task_data, void *user_data, const char *err);
void input_overlay_loaded(retro_task_t *task,
void *task_data, void *user_data, const char *err);
void input_overlay_set_visibility(int overlay_idx,enum overlay_visibility vis);

View File

@ -43,7 +43,8 @@ enum task_type
};
typedef struct retro_task retro_task_t;
typedef void (*retro_task_callback_t)(void *task_data,
typedef void (*retro_task_callback_t)(retro_task_t *task,
void *task_data,
void *user_data, const char *error);
typedef void (*retro_task_handler_t)(retro_task_t *task);
@ -51,7 +52,8 @@ typedef void (*retro_task_handler_t)(retro_task_t *task);
typedef bool (*retro_task_finder_t)(retro_task_t *task,
void *userdata);
typedef void (*retro_task_queue_msg_t)(const char *msg,
typedef void (*retro_task_queue_msg_t)(retro_task_t *task,
const char *msg,
unsigned prio, unsigned duration, bool flush);
typedef bool (*retro_task_retriever_t)(retro_task_t *task, void *data);

View File

@ -78,7 +78,7 @@ static void task_queue_msg_push(retro_task_t *task,
va_end(ap);
if (impl_current->msg_push)
impl_current->msg_push(buf, prio, duration, flush);
impl_current->msg_push(task, buf, prio, duration, flush);
}
static void task_queue_push_progress(retro_task_t *task)
@ -140,7 +140,7 @@ static void retro_task_internal_gather(void)
task_queue_push_progress(task);
if (task->callback)
task->callback(task->task_data, task->user_data, task->error);
task->callback(task, task->task_data, task->user_data, task->error);
if (task->cleanup)
task->cleanup(task);

View File

@ -1082,7 +1082,8 @@ static bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info
}
#ifdef HAVE_LIBRETRODB
void handle_dbscan_finished(void *task_data, void *user_data, const char *err);
void handle_dbscan_finished(retro_task_t *task,
void *task_data, void *user_data, const char *err);
#endif
static void content_add_to_playlist(const char *path)
@ -3259,7 +3260,8 @@ static int action_ok_undo_save_state(const char *path,
#ifdef HAVE_NETWORKING
#ifdef HAVE_ZLIB
static void cb_decompressed(void *task_data, void *user_data, const char *err)
static void cb_decompressed(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
decompress_task_data_t *dec = (decompress_task_data_t*)task_data;
@ -3392,7 +3394,8 @@ default_action_ok_list(action_ok_core_updater_list, MENU_ENUM_LABEL_CB_CORE_UPDA
default_action_ok_list(action_ok_thumbnails_updater_list, MENU_ENUM_LABEL_CB_THUMBNAILS_UPDATER_LIST)
default_action_ok_list(action_ok_lakka_list, MENU_ENUM_LABEL_CB_LAKKA_LIST)
static void cb_generic_dir_download(void *task_data,
static void cb_generic_dir_download(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
file_transfer_t *transf = (file_transfer_t*)user_data;
@ -3406,7 +3409,8 @@ static void cb_generic_dir_download(void *task_data,
}
/* expects http_transfer_t*, file_transfer_t* */
void cb_generic_download(void *task_data,
void cb_generic_download(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
char output_path[PATH_MAX_LENGTH];
@ -3541,11 +3545,14 @@ void cb_generic_download(void *task_data,
if (path_is_compressed_file(output_path))
{
void *frontend_userdata = task->frontend_userdata;
task->frontend_userdata = NULL;
if (!task_push_decompress(output_path, dir_path,
NULL, NULL, NULL,
cb_decompressed, (void*)(uintptr_t)
msg_hash_calculate(msg_hash_to_str(transf->enum_idx)),
NULL))
frontend_userdata))
{
err = msg_hash_to_str(MSG_DECOMPRESSION_FAILED);
goto finish;
@ -4275,7 +4282,8 @@ void netplay_refresh_rooms_menu(file_list_t *list)
#define INET6_ADDRSTRLEN 46
#endif
static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err)
static void netplay_refresh_rooms_cb(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
char *new_data = NULL;
const char *path = NULL;
@ -4402,7 +4410,8 @@ finish:
}
static void netplay_lan_scan_callback(void *task_data,
static void netplay_lan_scan_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
struct netplay_host_list *netplay_hosts = NULL;

View File

@ -37,7 +37,8 @@
#endif
#ifdef HAVE_LIBRETRODB
void handle_dbscan_finished(void *task_data, void *user_data, const char *err)
void handle_dbscan_finished(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
menu_ctx_environment_t menu_environ;
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;

View File

@ -21,6 +21,8 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <queues/task_queue.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
@ -288,7 +290,8 @@ void menu_cbs_init(void *data,
int menu_cbs_exit(void);
void cb_generic_download(void *task_data,
void cb_generic_download(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
RETRO_END_DECLS

View File

@ -4139,7 +4139,8 @@ static void menu_displaylist_parse_playlist_generic(
}
#ifdef HAVE_NETWORKING
static void wifi_scan_callback(void *task_data,
static void wifi_scan_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
unsigned i;

View File

@ -1253,7 +1253,8 @@ static bool menu_driver_load_image(menu_ctx_load_image_t *load_image_info)
return false;
}
void menu_display_handle_thumbnail_upload(void *task_data,
void menu_display_handle_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
menu_ctx_load_image_t load_image_info;
@ -1269,7 +1270,8 @@ void menu_display_handle_thumbnail_upload(void *task_data,
free(user_data);
}
void menu_display_handle_left_thumbnail_upload(void *task_data,
void menu_display_handle_left_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
menu_ctx_load_image_t load_image_info;
@ -1285,7 +1287,8 @@ void menu_display_handle_left_thumbnail_upload(void *task_data,
free(user_data);
}
void menu_display_handle_savestate_thumbnail_upload(void *task_data,
void menu_display_handle_savestate_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
menu_ctx_load_image_t load_image_info;
@ -1304,7 +1307,8 @@ void menu_display_handle_savestate_thumbnail_upload(void *task_data,
/* Function that gets called when we want to load in a
* new menu wallpaper.
*/
void menu_display_handle_wallpaper_upload(void *task_data,
void menu_display_handle_wallpaper_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
menu_ctx_load_image_t load_image_info;
@ -1696,7 +1700,8 @@ const char *config_get_menu_driver_options(void)
* when we need to extract the APK contents/zip file. This
* file contains assets which then get extracted to the
* user's asset directories. */
static void bundle_decompressed(void *task_data,
static void bundle_decompressed(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
settings_t *settings = config_get_ptr();

View File

@ -27,6 +27,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <gfx/math/matrix_4x4.h>
#include <queues/task_queue.h>
#include "menu_defines.h"
#include "menu_input.h"
@ -622,16 +623,20 @@ bool menu_display_get_tex_coords(menu_display_ctx_coord_draw_t *draw);
void menu_display_timedate(menu_display_ctx_datetime_t *datetime);
void menu_display_handle_wallpaper_upload(void *task_data,
void menu_display_handle_wallpaper_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
void menu_display_handle_thumbnail_upload(void *task_data,
void menu_display_handle_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
void menu_display_handle_left_thumbnail_upload(void *task_data,
void menu_display_handle_left_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
void menu_display_handle_savestate_thumbnail_upload(void *task_data,
void menu_display_handle_savestate_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);
void menu_display_push_quad(

View File

@ -180,7 +180,8 @@ void print_buf_lines(file_list_t *list, char *buf,
* with a newline, just ignore the partial last line. */
}
void cb_net_generic_subdir(void *task_data, void *user_data, const char *err)
void cb_net_generic_subdir(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
#ifdef HAVE_NETWORKING
char subdir_path[PATH_MAX_LENGTH];
@ -222,7 +223,8 @@ finish:
#endif
}
void cb_net_generic(void *task_data, void *user_data, const char *err)
void cb_net_generic(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
#ifdef HAVE_NETWORKING
bool refresh = false;

View File

@ -33,10 +33,12 @@ void print_buf_lines(file_list_t *list, char *buf,
const char *label, int buf_size,
enum msg_file_type type, bool append, bool extended);
void cb_net_generic_subdir(void *task_data, void *user_data,
void cb_net_generic_subdir(retro_task_t *task,
void *task_data, void *user_data,
const char *err);
void cb_net_generic(void *task_data, void *user_data, const char *err);
void cb_net_generic(retro_task_t *task,
void *task_data, void *user_data, const char *err);
RETRO_END_DECLS

View File

@ -638,7 +638,8 @@ static int16_t netplay_input_state(netplay_t *netplay,
}
}
static void netplay_announce_cb(void *task_data, void *user_data, const char *error)
static void netplay_announce_cb(retro_task_t *task,
void *task_data, void *user_data, const char *error)
{
RARCH_LOG("[netplay] announcing netplay game... \n");

View File

@ -2437,7 +2437,8 @@ global_t *global_get_ptr(void)
return &g_extern;
}
void runloop_task_msg_queue_push(const char *msg,
void runloop_task_msg_queue_push(retro_task_t *task,
const char *msg,
unsigned prio, unsigned duration,
bool flush)
{

View File

@ -377,7 +377,8 @@ global_t *global_get_ptr(void);
**/
int runloop_iterate(unsigned *sleep_ms);
void runloop_task_msg_queue_push(const char *msg,
void runloop_task_msg_queue_push(retro_task_t *task,
const char *msg,
unsigned prio, unsigned duration,
bool flush);

View File

@ -26,6 +26,7 @@
#include <compat/strl.h>
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include <queues/task_queue.h>
#include "../audio/audio_driver.h"
@ -74,7 +75,7 @@ static void task_audio_mixer_load_free(retro_task_t *task)
}
if (mixer->cb)
mixer->cb(NULL, NULL, NULL);
mixer->cb(task, NULL, NULL, NULL);
}
if (!string_is_empty(nbio->path))
@ -104,7 +105,8 @@ static int cb_nbio_audio_mixer_load(void *data, size_t len)
return 0;
}
static void task_audio_mixer_handle_upload_ogg(void *task_data,
static void task_audio_mixer_handle_upload_ogg(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -134,7 +136,8 @@ static void task_audio_mixer_handle_upload_ogg(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_ogg_and_play(void *task_data,
static void task_audio_mixer_handle_upload_ogg_and_play(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -165,7 +168,8 @@ static void task_audio_mixer_handle_upload_ogg_and_play(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_flac(void *task_data,
static void task_audio_mixer_handle_upload_flac(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -196,7 +200,8 @@ static void task_audio_mixer_handle_upload_flac(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_flac_and_play(void *task_data,
static void task_audio_mixer_handle_upload_flac_and_play(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -227,7 +232,8 @@ static void task_audio_mixer_handle_upload_flac_and_play(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_mp3(void *task_data,
static void task_audio_mixer_handle_upload_mp3(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -258,7 +264,8 @@ static void task_audio_mixer_handle_upload_mp3(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_mp3_and_play(void *task_data,
static void task_audio_mixer_handle_upload_mp3_and_play(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -289,7 +296,8 @@ static void task_audio_mixer_handle_upload_mp3_and_play(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_mod(void *task_data,
static void task_audio_mixer_handle_upload_mod(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -320,7 +328,8 @@ static void task_audio_mixer_handle_upload_mod(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_mod_and_play(void *task_data,
static void task_audio_mixer_handle_upload_mod_and_play(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -351,7 +360,8 @@ static void task_audio_mixer_handle_upload_mod_and_play(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_wav(void *task_data,
static void task_audio_mixer_handle_upload_wav(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;
@ -382,7 +392,8 @@ static void task_audio_mixer_handle_upload_wav(void *task_data,
free(user_data);
}
static void task_audio_mixer_handle_upload_wav_and_play(void *task_data,
static void task_audio_mixer_handle_upload_wav_and_play(retro_task_t *task,
void *task_data,
void *user_data, const char *err)
{
audio_mixer_stream_params_t params;

View File

@ -54,8 +54,9 @@ typedef struct
struct string_list *lpl_list;
} netplay_crc_handle_t;
static void netplay_crc_scan_callback(void *task_data,
void *user_data, const char *error)
static void netplay_crc_scan_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
netplay_crc_handle_t *state = (netplay_crc_handle_t*)task_data;
content_ctx_info_t content_info = {0};

View File

@ -35,8 +35,9 @@ struct nat_traversal_state_data
uint16_t port;
};
static void netplay_nat_traversal_callback(void *task_data,
void *user_data, const char *error)
static void netplay_nat_traversal_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
struct nat_traversal_state_data *ntsd =
(struct nat_traversal_state_data *) task_data;

View File

@ -39,8 +39,9 @@ enum frontend_powerstate get_last_powerstate(int *percent)
return state;
}
static void task_powerstate_cb(void *task_data,
void *user_data, const char *error)
static void task_powerstate_cb(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
powerstate_t *powerstate = (powerstate_t*)task_data;

View File

@ -507,8 +507,9 @@ bool content_undo_load_state(void)
return ret;
}
static void undo_save_state_cb(void *task_data,
void *user_data, const char *error)
static void undo_save_state_cb(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
/* Wipe the save file buffer as it's intended to be one use only */
undo_save_buf.path[0] = '\0';
@ -892,8 +893,9 @@ error:
* Load a state from disk to memory.
*
**/
static void content_load_state_cb(void *task_data,
void *user_data, const char *error)
static void content_load_state_cb(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
retro_ctx_serialize_info_t serial_info;
unsigned i;
@ -1041,8 +1043,9 @@ error:
*
* Called after the save state is done. Takes a screenshot if needed.
**/
static void save_state_cb(void *task_data,
void *user_data, const char *error)
static void save_state_cb(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
save_task_state_t *state = (save_task_state_t*)task_data;
char *path = strdup(state->path);
@ -1105,8 +1108,9 @@ error:
* Load then save a state.
*
**/
static void content_load_and_save_state_cb(void *task_data,
void *user_data, const char *error)
static void content_load_and_save_state_cb(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
{
load_task_data_t *load_data = (load_task_data_t*)task_data;
char *path = strdup(load_data->path);
@ -1114,7 +1118,7 @@ static void content_load_and_save_state_cb(void *task_data,
size_t size = load_data->undo_size;
bool autosave = load_data->autosave;
content_load_state_cb(task_data, user_data, error);
content_load_state_cb(task, task_data, user_data, error);
task_push_save_state(path, data, size, autosave);

View File

@ -10,6 +10,7 @@ extern "C" {
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include <queues/task_queue.h>
#include <file/archive_file.h>
#include "../../../tasks/tasks_internal.h"
#include "../../../verbosity.h"
@ -28,7 +29,8 @@ extern "C" {
#define THUMBNAILPACK_URL_HEADER "http://thumbnailpacks.libretro.com/"
#define THUMBNAILPACK_EXTENSION ".zip"
static void extractThumbnailPackCB(void *task_data, void *user_data, const char *err)
static void extractThumbnailPackCB(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
decompress_task_data_t *dec = (decompress_task_data_t*)task_data;
MainWindow *mainwindow = (MainWindow*)user_data;

View File

@ -120,7 +120,8 @@ static const QPixmap getInvader()
}
#ifdef HAVE_LIBRETRODB
static void scan_finished_handler(void *task_data, void *user_data, const char *err)
static void scan_finished_handler(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
bool dontAsk = false;
bool answer = false;

View File

@ -11,6 +11,7 @@ extern "C" {
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include <file/archive_file.h>
#include <queues/task_queue.h>
#include "../../../tasks/tasks_internal.h"
#include "../../../verbosity.h"
#include "../../../config.def.h"
@ -24,7 +25,8 @@ extern "C" {
#define TEMP_EXTENSION ".update_tmp"
#define RETROARCH_NIGHTLY_UPDATE_PATH "../RetroArch_update.zip"
static void extractUpdateCB(void *task_data, void *user_data, const char *err)
static void extractUpdateCB(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
decompress_task_data_t *dec = (decompress_task_data_t*)task_data;
MainWindow *mainwindow = (MainWindow*)user_data;