From 2997af48fa45ca347d1796ea2bd7044a9024b3c7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 22 Oct 2014 03:35:04 +0200 Subject: [PATCH] Move config-file code to SDK --- Makefile.common | 6 +-- audio/dsp_filter.c | 2 +- audio/resamplers/resampler.c | 2 +- conf/config_file_userdata.h | 48 ----------------- core_info.h | 2 +- core_options.c | 2 +- general.h | 1 - gfx/filter.c | 2 +- gfx/shader/shader_gl_cg.c | 2 +- gfx/shader/shader_parse.h | 2 +- griffin/griffin.c | 4 +- input/input_common.h | 2 +- input/overlay.c | 2 +- input/udev_input.c | 1 - {conf => libretro-sdk/file}/config_file.c | 2 +- .../file}/config_file_userdata.c | 2 +- .../include/file}/config_file.h | 29 ++++++---- .../include/file}/config_file_macros.h | 31 ++++++----- .../include/file/config_file_userdata.h | 54 +++++++++++++++++++ record/ffmpeg.c | 2 +- settings.c | 4 +- settings_data.h | 2 +- tools/retroarch-joyconfig.c | 2 +- 23 files changed, 111 insertions(+), 95 deletions(-) delete mode 100644 conf/config_file_userdata.h rename {conf => libretro-sdk/file}/config_file.c (99%) rename {conf => libretro-sdk/file}/config_file_userdata.c (98%) rename {conf => libretro-sdk/include/file}/config_file.h (78%) rename {conf => libretro-sdk/include/file}/config_file_macros.h (59%) create mode 100644 libretro-sdk/include/file/config_file_userdata.h diff --git a/Makefile.common b/Makefile.common index 1d2c3b1a76..f0131a50ec 100644 --- a/Makefile.common +++ b/Makefile.common @@ -120,8 +120,8 @@ OBJ += frontend/frontend.o \ libretro-sdk/compat/compat.o \ cheats.o \ core_info.o \ - conf/config_file.o \ - conf/config_file_userdata.o \ + libretro-sdk/file/config_file.o \ + libretro-sdk/file/config_file_userdata.o \ screenshot.o \ gfx/scaler/scaler.o \ gfx/shader/shader_null.o \ @@ -632,7 +632,7 @@ endif # Joyconfig binary JOYCONFIG_OBJ += tools/retroarch-joyconfig.o \ - conf/config_file.o \ + libretro-sdk/file/config_file.o \ libretro-sdk/file/file_path.o \ libretro-sdk/string/string_list.o \ libretro-sdk/compat/compat.o \ diff --git a/audio/dsp_filter.c b/audio/dsp_filter.c index 347a4c2cf2..738a44b5b7 100644 --- a/audio/dsp_filter.c +++ b/audio/dsp_filter.c @@ -18,7 +18,7 @@ #include "dsp_filter.h" #include "../dynamic.h" -#include "../conf/config_file_userdata.h" +#include #include "filters/dspfilter.h" #include #include "../file_ext.h" diff --git a/audio/resamplers/resampler.c b/audio/resamplers/resampler.c index 0d93a533fd..66ba42cccf 100644 --- a/audio/resamplers/resampler.c +++ b/audio/resamplers/resampler.c @@ -17,7 +17,7 @@ #ifdef RARCH_INTERNAL #include "../../performance.h" #endif -#include "../../conf/config_file_userdata.h" +#include #include static const rarch_resampler_t *resampler_drivers[] = { diff --git a/conf/config_file_userdata.h b/conf/config_file_userdata.h deleted file mode 100644 index e62a90a37d..0000000000 --- a/conf/config_file_userdata.h +++ /dev/null @@ -1,48 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - 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 . - */ - -#ifndef _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H -#define _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H - -#include -#include "config_file.h" - -struct config_file_userdata -{ - config_file_t *conf; - const char *prefix[2]; -}; - -int config_userdata_get_float(void *userdata, const char *key_str, - float *value, float default_value); - -int config_userdata_get_int(void *userdata, const char *key_str, - int *value, int default_value); - -int config_userdata_get_float_array(void *userdata, const char *key_str, - float **values, unsigned *out_num_values, - const float *default_values, unsigned num_default_values); - -int config_userdata_get_int_array(void *userdata, const char *key_str, - int **values, unsigned *out_num_values, - const int *default_values, unsigned num_default_values); - -int config_userdata_get_string(void *userdata, const char *key_str, - char **output, const char *default_output); - -void config_userdata_free(void *ptr); - -#endif diff --git a/core_info.h b/core_info.h index cab03d7adc..d86b5472d3 100644 --- a/core_info.h +++ b/core_info.h @@ -18,7 +18,7 @@ #ifndef CORE_INFO_H_ #define CORE_INFO_H_ -#include "conf/config_file.h" +#include #include #ifdef __cplusplus diff --git a/core_options.c b/core_options.c index 3b88ca0d0d..bba6860bd6 100644 --- a/core_options.c +++ b/core_options.c @@ -15,7 +15,7 @@ #include "core_options.h" #include -#include "conf/config_file.h" +#include #include #include #include diff --git a/general.h b/general.h index 5367e8698e..8350d55af0 100644 --- a/general.h +++ b/general.h @@ -805,7 +805,6 @@ const char *config_get_default_joypad(void); const char *config_get_default_menu(void); #endif -#include "conf/config_file.h" bool config_save_file(const char *path); void rarch_main_state_new(void); diff --git a/gfx/filter.c b/gfx/filter.c index f08a913c98..5b9c9c2b37 100644 --- a/gfx/filter.c +++ b/gfx/filter.c @@ -16,7 +16,7 @@ #include "filter.h" #include "filters/softfilter.h" #include "../dynamic.h" -#include "../conf/config_file_userdata.h" +#include #include "../general.h" #include #include "../file_ext.h" diff --git a/gfx/shader/shader_gl_cg.c b/gfx/shader/shader_gl_cg.c index 12d0de5443..07458af7e1 100644 --- a/gfx/shader/shader_gl_cg.c +++ b/gfx/shader/shader_gl_cg.c @@ -32,7 +32,7 @@ #include #include #include -#include "../../conf/config_file.h" +#include #include "../../dynamic.h" #include diff --git a/gfx/shader/shader_parse.h b/gfx/shader/shader_parse.h index d60232d2f1..e504059cc6 100644 --- a/gfx/shader/shader_parse.h +++ b/gfx/shader/shader_parse.h @@ -17,8 +17,8 @@ #define SHADER_PARSE_H #include +#include #include "../state_tracker.h" -#include "../../conf/config_file.h" #include #ifdef __cplusplus diff --git a/griffin/griffin.c b/griffin/griffin.c index 02cf7a9bc0..1796e99e18 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -72,8 +72,8 @@ CONFIG FILE #undef strcasecmp #endif -#include "../conf/config_file.c" -#include "../conf/config_file_userdata.c" +#include "../libretro-sdk/file/config_file.c" +#include "../libretro-sdk/file/config_file_userdata.c" #include "../core_options.c" /*============================================================ diff --git a/input/input_common.h b/input/input_common.h index e7b4df2c59..83ac2d480e 100644 --- a/input/input_common.h +++ b/input/input_common.h @@ -18,7 +18,7 @@ #include "input_autodetect.h" #include "../driver.h" -#include "../conf/config_file.h" +#include #include "../general.h" #include diff --git a/input/overlay.c b/input/overlay.c index 28c3962d44..1e2a1c3089 100644 --- a/input/overlay.c +++ b/input/overlay.c @@ -18,7 +18,7 @@ #include "../driver.h" #include "../libretro.h" #include "../gfx/image/image.h" -#include "../conf/config_file.h" +#include #include #include "input_common.h" #include diff --git a/input/udev_input.c b/input/udev_input.c index d367784430..a1c66a386f 100644 --- a/input/udev_input.c +++ b/input/udev_input.c @@ -16,7 +16,6 @@ #include "input_common.h" #include "keyboard_line.h" #include "../general.h" -#include "../conf/config_file.h" #include #include #include diff --git a/conf/config_file.c b/libretro-sdk/file/config_file.c similarity index 99% rename from conf/config_file.c rename to libretro-sdk/file/config_file.c index 827df88831..96c31682f3 100644 --- a/conf/config_file.c +++ b/libretro-sdk/file/config_file.c @@ -13,7 +13,7 @@ * If not, see . */ -#include "config_file.h" +#include #include #include #include diff --git a/conf/config_file_userdata.c b/libretro-sdk/file/config_file_userdata.c similarity index 98% rename from conf/config_file_userdata.c rename to libretro-sdk/file/config_file_userdata.c index f8a91ed312..56a0206953 100644 --- a/conf/config_file_userdata.c +++ b/libretro-sdk/file/config_file_userdata.c @@ -14,7 +14,7 @@ * If not, see . */ -#include "config_file_userdata.h" +#include #include #define get_array_setup() \ diff --git a/conf/config_file.h b/libretro-sdk/include/file/config_file.h similarity index 78% rename from conf/config_file.h rename to libretro-sdk/include/file/config_file.h index 48a6c27599..13a35e4e69 100644 --- a/conf/config_file.h +++ b/libretro-sdk/include/file/config_file.h @@ -1,16 +1,23 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * - * 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. +/* Copyright (C) 2010-2014 The RetroArch team * - * 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. + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (config_file.h). + * --------------------------------------------------------------------------------------- * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . + * 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. */ diff --git a/conf/config_file_macros.h b/libretro-sdk/include/file/config_file_macros.h similarity index 59% rename from conf/config_file_macros.h rename to libretro-sdk/include/file/config_file_macros.h index 2121246f8b..9c055b7ab7 100644 --- a/conf/config_file_macros.h +++ b/libretro-sdk/include/file/config_file_macros.h @@ -1,17 +1,23 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - 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. +/* Copyright (C) 2010-2014 The RetroArch team * - * 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. + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (config_file_macros.h). + * --------------------------------------------------------------------------------------- * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . + * 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_CONFIG_FILE_MACROS_H__ @@ -64,4 +70,3 @@ #define CONFIG_GET_PATH_EXTERN(var, key) CONFIG_GET_PATH_BASE(conf, g_extern, var, key) #endif - diff --git a/libretro-sdk/include/file/config_file_userdata.h b/libretro-sdk/include/file/config_file_userdata.h new file mode 100644 index 0000000000..da3d533f74 --- /dev/null +++ b/libretro-sdk/include/file/config_file_userdata.h @@ -0,0 +1,54 @@ +/* Copyright (C) 2010-2014 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (config_file_userdata.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_CONFIG_FILE_USERDATA_H +#define _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H + +#include +#include "config_file.h" + +struct config_file_userdata +{ + config_file_t *conf; + const char *prefix[2]; +}; + +int config_userdata_get_float(void *userdata, const char *key_str, + float *value, float default_value); + +int config_userdata_get_int(void *userdata, const char *key_str, + int *value, int default_value); + +int config_userdata_get_float_array(void *userdata, const char *key_str, + float **values, unsigned *out_num_values, + const float *default_values, unsigned num_default_values); + +int config_userdata_get_int_array(void *userdata, const char *key_str, + int **values, unsigned *out_num_values, + const int *default_values, unsigned num_default_values); + +int config_userdata_get_string(void *userdata, const char *key_str, + char **output, const char *default_output); + +void config_userdata_free(void *ptr); + +#endif diff --git a/record/ffmpeg.c b/record/ffmpeg.c index 64942a267a..526925873a 100644 --- a/record/ffmpeg.c +++ b/record/ffmpeg.c @@ -47,7 +47,7 @@ extern "C" { #include #include "../general.h" #include "../gfx/scaler/scaler.h" -#include "../conf/config_file.h" +#include #include "../audio/utils.h" #include "ffemu.h" #include diff --git a/settings.c b/settings.c index 78a1204a41..c055cc90c4 100644 --- a/settings.c +++ b/settings.c @@ -13,8 +13,8 @@ * If not, see . */ -#include "conf/config_file.h" -#include "conf/config_file_macros.h" +#include +#include #include #include #include "config.def.h" diff --git a/settings_data.h b/settings_data.h index 166570d3d8..526e5dd1c1 100644 --- a/settings_data.h +++ b/settings_data.h @@ -17,7 +17,7 @@ #define __RARCH_SETTINGS_DATA_H__ #include -#include "conf/config_file.h" +#include #include #include "settings_list.h" diff --git a/tools/retroarch-joyconfig.c b/tools/retroarch-joyconfig.c index f6f1c74872..a120f191f3 100644 --- a/tools/retroarch-joyconfig.c +++ b/tools/retroarch-joyconfig.c @@ -17,7 +17,7 @@ #include "config.h" #endif -#include "conf/config_file.h" +#include #include #include #include