mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
move content list builder into scanner task with progress, fixes menu freeze with large playlists
This commit is contained in:
parent
434bec8775
commit
5733d8ebd5
@ -4,6 +4,7 @@
|
||||
- AUDIO: Audio mixer's volume can now be independently increased/decreased, and muted.
|
||||
- SDL2: Fix 'SDL2 driver does not see the hat on wired Xbox 360 controller"
|
||||
- SCANNING: Fix PS1 game scanning
|
||||
- SCANNING: Move content list builder into scanner task with progress, fixes menu freeze with large playlists
|
||||
- VITA: Add support for external USB if mounted
|
||||
- VITA: Add cheevos support
|
||||
- MENU: Add 'User Interface -> Views'. Ability to display/hide online updater and core updater
|
||||
|
@ -399,7 +399,7 @@ static int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur)
|
||||
}
|
||||
|
||||
database_info_handle_t *database_info_dir_init(const char *dir,
|
||||
enum database_type type)
|
||||
enum database_type type, retro_task_t *task)
|
||||
{
|
||||
unsigned i;
|
||||
database_info_handle_t *db = (database_info_handle_t*)
|
||||
@ -423,6 +423,9 @@ database_info_handle_t *database_info_dir_init(const char *dir,
|
||||
{
|
||||
const char *path = db->list->elems[i].data;
|
||||
|
||||
if (task)
|
||||
task_set_progress(task, (i / (float)db->list->size) * 100);
|
||||
|
||||
if (path_is_compressed_file(path) && !path_contains_compressed_file(path))
|
||||
{
|
||||
struct string_list *archive_list = path_is_compressed_file(path) ?
|
||||
@ -469,7 +472,7 @@ error:
|
||||
}
|
||||
|
||||
database_info_handle_t *database_info_file_init(const char *path,
|
||||
enum database_type type)
|
||||
enum database_type type, retro_task_t *task)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
database_info_handle_t *db = (database_info_handle_t*)
|
||||
@ -501,6 +504,9 @@ database_info_handle_t *database_info_file_init(const char *path,
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
size_t path_len = strlen(path);
|
||||
|
||||
if (task)
|
||||
task_set_progress(task, (i / (float)archive_list->size) * 100);
|
||||
|
||||
new_path[0] = '\0';
|
||||
|
||||
strlcpy(new_path, path, sizeof(new_path));
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <file/archive_file.h>
|
||||
#include <retro_common_api.h>
|
||||
#include <queues/task_queue.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
@ -125,10 +126,10 @@ database_info_list_t *database_info_list_new(const char *rdb_path,
|
||||
void database_info_list_free(database_info_list_t *list);
|
||||
|
||||
database_info_handle_t *database_info_dir_init(const char *dir,
|
||||
enum database_type type);
|
||||
enum database_type type, retro_task_t *task);
|
||||
|
||||
database_info_handle_t *database_info_file_init(const char *path,
|
||||
enum database_type type);
|
||||
enum database_type type, retro_task_t *task);
|
||||
|
||||
void database_info_free(database_info_handle_t *handle);
|
||||
|
||||
|
@ -2987,3 +2987,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER,
|
||||
"コアのアップデーターを表示")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER,
|
||||
"Show/hide the ability to update cores (and core info files).")
|
||||
MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN,
|
||||
"コンテンツをスキャンするための準備中")
|
||||
|
@ -3057,3 +3057,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER,
|
||||
"Show Core Updater")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER,
|
||||
"Show/hide the ability to update cores (and core info files).")
|
||||
MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN,
|
||||
"Preparing for content scan...")
|
||||
|
@ -337,6 +337,7 @@ enum msg_hash_enums
|
||||
MSG_REDIRECTING_SAVESTATE_TO,
|
||||
MSG_REDIRECTING_SAVEFILE_TO,
|
||||
MSG_REDIRECTING_CHEATFILE_TO,
|
||||
MSG_PREPARING_FOR_CONTENT_SCAN,
|
||||
MSG_SCANNING,
|
||||
MSG_SCANNING_OF_DIRECTORY_FINISHED,
|
||||
MSG_LOADED_STATE_FROM_SLOT,
|
||||
|
@ -60,6 +60,10 @@ typedef struct db_handle
|
||||
unsigned status;
|
||||
char playlist_directory[4096];
|
||||
char content_database_path[4096];
|
||||
|
||||
bool is_directory;
|
||||
char fullpath[4096];
|
||||
bool scan_started;
|
||||
} db_handle_t;
|
||||
|
||||
int find_first_data_track(const char* cue_path,
|
||||
@ -630,6 +634,21 @@ static void task_database_handler(retro_task_t *task)
|
||||
if (!db)
|
||||
goto task_finished;
|
||||
|
||||
if (!db->scan_started)
|
||||
{
|
||||
db->scan_started = true;
|
||||
|
||||
if (db->is_directory)
|
||||
db->handle = database_info_dir_init(db->fullpath, DATABASE_TYPE_ITERATE, task);
|
||||
else
|
||||
db->handle = database_info_file_init(db->fullpath, DATABASE_TYPE_ITERATE, task);
|
||||
|
||||
task_free_title(task);
|
||||
|
||||
if (db->handle)
|
||||
db->handle->status = DATABASE_STATUS_ITERATE_BEGIN;
|
||||
}
|
||||
|
||||
dbinfo = db->handle;
|
||||
dbstate = &db->state;
|
||||
|
||||
@ -721,20 +740,16 @@ bool task_push_dbscan(
|
||||
t->handler = task_database_handler;
|
||||
t->state = db;
|
||||
t->callback = cb;
|
||||
t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN));
|
||||
|
||||
db->is_directory = directory;
|
||||
|
||||
strlcpy(db->fullpath, fullpath, sizeof(db->fullpath));
|
||||
strlcpy(db->playlist_directory, playlist_directory,
|
||||
sizeof(db->playlist_directory));
|
||||
strlcpy(db->content_database_path, content_database,
|
||||
sizeof(db->content_database_path));
|
||||
|
||||
if (directory)
|
||||
db->handle = database_info_dir_init(fullpath, DATABASE_TYPE_ITERATE);
|
||||
else
|
||||
db->handle = database_info_file_init(fullpath, DATABASE_TYPE_ITERATE);
|
||||
|
||||
if (db->handle)
|
||||
db->handle->status = DATABASE_STATUS_ITERATE_BEGIN;
|
||||
|
||||
task_queue_push(t);
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user