(SDK) Move fifo_buffer.c to libretro SDK

This commit is contained in:
twinaphex 2015-01-11 05:43:10 +01:00
parent 1463d5e7dc
commit 751f2b7403
15 changed files with 111 additions and 91 deletions

View File

@ -116,7 +116,7 @@ OBJ += frontend/frontend.o \
input/keyboard_line.o \ input/keyboard_line.o \
input/overlay.o \ input/overlay.o \
patch.o \ patch.o \
fifo_buffer.o \ libretro-sdk/queues/fifo_buffer.o \
core_options.o \ core_options.o \
libretro-sdk/compat/compat.o \ libretro-sdk/compat/compat.o \
cheats.o \ cheats.o \

View File

@ -20,7 +20,7 @@
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#include "../general.h" #include "../general.h"
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#define TRY_ALSA(x) if (x < 0) { \ #define TRY_ALSA(x) if (x < 0) { \
goto error; \ goto error; \

View File

@ -18,7 +18,7 @@
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include "../general.h" #include "../general.h"
#include "../performance.h" #include "../performance.h"
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -17,7 +17,7 @@
#include "../driver.h" #include "../driver.h"
#include "../general.h" #include "../general.h"
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#include <stdlib.h> #include <stdlib.h>
#include <boolean.h> #include <boolean.h>
#include <pthread.h> #include <pthread.h>

View File

@ -52,7 +52,7 @@ static DSMIXBINS dsmb;
#include <mmsystem.h> #include <mmsystem.h>
#endif #endif
#include <dsound.h> #include <dsound.h>
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#include "../general.h" #include "../general.h"
typedef struct dsound typedef struct dsound

View File

@ -19,7 +19,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#include "../ps3/sdk_defines.h" #include "../ps3/sdk_defines.h"

View File

@ -17,7 +17,7 @@
#include "../driver.h" #include "../driver.h"
#include <stdlib.h> #include <stdlib.h>
#include "rsound.h" #include "rsound.h"
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#include <boolean.h> #include <boolean.h>
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>

View File

@ -30,7 +30,7 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#ifdef _WIN32 #ifdef _WIN32
#define RSD_DEFAULT_HOST "127.0.0.1" // Stupid Windows. #define RSD_DEFAULT_HOST "127.0.0.1" // Stupid Windows.

View File

@ -26,7 +26,7 @@
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include "../general.h" #include "../general.h"
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
typedef struct sdl_audio typedef struct sdl_audio
{ {

View File

@ -1,54 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* 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/>.
*/
#ifndef __FIFO_BUFFER_H
#define __FIFO_BUFFER_H
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
struct fifo_buffer
{
uint8_t *buffer;
size_t bufsize;
size_t first;
size_t end;
};
typedef struct fifo_buffer fifo_buffer_t;
fifo_buffer_t *fifo_new(size_t size);
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size);
void fifo_free(fifo_buffer_t *buffer);
size_t fifo_read_avail(fifo_buffer_t *buffer);
size_t fifo_write_avail(fifo_buffer_t *buffer);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -405,7 +405,7 @@ STATE TRACKER
/*============================================================ /*============================================================
FIFO BUFFER FIFO BUFFER
============================================================ */ ============================================================ */
#include "../fifo_buffer.c" #include "../libretro-sdk/queues/fifo_buffer.c"
/*============================================================ /*============================================================
AUDIO RESAMPLER AUDIO RESAMPLER

View File

@ -0,0 +1,60 @@
/* Copyright (C) 2010-2015 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (boolean.h).
* ---------------------------------------------------------------------------------------
*
* 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:
*
* 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 __LIBRETRO_SDK_FIFO_BUFFER_H
#define __LIBRETRO_SDK_FIFO_BUFFER_H
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
struct fifo_buffer
{
uint8_t *buffer;
size_t bufsize;
size_t first;
size_t end;
};
typedef struct fifo_buffer fifo_buffer_t;
fifo_buffer_t *fifo_new(size_t size);
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size);
void fifo_free(fifo_buffer_t *buffer);
size_t fifo_read_avail(fifo_buffer_t *buffer);
size_t fifo_write_avail(fifo_buffer_t *buffer);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,27 +1,35 @@
/* RetroArch - A frontend for libretro. /* Copyright (C) 2010-2015 The RetroArch team
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* 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- * The following license statement only applies to this file (rthreads.c).
* 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; * Permission is hereby granted, free of charge,
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * to any person obtaining a copy of this software and associated documentation files (the "Software"),
* PURPOSE. See the GNU General Public License for more details. * 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. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* If not, see <http://www.gnu.org/licenses/>. *
* 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 <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "fifo_buffer.h" #include <queues/fifo_buffer.h>
fifo_buffer_t *fifo_new(size_t size) fifo_buffer_t *fifo_new(size_t size)
{ {
fifo_buffer_t *buf = (fifo_buffer_t*)calloc(1, sizeof(*buf)); fifo_buffer_t *buf = (fifo_buffer_t*)calloc(1, sizeof(*buf));
if (!buf) if (!buf)
return NULL; return NULL;
@ -38,7 +46,7 @@ fifo_buffer_t *fifo_new(size_t size)
void fifo_free(fifo_buffer_t *buffer) void fifo_free(fifo_buffer_t *buffer)
{ {
if(!buffer) if (!buffer)
return; return;
free(buffer->buffer); free(buffer->buffer);

View File

@ -1,17 +1,23 @@
/* RetroArch - A frontend for libretro. /* Copyright (C) 2010-2015 The RetroArch team
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* 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- * The following license statement only applies to this file (rthreads.c).
* 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; * Permission is hereby granted, free of charge,
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * to any person obtaining a copy of this software and associated documentation files (the "Software"),
* PURPOSE. See the GNU General Public License for more details. * 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. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* If not, see <http://www.gnu.org/licenses/>. *
* 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 <stdlib.h> #include <stdlib.h>

View File

@ -44,7 +44,7 @@ extern "C" {
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <boolean.h> #include <boolean.h>
#include "../fifo_buffer.h" #include <queues/fifo_buffer.h>
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include "../general.h" #include "../general.h"
#include <gfx/scaler/scaler.h> #include <gfx/scaler/scaler.h>