show taskbar progress for scanner

This commit is contained in:
Brad Parker 2019-05-22 01:31:55 -04:00
parent 7a7d2303b5
commit e35eff126a

View File

@ -39,6 +39,7 @@
#include "../configuration.h" #include "../configuration.h"
#include "../retroarch.h" #include "../retroarch.h"
#include "../ui/ui_companion_driver.h" #include "../ui/ui_companion_driver.h"
#include "../gfx/video_display_server.h"
#endif #endif
#include "../verbosity.h" #include "../verbosity.h"
#ifndef COLLECTION_SIZE #ifndef COLLECTION_SIZE
@ -157,7 +158,7 @@ static int task_database_iterate_start(retro_task_t *task,
task_free_title(task); task_free_title(task);
task_set_title(task, strdup(msg)); task_set_title(task, strdup(msg));
if (db->list->size != 0) if (db->list->size != 0)
task_set_progress(task, roundf((float)db->list_ptr / (float)db->list->size * 100.0f)); task_set_progress(task, roundf((float)db->list_ptr / ((float)db->list->size / 100.0f)));
#else #else
fprintf(stderr, "msg: %s\n", msg); fprintf(stderr, "msg: %s\n", msg);
#endif #endif
@ -1363,6 +1364,15 @@ task_finished:
free(dbinfo); free(dbinfo);
} }
#ifdef RARCH_INTERNAL
static void task_database_progress_cb(retro_task_t *task)
{
if (!task)
return;
video_display_server_set_window_progress(task->progress, task->finished);
}
#endif
bool task_push_dbscan( bool task_push_dbscan(
const char *playlist_directory, const char *playlist_directory,
const char *content_database, const char *content_database,
@ -1387,6 +1397,7 @@ bool task_push_dbscan(
t->alternative_look = true; t->alternative_look = true;
#ifdef RARCH_INTERNAL #ifdef RARCH_INTERNAL
t->progress_cb = task_database_progress_cb;
db->scan_without_core_match = settings->bools.scan_without_core_match; db->scan_without_core_match = settings->bools.scan_without_core_match;
#endif #endif
db->show_hidden_files = db_dir_show_hidden_files; db->show_hidden_files = db_dir_show_hidden_files;