mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-16 07:16:36 +00:00
72 lines
2.8 KiB
C
72 lines
2.8 KiB
C
/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes.
|
|
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
|
* Copyright (C) 2011-2012 - Daniel De Matteis
|
|
*
|
|
* Some code herein may be based on code found in BSNES.
|
|
*
|
|
* SSNES 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.
|
|
*
|
|
* SSNES 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 SSNES.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef CONFIG_FILE_MACROS_H__
|
|
#define CONFIG_FILE_MACROS_H__
|
|
|
|
// Macros to ease config getting.
|
|
#include <stdint.h>
|
|
|
|
#define CONFIG_GET_BOOL_BASE(conf, base, var, key) do { \
|
|
bool tmp; \
|
|
if (config_get_bool(conf, key, &tmp)) \
|
|
base.var = tmp; \
|
|
} while(0)
|
|
|
|
#define CONFIG_GET_INT_BASE(conf, base, var, key) do { \
|
|
int tmp; \
|
|
if (config_get_int(conf, key, &tmp)) \
|
|
base.var = tmp; \
|
|
} while(0)
|
|
|
|
#define CONFIG_GET_UINT64_BASE(conf, base, var, key) do { \
|
|
uint64_t tmp; \
|
|
if (config_get_int(conf, key, &tmp)) \
|
|
base.var = tmp; \
|
|
} while(0)
|
|
|
|
#define CONFIG_GET_FLOAT_BASE(conf, base, var, key) do { \
|
|
float tmp; \
|
|
if (config_get_float(conf, key, &tmp)) \
|
|
base.var = tmp; \
|
|
} while(0)
|
|
|
|
#define CONFIG_GET_STRING_BASE(conf, base, var, key) \
|
|
config_get_array(conf, key, base.var, sizeof(base.var))
|
|
|
|
#define CONFIG_GET_BOOL(var, key) CONFIG_GET_BOOL_BASE(conf, g_settings, var, key)
|
|
#define CONFIG_GET_INT(var, key) CONFIG_GET_INT_BASE(conf, g_settings, var, key)
|
|
#define CONFIG_GET_UINT64(var, key) CONFIG_GET_UINT64_BASE(conf, g_settings, var, key)
|
|
#define CONFIG_GET_FLOAT(var, key) CONFIG_GET_FLOAT_BASE(conf, g_settings, var, key)
|
|
#define CONFIG_GET_STRING(var, key) CONFIG_GET_STRING_BASE(conf, g_settings, var, key)
|
|
|
|
#define CONFIG_GET_BOOL_EXTERN(var, key) CONFIG_GET_BOOL_BASE(conf, g_extern, var, key)
|
|
#define CONFIG_GET_INT_EXTERN(var, key) CONFIG_GET_INT_BASE(conf, g_extern, var, key)
|
|
#define CONFIG_GET_FLOAT_EXTERN(var, key) CONFIG_GET_FLOAT_BASE(conf, g_extern, var, key)
|
|
#define CONFIG_GET_STRING_EXTERN(var, key) CONFIG_GET_STRING_BASE(conf, g_extern, var, key)
|
|
|
|
#ifdef SSNES_CONSOLE
|
|
#define CONFIG_GET_BOOL_CONSOLE(var, key) CONFIG_GET_BOOL_BASE(conf, g_console, var, key)
|
|
#define CONFIG_GET_INT_CONSOLE(var, key) CONFIG_GET_INT_BASE(conf, g_console, var, key)
|
|
#define CONFIG_GET_FLOAT_CONSOLE(var, key) CONFIG_GET_FLOAT_BASE(conf, g_console, var, key)
|
|
#define CONFIG_GET_STRING_CONSOLE(var, key) CONFIG_GET_STRING_BASE(conf, g_console, var, key)
|
|
#endif
|
|
|
|
#endif
|
|
|