From 48317e66b9c20b1ae28a97a016b5643573bca87f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 24 Jan 2016 00:40:34 +0100 Subject: [PATCH] Create task_content.c - WIP --- Makefile.common | 1 + griffin/griffin.c | 1 + menu/menu_driver.c | 39 --------------------------- tasks/task_content.c | 64 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 39 deletions(-) create mode 100644 tasks/task_content.c diff --git a/Makefile.common b/Makefile.common index 6f8b3eeb4f..97b90095ae 100644 --- a/Makefile.common +++ b/Makefile.common @@ -123,6 +123,7 @@ OBJ += frontend/frontend.o \ intl/msg_hash_us.o \ runloop.o \ tasks/tasks.o \ + tasks/task_content.o \ tasks/task_file_transfer.o \ content.o \ libretro-common/encodings/encoding_utf.o \ diff --git a/griffin/griffin.c b/griffin/griffin.c index 52ca2df197..402e006944 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -753,6 +753,7 @@ NETPLAY /*============================================================ DATA RUNLOOP ============================================================ */ +#include "../tasks/task_content.c" #include "../tasks/task_file_transfer.c" #ifdef HAVE_ZLIB #include "../tasks/task_decompress.c" diff --git a/menu/menu_driver.c b/menu/menu_driver.c index def504c198..6586a98d37 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -474,45 +474,6 @@ bool menu_load_content(enum rarch_core_type type) return true; } -int menu_common_load_content( - const char *core_path, const char *fullpath, - bool persist, enum rarch_core_type type) -{ - enum event_command cmd = EVENT_CMD_NONE; - - if (core_path) - { - runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path); - event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL); - } - - if (fullpath) - runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)fullpath); - - switch (type) - { - case CORE_TYPE_PLAIN: - case CORE_TYPE_DUMMY: - cmd = persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT; - break; -#ifdef HAVE_FFMPEG - case CORE_TYPE_FFMPEG: - cmd = EVENT_CMD_LOAD_CONTENT_FFMPEG; - break; -#endif - case CORE_TYPE_IMAGEVIEWER: -#ifdef HAVE_IMAGEVIEWER - cmd = EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER; -#endif - break; - } - - if (cmd != EVENT_CMD_NONE) - event_cmd_ctl(cmd, NULL); - - return -1; -} - /** * menu_free: * @menu : Menu handle. diff --git a/tasks/task_content.c b/tasks/task_content.c new file mode 100644 index 0000000000..b8cdafdaf5 --- /dev/null +++ b/tasks/task_content.c @@ -0,0 +1,64 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2016 - 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 + +#include "tasks.h" +#include "../command_event.h" + +int menu_common_load_content( + const char *core_path, const char *fullpath, + bool persist, enum rarch_core_type type) +{ + enum event_command cmd = EVENT_CMD_NONE; + + if (core_path) + { + runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path); + event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL); + } + + if (fullpath) + runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)fullpath); + + switch (type) + { + case CORE_TYPE_PLAIN: + case CORE_TYPE_DUMMY: + cmd = persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT; + break; +#ifdef HAVE_FFMPEG + case CORE_TYPE_FFMPEG: + cmd = EVENT_CMD_LOAD_CONTENT_FFMPEG; + break; +#endif + case CORE_TYPE_IMAGEVIEWER: +#ifdef HAVE_IMAGEVIEWER + cmd = EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER; +#endif + break; + } + + if (cmd != EVENT_CMD_NONE) + event_cmd_ctl(cmd, NULL); + + return -1; +} + +bool rarch_task_push_content_load_default( + rarch_task_callback_t cb, void *user_data) +{ + return true; +}