Split up database runloop data code to tasks/task_database.c

This commit is contained in:
Twinaphex 2015-05-05 18:05:59 +02:00
parent a04debf7c5
commit 8c75fd3530
5 changed files with 57 additions and 29 deletions

View File

@ -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

View File

@ -692,6 +692,9 @@ NETPLAY
DATA RUNLOOP
============================================================ */
#include "../tasks/task_file_transfer.c"
#ifdef HAVE_LIBRETRODB
#include "../tasks/task_database.c"
#endif
/*============================================================
SCREENSHOTS

View File

@ -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)
{

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -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);