mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 00:32:49 +00:00
Scanning should now work in standalone program
This commit is contained in:
parent
d66b8fa882
commit
c24179dc63
@ -7,6 +7,15 @@
|
||||
#include "../../../core_info.h"
|
||||
#include "../../../tasks/tasks_internal.h"
|
||||
|
||||
static bool loop_active = true;
|
||||
|
||||
static void main_msg_queue_push(const char *msg,
|
||||
unsigned prio, unsigned duration,
|
||||
bool flush)
|
||||
{
|
||||
fprintf(stderr, "MSGQ: %s\n", msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* return codes -
|
||||
* graceful exit: 1
|
||||
@ -14,6 +23,12 @@
|
||||
* error exit: -1
|
||||
*/
|
||||
|
||||
static void main_db_cb(void *task_data, void *user_data, const char *err)
|
||||
{
|
||||
fprintf(stderr, "DB CB: %s\n", err);
|
||||
loop_active = false;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *db_dir = NULL;
|
||||
@ -35,14 +50,23 @@ int main(int argc, char *argv[])
|
||||
input_dir = argv[4];
|
||||
playlist_dir = argv[5];
|
||||
|
||||
task_queue_init(false /* threaded enable */, NULL);
|
||||
fprintf(stderr, "RDB database dir: %s\n", db_dir);
|
||||
fprintf(stderr, "Core dir: %s\n", core_dir);
|
||||
fprintf(stderr, "Core info dir: %s\n", core_info_dir);
|
||||
fprintf(stderr, "Input dir: %s\n", input_dir);
|
||||
fprintf(stderr, "Playlist dir: %s\n", playlist_dir);
|
||||
|
||||
task_queue_init(false /* threaded enable */, main_msg_queue_push);
|
||||
|
||||
core_info_init_list(core_info_dir, core_dir, exts, true);
|
||||
|
||||
task_push_dbscan(playlist_dir, db_dir, input_dir, false,
|
||||
true, NULL /* bind callback here later */);
|
||||
task_push_dbscan(playlist_dir, db_dir, input_dir, true,
|
||||
true, main_db_cb);
|
||||
|
||||
task_queue_check();
|
||||
while (loop_active)
|
||||
task_queue_check();
|
||||
|
||||
fprintf(stderr, "Exit loop\n");
|
||||
|
||||
core_info_deinit_list();
|
||||
task_queue_deinit();
|
||||
|
@ -150,7 +150,7 @@ static int task_database_iterate_start(database_info_handle_t *db,
|
||||
#ifdef RARCH_INTERNAL
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
#else
|
||||
RARCH_LOG("msg: %s\n", msg);
|
||||
fprintf(stderr, "msg: %s\n", msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -741,8 +741,8 @@ static int database_info_list_iterate_new(database_state_handle_t *db_state,
|
||||
{
|
||||
const char *new_database = database_info_get_current_name(db_state);
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("Check database [%d/%d] : %s\n", (unsigned)db_state->list_index,
|
||||
#ifndef RARCH_INTERNAL
|
||||
fprintf(stderr, "Check database [%d/%d] : %s\n", (unsigned)db_state->list_index,
|
||||
(unsigned)db_state->list->size, new_database);
|
||||
#endif
|
||||
if (db_state->info)
|
||||
@ -808,6 +808,7 @@ static int database_info_list_iterate_found_match(
|
||||
(hash = strchr(entry_path_str, '#')))
|
||||
*hash = '\0';
|
||||
|
||||
#if defined(RARCH_INTERNAL)
|
||||
#if 0
|
||||
RARCH_LOG("Found match in database !\n");
|
||||
|
||||
@ -819,6 +820,17 @@ static int database_info_list_iterate_found_match(
|
||||
RARCH_LOG("ZIP entry: %s\n", archive_name);
|
||||
RARCH_LOG("entry path str: %s\n", entry_path_str);
|
||||
#endif
|
||||
#else
|
||||
fprintf(stderr, "Found match in database !\n");
|
||||
|
||||
fprintf(stderr, "Path: %s\n", db_path);
|
||||
fprintf(stderr, "CRC : %s\n", db_crc);
|
||||
fprintf(stderr, "Playlist Path: %s\n", db_playlist_path);
|
||||
fprintf(stderr, "Entry Path: %s\n", entry_path);
|
||||
fprintf(stderr, "Playlist not NULL: %d\n", playlist != NULL);
|
||||
fprintf(stderr, "ZIP entry: %s\n", archive_name);
|
||||
fprintf(stderr, "entry path str: %s\n", entry_path_str);
|
||||
#endif
|
||||
|
||||
if(!playlist_entry_exists(playlist, entry_path_str, db_crc))
|
||||
{
|
||||
@ -1243,7 +1255,7 @@ static void task_database_handler(retro_task_t *task)
|
||||
#ifdef RARCH_INTERNAL
|
||||
runloop_msg_queue_push(msg, 0, 180, true);
|
||||
#else
|
||||
RARCH_LOG("msg: %s\n", msg);
|
||||
fprintf(stderr, "msg: %s\n", msg);
|
||||
#endif
|
||||
goto task_finished;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user