From 8c75fd3530fb6380dc995a6041d47e13577d81de Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Tue, 5 May 2015 18:05:59 +0200 Subject: [PATCH] Split up database runloop data code to tasks/task_database.c --- Makefile.common | 3 ++- griffin/griffin.c | 3 +++ runloop_data.c | 28 -------------------------- tasks/task_database.c | 46 +++++++++++++++++++++++++++++++++++++++++++ tasks/tasks.h | 6 ++++++ 5 files changed, 57 insertions(+), 29 deletions(-) diff --git a/Makefile.common b/Makefile.common index 7bb669a344..3c7042fb53 100644 --- a/Makefile.common +++ b/Makefile.common @@ -197,7 +197,8 @@ OBJ += libretro-db/bintree.o \ libretro-db/query.o \ libretro-db/rmsgpack.o \ libretro-db/rmsgpack_dom.o \ - database_info.o + database_info.o \ + tasks/task_database.o endif # Miscellaneous diff --git a/griffin/griffin.c b/griffin/griffin.c index 322da0e96c..c0facf33e7 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -692,6 +692,9 @@ NETPLAY DATA RUNLOOP ============================================================ */ #include "../tasks/task_file_transfer.c" +#ifdef HAVE_LIBRETRODB +#include "../tasks/task_database.c" +#endif /*============================================================ SCREENSHOTS diff --git a/runloop_data.c b/runloop_data.c index d8a4c43c19..fcef21a36a 100644 --- a/runloop_data.c +++ b/runloop_data.c @@ -39,34 +39,6 @@ static void *rarch_main_data_get_ptr(void) return g_data_runloop; } -#ifdef HAVE_LIBRETRODB -#ifdef HAVE_MENU -static void rarch_main_data_db_iterate(bool is_thread, - data_runloop_t *runloop) -{ - menu_handle_t *menu = menu_driver_get_ptr(); - database_info_handle_t *db = menu ? menu->db : NULL; - - if (!db || !menu) - return; - - switch (db->status) - { - case DATABASE_STATUS_NONE: - break; - case DATABASE_STATUS_ITERATE: - database_info_iterate(db); - break; - case DATABASE_STATUS_FREE: - database_info_free(db); - db = NULL; - break; - } -} - -#endif -#endif - #ifdef HAVE_OVERLAY static void rarch_main_data_overlay_image_upload_iterate(bool is_thread, data_runloop_t *runloop) { diff --git a/tasks/task_database.c b/tasks/task_database.c index e69de29bb2..494b04d8a6 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -0,0 +1,46 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "../menu/menu_driver.h" + +#include "../runloop_data.h" +#include "tasks.h" + +#ifdef HAVE_LIBRETRODB +#ifdef HAVE_MENU +void rarch_main_data_db_iterate(bool is_thread, void *data) +{ + data_runloop_t *runloop = (data_runloop_t*)data; + menu_handle_t *menu = menu_driver_get_ptr(); + database_info_handle_t *db = menu ? menu->db : NULL; + + if (!db || !menu || !runloop) + return; + + switch (db->status) + { + case DATABASE_STATUS_NONE: + break; + case DATABASE_STATUS_ITERATE: + database_info_iterate(db); + break; + case DATABASE_STATUS_FREE: + database_info_free(db); + db = NULL; + break; + } +} +#endif +#endif diff --git a/tasks/tasks.h b/tasks/tasks.h index e9c989898e..d90cb1914b 100644 --- a/tasks/tasks.h +++ b/tasks/tasks.h @@ -44,6 +44,12 @@ void rarch_main_data_nbio_image_upload_iterate(bool is_thread, void *data); #endif +#ifdef HAVE_LIBRETRODB +#ifdef HAVE_MENU +void rarch_main_data_db_iterate(bool is_thread, void *data); +#endif +#endif + void rarch_main_data_nbio_iterate(bool is_thread, void *runloop);