mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 22:38:34 +00:00
Move task_queue.c to libretro-common
This commit is contained in:
parent
8d47203ad1
commit
31112e937b
@ -122,7 +122,7 @@ OBJ += frontend/frontend.o \
|
||||
intl/msg_hash_pt.o \
|
||||
intl/msg_hash_us.o \
|
||||
runloop.o \
|
||||
tasks/task_queue.o \
|
||||
libretro-common/rthreads/task_queue.o \
|
||||
tasks/tasks_internal.o \
|
||||
tasks/task_content.o \
|
||||
tasks/task_file_transfer.o \
|
||||
|
@ -700,7 +700,7 @@ RETROARCH
|
||||
#include "../libretro_version_1.c"
|
||||
#include "../retroarch.c"
|
||||
#include "../runloop.c"
|
||||
#include "../tasks/task_queue.c"
|
||||
#include "../libretro-common/rthreads/task_queue.c"
|
||||
#include "../tasks/tasks_internal.c"
|
||||
|
||||
#include "../msg_hash.c"
|
||||
|
@ -1,21 +1,27 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2016 - Higor Euripedes
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
/* Copyright (C) 2010-2016 The RetroArch team
|
||||
*
|
||||
* 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.
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (task_queue.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef TASK_QUEUE_H
|
||||
#define TASK_QUEUE_H
|
||||
#ifndef __LIBRETRO_SDK_TASK_QUEUE_H__
|
||||
#define __LIBRETRO_SDK_TASK_QUEUE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
@ -1,24 +1,30 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2016 - Higor Euripedes
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
/* Copyright (C) 2010-2016 The RetroArch team
|
||||
*
|
||||
* 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.
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (task_queue.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "task_queue.h"
|
||||
#include <rthreads/task_queue.h>
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#include <rthreads/rthreads.h>
|
||||
@ -44,6 +50,44 @@ struct retro_task_impl
|
||||
static task_queue_t tasks_running = {NULL, NULL};
|
||||
static task_queue_t tasks_finished = {NULL, NULL};
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
static void task_queue_msg_push(unsigned prio, unsigned duration,
|
||||
bool flush, const char *fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
/* print something here */
|
||||
}
|
||||
|
||||
void task_queue_push_progress(retro_task_t *task)
|
||||
{
|
||||
if (task->title)
|
||||
{
|
||||
if (task->finished)
|
||||
{
|
||||
if (task->error)
|
||||
task_queue_msg_push(1, 60, true, "%s: %s",
|
||||
"Task failed\n", task->title);
|
||||
else
|
||||
task_queue_msg_push(1, 60, true, "100%%: %s", task->title);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (task->progress >= 0 && task->progress <= 100)
|
||||
task_queue_msg_push(1, 60, true, "%i%%: %s",
|
||||
task->progress, task->title);
|
||||
else
|
||||
task_queue_msg_push(1, 60, true, "%s...", task->title);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void task_queue_put(task_queue_t *queue, retro_task_t *task)
|
||||
{
|
||||
task->next = NULL;
|
@ -55,7 +55,6 @@
|
||||
#include "configuration.h"
|
||||
#include "general.h"
|
||||
#include "runloop.h"
|
||||
#include "tasks/task_queue.h"
|
||||
#include "performance.h"
|
||||
#include "cheats.h"
|
||||
#include "system.h"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#ifdef HAVE_THREADS
|
||||
#include <rthreads/rthreads.h>
|
||||
#endif
|
||||
#include <rthreads/task_queue.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
@ -54,7 +55,6 @@
|
||||
|
||||
#include "msg_hash.h"
|
||||
|
||||
#include "tasks/task_queue.h"
|
||||
#include "input/input_keyboard.h"
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
|
@ -18,12 +18,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "task_queue.h"
|
||||
#include "tasks_internal.h"
|
||||
|
||||
#include "../msg_hash.h"
|
||||
#include "../runloop.h"
|
||||
|
||||
static void task_msg_queue_pushf(unsigned prio, unsigned duration,
|
||||
static void task_queue_msg_push(unsigned prio, unsigned duration,
|
||||
bool flush, const char *fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
@ -42,18 +42,18 @@ void task_queue_push_progress(retro_task_t *task)
|
||||
if (task->finished)
|
||||
{
|
||||
if (task->error)
|
||||
task_msg_queue_pushf(1, 60, true, "%s: %s",
|
||||
task_queue_msg_push(1, 60, true, "%s: %s",
|
||||
msg_hash_to_str(MSG_TASK_FAILED), task->title);
|
||||
else
|
||||
task_msg_queue_pushf(1, 60, true, "100%%: %s", task->title);
|
||||
task_queue_msg_push(1, 60, true, "100%%: %s", task->title);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (task->progress >= 0 && task->progress <= 100)
|
||||
task_msg_queue_pushf(1, 60, true, "%i%%: %s",
|
||||
task_queue_msg_push(1, 60, true, "%i%%: %s",
|
||||
task->progress, task->title);
|
||||
else
|
||||
task_msg_queue_pushf(1, 60, true, "%s...", task->title);
|
||||
task_queue_msg_push(1, 60, true, "%s...", task->title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "task_queue.h"
|
||||
#include <rthreads/task_queue.h>
|
||||
|
||||
#include "../runloop.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user