2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2015-01-07 16:46:50 +00:00
|
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
2015-04-05 16:14:24 +00:00
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2010-12-30 00:50:37 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2010-12-30 00:50:37 +00:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2010-12-30 00:50:37 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-06-22 18:42:41 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
|
2014-10-22 01:35:04 +00:00
|
|
|
#include <file/config_file.h>
|
2015-06-22 18:42:41 +00:00
|
|
|
#include <file/file_path.h>
|
2014-10-21 05:58:58 +00:00
|
|
|
#include <compat/strl.h>
|
|
|
|
#include <compat/posix_string.h>
|
2015-06-22 18:42:41 +00:00
|
|
|
|
2011-01-08 21:15:02 +00:00
|
|
|
#include "config.def.h"
|
2013-04-26 09:44:54 +00:00
|
|
|
#include "input/input_common.h"
|
2015-01-12 01:52:52 +00:00
|
|
|
#include "input/input_keymaps.h"
|
2015-01-24 22:49:35 +00:00
|
|
|
#include "input/input_remapping.h"
|
2015-03-20 23:42:09 +00:00
|
|
|
#include "configuration.h"
|
2015-02-14 04:52:05 +00:00
|
|
|
#include "general.h"
|
2015-06-25 09:04:51 +00:00
|
|
|
#include "system.h"
|
2011-01-07 16:59:53 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2010-12-30 02:02:30 +00:00
|
|
|
#include "config.h"
|
2011-01-07 16:59:53 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-21 06:39:51 +00:00
|
|
|
#define CONFIG_GET_BOOL_BASE(conf, base, var, key) do { \
|
|
|
|
bool tmp = false; \
|
|
|
|
if (config_get_bool(conf, key, &tmp)) \
|
|
|
|
base->var = tmp; \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define CONFIG_GET_INT_BASE(conf, base, var, key) do { \
|
|
|
|
int tmp = 0; \
|
|
|
|
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 = 0; \
|
|
|
|
if (config_get_int(conf, key, &tmp)) \
|
|
|
|
base->var = tmp; \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define CONFIG_GET_HEX_BASE(conf, base, var, key) do { \
|
|
|
|
unsigned tmp = 0; \
|
|
|
|
if (config_get_hex(conf, key, &tmp)) \
|
|
|
|
base->var = tmp; \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define CONFIG_GET_FLOAT_BASE(conf, base, var, key) do { \
|
|
|
|
float tmp = 0.0f; \
|
|
|
|
if (config_get_float(conf, key, &tmp)) \
|
|
|
|
base->var = tmp; \
|
|
|
|
} while(0)
|
|
|
|
|
2015-03-21 07:05:50 +00:00
|
|
|
#define CONFIG_GET_STRING_BASE(conf, base, var, key) config_get_array(conf, key, base->var, sizeof(base->var))
|
|
|
|
#define CONFIG_GET_PATH_BASE(conf, base, var, key) config_get_path (conf, key, base->var, sizeof(base->var))
|
2015-03-21 06:39:51 +00:00
|
|
|
|
2015-03-21 00:47:06 +00:00
|
|
|
static settings_t *g_config;
|
2014-06-12 16:06:29 +00:00
|
|
|
struct defaults g_defaults;
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_audio:
|
|
|
|
*
|
|
|
|
* Gets default audio driver.
|
|
|
|
*
|
|
|
|
* Returns: Default audio driver.
|
|
|
|
**/
|
2012-05-07 21:20:13 +00:00
|
|
|
const char *config_get_default_audio(void)
|
2010-12-29 18:00:21 +00:00
|
|
|
{
|
2010-12-29 19:50:50 +00:00
|
|
|
switch (AUDIO_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case AUDIO_RSOUND:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "rsound";
|
2010-12-29 19:50:50 +00:00
|
|
|
case AUDIO_OSS:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "oss";
|
2010-12-29 19:50:50 +00:00
|
|
|
case AUDIO_ALSA:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "alsa";
|
2013-01-04 19:58:34 +00:00
|
|
|
case AUDIO_ALSATHREAD:
|
|
|
|
return "alsathread";
|
2010-12-29 19:50:50 +00:00
|
|
|
case AUDIO_ROAR:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "roar";
|
2011-08-08 15:27:52 +00:00
|
|
|
case AUDIO_COREAUDIO:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "coreaudio";
|
2010-12-29 19:50:50 +00:00
|
|
|
case AUDIO_AL:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "openal";
|
2012-10-18 03:45:21 +00:00
|
|
|
case AUDIO_SL:
|
|
|
|
return "opensl";
|
2011-01-07 16:59:53 +00:00
|
|
|
case AUDIO_SDL:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "sdl";
|
2014-08-22 22:15:44 +00:00
|
|
|
case AUDIO_SDL2:
|
|
|
|
return "sdl2";
|
2011-08-04 16:45:40 +00:00
|
|
|
case AUDIO_DSOUND:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "dsound";
|
2011-01-27 00:46:00 +00:00
|
|
|
case AUDIO_XAUDIO:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "xaudio";
|
2011-01-29 00:15:09 +00:00
|
|
|
case AUDIO_PULSE:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "pulse";
|
2011-05-14 23:46:11 +00:00
|
|
|
case AUDIO_EXT:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "ext";
|
2011-12-13 22:17:37 +00:00
|
|
|
case AUDIO_XENON360:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "xenon360";
|
2011-12-14 11:49:13 +00:00
|
|
|
case AUDIO_PS3:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "ps3";
|
2011-12-14 11:49:13 +00:00
|
|
|
case AUDIO_WII:
|
2012-08-09 01:54:27 +00:00
|
|
|
return "gx";
|
2014-02-17 13:26:03 +00:00
|
|
|
case AUDIO_PSP1:
|
|
|
|
return "psp1";
|
2015-04-01 21:14:13 +00:00
|
|
|
case AUDIO_CTR:
|
|
|
|
return "ctr";
|
2013-08-28 04:03:25 +00:00
|
|
|
case AUDIO_RWEBAUDIO:
|
|
|
|
return "rwebaudio";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2010-12-29 19:50:50 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2012-05-07 21:20:13 +00:00
|
|
|
}
|
2010-12-29 19:50:50 +00:00
|
|
|
|
2015-04-15 11:37:38 +00:00
|
|
|
const char *config_get_default_record(void)
|
|
|
|
{
|
|
|
|
switch (RECORD_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case RECORD_FFMPEG:
|
|
|
|
return "ffmpeg";
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "null";
|
|
|
|
}
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_audio_resampler:
|
|
|
|
*
|
|
|
|
* Gets default audio resampler driver.
|
|
|
|
*
|
|
|
|
* Returns: Default audio resampler driver.
|
|
|
|
**/
|
2014-07-18 17:11:53 +00:00
|
|
|
const char *config_get_default_audio_resampler(void)
|
|
|
|
{
|
|
|
|
switch (AUDIO_DEFAULT_RESAMPLER_DRIVER)
|
|
|
|
{
|
|
|
|
case AUDIO_RESAMPLER_CC:
|
|
|
|
return "cc";
|
|
|
|
case AUDIO_RESAMPLER_SINC:
|
|
|
|
return "sinc";
|
2014-10-03 11:34:55 +00:00
|
|
|
case AUDIO_RESAMPLER_NEAREST:
|
|
|
|
return "nearest";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2014-07-18 17:11:53 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2014-07-18 17:11:53 +00:00
|
|
|
}
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_video:
|
|
|
|
*
|
|
|
|
* Gets default video driver.
|
|
|
|
*
|
|
|
|
* Returns: Default video driver.
|
|
|
|
**/
|
2012-05-07 21:20:13 +00:00
|
|
|
const char *config_get_default_video(void)
|
|
|
|
{
|
|
|
|
switch (VIDEO_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case VIDEO_GL:
|
|
|
|
return "gl";
|
|
|
|
case VIDEO_WII:
|
2012-08-09 01:54:27 +00:00
|
|
|
return "gx";
|
2012-05-07 21:20:13 +00:00
|
|
|
case VIDEO_XENON360:
|
|
|
|
return "xenon360";
|
2012-07-07 17:15:06 +00:00
|
|
|
case VIDEO_XDK_D3D:
|
2012-10-26 19:09:30 +00:00
|
|
|
case VIDEO_D3D9:
|
2014-01-01 00:09:31 +00:00
|
|
|
return "d3d";
|
2012-11-23 04:20:05 +00:00
|
|
|
case VIDEO_PSP1:
|
|
|
|
return "psp1";
|
2012-11-26 02:16:20 +00:00
|
|
|
case VIDEO_VITA:
|
|
|
|
return "vita";
|
2015-04-01 21:14:13 +00:00
|
|
|
case VIDEO_CTR:
|
|
|
|
return "ctr";
|
2012-05-07 21:20:13 +00:00
|
|
|
case VIDEO_XVIDEO:
|
|
|
|
return "xvideo";
|
|
|
|
case VIDEO_SDL:
|
|
|
|
return "sdl";
|
2014-08-22 22:15:44 +00:00
|
|
|
case VIDEO_SDL2:
|
|
|
|
return "sdl2";
|
2012-05-07 21:20:13 +00:00
|
|
|
case VIDEO_EXT:
|
|
|
|
return "ext";
|
2012-09-24 19:19:07 +00:00
|
|
|
case VIDEO_VG:
|
|
|
|
return "vg";
|
2013-07-28 16:37:31 +00:00
|
|
|
case VIDEO_OMAP:
|
|
|
|
return "omap";
|
2013-11-24 16:28:21 +00:00
|
|
|
case VIDEO_EXYNOS:
|
|
|
|
return "exynos";
|
2015-03-13 04:59:52 +00:00
|
|
|
case VIDEO_DISPMANX:
|
|
|
|
return "dispmanx";
|
2016-01-10 11:04:32 +00:00
|
|
|
case VIDEO_SUNXI:
|
|
|
|
return "sunxi";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2012-05-07 21:20:13 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2012-05-07 21:20:13 +00:00
|
|
|
}
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_input:
|
|
|
|
*
|
|
|
|
* Gets default input driver.
|
|
|
|
*
|
|
|
|
* Returns: Default input driver.
|
|
|
|
**/
|
2012-05-07 21:20:13 +00:00
|
|
|
const char *config_get_default_input(void)
|
|
|
|
{
|
2011-01-06 17:34:11 +00:00
|
|
|
switch (INPUT_DEFAULT_DRIVER)
|
|
|
|
{
|
2012-10-16 17:46:31 +00:00
|
|
|
case INPUT_ANDROID:
|
2015-04-29 00:49:23 +00:00
|
|
|
return "android";
|
2011-11-30 16:24:18 +00:00
|
|
|
case INPUT_PS3:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "ps3";
|
2012-11-23 01:40:03 +00:00
|
|
|
case INPUT_PSP:
|
|
|
|
return "psp";
|
2015-04-01 21:14:13 +00:00
|
|
|
case INPUT_CTR:
|
|
|
|
return "ctr";
|
2011-01-06 17:34:11 +00:00
|
|
|
case INPUT_SDL:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "sdl";
|
2014-08-22 22:15:44 +00:00
|
|
|
case INPUT_SDL2:
|
|
|
|
return "sdl2";
|
2012-09-30 09:26:26 +00:00
|
|
|
case INPUT_DINPUT:
|
|
|
|
return "dinput";
|
2011-03-13 03:51:09 +00:00
|
|
|
case INPUT_X:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "x";
|
2014-08-09 19:35:27 +00:00
|
|
|
case INPUT_WAYLAND:
|
|
|
|
return "wayland";
|
2011-12-14 00:35:17 +00:00
|
|
|
case INPUT_XENON360:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "xenon360";
|
2012-07-07 17:56:46 +00:00
|
|
|
case INPUT_XINPUT:
|
|
|
|
return "xinput";
|
2011-12-14 12:20:22 +00:00
|
|
|
case INPUT_WII:
|
2012-08-09 01:54:27 +00:00
|
|
|
return "gx";
|
2012-05-25 19:44:39 +00:00
|
|
|
case INPUT_LINUXRAW:
|
|
|
|
return "linuxraw";
|
2014-01-03 19:18:50 +00:00
|
|
|
case INPUT_UDEV:
|
|
|
|
return "udev";
|
2015-04-19 15:58:15 +00:00
|
|
|
case INPUT_COCOA:
|
|
|
|
return "cocoa";
|
2013-03-18 22:56:07 +00:00
|
|
|
case INPUT_QNX:
|
|
|
|
return "qnx_input";
|
2013-09-11 00:21:48 +00:00
|
|
|
case INPUT_RWEBINPUT:
|
|
|
|
return "rwebinput";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2011-01-06 17:34:11 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2012-05-07 21:20:13 +00:00
|
|
|
}
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_joypad:
|
|
|
|
*
|
|
|
|
* Gets default input joypad driver.
|
|
|
|
*
|
|
|
|
* Returns: Default input joypad driver.
|
|
|
|
**/
|
2014-10-03 00:40:47 +00:00
|
|
|
const char *config_get_default_joypad(void)
|
|
|
|
{
|
|
|
|
switch (JOYPAD_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case JOYPAD_PS3:
|
|
|
|
return "ps3";
|
2015-04-05 18:43:24 +00:00
|
|
|
case JOYPAD_XINPUT:
|
|
|
|
return "xinput";
|
2014-10-03 00:40:47 +00:00
|
|
|
case JOYPAD_GX:
|
|
|
|
return "gx";
|
|
|
|
case JOYPAD_XDK:
|
|
|
|
return "xdk";
|
|
|
|
case JOYPAD_PSP:
|
|
|
|
return "psp";
|
2015-04-01 21:14:13 +00:00
|
|
|
case JOYPAD_CTR:
|
|
|
|
return "ctr";
|
2014-10-03 00:40:47 +00:00
|
|
|
case JOYPAD_DINPUT:
|
|
|
|
return "dinput";
|
|
|
|
case JOYPAD_UDEV:
|
|
|
|
return "udev";
|
|
|
|
case JOYPAD_LINUXRAW:
|
|
|
|
return "linuxraw";
|
|
|
|
case JOYPAD_ANDROID:
|
|
|
|
return "android";
|
|
|
|
case JOYPAD_SDL:
|
|
|
|
#ifdef HAVE_SDL2
|
|
|
|
return "sdl2";
|
|
|
|
#else
|
|
|
|
return "sdl";
|
|
|
|
#endif
|
2015-04-01 18:00:38 +00:00
|
|
|
case JOYPAD_HID:
|
|
|
|
return "hid";
|
2014-10-03 00:40:47 +00:00
|
|
|
case JOYPAD_QNX:
|
|
|
|
return "qnx";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2014-10-03 00:40:47 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2014-10-03 00:40:47 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 15:13:53 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_menu:
|
|
|
|
*
|
|
|
|
* Gets default menu driver.
|
|
|
|
*
|
|
|
|
* Returns: Default menu driver.
|
|
|
|
**/
|
2014-05-27 15:13:53 +00:00
|
|
|
const char *config_get_default_menu(void)
|
|
|
|
{
|
|
|
|
switch (MENU_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case MENU_RGUI:
|
|
|
|
return "rgui";
|
|
|
|
case MENU_RMENU:
|
|
|
|
return "rmenu";
|
|
|
|
case MENU_RMENU_XUI:
|
|
|
|
return "rmenu_xui";
|
2014-09-11 02:07:07 +00:00
|
|
|
case MENU_GLUI:
|
|
|
|
return "glui";
|
2014-10-08 23:21:22 +00:00
|
|
|
case MENU_XMB:
|
|
|
|
return "xmb";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2014-05-27 15:13:53 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2014-05-27 15:13:53 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_camera:
|
|
|
|
*
|
|
|
|
* Gets default camera driver.
|
|
|
|
*
|
|
|
|
* Returns: Default camera driver.
|
|
|
|
**/
|
2013-11-11 13:26:57 +00:00
|
|
|
const char *config_get_default_camera(void)
|
|
|
|
{
|
|
|
|
switch (CAMERA_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case CAMERA_V4L2:
|
|
|
|
return "video4linux2";
|
2013-11-13 00:48:36 +00:00
|
|
|
case CAMERA_RWEBCAM:
|
|
|
|
return "rwebcam";
|
2013-11-17 18:47:37 +00:00
|
|
|
case CAMERA_ANDROID:
|
|
|
|
return "android";
|
2015-04-19 18:46:49 +00:00
|
|
|
case CAMERA_AVFOUNDATION:
|
|
|
|
return "avfoundation";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2013-11-11 13:26:57 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2013-11-11 13:26:57 +00:00
|
|
|
}
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_get_default_location:
|
|
|
|
*
|
|
|
|
* Gets default location driver.
|
|
|
|
*
|
|
|
|
* Returns: Default location driver.
|
|
|
|
**/
|
2013-12-19 00:51:51 +00:00
|
|
|
const char *config_get_default_location(void)
|
|
|
|
{
|
|
|
|
switch (LOCATION_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case LOCATION_ANDROID:
|
|
|
|
return "android";
|
2015-04-20 09:41:33 +00:00
|
|
|
case LOCATION_CORELOCATION:
|
|
|
|
return "corelocation";
|
2015-01-09 01:15:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
2013-12-19 00:51:51 +00:00
|
|
|
}
|
2014-10-03 15:07:51 +00:00
|
|
|
|
2015-01-09 00:08:54 +00:00
|
|
|
return "null";
|
2013-12-19 00:51:51 +00:00
|
|
|
}
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* config_set_defaults:
|
|
|
|
*
|
|
|
|
* Set 'default' configuration values.
|
|
|
|
**/
|
2014-10-03 11:39:19 +00:00
|
|
|
static void config_set_defaults(void)
|
2012-05-07 21:20:13 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i, j;
|
2015-04-13 00:12:28 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
const char *def_video = config_get_default_video();
|
|
|
|
const char *def_audio = config_get_default_audio();
|
2014-07-18 17:11:53 +00:00
|
|
|
const char *def_audio_resampler = config_get_default_audio_resampler();
|
2015-04-13 00:12:28 +00:00
|
|
|
const char *def_input = config_get_default_input();
|
|
|
|
const char *def_joypad = config_get_default_joypad();
|
2014-05-27 15:13:53 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-04-13 00:12:28 +00:00
|
|
|
const char *def_menu = config_get_default_menu();
|
2014-05-27 15:13:53 +00:00
|
|
|
#endif
|
2015-04-13 00:12:28 +00:00
|
|
|
const char *def_camera = config_get_default_camera();
|
|
|
|
const char *def_location = config_get_default_location();
|
2015-04-15 11:37:38 +00:00
|
|
|
const char *def_record = config_get_default_record();
|
2011-01-06 17:34:11 +00:00
|
|
|
|
2013-11-11 13:26:57 +00:00
|
|
|
if (def_camera)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->camera.driver,
|
|
|
|
def_camera, sizeof(settings->camera.driver));
|
2013-12-19 00:51:51 +00:00
|
|
|
if (def_location)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->location.driver,
|
|
|
|
def_location, sizeof(settings->location.driver));
|
2010-12-29 19:50:50 +00:00
|
|
|
if (def_video)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->video.driver,
|
|
|
|
def_video, sizeof(settings->video.driver));
|
2010-12-29 19:50:50 +00:00
|
|
|
if (def_audio)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->audio.driver,
|
|
|
|
def_audio, sizeof(settings->audio.driver));
|
2014-07-18 17:11:53 +00:00
|
|
|
if (def_audio_resampler)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->audio.resampler,
|
|
|
|
def_audio_resampler, sizeof(settings->audio.resampler));
|
2011-01-06 17:34:11 +00:00
|
|
|
if (def_input)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->input.driver,
|
|
|
|
def_input, sizeof(settings->input.driver));
|
2014-10-03 00:40:47 +00:00
|
|
|
if (def_joypad)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->input.joypad_driver,
|
2015-04-04 19:32:25 +00:00
|
|
|
def_joypad, sizeof(settings->input.joypad_driver));
|
2015-04-15 11:37:38 +00:00
|
|
|
if (def_record)
|
|
|
|
strlcpy(settings->record.driver,
|
|
|
|
def_record, sizeof(settings->record.driver));
|
2014-05-27 15:13:53 +00:00
|
|
|
#ifdef HAVE_MENU
|
|
|
|
if (def_menu)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->menu.driver,
|
|
|
|
def_menu, sizeof(settings->menu.driver));
|
2014-05-27 15:13:53 +00:00
|
|
|
#endif
|
2010-12-29 19:50:50 +00:00
|
|
|
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->history_list_enable = def_history_list_enable;
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->load_dummy_on_core_shutdown = load_dummy_on_core_shutdown;
|
|
|
|
|
2015-06-23 05:09:24 +00:00
|
|
|
#ifdef HAVE_FFMPEG
|
2015-06-28 15:21:32 +00:00
|
|
|
settings->multimedia.builtin_mediaplayer_enable = true;
|
|
|
|
#else
|
|
|
|
settings->multimedia.builtin_mediaplayer_enable = false;
|
2015-06-23 05:09:24 +00:00
|
|
|
#endif
|
2015-06-28 15:21:32 +00:00
|
|
|
settings->multimedia.builtin_imageviewer_enable = true;
|
2015-03-21 04:42:49 +00:00
|
|
|
settings->video.scale = scale;
|
2015-07-01 22:35:46 +00:00
|
|
|
settings->video.fullscreen = global->force_fullscreen
|
|
|
|
? true : fullscreen;
|
2015-03-21 04:42:49 +00:00
|
|
|
settings->video.windowed_fullscreen = windowed_fullscreen;
|
|
|
|
settings->video.monitor_index = monitor_index;
|
|
|
|
settings->video.fullscreen_x = fullscreen_x;
|
|
|
|
settings->video.fullscreen_y = fullscreen_y;
|
|
|
|
settings->video.disable_composition = disable_composition;
|
|
|
|
settings->video.vsync = vsync;
|
|
|
|
settings->video.hard_sync = hard_sync;
|
|
|
|
settings->video.hard_sync_frames = hard_sync_frames;
|
|
|
|
settings->video.frame_delay = frame_delay;
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->video.black_frame_insertion = black_frame_insertion;
|
2015-03-21 04:42:49 +00:00
|
|
|
settings->video.swap_interval = swap_interval;
|
|
|
|
settings->video.threaded = video_threaded;
|
2014-06-12 23:10:14 +00:00
|
|
|
|
|
|
|
if (g_defaults.settings.video_threaded_enable != video_threaded)
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->video.threaded = g_defaults.settings.video_threaded_enable;
|
2014-06-12 23:10:14 +00:00
|
|
|
|
2015-03-18 20:33:04 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-04-12 01:31:10 +00:00
|
|
|
settings->menu.threaded_data_runloop_enable = threaded_data_runloop_enable;
|
2015-03-18 20:33:04 +00:00
|
|
|
#endif
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->video.shared_context = video_shared_context;
|
|
|
|
settings->video.force_srgb_disable = false;
|
2014-08-11 09:00:11 +00:00
|
|
|
#ifdef GEKKO
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->video.viwidth = video_viwidth;
|
|
|
|
settings->video.vfilter = video_vfilter;
|
2014-08-11 09:00:11 +00:00
|
|
|
#endif
|
2015-05-08 07:15:53 +00:00
|
|
|
settings->video.smooth = video_smooth;
|
|
|
|
settings->video.force_aspect = force_aspect;
|
|
|
|
settings->video.scale_integer = scale_integer;
|
|
|
|
settings->video.crop_overscan = crop_overscan;
|
|
|
|
settings->video.aspect_ratio = aspect_ratio;
|
|
|
|
settings->video.aspect_ratio_auto = aspect_ratio_auto; /* Let implementation decide if automatic, or 1:1 PAR. */
|
|
|
|
settings->video.aspect_ratio_idx = aspect_ratio_idx;
|
|
|
|
settings->video.shader_enable = shader_enable;
|
|
|
|
settings->video.allow_rotate = allow_rotate;
|
|
|
|
|
|
|
|
settings->video.font_enable = font_enable;
|
|
|
|
settings->video.font_size = font_size;
|
|
|
|
settings->video.msg_pos_x = message_pos_offset_x;
|
|
|
|
settings->video.msg_pos_y = message_pos_offset_y;
|
|
|
|
|
|
|
|
settings->video.msg_color_r = ((message_color >> 16) & 0xff) / 255.0f;
|
|
|
|
settings->video.msg_color_g = ((message_color >> 8) & 0xff) / 255.0f;
|
|
|
|
settings->video.msg_color_b = ((message_color >> 0) & 0xff) / 255.0f;
|
2011-01-23 01:48:06 +00:00
|
|
|
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->video.refresh_rate = refresh_rate;
|
2014-06-12 23:10:14 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
if (g_defaults.settings.video_refresh_rate > 0.0 &&
|
|
|
|
g_defaults.settings.video_refresh_rate != refresh_rate)
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->video.refresh_rate = g_defaults.settings.video_refresh_rate;
|
2014-06-12 23:10:14 +00:00
|
|
|
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->video.post_filter_record = post_filter_record;
|
|
|
|
settings->video.gpu_record = gpu_record;
|
|
|
|
settings->video.gpu_screenshot = gpu_screenshot;
|
|
|
|
settings->video.rotation = ORIENTATION_NORMAL;
|
2011-08-11 03:25:31 +00:00
|
|
|
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->audio.enable = audio_enable;
|
|
|
|
settings->audio.mute_enable = false;
|
|
|
|
settings->audio.out_rate = out_rate;
|
|
|
|
settings->audio.block_frames = 0;
|
2010-12-29 18:00:21 +00:00
|
|
|
if (audio_device)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->audio.device,
|
|
|
|
audio_device, sizeof(settings->audio.device));
|
2014-06-12 16:30:41 +00:00
|
|
|
|
|
|
|
if (!g_defaults.settings.out_latency)
|
2015-04-13 00:12:28 +00:00
|
|
|
g_defaults.settings.out_latency = out_latency;
|
|
|
|
|
|
|
|
settings->audio.latency = g_defaults.settings.out_latency;
|
|
|
|
settings->audio.sync = audio_sync;
|
|
|
|
settings->audio.rate_control = rate_control;
|
|
|
|
settings->audio.rate_control_delta = rate_control_delta;
|
|
|
|
settings->audio.max_timing_skew = max_timing_skew;
|
|
|
|
settings->audio.volume = audio_volume;
|
2015-05-19 19:18:07 +00:00
|
|
|
|
|
|
|
audio_driver_set_volume_gain(db_to_gain(settings->audio.volume));
|
2015-04-13 00:12:28 +00:00
|
|
|
|
|
|
|
settings->rewind_enable = rewind_enable;
|
|
|
|
settings->rewind_buffer_size = rewind_buffer_size;
|
|
|
|
settings->rewind_granularity = rewind_granularity;
|
|
|
|
settings->slowmotion_ratio = slowmotion_ratio;
|
|
|
|
settings->fastforward_ratio = fastforward_ratio;
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->fastforward_ratio_throttle_enable = fastforward_ratio_throttle_enable;
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->pause_nonactive = pause_nonactive;
|
|
|
|
settings->autosave_interval = autosave_interval;
|
2015-03-20 18:32:46 +00:00
|
|
|
|
2015-05-08 07:15:53 +00:00
|
|
|
settings->block_sram_overwrite = block_sram_overwrite;
|
|
|
|
settings->savestate_auto_index = savestate_auto_index;
|
|
|
|
settings->savestate_auto_save = savestate_auto_save;
|
|
|
|
settings->savestate_auto_load = savestate_auto_load;
|
|
|
|
settings->network_cmd_enable = network_cmd_enable;
|
|
|
|
settings->network_cmd_port = network_cmd_port;
|
|
|
|
settings->stdin_cmd_enable = stdin_cmd_enable;
|
|
|
|
settings->content_history_size = default_content_history_size;
|
|
|
|
settings->libretro_log_level = libretro_log_level;
|
2011-09-16 13:32:21 +00:00
|
|
|
|
2014-02-10 19:26:48 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-05-08 07:15:53 +00:00
|
|
|
settings->menu_show_start_screen = menu_show_start_screen;
|
|
|
|
settings->menu.pause_libretro = true;
|
|
|
|
settings->menu.mouse.enable = false;
|
|
|
|
settings->menu.pointer.enable = pointer_enable;
|
|
|
|
settings->menu.timedate_enable = true;
|
|
|
|
settings->menu.core_enable = true;
|
2015-06-04 10:17:23 +00:00
|
|
|
settings->menu.dynamic_wallpaper_enable = false;
|
2015-06-18 02:32:56 +00:00
|
|
|
settings->menu.boxart_enable = false;
|
2015-05-08 07:15:53 +00:00
|
|
|
*settings->menu.wallpaper = '\0';
|
|
|
|
settings->menu.collapse_subgroups_enable = collapse_subgroups_enable;
|
|
|
|
settings->menu.show_advanced_settings = show_advanced_settings;
|
|
|
|
settings->menu.entry_normal_color = menu_entry_normal_color;
|
|
|
|
settings->menu.entry_hover_color = menu_entry_hover_color;
|
|
|
|
settings->menu.title_color = menu_title_color;
|
|
|
|
|
|
|
|
settings->menu.dpi.override_enable = menu_dpi_override_enable;
|
|
|
|
settings->menu.dpi.override_value = menu_dpi_override_value;
|
2015-04-24 14:37:09 +00:00
|
|
|
|
2015-07-04 17:58:43 +00:00
|
|
|
settings->menu.navigation.wraparound.setting_enable = true;
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->menu.navigation.wraparound.horizontal_enable = true;
|
|
|
|
settings->menu.navigation.wraparound.vertical_enable = true;
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->menu.navigation.browser.filter.supported_extensions_enable = true;
|
2014-02-10 19:26:48 +00:00
|
|
|
#endif
|
2013-10-05 09:11:43 +00:00
|
|
|
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->ui.companion_start_on_boot = true;
|
|
|
|
settings->ui.menubar_enable = true;
|
|
|
|
settings->ui.suspend_screensaver_enable = true;
|
2014-12-04 12:26:27 +00:00
|
|
|
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->location.allow = false;
|
|
|
|
settings->camera.allow = false;
|
2014-04-06 20:59:16 +00:00
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->input.autoconfig_descriptor_label_show = true;
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->input.input_descriptor_label_show = input_descriptor_label_show;
|
|
|
|
settings->input.input_descriptor_hide_unbound = input_descriptor_hide_unbound;
|
|
|
|
settings->input.remap_binds_enable = true;
|
2015-07-04 17:14:04 +00:00
|
|
|
settings->input.max_users = input_max_users;
|
2014-12-04 12:45:56 +00:00
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
rarch_assert(sizeof(settings->input.binds[0]) >= sizeof(retro_keybinds_1));
|
|
|
|
rarch_assert(sizeof(settings->input.binds[1]) >= sizeof(retro_keybinds_rest));
|
2015-01-05 01:36:10 +00:00
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
memcpy(settings->input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1));
|
2015-01-05 01:36:10 +00:00
|
|
|
|
2015-01-05 00:58:00 +00:00
|
|
|
for (i = 1; i < MAX_USERS; i++)
|
2015-03-20 18:32:46 +00:00
|
|
|
memcpy(settings->input.binds[i], retro_keybinds_rest,
|
2014-09-01 23:27:46 +00:00
|
|
|
sizeof(retro_keybinds_rest));
|
2015-01-05 21:53:21 +00:00
|
|
|
|
2015-01-24 22:49:35 +00:00
|
|
|
input_remapping_set_defaults();
|
2010-12-29 18:43:17 +00:00
|
|
|
|
2015-01-05 00:58:00 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
2013-05-06 14:24:13 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
for (j = 0; j < RARCH_BIND_LIST_END; j++)
|
2013-05-06 14:24:13 +00:00
|
|
|
{
|
2015-04-13 00:12:28 +00:00
|
|
|
settings->input.autoconf_binds[i][j].joykey = NO_BTN;
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->input.autoconf_binds[i][j].joyaxis = AXIS_NONE;
|
2013-05-06 14:24:13 +00:00
|
|
|
}
|
|
|
|
}
|
2015-03-20 18:32:46 +00:00
|
|
|
memset(settings->input.autoconfigured, 0,
|
|
|
|
sizeof(settings->input.autoconfigured));
|
2013-04-26 12:36:36 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
/* Verify that binds are in proper order. */
|
2015-01-05 00:58:00 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
2013-10-22 13:08:17 +00:00
|
|
|
for (j = 0; j < RARCH_BIND_LIST_END; j++)
|
2015-01-05 01:36:10 +00:00
|
|
|
{
|
2015-03-20 18:32:46 +00:00
|
|
|
if (settings->input.binds[i][j].valid)
|
|
|
|
rarch_assert(j == settings->input.binds[i][j].id);
|
2015-01-05 01:36:10 +00:00
|
|
|
}
|
2012-02-01 22:02:17 +00:00
|
|
|
|
2015-05-08 07:15:53 +00:00
|
|
|
settings->input.axis_threshold = axis_threshold;
|
|
|
|
settings->input.netplay_client_swap_input = netplay_client_swap_input;
|
|
|
|
settings->input.turbo_period = turbo_period;
|
|
|
|
settings->input.turbo_duty_cycle = turbo_duty_cycle;
|
2014-06-12 20:31:25 +00:00
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->network.buildbot_url, buildbot_server_url,
|
|
|
|
sizeof(settings->network.buildbot_url));
|
|
|
|
strlcpy(settings->network.buildbot_assets_url, buildbot_assets_server_url,
|
|
|
|
sizeof(settings->network.buildbot_assets_url));
|
|
|
|
settings->network.buildbot_auto_extract_archive = true;
|
2015-01-19 03:09:28 +00:00
|
|
|
|
2015-05-08 07:15:53 +00:00
|
|
|
settings->input.overlay_enable = true;
|
2015-07-03 17:27:16 +00:00
|
|
|
settings->input.overlay_enable_autopreferred = true;
|
2015-05-08 07:15:53 +00:00
|
|
|
settings->input.overlay_opacity = 0.7f;
|
|
|
|
settings->input.overlay_scale = 1.0f;
|
|
|
|
settings->input.autodetect_enable = input_autodetect_enable;
|
|
|
|
*settings->input.keyboard_layout = '\0';
|
2013-01-05 19:06:59 +00:00
|
|
|
|
2015-01-05 00:58:00 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
2013-09-22 09:08:09 +00:00
|
|
|
{
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->input.joypad_map[i] = i;
|
|
|
|
settings->input.analog_dpad_mode[i] = ANALOG_DPAD_NONE;
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_libretro_device[i])
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->input.libretro_device[i] = RETRO_DEVICE_JOYPAD;
|
2013-09-22 09:08:09 +00:00
|
|
|
}
|
2012-05-28 21:14:18 +00:00
|
|
|
|
2015-05-08 07:15:53 +00:00
|
|
|
settings->core.set_supports_no_game_enable = true;
|
2015-04-28 01:22:04 +00:00
|
|
|
|
2015-05-20 17:12:27 +00:00
|
|
|
video_viewport_reset_custom();
|
2014-09-21 03:23:51 +00:00
|
|
|
|
2015-04-05 16:14:24 +00:00
|
|
|
/* Make sure settings from other configs carry over into defaults
|
2014-09-01 23:27:46 +00:00
|
|
|
* for another config. */
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_save_path)
|
|
|
|
*global->savefile_dir = '\0';
|
|
|
|
if (!global->has_set_state_path)
|
|
|
|
*global->savestate_dir = '\0';
|
2014-06-16 19:50:29 +00:00
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
*settings->libretro_info_path = '\0';
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_libretro_directory)
|
2015-03-20 18:32:46 +00:00
|
|
|
*settings->libretro_directory = '\0';
|
2014-06-16 19:50:29 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_ups_pref)
|
|
|
|
global->ups_pref = false;
|
|
|
|
if (!global->has_set_bps_pref)
|
|
|
|
global->bps_pref = false;
|
|
|
|
if (!global->has_set_ips_pref)
|
|
|
|
global->ips_pref = false;
|
2015-01-13 02:21:36 +00:00
|
|
|
|
2015-04-15 10:42:36 +00:00
|
|
|
*global->record.output_dir = '\0';
|
|
|
|
*global->record.config_dir = '\0';
|
2015-04-14 19:13:54 +00:00
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
*settings->core_options_path = '\0';
|
|
|
|
*settings->content_history_path = '\0';
|
|
|
|
*settings->content_history_directory = '\0';
|
|
|
|
*settings->content_database = '\0';
|
|
|
|
*settings->cheat_database = '\0';
|
|
|
|
*settings->cursor_directory = '\0';
|
|
|
|
*settings->cheat_settings_path = '\0';
|
|
|
|
*settings->resampler_directory = '\0';
|
|
|
|
*settings->screenshot_directory = '\0';
|
|
|
|
*settings->system_directory = '\0';
|
|
|
|
*settings->extraction_directory = '\0';
|
|
|
|
*settings->input_remapping_directory = '\0';
|
|
|
|
*settings->input.autoconfig_dir = '\0';
|
|
|
|
*settings->input.overlay = '\0';
|
|
|
|
*settings->core_assets_directory = '\0';
|
|
|
|
*settings->assets_directory = '\0';
|
2015-06-04 10:17:23 +00:00
|
|
|
*settings->dynamic_wallpapers_directory = '\0';
|
2015-06-18 02:32:56 +00:00
|
|
|
*settings->boxarts_directory = '\0';
|
2015-03-20 18:32:46 +00:00
|
|
|
*settings->playlist_directory = '\0';
|
|
|
|
*settings->video.shader_path = '\0';
|
|
|
|
*settings->video.shader_dir = '\0';
|
|
|
|
*settings->video.filter_dir = '\0';
|
|
|
|
*settings->audio.filter_dir = '\0';
|
|
|
|
*settings->video.softfilter_plugin = '\0';
|
|
|
|
*settings->audio.dsp_plugin = '\0';
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-03-20 18:32:46 +00:00
|
|
|
*settings->menu_content_directory = '\0';
|
|
|
|
*settings->menu_config_directory = '\0';
|
2013-09-15 14:03:43 +00:00
|
|
|
#endif
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->core_specific_config = default_core_specific_config;
|
2015-04-18 01:07:15 +00:00
|
|
|
settings->auto_overrides_enable = default_auto_overrides_enable;
|
2015-04-18 01:10:26 +00:00
|
|
|
settings->auto_remaps_enable = default_auto_remaps_enable;
|
2015-05-07 01:55:15 +00:00
|
|
|
|
2015-05-07 23:06:14 +00:00
|
|
|
settings->sort_savefiles_enable = default_sort_savefiles_enable;
|
|
|
|
settings->sort_savestates_enable = default_sort_savestates_enable;
|
|
|
|
|
2015-05-07 01:55:15 +00:00
|
|
|
settings->menu_ok_btn = default_menu_btn_ok;
|
|
|
|
settings->menu_cancel_btn = default_menu_btn_cancel;
|
|
|
|
settings->menu_search_btn = default_menu_btn_search;
|
|
|
|
settings->menu_default_btn = default_menu_btn_default;
|
|
|
|
settings->menu_info_btn = default_menu_btn_info;
|
|
|
|
settings->menu_scroll_down_btn = default_menu_btn_scroll_down;
|
|
|
|
settings->menu_scroll_up_btn = default_menu_btn_scroll_up;
|
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->user_language = 0;
|
2014-08-01 05:00:32 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.sound.system_bgm_enable = false;
|
2013-01-10 05:38:19 +00:00
|
|
|
#ifdef RARCH_CONSOLE
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.screen.gamma_correction = DEFAULT_GAMMA;
|
|
|
|
global->console.screen.resolutions.current.id = 0;
|
|
|
|
global->console.sound.mode = SOUND_MODE_NORMAL;
|
2013-05-25 16:07:30 +00:00
|
|
|
#endif
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-07-03 20:26:08 +00:00
|
|
|
if (*g_defaults.wallpapers_dir)
|
|
|
|
strlcpy(settings->dynamic_wallpapers_directory,
|
|
|
|
g_defaults.wallpapers_dir, sizeof(settings->dynamic_wallpapers_directory));
|
|
|
|
if (*g_defaults.remap_dir)
|
|
|
|
strlcpy(settings->input_remapping_directory,
|
|
|
|
g_defaults.remap_dir, sizeof(settings->input_remapping_directory));
|
2015-01-28 08:29:11 +00:00
|
|
|
if (*g_defaults.extraction_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->extraction_directory,
|
|
|
|
g_defaults.extraction_dir, sizeof(settings->extraction_directory));
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.audio_filter_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->audio.filter_dir,
|
|
|
|
g_defaults.audio_filter_dir, sizeof(settings->audio.filter_dir));
|
2014-10-29 06:42:07 +00:00
|
|
|
if (*g_defaults.video_filter_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->video.filter_dir,
|
|
|
|
g_defaults.video_filter_dir, sizeof(settings->video.filter_dir));
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.assets_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->assets_directory,
|
|
|
|
g_defaults.assets_dir, sizeof(settings->assets_directory));
|
2015-07-04 02:47:14 +00:00
|
|
|
if (*g_defaults.core_assets_dir)
|
|
|
|
strlcpy(settings->core_assets_directory,
|
|
|
|
g_defaults.core_assets_dir, sizeof(settings->core_assets_directory));
|
2014-09-15 02:12:27 +00:00
|
|
|
if (*g_defaults.playlist_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->playlist_directory,
|
|
|
|
g_defaults.playlist_dir, sizeof(settings->playlist_directory));
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.core_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
fill_pathname_expand_special(settings->libretro_directory,
|
|
|
|
g_defaults.core_dir, sizeof(settings->libretro_directory));
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.core_path)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->libretro, g_defaults.core_path,
|
|
|
|
sizeof(settings->libretro));
|
2015-02-01 11:25:04 +00:00
|
|
|
if (*g_defaults.database_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->content_database, g_defaults.database_dir,
|
|
|
|
sizeof(settings->content_database));
|
2015-02-01 11:25:04 +00:00
|
|
|
if (*g_defaults.cursor_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->cursor_directory, g_defaults.cursor_dir,
|
|
|
|
sizeof(settings->cursor_directory));
|
2015-03-12 23:24:17 +00:00
|
|
|
if (*g_defaults.cheats_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->cheat_database, g_defaults.cheats_dir,
|
|
|
|
sizeof(settings->cheat_database));
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.core_info_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
fill_pathname_expand_special(settings->libretro_info_path,
|
|
|
|
g_defaults.core_info_dir, sizeof(settings->libretro_info_path));
|
2014-06-03 23:44:38 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.overlay_dir)
|
2014-07-23 14:31:40 +00:00
|
|
|
{
|
2015-03-21 04:42:49 +00:00
|
|
|
fill_pathname_expand_special(global->overlay_dir,
|
|
|
|
g_defaults.overlay_dir, sizeof(global->overlay_dir));
|
2014-10-29 06:37:47 +00:00
|
|
|
#ifdef RARCH_MOBILE
|
2015-03-20 18:32:46 +00:00
|
|
|
if (!*settings->input.overlay)
|
|
|
|
fill_pathname_join(settings->input.overlay,
|
2015-03-21 04:42:49 +00:00
|
|
|
global->overlay_dir,
|
2014-09-01 23:27:46 +00:00
|
|
|
"gamepads/retropad/retropad.cfg",
|
2015-03-20 18:32:46 +00:00
|
|
|
sizeof(settings->input.overlay));
|
2015-01-29 19:33:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*g_defaults.osk_overlay_dir)
|
|
|
|
{
|
2015-03-21 04:42:49 +00:00
|
|
|
fill_pathname_expand_special(global->osk_overlay_dir,
|
|
|
|
g_defaults.osk_overlay_dir, sizeof(global->osk_overlay_dir));
|
2015-01-29 19:33:27 +00:00
|
|
|
#ifdef RARCH_MOBILE
|
2015-03-20 18:32:46 +00:00
|
|
|
if (!*settings->input.overlay)
|
|
|
|
fill_pathname_join(settings->osk.overlay,
|
2015-03-21 04:42:49 +00:00
|
|
|
global->osk_overlay_dir,
|
2015-01-29 19:33:27 +00:00
|
|
|
"overlays/keyboards/US-101/US-101.cfg",
|
2015-03-20 18:32:46 +00:00
|
|
|
sizeof(settings->osk.overlay));
|
2014-10-29 06:37:47 +00:00
|
|
|
#endif
|
2014-07-23 14:31:40 +00:00
|
|
|
}
|
2015-02-11 21:51:58 +00:00
|
|
|
else
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(global->osk_overlay_dir,
|
|
|
|
global->overlay_dir, sizeof(global->osk_overlay_dir));
|
2014-07-19 22:51:44 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MENU
|
|
|
|
if (*g_defaults.menu_config_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->menu_config_directory,
|
2014-09-01 23:27:46 +00:00
|
|
|
g_defaults.menu_config_dir,
|
2015-03-20 18:32:46 +00:00
|
|
|
sizeof(settings->menu_config_directory));
|
2014-06-03 23:44:38 +00:00
|
|
|
#endif
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.shader_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
fill_pathname_expand_special(settings->video.shader_dir,
|
|
|
|
g_defaults.shader_dir, sizeof(settings->video.shader_dir));
|
2014-08-22 08:49:57 +00:00
|
|
|
if (*g_defaults.autoconfig_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->input.autoconfig_dir,
|
2014-09-01 23:27:46 +00:00
|
|
|
g_defaults.autoconfig_dir,
|
2015-03-20 18:32:46 +00:00
|
|
|
sizeof(settings->input.autoconfig_dir));
|
2014-07-23 14:31:40 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_state_path && *g_defaults.savestate_dir)
|
|
|
|
strlcpy(global->savestate_dir,
|
|
|
|
g_defaults.savestate_dir, sizeof(global->savestate_dir));
|
|
|
|
if (!global->has_set_save_path && *g_defaults.sram_dir)
|
|
|
|
strlcpy(global->savefile_dir,
|
|
|
|
g_defaults.sram_dir, sizeof(global->savefile_dir));
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.system_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->system_directory,
|
|
|
|
g_defaults.system_dir, sizeof(settings->system_directory));
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.screenshot_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->screenshot_directory,
|
2014-09-01 23:27:46 +00:00
|
|
|
g_defaults.screenshot_dir,
|
2015-03-20 18:32:46 +00:00
|
|
|
sizeof(settings->screenshot_directory));
|
2014-09-27 13:55:55 +00:00
|
|
|
if (*g_defaults.resampler_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->resampler_directory,
|
2014-09-27 13:55:55 +00:00
|
|
|
g_defaults.resampler_dir,
|
2015-03-20 18:32:46 +00:00
|
|
|
sizeof(settings->resampler_directory));
|
2014-11-27 07:46:30 +00:00
|
|
|
if (*g_defaults.content_history_dir)
|
2015-03-20 18:32:46 +00:00
|
|
|
strlcpy(settings->content_history_directory,
|
2014-11-27 07:46:30 +00:00
|
|
|
g_defaults.content_history_dir,
|
2015-03-20 18:32:46 +00:00
|
|
|
sizeof(settings->content_history_directory));
|
2014-06-12 16:06:29 +00:00
|
|
|
|
|
|
|
if (*g_defaults.config_path)
|
2015-03-21 04:42:49 +00:00
|
|
|
fill_pathname_expand_special(global->config_path,
|
|
|
|
g_defaults.config_path, sizeof(global->config_path));
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-03-20 18:32:46 +00:00
|
|
|
settings->config_save_on_exit = config_save_on_exit;
|
2013-05-22 13:35:28 +00:00
|
|
|
|
2014-07-28 18:08:37 +00:00
|
|
|
/* Avoid reloading config on every content load */
|
2015-03-21 04:42:49 +00:00
|
|
|
global->block_config_read = default_block_config_read;
|
2010-12-29 18:00:21 +00:00
|
|
|
}
|
|
|
|
|
2015-01-13 22:23:15 +00:00
|
|
|
#ifndef GLOBAL_CONFIG_DIR
|
|
|
|
#if defined(__HAIKU__)
|
|
|
|
#define GLOBAL_CONFIG_DIR "/system/settings"
|
|
|
|
#else
|
|
|
|
#define GLOBAL_CONFIG_DIR "/etc"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
/**
|
|
|
|
* open_default_config_file
|
|
|
|
*
|
|
|
|
* Open a default config file. Platform-specific.
|
|
|
|
*
|
|
|
|
* Returns: handle to config file if found, otherwise NULL.
|
|
|
|
**/
|
2011-02-22 10:28:28 +00:00
|
|
|
static config_file_t *open_default_config_file(void)
|
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char conf_path[PATH_MAX_LENGTH] = {0};
|
|
|
|
char app_path[PATH_MAX_LENGTH] = {0};
|
2015-06-26 17:57:40 +00:00
|
|
|
const char *xdg = NULL;
|
|
|
|
const char *home = NULL;
|
2015-06-12 15:00:37 +00:00
|
|
|
config_file_t *conf = NULL;
|
|
|
|
bool saved = false;
|
|
|
|
global_t *global = global_get_ptr();
|
2012-12-25 13:51:08 +00:00
|
|
|
|
2015-01-13 22:21:05 +00:00
|
|
|
(void)conf_path;
|
|
|
|
(void)app_path;
|
2015-01-13 22:30:49 +00:00
|
|
|
(void)saved;
|
2015-06-26 17:57:40 +00:00
|
|
|
(void)xdg;
|
|
|
|
(void)home;
|
2013-04-28 21:16:33 +00:00
|
|
|
|
2015-01-13 22:21:05 +00:00
|
|
|
#if defined(_WIN32) && !defined(_XBOX)
|
2013-04-28 21:16:33 +00:00
|
|
|
fill_pathname_application_path(app_path, sizeof(app_path));
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_resolve_relative(conf_path, app_path,
|
|
|
|
"retroarch.cfg", sizeof(conf_path));
|
2013-04-28 21:16:33 +00:00
|
|
|
|
2013-04-27 22:35:20 +00:00
|
|
|
conf = config_file_new(conf_path);
|
2015-01-13 22:21:05 +00:00
|
|
|
|
2011-02-22 10:28:28 +00:00
|
|
|
if (!conf)
|
|
|
|
{
|
|
|
|
const char *appdata = getenv("APPDATA");
|
2015-01-13 22:21:05 +00:00
|
|
|
|
2011-02-22 10:28:28 +00:00
|
|
|
if (appdata)
|
|
|
|
{
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, appdata,
|
|
|
|
"retroarch.cfg", sizeof(conf_path));
|
2011-02-22 10:28:28 +00:00
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
}
|
|
|
|
}
|
2013-04-27 23:35:31 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
if (!conf)
|
2013-10-01 09:57:07 +00:00
|
|
|
{
|
2015-01-29 23:34:54 +00:00
|
|
|
/* Try to create a new config file. */
|
2013-10-01 09:57:07 +00:00
|
|
|
conf = config_file_new(NULL);
|
2015-01-13 22:30:49 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
if (conf)
|
2013-10-01 09:57:07 +00:00
|
|
|
{
|
2015-04-05 16:14:24 +00:00
|
|
|
/* Since this is a clean config file, we can
|
2014-09-01 23:27:46 +00:00
|
|
|
* safely use config_save_on_exit. */
|
|
|
|
fill_pathname_resolve_relative(conf_path, app_path,
|
|
|
|
"retroarch.cfg", sizeof(conf_path));
|
2013-10-01 09:57:07 +00:00
|
|
|
config_set_bool(conf, "config_save_on_exit", true);
|
|
|
|
saved = config_file_write(conf, conf_path);
|
|
|
|
}
|
|
|
|
|
2015-01-13 22:30:49 +00:00
|
|
|
if (!saved)
|
2013-10-01 09:57:07 +00:00
|
|
|
{
|
2014-09-03 04:14:13 +00:00
|
|
|
/* WARN here to make sure user has a good chance of seeing it. */
|
|
|
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n",
|
|
|
|
conf_path);
|
2013-10-01 09:57:07 +00:00
|
|
|
config_file_free(conf);
|
2015-01-13 22:21:05 +00:00
|
|
|
return NULL;
|
2013-10-01 09:57:07 +00:00
|
|
|
}
|
2015-01-13 22:30:49 +00:00
|
|
|
|
|
|
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path);
|
2013-10-01 09:57:07 +00:00
|
|
|
}
|
2014-01-03 22:16:02 +00:00
|
|
|
#elif defined(OSX)
|
2015-06-26 15:46:13 +00:00
|
|
|
home = getenv("HOME");
|
2014-01-03 22:16:02 +00:00
|
|
|
|
|
|
|
if (!home)
|
|
|
|
return NULL;
|
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, home,
|
|
|
|
"Library/Application Support/RetroArch", sizeof(conf_path));
|
2014-01-03 22:16:02 +00:00
|
|
|
path_mkdir(conf_path);
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, conf_path,
|
|
|
|
"retroarch.cfg", sizeof(conf_path));
|
2014-01-03 22:16:02 +00:00
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
if (!conf)
|
|
|
|
{
|
|
|
|
conf = config_file_new(NULL);
|
2015-01-13 22:30:49 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
if (conf)
|
|
|
|
{
|
|
|
|
config_set_bool(conf, "config_save_on_exit", true);
|
|
|
|
saved = config_file_write(conf, conf_path);
|
|
|
|
}
|
2015-01-13 22:30:49 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
if (!saved)
|
|
|
|
{
|
|
|
|
/* WARN here to make sure user has a good chance of seeing it. */
|
|
|
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n",
|
|
|
|
conf_path);
|
|
|
|
config_file_free(conf);
|
2015-01-08 17:01:13 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2015-01-13 22:21:05 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path);
|
2014-01-03 22:16:02 +00:00
|
|
|
}
|
2012-02-27 16:29:59 +00:00
|
|
|
#elif !defined(__CELLOS_LV2__) && !defined(_XBOX)
|
2015-06-26 15:46:13 +00:00
|
|
|
xdg = getenv("XDG_CONFIG_HOME");
|
|
|
|
home = getenv("HOME");
|
2013-02-26 17:46:07 +00:00
|
|
|
|
2014-09-03 04:14:13 +00:00
|
|
|
/* XDG_CONFIG_HOME falls back to $HOME/.config. */
|
2011-02-22 10:28:28 +00:00
|
|
|
if (xdg)
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, xdg,
|
|
|
|
"retroarch/retroarch.cfg", sizeof(conf_path));
|
2013-02-26 17:46:07 +00:00
|
|
|
else if (home)
|
2014-08-28 16:44:22 +00:00
|
|
|
#ifdef __HAIKU__
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, home,
|
|
|
|
"config/settings/retroarch/retroarch.cfg", sizeof(conf_path));
|
2014-08-28 16:44:22 +00:00
|
|
|
#else
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, home,
|
|
|
|
".config/retroarch/retroarch.cfg", sizeof(conf_path));
|
2014-08-28 16:44:22 +00:00
|
|
|
#endif
|
2013-02-26 17:46:07 +00:00
|
|
|
|
|
|
|
if (xdg || home)
|
|
|
|
{
|
|
|
|
RARCH_LOG("Looking for config in: \"%s\".\n", conf_path);
|
2011-02-22 10:28:28 +00:00
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
}
|
2013-02-26 17:46:07 +00:00
|
|
|
|
2014-09-03 04:14:13 +00:00
|
|
|
/* Fallback to $HOME/.retroarch.cfg. */
|
2013-02-26 17:46:07 +00:00
|
|
|
if (!conf && home)
|
2011-02-22 10:28:28 +00:00
|
|
|
{
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, home,
|
|
|
|
".retroarch.cfg", sizeof(conf_path));
|
2013-02-26 17:46:07 +00:00
|
|
|
RARCH_LOG("Looking for config in: \"%s\".\n", conf_path);
|
2011-02-22 10:28:28 +00:00
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
}
|
2013-02-26 17:46:07 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
if (!conf)
|
2013-10-01 09:57:07 +00:00
|
|
|
{
|
2015-01-29 23:34:54 +00:00
|
|
|
if (home || xdg)
|
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char basedir[PATH_MAX_LENGTH] = {0};
|
2015-01-13 22:30:49 +00:00
|
|
|
|
2015-06-12 15:00:37 +00:00
|
|
|
/* Try to create a new config file. */
|
2015-01-09 15:59:19 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
/* XDG_CONFIG_HOME falls back to $HOME/.config. */
|
|
|
|
if (xdg)
|
|
|
|
fill_pathname_join(conf_path, xdg,
|
|
|
|
"retroarch/retroarch.cfg", sizeof(conf_path));
|
|
|
|
else if (home)
|
2014-08-28 16:44:22 +00:00
|
|
|
#ifdef __HAIKU__
|
2015-01-29 23:34:54 +00:00
|
|
|
fill_pathname_join(conf_path, home,
|
|
|
|
"config/settings/retroarch/retroarch.cfg", sizeof(conf_path));
|
2014-08-28 16:44:22 +00:00
|
|
|
#else
|
2014-09-01 23:27:46 +00:00
|
|
|
fill_pathname_join(conf_path, home,
|
|
|
|
".config/retroarch/retroarch.cfg", sizeof(conf_path));
|
2014-08-28 16:44:22 +00:00
|
|
|
#endif
|
2013-10-01 09:57:07 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
fill_pathname_basedir(basedir, conf_path, sizeof(basedir));
|
2013-10-01 09:57:07 +00:00
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
if (path_mkdir(basedir))
|
2013-10-01 09:57:07 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char skeleton_conf[PATH_MAX_LENGTH] = {0};
|
|
|
|
|
2015-01-29 23:34:54 +00:00
|
|
|
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR,
|
|
|
|
"retroarch.cfg", sizeof(skeleton_conf));
|
|
|
|
conf = config_file_new(skeleton_conf);
|
|
|
|
if (conf)
|
|
|
|
RARCH_WARN("Using skeleton config \"%s\" as base for a new config file.\n", skeleton_conf);
|
|
|
|
else
|
|
|
|
conf = config_file_new(NULL);
|
|
|
|
|
|
|
|
if (conf)
|
|
|
|
{
|
|
|
|
/* Since this is a clean config file, we can safely use config_save_on_exit. */
|
|
|
|
config_set_bool(conf, "config_save_on_exit", true);
|
|
|
|
saved = config_file_write(conf, conf_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!saved)
|
|
|
|
{
|
|
|
|
/* WARN here to make sure user has a good chance of seeing it. */
|
|
|
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
|
|
|
config_file_free(conf);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path);
|
2013-10-01 09:57:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-04-27 23:35:31 +00:00
|
|
|
#endif
|
2015-01-13 22:21:05 +00:00
|
|
|
|
|
|
|
if (!conf)
|
|
|
|
return NULL;
|
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(global->config_path, conf_path,
|
|
|
|
sizeof(global->config_path));
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2011-02-22 10:28:28 +00:00
|
|
|
return conf;
|
|
|
|
}
|
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
static void read_keybinds_keyboard(config_file_t *conf, unsigned user,
|
|
|
|
unsigned idx, struct retro_keybind *bind)
|
|
|
|
{
|
2015-01-13 23:35:27 +00:00
|
|
|
const char *prefix = NULL;
|
|
|
|
|
|
|
|
if (!input_config_bind_map[idx].valid)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!input_config_bind_map[idx].base)
|
|
|
|
return;
|
|
|
|
|
|
|
|
prefix = input_config_get_prefix(user, input_config_bind_map[idx].meta);
|
|
|
|
|
|
|
|
if (prefix)
|
|
|
|
input_config_parse_key(conf, prefix,
|
|
|
|
input_config_bind_map[idx].base, bind);
|
2015-01-11 04:29:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void read_keybinds_button(config_file_t *conf, unsigned user,
|
|
|
|
unsigned idx, struct retro_keybind *bind)
|
|
|
|
{
|
2015-01-13 23:35:27 +00:00
|
|
|
const char *prefix = NULL;
|
|
|
|
|
|
|
|
if (!input_config_bind_map[idx].valid)
|
|
|
|
return;
|
|
|
|
if (!input_config_bind_map[idx].base)
|
|
|
|
return;
|
|
|
|
|
|
|
|
prefix = input_config_get_prefix(user,
|
|
|
|
input_config_bind_map[idx].meta);
|
|
|
|
|
|
|
|
if (prefix)
|
|
|
|
input_config_parse_joy_button(conf, prefix,
|
|
|
|
input_config_bind_map[idx].base, bind);
|
2015-01-11 04:29:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void read_keybinds_axis(config_file_t *conf, unsigned user,
|
|
|
|
unsigned idx, struct retro_keybind *bind)
|
|
|
|
{
|
2015-01-13 23:35:27 +00:00
|
|
|
const char *prefix = NULL;
|
|
|
|
|
|
|
|
if (!input_config_bind_map[idx].valid)
|
|
|
|
return;
|
|
|
|
if (!input_config_bind_map[idx].base)
|
|
|
|
return;
|
|
|
|
|
|
|
|
prefix = input_config_get_prefix(user,
|
|
|
|
input_config_bind_map[idx].meta);
|
|
|
|
|
|
|
|
if (prefix)
|
|
|
|
input_config_parse_joy_axis(conf, prefix,
|
|
|
|
input_config_bind_map[idx].base, bind);
|
2015-01-11 04:29:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void read_keybinds_user(config_file_t *conf, unsigned user)
|
|
|
|
{
|
|
|
|
unsigned i;
|
2015-03-20 19:52:54 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-01-13 23:35:27 +00:00
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
for (i = 0; input_config_bind_map[i].valid; i++)
|
|
|
|
{
|
|
|
|
struct retro_keybind *bind = (struct retro_keybind*)
|
2015-03-20 19:52:54 +00:00
|
|
|
&settings->input.binds[user][i];
|
2015-01-11 04:29:32 +00:00
|
|
|
|
|
|
|
if (!bind->valid)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
read_keybinds_keyboard(conf, user, i, bind);
|
|
|
|
read_keybinds_button(conf, user, i, bind);
|
|
|
|
read_keybinds_axis(conf, user, i, bind);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void config_read_keybinds_conf(config_file_t *conf)
|
|
|
|
{
|
|
|
|
unsigned i;
|
2015-01-13 23:35:27 +00:00
|
|
|
|
2015-01-11 04:29:32 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
|
|
|
read_keybinds_user(conf, i);
|
|
|
|
}
|
2012-02-29 18:25:54 +00:00
|
|
|
|
2014-10-22 01:22:08 +00:00
|
|
|
/* Also dumps inherited values, useful for logging. */
|
2015-04-15 20:31:24 +00:00
|
|
|
#if 0
|
2014-10-22 01:22:08 +00:00
|
|
|
static void config_file_dump_all(config_file_t *conf)
|
|
|
|
{
|
2015-01-09 15:59:19 +00:00
|
|
|
struct config_entry_list *list = NULL;
|
2014-10-22 01:22:08 +00:00
|
|
|
struct config_include_list *includes = conf->includes;
|
2015-01-09 15:59:19 +00:00
|
|
|
|
2014-10-22 01:22:08 +00:00
|
|
|
while (includes)
|
|
|
|
{
|
|
|
|
RARCH_LOG("#include \"%s\"\n", includes->path);
|
|
|
|
includes = includes->next;
|
|
|
|
}
|
|
|
|
|
2015-01-09 15:59:19 +00:00
|
|
|
list = conf->entries;
|
2015-01-13 23:35:27 +00:00
|
|
|
|
2014-10-22 01:22:08 +00:00
|
|
|
while (list)
|
|
|
|
{
|
2015-04-15 20:31:24 +00:00
|
|
|
RARCH_LOG("%s = \"%s\"%s\n", list->key,
|
|
|
|
list->value, list->readonly ? " (included)" : "");
|
2014-10-22 01:22:08 +00:00
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
}
|
2015-04-15 20:31:24 +00:00
|
|
|
#endif
|
2015-01-08 18:11:05 +00:00
|
|
|
/**
|
|
|
|
* config_load:
|
|
|
|
* @path : path to be read from.
|
|
|
|
* @set_defaults : set default values first before
|
|
|
|
* reading the values from the config file
|
|
|
|
*
|
|
|
|
* Loads a config file and reads all the values into memory.
|
|
|
|
*
|
|
|
|
*/
|
2014-10-02 23:07:35 +00:00
|
|
|
static bool config_load_file(const char *path, bool set_defaults)
|
2011-01-19 11:54:19 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
2015-06-12 15:00:37 +00:00
|
|
|
char *save = NULL;
|
|
|
|
const char *extra_path = NULL;
|
|
|
|
char tmp_str[PATH_MAX_LENGTH] = {0};
|
|
|
|
char tmp_append_path[PATH_MAX_LENGTH] = {0}; /* Don't destroy append_config_path. */
|
2015-05-20 21:13:39 +00:00
|
|
|
int vp_width = 0, vp_height = 0, vp_x = 0, vp_y = 0;
|
2015-06-12 15:00:37 +00:00
|
|
|
unsigned msg_color = 0;
|
|
|
|
config_file_t *conf = NULL;
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
video_viewport_t *custom_vp = (video_viewport_t*)
|
|
|
|
video_viewport_get_custom();
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2012-01-28 14:41:57 +00:00
|
|
|
if (path)
|
2010-12-29 18:00:21 +00:00
|
|
|
{
|
2012-01-28 14:41:57 +00:00
|
|
|
conf = config_file_new(path);
|
2010-12-30 00:33:40 +00:00
|
|
|
if (!conf)
|
2012-01-29 21:00:21 +00:00
|
|
|
return false;
|
2010-12-29 18:00:21 +00:00
|
|
|
}
|
|
|
|
else
|
2011-02-22 10:28:28 +00:00
|
|
|
conf = open_default_config_file();
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2014-10-01 14:08:07 +00:00
|
|
|
if (!conf)
|
2012-01-28 14:47:02 +00:00
|
|
|
return true;
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2014-01-02 16:25:05 +00:00
|
|
|
if (set_defaults)
|
|
|
|
config_set_defaults();
|
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(tmp_append_path, global->append_config_path,
|
2014-09-01 23:27:46 +00:00
|
|
|
sizeof(tmp_append_path));
|
2015-04-05 16:14:24 +00:00
|
|
|
extra_path = strtok_r(tmp_append_path, "|", &save);
|
2014-10-01 14:08:07 +00:00
|
|
|
|
2012-09-10 22:10:44 +00:00
|
|
|
while (extra_path)
|
|
|
|
{
|
2014-10-01 14:08:07 +00:00
|
|
|
bool ret = false;
|
2012-09-10 22:10:44 +00:00
|
|
|
RARCH_LOG("Appending config \"%s\"\n", extra_path);
|
2014-10-01 14:08:07 +00:00
|
|
|
ret = config_append_file(conf, extra_path);
|
2012-09-10 22:10:44 +00:00
|
|
|
if (!ret)
|
|
|
|
RARCH_ERR("Failed to append config \"%s\"\n", extra_path);
|
2015-04-05 16:14:24 +00:00
|
|
|
extra_path = strtok_r(NULL, "|", &save);
|
2012-09-10 22:10:44 +00:00
|
|
|
}
|
2015-04-15 20:31:24 +00:00
|
|
|
#if 0
|
2015-03-21 04:42:49 +00:00
|
|
|
if (global->verbosity)
|
2011-10-17 17:11:31 +00:00
|
|
|
{
|
2012-10-16 11:57:35 +00:00
|
|
|
RARCH_LOG_OUTPUT("=== Config ===\n");
|
2014-06-11 12:19:34 +00:00
|
|
|
config_file_dump_all(conf);
|
2012-10-16 11:57:35 +00:00
|
|
|
RARCH_LOG_OUTPUT("=== Config end ===\n");
|
2011-10-17 17:11:31 +00:00
|
|
|
}
|
2015-04-15 20:31:24 +00:00
|
|
|
#endif
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, video.scale, "video_scale");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE (conf, settings, video.fullscreen_x, "video_fullscreen_x");
|
|
|
|
CONFIG_GET_INT_BASE (conf, settings, video.fullscreen_y, "video_fullscreen_y");
|
2011-07-09 06:37:08 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->force_fullscreen)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.fullscreen, "video_fullscreen");
|
2011-07-09 06:37:08 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.windowed_fullscreen, "video_windowed_fullscreen");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE (conf, settings, video.monitor_index, "video_monitor_index");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.disable_composition, "video_disable_composition");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.vsync, "video_vsync");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.hard_sync, "video_hard_sync");
|
2013-05-26 11:43:24 +00:00
|
|
|
|
2014-09-29 12:19:40 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-03-18 20:33:04 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-07-01 22:35:46 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.threaded_data_runloop_enable,
|
|
|
|
"threaded_data_runloop_enable");
|
2015-03-18 20:33:04 +00:00
|
|
|
#endif
|
2015-04-24 14:37:09 +00:00
|
|
|
|
2015-07-01 22:35:46 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.dpi.override_enable,
|
|
|
|
"dpi_override_enable");
|
|
|
|
CONFIG_GET_INT_BASE (conf, settings, menu.dpi.override_value,
|
|
|
|
"dpi_override_value");
|
|
|
|
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.pause_libretro,
|
|
|
|
"menu_pause_libretro");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.mouse.enable,
|
|
|
|
"menu_mouse_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.pointer.enable,
|
|
|
|
"menu_pointer_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.timedate_enable,
|
|
|
|
"menu_timedate_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.core_enable,
|
|
|
|
"menu_core_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.dynamic_wallpaper_enable,
|
|
|
|
"menu_dynamic_wallpaper_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.boxart_enable,
|
|
|
|
"menu_boxart_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.navigation.wraparound.horizontal_enable,
|
|
|
|
"menu_navigation_wraparound_horizontal_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.navigation.wraparound.vertical_enable,
|
|
|
|
"menu_navigation_wraparound_vertical_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings,
|
|
|
|
menu.navigation.browser.filter.supported_extensions_enable,
|
|
|
|
"menu_navigation_browser_filter_supported_extensions_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.collapse_subgroups_enable,
|
|
|
|
"menu_collapse_subgroups_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu.show_advanced_settings,
|
|
|
|
"menu_show_advanced_settings");
|
|
|
|
CONFIG_GET_HEX_BASE(conf, settings, menu.entry_normal_color,
|
|
|
|
"menu_entry_normal_color");
|
|
|
|
CONFIG_GET_HEX_BASE(conf, settings, menu.entry_hover_color,
|
|
|
|
"menu_entry_hover_color");
|
|
|
|
CONFIG_GET_HEX_BASE(conf, settings, menu.title_color,
|
|
|
|
"menu_title_color");
|
|
|
|
config_get_path(conf, "menu_wallpaper",
|
|
|
|
settings->menu.wallpaper, sizeof(settings->menu.wallpaper));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->menu.wallpaper, "default"))
|
|
|
|
*settings->menu.wallpaper = '\0';
|
2014-09-29 12:19:40 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, video.hard_sync_frames, "video_hard_sync_frames");
|
2015-03-20 19:52:54 +00:00
|
|
|
if (settings->video.hard_sync_frames > 3)
|
|
|
|
settings->video.hard_sync_frames = 3;
|
2013-05-26 11:43:24 +00:00
|
|
|
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, video.frame_delay, "video_frame_delay");
|
2015-03-20 19:52:54 +00:00
|
|
|
if (settings->video.frame_delay > 15)
|
|
|
|
settings->video.frame_delay = 15;
|
2014-08-28 18:54:42 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.black_frame_insertion, "video_black_frame_insertion");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, video.swap_interval, "video_swap_interval");
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.swap_interval = max(settings->video.swap_interval, 1);
|
|
|
|
settings->video.swap_interval = min(settings->video.swap_interval, 4);
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.threaded, "video_threaded");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.shared_context, "video_shared_context");
|
2014-08-11 09:00:11 +00:00
|
|
|
#ifdef GEKKO
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, video.viwidth, "video_viwidth");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.vfilter, "video_vfilter");
|
2014-08-11 09:00:11 +00:00
|
|
|
#endif
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.smooth, "video_smooth");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.force_aspect, "video_force_aspect");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.scale_integer, "video_scale_integer");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.crop_overscan, "video_crop_overscan");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, video.aspect_ratio, "video_aspect_ratio");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, video.aspect_ratio_idx, "aspect_ratio_index");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.aspect_ratio_auto, "video_aspect_ratio_auto");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, video.refresh_rate, "video_refresh_rate");
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2015-03-20 22:34:38 +00:00
|
|
|
config_get_path(conf, "video_shader", settings->video.shader_path, sizeof(settings->video.shader_path));
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.shader_enable, "video_shader_enable");
|
2013-04-06 23:38:11 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.allow_rotate, "video_allow_rotate");
|
2011-01-23 01:48:06 +00:00
|
|
|
|
2015-03-20 22:34:38 +00:00
|
|
|
config_get_path(conf, "video_font_path", settings->video.font_path, sizeof(settings->video.font_path));
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, video.font_size, "video_font_size");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.font_enable, "video_font_enable");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, video.msg_pos_x, "video_message_pos_x");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, video.msg_pos_y, "video_message_pos_y");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, video.rotation, "video_rotation");
|
2011-09-05 15:00:28 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.force_srgb_disable, "video_force_srgb_disable");
|
2014-09-21 03:23:51 +00:00
|
|
|
|
2015-04-28 01:22:04 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, core.set_supports_no_game_enable, "core_set_supports_no_game_enable");
|
|
|
|
|
2013-01-10 05:38:19 +00:00
|
|
|
#ifdef RARCH_CONSOLE
|
2015-04-05 16:14:24 +00:00
|
|
|
/* TODO - will be refactored later to make it more clean - it's more
|
2013-01-10 05:38:19 +00:00
|
|
|
* important that it works for consoles right now */
|
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, console.screen.gamma_correction, "gamma_correction");
|
2013-01-11 06:49:32 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_get_bool(conf, "custom_bgm_enable",
|
2015-03-21 04:42:49 +00:00
|
|
|
&global->console.sound.system_bgm_enable);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_get_bool(conf, "flicker_filter_enable",
|
2015-03-21 04:42:49 +00:00
|
|
|
&global->console.flickerfilter_enable);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_get_bool(conf, "soft_filter_enable",
|
2015-03-21 04:42:49 +00:00
|
|
|
&global->console.softfilter_enable);
|
2014-09-01 23:27:46 +00:00
|
|
|
|
2015-07-06 05:29:51 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, global, console.screen.resolutions.width,
|
|
|
|
"console_resolution_width");
|
|
|
|
CONFIG_GET_INT_BASE(conf, global, console.screen.resolutions.height,
|
|
|
|
"console_resolution_height");
|
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, global, console.screen.flicker_filter_index,
|
2014-09-01 23:27:46 +00:00
|
|
|
"flicker_filter_index");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, global, console.screen.soft_filter_index,
|
2014-09-01 23:27:46 +00:00
|
|
|
"soft_filter_index");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, global, console.screen.resolutions.current.id,
|
2014-09-01 23:27:46 +00:00
|
|
|
"current_resolution_id");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, global, console.sound.mode, "sound_mode");
|
2013-06-04 12:43:54 +00:00
|
|
|
#endif
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, state_slot, "state_slot");
|
2013-06-04 12:43:54 +00:00
|
|
|
|
2015-05-20 21:13:39 +00:00
|
|
|
|
|
|
|
config_get_int(conf, "custom_viewport_width", &vp_width);
|
|
|
|
config_get_int(conf, "custom_viewport_height", &vp_height);
|
|
|
|
config_get_int(conf, "custom_viewport_x", &vp_x);
|
|
|
|
config_get_int(conf, "custom_viewport_y", &vp_y);
|
|
|
|
|
|
|
|
if (custom_vp)
|
|
|
|
{
|
|
|
|
custom_vp->width = vp_width;
|
|
|
|
custom_vp->height = vp_height;
|
|
|
|
custom_vp->x = vp_x;
|
|
|
|
custom_vp->y = vp_y;
|
|
|
|
}
|
2013-01-10 05:38:19 +00:00
|
|
|
|
2011-09-05 15:00:28 +00:00
|
|
|
if (config_get_hex(conf, "video_message_color", &msg_color))
|
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.msg_color_r = ((msg_color >> 16) & 0xff) / 255.0f;
|
|
|
|
settings->video.msg_color_g = ((msg_color >> 8) & 0xff) / 255.0f;
|
|
|
|
settings->video.msg_color_b = ((msg_color >> 0) & 0xff) / 255.0f;
|
2011-09-05 15:00:28 +00:00
|
|
|
}
|
2011-01-23 01:59:44 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.post_filter_record, "video_post_filter_record");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.gpu_record, "video_gpu_record");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, video.gpu_screenshot, "video_gpu_screenshot");
|
2011-08-11 03:25:31 +00:00
|
|
|
|
2015-03-20 23:10:37 +00:00
|
|
|
config_get_path(conf, "video_shader_dir", settings->video.shader_dir, sizeof(settings->video.shader_dir));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->video.shader_dir, "default"))
|
|
|
|
*settings->video.shader_dir = '\0';
|
2011-03-29 16:04:41 +00:00
|
|
|
|
2015-03-20 23:10:37 +00:00
|
|
|
config_get_path(conf, "video_filter_dir", settings->video.filter_dir, sizeof(settings->video.filter_dir));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->video.filter_dir, "default"))
|
|
|
|
*settings->video.filter_dir = '\0';
|
2014-04-15 04:19:24 +00:00
|
|
|
|
2015-03-20 23:10:37 +00:00
|
|
|
config_get_path(conf, "audio_filter_dir", settings->audio.filter_dir, sizeof(settings->audio.filter_dir));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->audio.filter_dir, "default"))
|
|
|
|
*settings->audio.filter_dir = '\0';
|
2014-04-27 16:15:41 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.remap_binds_enable, "input_remap_binds_enable");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, input.axis_threshold, "input_axis_threshold");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.netplay_client_swap_input, "netplay_client_swap_input");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, input.max_users, "input_max_users");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.input_descriptor_label_show, "input_descriptor_label_show");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.input_descriptor_hide_unbound, "input_descriptor_hide_unbound");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.autoconfig_descriptor_label_show, "autoconfig_descriptor_label_show");
|
2012-02-02 20:02:36 +00:00
|
|
|
|
2015-04-13 00:12:28 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, ui.companion_start_on_boot, "ui_companion_start_on_boot");
|
|
|
|
|
2015-03-20 23:01:35 +00:00
|
|
|
config_get_path(conf, "core_updater_buildbot_url",
|
2015-03-20 23:10:37 +00:00
|
|
|
settings->network.buildbot_url, sizeof(settings->network.buildbot_url));
|
2015-03-20 23:01:35 +00:00
|
|
|
config_get_path(conf, "core_updater_buildbot_assets_url",
|
2015-03-20 23:10:37 +00:00
|
|
|
settings->network.buildbot_assets_url, sizeof(settings->network.buildbot_assets_url));
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, network.buildbot_auto_extract_archive, "core_updater_auto_extract_archive");
|
2015-01-19 03:09:28 +00:00
|
|
|
|
2015-01-05 00:58:00 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
2012-02-02 20:02:36 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char buf[64] = {0};
|
2012-02-18 11:09:20 +00:00
|
|
|
snprintf(buf, sizeof(buf), "input_player%u_joypad_index", i + 1);
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, input.joypad_map[i], buf);
|
2013-09-22 09:08:09 +00:00
|
|
|
|
2014-01-08 16:31:14 +00:00
|
|
|
snprintf(buf, sizeof(buf), "input_player%u_analog_dpad_mode", i + 1);
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, input.analog_dpad_mode[i], buf);
|
2014-01-08 16:31:14 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_libretro_device[i])
|
2013-09-22 09:08:09 +00:00
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1);
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, input.libretro_device[i], buf);
|
2013-09-22 09:08:09 +00:00
|
|
|
}
|
2012-02-02 20:02:36 +00:00
|
|
|
}
|
2011-01-10 15:53:37 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_ups_pref)
|
2015-01-13 02:13:19 +00:00
|
|
|
{
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, ups_pref, "ups_pref");
|
2015-01-13 02:13:19 +00:00
|
|
|
}
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_bps_pref)
|
2015-01-13 02:13:19 +00:00
|
|
|
{
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, bps_pref, "bps_pref");
|
2015-01-13 02:13:19 +00:00
|
|
|
}
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_ips_pref)
|
2015-01-13 02:13:19 +00:00
|
|
|
{
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, ips_pref, "ips_pref");
|
2015-01-13 02:13:19 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 04:14:13 +00:00
|
|
|
/* Audio settings. */
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, audio.enable, "audio_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, audio.mute_enable, "audio_mute_enable");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, audio.out_rate, "audio_out_rate");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, audio.block_frames, "audio_block_frames");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, audio.device, "audio_device");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, audio.latency, "audio_latency");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, audio.sync, "audio_sync");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, audio.rate_control, "audio_rate_control");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, audio.rate_control_delta, "audio_rate_control_delta");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, audio.max_timing_skew, "audio_max_timing_skew");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, audio.volume, "audio_volume");
|
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, audio.resampler, "audio_resampler");
|
2015-05-19 19:18:07 +00:00
|
|
|
audio_driver_set_volume_gain(db_to_gain(settings->audio.volume));
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, camera.device, "camera_device");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, camera.allow, "camera_allow");
|
2014-04-06 20:59:16 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, location.allow, "location_allow");
|
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, video.driver, "video_driver");
|
2015-06-21 07:07:47 +00:00
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, record.driver, "record_driver");
|
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, camera.driver, "camera_driver");
|
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, location.driver, "location_driver");
|
2014-09-05 16:14:00 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, menu.driver, "menu_driver");
|
2014-09-05 16:14:00 +00:00
|
|
|
#endif
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, video.context_driver, "video_context_driver");
|
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, audio.driver, "audio_driver");
|
2015-03-20 22:34:38 +00:00
|
|
|
config_get_path(conf, "video_filter", settings->video.softfilter_plugin, sizeof(settings->video.softfilter_plugin));
|
|
|
|
config_get_path(conf, "audio_dsp_plugin", settings->audio.dsp_plugin, sizeof(settings->audio.dsp_plugin));
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, input.driver, "input_driver");
|
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, input.joypad_driver, "input_joypad_driver");
|
|
|
|
CONFIG_GET_STRING_BASE(conf, settings, input.keyboard_layout, "input_keyboard_layout");
|
2011-11-15 20:15:12 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_libretro)
|
2015-03-20 23:01:35 +00:00
|
|
|
config_get_path(conf, "libretro_path", settings->libretro, sizeof(settings->libretro));
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_libretro_directory)
|
2015-03-20 23:01:35 +00:00
|
|
|
config_get_path(conf, "libretro_directory", settings->libretro_directory, sizeof(settings->libretro_directory));
|
2014-05-09 16:51:20 +00:00
|
|
|
|
2014-09-03 04:14:13 +00:00
|
|
|
/* Safe-guard against older behavior. */
|
2015-03-20 19:52:54 +00:00
|
|
|
if (path_is_directory(settings->libretro))
|
2014-05-09 16:51:20 +00:00
|
|
|
{
|
|
|
|
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
|
2015-03-20 19:52:54 +00:00
|
|
|
strlcpy(settings->libretro_directory, settings->libretro,
|
|
|
|
sizeof(settings->libretro_directory));
|
|
|
|
*settings->libretro = '\0';
|
2014-05-09 16:51:20 +00:00
|
|
|
}
|
2012-09-07 20:20:49 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, ui.menubar_enable, "ui_menubar_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, ui.suspend_screensaver_enable, "suspend_screensaver_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, fps_show, "fps_show");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, load_dummy_on_core_shutdown, "load_dummy_on_core_shutdown");
|
2015-06-28 15:21:32 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, multimedia.builtin_mediaplayer_enable, "builtin_mediaplayer_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, multimedia.builtin_imageviewer_enable, "builtin_imageviewer_enable");
|
2013-10-10 23:19:54 +00:00
|
|
|
|
2015-03-20 22:34:38 +00:00
|
|
|
config_get_path(conf, "libretro_info_path", settings->libretro_info_path, sizeof(settings->libretro_info_path));
|
2013-10-10 22:36:08 +00:00
|
|
|
|
2015-03-20 22:34:38 +00:00
|
|
|
config_get_path(conf, "core_options_path", settings->core_options_path, sizeof(settings->core_options_path));
|
2015-03-20 22:49:18 +00:00
|
|
|
config_get_path(conf, "screenshot_directory", settings->screenshot_directory, sizeof(settings->screenshot_directory));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (*settings->screenshot_directory)
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->screenshot_directory, "default"))
|
|
|
|
*settings->screenshot_directory = '\0';
|
|
|
|
else if (!path_is_directory(settings->screenshot_directory))
|
2013-09-16 21:30:42 +00:00
|
|
|
{
|
|
|
|
RARCH_WARN("screenshot_directory is not an existing directory, ignoring ...\n");
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->screenshot_directory = '\0';
|
2013-09-16 21:30:42 +00:00
|
|
|
}
|
2011-08-24 13:47:39 +00:00
|
|
|
}
|
2011-01-31 17:06:57 +00:00
|
|
|
|
2015-07-01 22:35:46 +00:00
|
|
|
config_get_path(conf, "input_remapping_path", settings->input.remapping_path,
|
|
|
|
sizeof(settings->input.remapping_path));
|
|
|
|
config_get_path(conf, "resampler_directory", settings->resampler_directory,
|
|
|
|
sizeof(settings->resampler_directory));
|
|
|
|
config_get_path(conf, "extraction_directory", settings->extraction_directory,
|
|
|
|
sizeof(settings->extraction_directory));
|
|
|
|
config_get_path(conf, "input_remapping_directory", settings->input_remapping_directory,
|
|
|
|
sizeof(settings->input_remapping_directory));
|
|
|
|
config_get_path(conf, "core_assets_directory", settings->core_assets_directory,
|
|
|
|
sizeof(settings->core_assets_directory));
|
|
|
|
config_get_path(conf, "assets_directory", settings->assets_directory,
|
|
|
|
sizeof(settings->assets_directory));
|
|
|
|
config_get_path(conf, "dynamic_wallpapers_directory", settings->dynamic_wallpapers_directory,
|
|
|
|
sizeof(settings->dynamic_wallpapers_directory));
|
|
|
|
config_get_path(conf, "boxarts_directory", settings->boxarts_directory,
|
|
|
|
sizeof(settings->boxarts_directory));
|
|
|
|
config_get_path(conf, "playlist_directory", settings->playlist_directory,
|
|
|
|
sizeof(settings->playlist_directory));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->core_assets_directory, "default"))
|
|
|
|
*settings->core_assets_directory = '\0';
|
|
|
|
if (!strcmp(settings->assets_directory, "default"))
|
|
|
|
*settings->assets_directory = '\0';
|
2015-06-04 10:17:23 +00:00
|
|
|
if (!strcmp(settings->dynamic_wallpapers_directory, "default"))
|
|
|
|
*settings->dynamic_wallpapers_directory = '\0';
|
2015-06-18 02:32:56 +00:00
|
|
|
if (!strcmp(settings->boxarts_directory, "default"))
|
|
|
|
*settings->boxarts_directory = '\0';
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->playlist_directory, "default"))
|
|
|
|
*settings->playlist_directory = '\0';
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-07-01 22:35:46 +00:00
|
|
|
config_get_path(conf, "rgui_browser_directory", settings->menu_content_directory,
|
|
|
|
sizeof(settings->menu_content_directory));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->menu_content_directory, "default"))
|
|
|
|
*settings->menu_content_directory = '\0';
|
2015-07-01 22:35:46 +00:00
|
|
|
config_get_path(conf, "rgui_config_directory", settings->menu_config_directory,
|
|
|
|
sizeof(settings->menu_config_directory));
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->menu_config_directory, "default"))
|
|
|
|
*settings->menu_config_directory = '\0';
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, menu_show_start_screen, "rgui_show_start_screen");
|
2013-03-17 20:37:41 +00:00
|
|
|
#endif
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, libretro_log_level, "libretro_log_level");
|
2014-05-26 09:07:59 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_verbosity)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, verbosity, "log_verbosity");
|
2013-03-17 20:37:41 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, perfcnt_enable, "perfcnt_enable");
|
2014-06-01 20:06:52 +00:00
|
|
|
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, archive.mode, "archive_mode");
|
2014-11-14 15:30:55 +00:00
|
|
|
|
2015-07-01 22:35:46 +00:00
|
|
|
config_get_path(conf, "recording_output_directory", global->record.output_dir,
|
|
|
|
sizeof(global->record.output_dir));
|
|
|
|
config_get_path(conf, "recording_config_directory", global->record.config_dir,
|
|
|
|
sizeof(global->record.config_dir));
|
2015-04-14 19:13:54 +00:00
|
|
|
|
2013-05-22 20:31:16 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2015-03-21 04:42:49 +00:00
|
|
|
config_get_path(conf, "overlay_directory", global->overlay_dir, sizeof(global->overlay_dir));
|
|
|
|
if (!strcmp(global->overlay_dir, "default"))
|
|
|
|
*global->overlay_dir = '\0';
|
2013-05-24 16:35:28 +00:00
|
|
|
|
2015-03-20 23:01:35 +00:00
|
|
|
config_get_path(conf, "input_overlay", settings->input.overlay, sizeof(settings->input.overlay));
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.overlay_enable, "input_overlay_enable");
|
2015-07-03 17:27:16 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.overlay_enable_autopreferred, "input_overlay_enable_autopreferred");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, input.overlay_opacity, "input_overlay_opacity");
|
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, input.overlay_scale, "input_overlay_scale");
|
2015-01-29 19:33:27 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
config_get_path(conf, "osk_overlay_directory", global->osk_overlay_dir, sizeof(global->osk_overlay_dir));
|
|
|
|
if (!strcmp(global->osk_overlay_dir, "default"))
|
|
|
|
*global->osk_overlay_dir = '\0';
|
2015-01-29 19:33:27 +00:00
|
|
|
|
2015-03-20 23:10:37 +00:00
|
|
|
config_get_path(conf, "input_osk_overlay", settings->osk.overlay, sizeof(settings->osk.overlay));
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, osk.enable, "input_osk_overlay_enable");
|
2013-05-22 20:31:16 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, rewind_enable, "rewind_enable");
|
2011-02-05 10:31:35 +00:00
|
|
|
|
2015-06-26 15:46:13 +00:00
|
|
|
{
|
|
|
|
/* ugly hack around C89 not allowing mixing declarations and code */
|
|
|
|
int buffer_size = 0;
|
|
|
|
if (config_get_int(conf, "rewind_buffer_size", &buffer_size))
|
|
|
|
settings->rewind_buffer_size = buffer_size * UINT64_C(1000000);
|
|
|
|
}
|
2011-02-05 10:31:35 +00:00
|
|
|
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, rewind_granularity, "rewind_granularity");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, slowmotion_ratio, "slowmotion_ratio");
|
2015-03-20 19:52:54 +00:00
|
|
|
if (settings->slowmotion_ratio < 1.0f)
|
|
|
|
settings->slowmotion_ratio = 1.0f;
|
2011-01-31 17:06:57 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_FLOAT_BASE(conf, settings, fastforward_ratio, "fastforward_ratio");
|
2014-10-03 17:07:40 +00:00
|
|
|
|
|
|
|
/* Sanitize fastforward_ratio value - previously range was -1
|
|
|
|
* and up (with 0 being skipped) */
|
2015-03-20 19:52:54 +00:00
|
|
|
if (settings->fastforward_ratio <= 0.0f)
|
|
|
|
settings->fastforward_ratio = 1.0f;
|
2014-10-03 17:07:40 +00:00
|
|
|
|
2015-07-01 22:35:46 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, fastforward_ratio_throttle_enable,
|
|
|
|
"fastforward_ratio_throttle_enable");
|
2013-08-07 20:24:12 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, pause_nonactive, "pause_nonactive");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, autosave_interval, "autosave_interval");
|
2011-02-05 20:45:44 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, content_database, "content_database_path");
|
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, cheat_database, "cheat_database_path");
|
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, cursor_directory, "cursor_directory");
|
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, cheat_settings_path, "cheat_settings_path");
|
2011-04-17 11:30:59 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, block_sram_overwrite, "block_sram_overwrite");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, savestate_auto_index, "savestate_auto_index");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, savestate_auto_save, "savestate_auto_save");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, savestate_auto_load, "savestate_auto_load");
|
2011-09-16 13:32:21 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, network_cmd_enable, "network_cmd_enable");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, network_cmd_port, "network_cmd_port");
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, stdin_cmd_enable, "stdin_cmd_enable");
|
2012-05-27 12:12:29 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, content_history_directory, "content_history_dir");
|
2014-09-15 02:20:45 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, history_list_enable, "history_list_enable");
|
2014-10-17 02:17:28 +00:00
|
|
|
|
2015-05-25 22:12:49 +00:00
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, content_history_path, "content_history_path");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, content_history_size, "content_history_size");
|
2013-06-09 19:59:48 +00:00
|
|
|
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, input.turbo_period, "input_turbo_period");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, input.turbo_duty_cycle, "input_duty_cycle");
|
2012-10-01 20:15:48 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, input.autodetect_enable, "input_autodetect_enable");
|
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, input.autoconfig_dir, "joypad_autoconfig_dir");
|
2013-04-26 12:36:36 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_username)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_PATH_BASE(conf, settings, username, "netplay_nickname");
|
2015-03-21 07:05:50 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, user_language, "user_language");
|
2014-06-09 21:21:48 +00:00
|
|
|
#ifdef HAVE_NETPLAY
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_netplay_mode)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, netplay_is_spectate,
|
2014-09-01 23:27:46 +00:00
|
|
|
"netplay_spectator_mode_enable");
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_netplay_mode)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, global, netplay_is_client, "netplay_mode");
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_netplay_ip_address)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_PATH_BASE(conf, global, netplay_server, "netplay_ip_address");
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_netplay_delay_frames)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, global, netplay_sync_frames, "netplay_delay_frames");
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_netplay_ip_port)
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, global, netplay_port, "netplay_ip_port");
|
2014-06-09 21:21:48 +00:00
|
|
|
#endif
|
2014-06-09 20:50:44 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, config_save_on_exit, "config_save_on_exit");
|
2013-05-22 13:35:28 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_save_path &&
|
2014-09-01 23:27:46 +00:00
|
|
|
config_get_path(conf, "savefile_directory", tmp_str, sizeof(tmp_str)))
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2013-05-21 02:18:34 +00:00
|
|
|
if (!strcmp(tmp_str, "default"))
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(global->savefile_dir, g_defaults.sram_dir,
|
|
|
|
sizeof(global->savefile_dir));
|
2013-05-21 02:18:34 +00:00
|
|
|
else if (path_is_directory(tmp_str))
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(global->savefile_dir, tmp_str,
|
|
|
|
sizeof(global->savefile_dir));
|
|
|
|
strlcpy(global->savefile_name, tmp_str,
|
|
|
|
sizeof(global->savefile_name));
|
|
|
|
fill_pathname_dir(global->savefile_name, global->basename,
|
|
|
|
".srm", sizeof(global->savefile_name));
|
2011-08-24 13:47:39 +00:00
|
|
|
}
|
|
|
|
else
|
2013-05-01 10:50:40 +00:00
|
|
|
RARCH_WARN("savefile_directory is not a directory, ignoring ...\n");
|
2011-08-24 13:47:39 +00:00
|
|
|
}
|
2012-06-11 22:28:34 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_state_path &&
|
2014-09-01 23:27:46 +00:00
|
|
|
config_get_path(conf, "savestate_directory", tmp_str, sizeof(tmp_str)))
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2013-05-21 02:18:34 +00:00
|
|
|
if (!strcmp(tmp_str, "default"))
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(global->savestate_dir, g_defaults.savestate_dir,
|
|
|
|
sizeof(global->savestate_dir));
|
2013-05-21 02:18:34 +00:00
|
|
|
else if (path_is_directory(tmp_str))
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(global->savestate_dir, tmp_str,
|
|
|
|
sizeof(global->savestate_dir));
|
|
|
|
strlcpy(global->savestate_name, tmp_str,
|
|
|
|
sizeof(global->savestate_name));
|
|
|
|
fill_pathname_dir(global->savestate_name, global->basename,
|
|
|
|
".state", sizeof(global->savestate_name));
|
2011-08-24 13:47:39 +00:00
|
|
|
}
|
|
|
|
else
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_WARN("savestate_directory is not a directory, ignoring ...\n");
|
2011-08-24 13:47:39 +00:00
|
|
|
}
|
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
if (settings->content_history_path[0] == '\0')
|
2014-11-29 15:40:33 +00:00
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
if (settings->content_history_directory[0] != '\0')
|
2014-11-29 15:40:33 +00:00
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
fill_pathname_join(settings->content_history_path,
|
|
|
|
settings->content_history_directory,
|
2015-06-08 21:38:03 +00:00
|
|
|
"content_history.lpl",
|
2015-03-20 19:52:54 +00:00
|
|
|
sizeof(settings->content_history_path));
|
2014-11-29 15:40:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
fill_pathname_resolve_relative(settings->content_history_path,
|
2015-06-08 21:38:03 +00:00
|
|
|
global->config_path, "content_history.lpl",
|
2015-03-20 19:52:54 +00:00
|
|
|
sizeof(settings->content_history_path));
|
2014-11-29 15:40:33 +00:00
|
|
|
}
|
|
|
|
}
|
2014-11-27 07:46:30 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
if (!config_get_path(conf, "system_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->system_directory, sizeof(settings->system_directory)))
|
2012-09-18 21:48:50 +00:00
|
|
|
{
|
|
|
|
RARCH_WARN("system_directory is not set in config. Assuming system directory is same folder as game: \"%s\".\n",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->system_directory);
|
2012-09-18 21:48:50 +00:00
|
|
|
}
|
2012-06-11 22:28:34 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
if (!strcmp(settings->system_directory, "default"))
|
|
|
|
*settings->system_directory = '\0';
|
2013-05-21 02:18:34 +00:00
|
|
|
|
2012-02-29 18:25:54 +00:00
|
|
|
config_read_keybinds_conf(conf);
|
2010-12-29 20:12:56 +00:00
|
|
|
|
2015-03-21 07:00:17 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, core_specific_config, "core_specific_config");
|
2015-04-18 01:07:15 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, auto_overrides_enable, "auto_overrides_enable");
|
2015-04-18 01:10:26 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, auto_remaps_enable, "auto_remaps_enable");
|
2014-01-01 19:44:20 +00:00
|
|
|
|
2015-05-07 23:06:14 +00:00
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, sort_savefiles_enable, "sort_savefiles_enable");
|
|
|
|
CONFIG_GET_BOOL_BASE(conf, settings, sort_savestates_enable, "sort_savestates_enable");
|
|
|
|
|
2015-05-07 01:55:15 +00:00
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_ok_btn, "menu_ok_btn");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_cancel_btn, "menu_cancel_btn");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_search_btn, "menu_search_btn");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_info_btn, "menu_info_btn");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_default_btn, "menu_default_btn");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_cancel_btn, "menu_cancel_btn");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_scroll_down_btn, "menu_scroll_down_btn");
|
|
|
|
CONFIG_GET_INT_BASE(conf, settings, menu_scroll_up_btn, "menu_scroll_up_btn");
|
|
|
|
|
2010-12-29 18:00:21 +00:00
|
|
|
config_file_free(conf);
|
2012-01-28 14:47:02 +00:00
|
|
|
return true;
|
2010-12-29 18:00:21 +00:00
|
|
|
}
|
2010-12-30 03:51:08 +00:00
|
|
|
|
2014-10-02 23:07:35 +00:00
|
|
|
static void config_load_core_specific(void)
|
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-03-21 04:42:49 +00:00
|
|
|
global_t *global = global_get_ptr();
|
2015-03-20 19:52:54 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
*global->core_specific_config_path = '\0';
|
2014-10-02 23:07:35 +00:00
|
|
|
|
2015-06-20 21:42:30 +00:00
|
|
|
if (!*settings->libretro)
|
|
|
|
return;
|
2014-10-02 23:07:35 +00:00
|
|
|
#ifdef HAVE_DYNAMIC
|
2015-06-20 21:42:30 +00:00
|
|
|
if (global->core_type == CORE_TYPE_DUMMY)
|
2014-10-02 23:07:35 +00:00
|
|
|
return;
|
2015-06-20 21:42:30 +00:00
|
|
|
#endif
|
2014-10-02 23:07:35 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_MENU
|
2015-03-20 19:52:54 +00:00
|
|
|
if (*settings->menu_config_directory)
|
2014-10-02 23:07:35 +00:00
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
path_resolve_realpath(settings->menu_config_directory,
|
|
|
|
sizeof(settings->menu_config_directory));
|
2015-03-21 04:42:49 +00:00
|
|
|
strlcpy(global->core_specific_config_path,
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu_config_directory,
|
2015-03-21 04:42:49 +00:00
|
|
|
sizeof(global->core_specific_config_path));
|
2014-10-02 23:07:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
/* Use original config file's directory as a fallback. */
|
2015-03-21 04:42:49 +00:00
|
|
|
fill_pathname_basedir(global->core_specific_config_path,
|
|
|
|
global->config_path, sizeof(global->core_specific_config_path));
|
2014-10-02 23:07:35 +00:00
|
|
|
}
|
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
fill_pathname_dir(global->core_specific_config_path, settings->libretro,
|
|
|
|
".cfg", sizeof(global->core_specific_config_path));
|
2014-10-02 23:07:35 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
if (settings->core_specific_config)
|
2014-10-02 23:07:35 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char tmp[PATH_MAX_LENGTH] = {0};
|
2015-05-07 05:36:29 +00:00
|
|
|
|
2015-06-12 15:00:37 +00:00
|
|
|
/* Toggle has_save_path to false so it resets */
|
|
|
|
global->has_set_save_path = false;
|
|
|
|
global->has_set_state_path = false;
|
2015-05-07 05:36:29 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
strlcpy(tmp, settings->libretro, sizeof(tmp));
|
2014-10-02 23:07:35 +00:00
|
|
|
RARCH_LOG("Loading core-specific config from: %s.\n",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->core_specific_config_path);
|
2014-10-02 23:07:35 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!config_load_file(global->core_specific_config_path, true))
|
2014-10-02 23:07:35 +00:00
|
|
|
RARCH_WARN("Core-specific config not found, reusing last config.\n");
|
|
|
|
|
|
|
|
/* Force some parameters which are implied when using core specific configs.
|
|
|
|
* Don't have the core config file overwrite the libretro path. */
|
2015-03-20 19:52:54 +00:00
|
|
|
strlcpy(settings->libretro, tmp, sizeof(settings->libretro));
|
2014-10-02 23:07:35 +00:00
|
|
|
|
|
|
|
/* This must be true for core specific configs. */
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->core_specific_config = true;
|
2015-05-07 05:36:29 +00:00
|
|
|
|
2015-06-12 15:00:37 +00:00
|
|
|
/* Reset save paths */
|
|
|
|
global->has_set_save_path = true;
|
|
|
|
global->has_set_state_path = true;
|
2014-10-02 23:07:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-05 16:14:24 +00:00
|
|
|
/**
|
2015-04-05 18:52:43 +00:00
|
|
|
* config_load_override:
|
2015-04-05 16:14:24 +00:00
|
|
|
*
|
|
|
|
* Tries to append game-specific and core-specific configuration.
|
|
|
|
* These settings will always have precedence, thus this feature
|
|
|
|
* can be used to enforce overrides.
|
|
|
|
*
|
|
|
|
* This function only has an effect if a game-specific or core-specific
|
|
|
|
* configuration file exists at respective locations.
|
|
|
|
*
|
2015-04-05 18:52:43 +00:00
|
|
|
* core-specific: $CONFIG_DIR/$CORE_NAME/$CORE_NAME.cfg fallback: $CURRENT_CFG_LOCATION/$CORE_NAME/$CORE_NAME.cfg
|
|
|
|
* game-specific: $CONFIG_DIR/$CORE_NAME/$ROM_NAME.cfg fallback: $CURRENT_CFG_LOCATION/$CORE_NAME/$GAME_NAME.cfg
|
2015-04-05 16:14:24 +00:00
|
|
|
*
|
2015-04-07 01:16:00 +00:00
|
|
|
* Returns: false if there was an error or no action was performed.
|
2015-04-05 16:14:24 +00:00
|
|
|
*
|
|
|
|
*/
|
2015-04-05 18:52:43 +00:00
|
|
|
bool config_load_override(void)
|
2015-04-05 16:14:24 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char config_directory[PATH_MAX_LENGTH] = {0}; /* path to the directory containing retroarch.cfg (prefix) */
|
|
|
|
char core_path[PATH_MAX_LENGTH] = {0}; /* final path for core-specific configuration (prefix+suffix) */
|
|
|
|
char game_path[PATH_MAX_LENGTH] = {0}; /* final path for game-specific configuration (prefix+suffix) */
|
|
|
|
config_file_t *new_conf = NULL;
|
|
|
|
const char *core_name = NULL;
|
|
|
|
const char *game_name = NULL;
|
|
|
|
bool should_append = false;
|
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
settings_t *settings = config_get_ptr();
|
2015-06-25 10:36:55 +00:00
|
|
|
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Early return in case a library isn't loaded */
|
2015-06-25 10:36:55 +00:00
|
|
|
if (!info->info.library_name || !strcmp(info->info.library_name,"No Core"))
|
2015-04-07 00:54:58 +00:00
|
|
|
return false;
|
2015-04-05 20:41:24 +00:00
|
|
|
|
2015-06-25 09:04:51 +00:00
|
|
|
RARCH_LOG("Game name: %s\n", global->basename);
|
2015-06-25 10:36:55 +00:00
|
|
|
RARCH_LOG("Core name: %s\n", info->info.library_name);
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-04-05 18:52:43 +00:00
|
|
|
if (!global || !settings )
|
2015-04-05 16:14:24 +00:00
|
|
|
{
|
|
|
|
RARCH_ERR("Could not obtain global pointer or configuration file pointer to retrieve path of retroarch.cfg.\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Config directory: config_directory.
|
|
|
|
* Try config directory setting first,
|
|
|
|
* fallback to the location of the current configuration file. */
|
2015-05-19 18:29:03 +00:00
|
|
|
if (settings->menu_config_directory[0] != '\0')
|
2015-04-05 16:14:24 +00:00
|
|
|
strlcpy(config_directory, settings->menu_config_directory, PATH_MAX_LENGTH);
|
2015-05-19 18:29:03 +00:00
|
|
|
else if (global->config_path[0] != '\0')
|
2015-04-05 16:14:24 +00:00
|
|
|
fill_pathname_basedir(config_directory, global->config_path, PATH_MAX_LENGTH);
|
|
|
|
else
|
|
|
|
{
|
2015-04-05 20:41:24 +00:00
|
|
|
RARCH_WARN("No config directory set under Settings > Path and retroarch.cfg not found.\n");
|
2015-04-07 00:54:58 +00:00
|
|
|
return false;
|
2015-04-05 16:14:24 +00:00
|
|
|
}
|
2015-04-11 21:03:30 +00:00
|
|
|
|
2015-04-05 16:14:24 +00:00
|
|
|
RARCH_LOG("Config directory: %s\n", config_directory);
|
|
|
|
|
2015-06-25 10:36:55 +00:00
|
|
|
core_name = info->info.library_name;
|
2015-04-05 16:14:24 +00:00
|
|
|
game_name = path_basename(global->basename);
|
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Concatenate strings into full paths for core_path, game_path */
|
2015-04-05 16:14:24 +00:00
|
|
|
fill_pathname_join(core_path, config_directory, core_name, PATH_MAX_LENGTH);
|
|
|
|
fill_pathname_join(core_path, core_path, core_name, PATH_MAX_LENGTH);
|
|
|
|
strlcat(core_path, ".cfg", PATH_MAX_LENGTH);
|
|
|
|
|
|
|
|
fill_pathname_join(game_path, config_directory, core_name, PATH_MAX_LENGTH);
|
|
|
|
fill_pathname_join(game_path, game_path, game_name, PATH_MAX_LENGTH);
|
|
|
|
strlcat(game_path, ".cfg", PATH_MAX_LENGTH);
|
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Create a new config file from core_path */
|
|
|
|
new_conf = config_file_new(core_path);
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-06-26 16:35:35 +00:00
|
|
|
/* If a core override exists, add its location to append_config_path */
|
2015-04-05 16:14:24 +00:00
|
|
|
if (new_conf)
|
|
|
|
{
|
2015-04-08 03:08:30 +00:00
|
|
|
if (settings->core_specific_config)
|
|
|
|
{
|
2015-04-08 03:18:45 +00:00
|
|
|
RARCH_LOG("Can't use overrides in conjunction with per-core configs, disabling overrides\n");
|
2015-04-15 20:31:24 +00:00
|
|
|
return false;
|
2015-04-11 21:03:30 +00:00
|
|
|
}
|
2015-04-07 00:54:58 +00:00
|
|
|
RARCH_LOG("Core-specific overrides found at %s. Appending.\n", core_path);
|
2015-04-05 16:14:24 +00:00
|
|
|
strlcpy(global->append_config_path, core_path, sizeof(global->append_config_path));
|
|
|
|
should_append = true;
|
|
|
|
}
|
|
|
|
else
|
2015-04-07 00:54:58 +00:00
|
|
|
RARCH_LOG("No core-specific overrides found at %s.\n", core_path);
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-06-26 15:46:13 +00:00
|
|
|
/* Create a new config file from game_path */
|
2015-04-05 16:14:24 +00:00
|
|
|
new_conf = config_file_new(game_path);
|
|
|
|
|
2015-06-26 15:46:13 +00:00
|
|
|
/* If a game override exists, add it's location to append_config_path */
|
2015-04-05 16:14:24 +00:00
|
|
|
if (new_conf)
|
|
|
|
{
|
2015-04-07 00:58:57 +00:00
|
|
|
RARCH_LOG("Game-specific overrides found at %s. Appending.\n", game_path);
|
2015-04-08 03:20:09 +00:00
|
|
|
if (should_append)
|
2015-04-05 16:14:24 +00:00
|
|
|
{
|
2015-04-11 21:03:30 +00:00
|
|
|
strlcat(global->append_config_path, "|", sizeof(global->append_config_path));
|
|
|
|
strlcat(global->append_config_path, game_path, sizeof(global->append_config_path));
|
2015-04-05 16:14:24 +00:00
|
|
|
}
|
|
|
|
else
|
2015-04-11 21:03:30 +00:00
|
|
|
strlcpy(global->append_config_path, game_path, sizeof(global->append_config_path));
|
2015-04-07 00:58:57 +00:00
|
|
|
|
2015-04-05 16:14:24 +00:00
|
|
|
should_append = true;
|
|
|
|
}
|
|
|
|
else
|
2015-04-07 00:54:58 +00:00
|
|
|
RARCH_LOG("No game-specific overrides found at %s.\n", game_path);
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Re-load the configuration with any overrides that might have been found */
|
2015-04-08 03:20:09 +00:00
|
|
|
if (should_append)
|
2015-04-05 20:41:24 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char buf[PATH_MAX_LENGTH] = {0};
|
2015-04-11 21:03:30 +00:00
|
|
|
|
2015-04-11 04:02:56 +00:00
|
|
|
if (settings->core_specific_config)
|
|
|
|
{
|
|
|
|
RARCH_WARN("Can't use overrides in conjunction with per-core configs, disabling overrides\n");
|
2015-04-11 21:03:30 +00:00
|
|
|
return false;
|
|
|
|
}
|
2015-04-11 04:02:56 +00:00
|
|
|
|
2015-04-11 21:03:30 +00:00
|
|
|
#ifdef HAVE_NETPLAY
|
2015-04-11 04:02:56 +00:00
|
|
|
if (global->netplay_enable)
|
|
|
|
{
|
|
|
|
RARCH_WARN("Can't use overrides in conjunction with netplay, disabling overrides\n");
|
2015-04-11 21:03:30 +00:00
|
|
|
return false;
|
2015-05-07 23:06:14 +00:00
|
|
|
}
|
2015-04-11 21:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Store the libretro_path we're using since it will be overwritten by the override when reloading */
|
2015-04-11 21:03:30 +00:00
|
|
|
strlcpy(buf,settings->libretro,sizeof(buf));
|
2015-05-07 05:36:29 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Toggle has_save_path to false so it resets */
|
|
|
|
global->has_set_save_path = false;
|
|
|
|
global->has_set_state_path = false;
|
2015-05-07 05:36:29 +00:00
|
|
|
|
2015-04-08 03:20:09 +00:00
|
|
|
if (config_load_file(global->config_path, false))
|
2015-05-07 23:06:14 +00:00
|
|
|
{
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Restore the libretro_path we're using
|
|
|
|
* since it will be overwritten by the override when reloading. */
|
2015-04-11 21:03:30 +00:00
|
|
|
strlcpy(settings->libretro,buf,sizeof(settings->libretro));
|
|
|
|
rarch_main_msg_queue_push("Configuration override loaded", 1, 100, true);
|
2015-05-07 05:36:29 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Reset save paths */
|
|
|
|
global->has_set_save_path = true;
|
|
|
|
global->has_set_state_path = true;
|
2015-04-11 21:03:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-04-05 20:41:24 +00:00
|
|
|
}
|
2015-04-05 16:14:24 +00:00
|
|
|
|
2015-04-07 00:54:58 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-07 01:07:44 +00:00
|
|
|
/**
|
|
|
|
* config_unload_override:
|
|
|
|
*
|
|
|
|
* Unloads configuration overrides if overrides are active.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Returns: false if there was an error.
|
|
|
|
*/
|
2015-04-07 01:22:33 +00:00
|
|
|
bool config_unload_override(void)
|
2015-04-07 00:54:58 +00:00
|
|
|
{
|
2015-04-07 04:54:42 +00:00
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
|
|
|
|
if (!global)
|
|
|
|
return false;
|
2015-04-07 00:58:57 +00:00
|
|
|
|
2015-04-07 04:54:42 +00:00
|
|
|
*global->append_config_path = '\0';
|
2015-05-07 23:06:14 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Toggle has_save_path to false so it resets */
|
2015-05-07 05:36:29 +00:00
|
|
|
global->has_set_save_path = false;
|
|
|
|
global->has_set_state_path = false;
|
2015-05-07 23:06:14 +00:00
|
|
|
|
2015-04-07 00:58:57 +00:00
|
|
|
if (config_load_file(global->config_path, false))
|
2015-04-07 00:54:58 +00:00
|
|
|
{
|
2015-05-08 07:12:49 +00:00
|
|
|
RARCH_LOG("Configuration overrides unloaded, original configuration reset\n");
|
2015-05-07 23:06:14 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Reset save paths */
|
|
|
|
global->has_set_save_path = true;
|
|
|
|
global->has_set_state_path = true;
|
2015-05-07 05:36:29 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
return true;
|
2015-04-07 00:58:57 +00:00
|
|
|
}
|
2015-05-08 07:12:49 +00:00
|
|
|
|
|
|
|
return false;
|
2015-04-05 16:14:24 +00:00
|
|
|
}
|
|
|
|
|
2015-04-05 19:06:23 +00:00
|
|
|
/**
|
|
|
|
* config_load_remap:
|
|
|
|
*
|
|
|
|
* Tries to append game-specific and core-specific remap files.
|
|
|
|
*
|
|
|
|
* This function only has an effect if a game-specific or core-specific
|
|
|
|
* configuration file exists at respective locations.
|
|
|
|
*
|
|
|
|
* core-specific: $REMAP_DIR/$CORE_NAME/$CORE_NAME.cfg
|
|
|
|
* game-specific: $REMAP_DIR/$CORE_NAME/$GAME_NAME.cfg
|
|
|
|
*
|
2015-04-07 01:16:00 +00:00
|
|
|
* Returns: false if there was an error or no action was performed.
|
2015-04-05 19:06:23 +00:00
|
|
|
*/
|
2015-04-05 20:41:24 +00:00
|
|
|
bool config_load_remap(void)
|
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
config_file_t *new_conf = NULL;
|
|
|
|
const char *core_name = NULL;
|
|
|
|
const char *game_name = NULL;
|
|
|
|
char remap_directory[PATH_MAX_LENGTH] = {0}; /* path to the directory containing retroarch.cfg (prefix) */
|
|
|
|
char core_path[PATH_MAX_LENGTH] = {0}; /* final path for core-specific configuration (prefix+suffix) */
|
|
|
|
char game_path[PATH_MAX_LENGTH] = {0}; /* final path for game-specific configuration (prefix+suffix) */
|
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
settings_t *settings = config_get_ptr();
|
2015-06-25 10:36:55 +00:00
|
|
|
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
2015-04-05 20:41:24 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Early return in case a library isn't loaded or remapping is disabled */
|
2015-06-25 10:36:55 +00:00
|
|
|
if (!info->info.library_name || !strcmp(info->info.library_name,"No Core"))
|
2015-04-07 01:16:00 +00:00
|
|
|
return false;
|
2015-04-05 20:41:24 +00:00
|
|
|
|
2015-06-25 09:04:51 +00:00
|
|
|
RARCH_LOG("Game name: %s\n", global->basename);
|
2015-06-25 10:36:55 +00:00
|
|
|
RARCH_LOG("Core name: %s\n", info->info.library_name);
|
2015-04-05 20:41:24 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Remap directory: remap_directory.
|
|
|
|
* Try remap directory setting, no fallbacks defined */
|
2015-05-19 18:29:03 +00:00
|
|
|
if (settings->input_remapping_directory[0] != '\0')
|
2015-04-05 20:41:24 +00:00
|
|
|
strlcpy(remap_directory, settings->input_remapping_directory, PATH_MAX_LENGTH);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_WARN("No remap directory set.\n");
|
2015-04-07 01:16:00 +00:00
|
|
|
return false;
|
2015-04-05 20:41:24 +00:00
|
|
|
}
|
|
|
|
RARCH_LOG("Remap directory: %s\n", remap_directory);
|
|
|
|
|
2015-06-25 10:36:55 +00:00
|
|
|
core_name = info->info.library_name;
|
2015-04-05 20:41:24 +00:00
|
|
|
game_name = path_basename(global->basename);
|
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Concatenate strings into full paths for core_path, game_path */
|
2015-04-05 20:41:24 +00:00
|
|
|
fill_pathname_join(core_path, remap_directory, core_name, PATH_MAX_LENGTH);
|
|
|
|
fill_pathname_join(core_path, core_path, core_name, PATH_MAX_LENGTH);
|
|
|
|
strlcat(core_path, ".rmp", PATH_MAX_LENGTH);
|
|
|
|
|
|
|
|
fill_pathname_join(game_path, remap_directory, core_name, PATH_MAX_LENGTH);
|
|
|
|
fill_pathname_join(game_path, game_path, game_name, PATH_MAX_LENGTH);
|
|
|
|
strlcat(game_path, ".rmp", PATH_MAX_LENGTH);
|
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Create a new config file from game_path */
|
|
|
|
new_conf = config_file_new(game_path);
|
2015-04-05 20:41:24 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* If a game remap file exists, load it. */
|
2015-04-05 20:41:24 +00:00
|
|
|
if (new_conf)
|
|
|
|
{
|
2015-04-07 01:30:47 +00:00
|
|
|
RARCH_LOG("Game-specific remap found at %s. Appending.\n", game_path);
|
2015-04-08 03:20:09 +00:00
|
|
|
if (input_remapping_load_file(game_path))
|
2015-05-08 07:12:49 +00:00
|
|
|
{
|
|
|
|
rarch_main_msg_queue_push("Game remap file loaded", 1, 100, true);
|
2015-04-07 01:16:00 +00:00
|
|
|
return true;
|
2015-05-08 07:12:49 +00:00
|
|
|
}
|
2015-04-05 20:41:24 +00:00
|
|
|
}
|
2015-04-08 03:51:31 +00:00
|
|
|
else
|
2015-04-07 02:54:59 +00:00
|
|
|
{
|
|
|
|
RARCH_LOG("No core-specific remap found at %s.\n", core_path);
|
|
|
|
*settings->input.remapping_path= '\0';
|
|
|
|
input_remapping_set_defaults();
|
|
|
|
}
|
2015-04-05 20:41:24 +00:00
|
|
|
|
|
|
|
new_conf = NULL;
|
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* Create a new config file from core_path */
|
2015-04-07 01:30:47 +00:00
|
|
|
new_conf = config_file_new(core_path);
|
2015-04-05 20:41:24 +00:00
|
|
|
|
2015-05-08 07:12:49 +00:00
|
|
|
/* If a core remap file exists, load it. */
|
2015-04-05 20:41:24 +00:00
|
|
|
if (new_conf)
|
|
|
|
{
|
2015-04-07 01:30:47 +00:00
|
|
|
RARCH_LOG("Core-specific remap found at %s. Loading.\n", core_path);
|
2015-04-08 03:20:09 +00:00
|
|
|
if (input_remapping_load_file(core_path))
|
2015-05-08 07:12:49 +00:00
|
|
|
{
|
|
|
|
rarch_main_msg_queue_push("Core remap file loaded", 1, 100, true);
|
2015-04-07 01:16:00 +00:00
|
|
|
return true;
|
2015-05-08 07:12:49 +00:00
|
|
|
}
|
2015-04-05 20:41:24 +00:00
|
|
|
}
|
|
|
|
else
|
2015-04-07 02:54:59 +00:00
|
|
|
{
|
2015-04-07 01:30:47 +00:00
|
|
|
RARCH_LOG("No core-specific remap found at %s.\n", core_path);
|
2015-04-07 02:54:59 +00:00
|
|
|
*settings->input.remapping_path= '\0';
|
2015-04-15 20:31:24 +00:00
|
|
|
input_remapping_set_defaults();
|
2015-04-07 02:54:59 +00:00
|
|
|
}
|
2015-04-07 01:30:47 +00:00
|
|
|
|
|
|
|
new_conf = NULL;
|
2015-04-05 20:41:24 +00:00
|
|
|
|
2015-04-07 01:16:00 +00:00
|
|
|
return false;
|
2015-04-05 20:41:24 +00:00
|
|
|
}
|
2015-04-05 19:06:23 +00:00
|
|
|
|
2014-10-02 23:07:35 +00:00
|
|
|
static void parse_config_file(void)
|
|
|
|
{
|
2015-03-21 04:42:49 +00:00
|
|
|
global_t *global = global_get_ptr();
|
2015-04-05 16:14:24 +00:00
|
|
|
bool ret = config_load_file((*global->config_path)
|
2015-03-21 04:42:49 +00:00
|
|
|
? global->config_path : NULL, false);
|
2015-01-24 22:42:31 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (*global->config_path)
|
2014-10-02 23:07:35 +00:00
|
|
|
{
|
2015-03-21 04:42:49 +00:00
|
|
|
RARCH_LOG("Loading config from: %s.\n", global->config_path);
|
2014-10-02 23:07:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_LOG("Loading default config.\n");
|
2015-03-21 04:42:49 +00:00
|
|
|
if (*global->config_path)
|
|
|
|
RARCH_LOG("Found default config: %s.\n", global->config_path);
|
2014-10-02 23:07:35 +00:00
|
|
|
}
|
|
|
|
|
2015-01-24 22:42:31 +00:00
|
|
|
if (ret)
|
|
|
|
return;
|
|
|
|
|
|
|
|
RARCH_ERR("Couldn't find config at path: \"%s\"\n",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->config_path);
|
2014-10-02 23:07:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-03 11:39:19 +00:00
|
|
|
#if 0
|
|
|
|
static bool config_read_keybinds(const char *path)
|
2012-02-29 18:25:54 +00:00
|
|
|
{
|
2014-10-01 14:08:07 +00:00
|
|
|
config_file_t *conf = (config_file_t*)config_file_new(path);
|
|
|
|
|
2012-02-29 18:25:54 +00:00
|
|
|
if (!conf)
|
|
|
|
return false;
|
2014-10-01 14:08:07 +00:00
|
|
|
|
2012-02-29 18:25:54 +00:00
|
|
|
config_read_keybinds_conf(conf);
|
|
|
|
config_file_free(conf);
|
2014-10-01 14:08:07 +00:00
|
|
|
|
2012-02-29 18:25:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-10-03 11:39:19 +00:00
|
|
|
#endif
|
2012-02-29 18:25:54 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
static void save_keybind_key(config_file_t *conf, const char *prefix,
|
|
|
|
const char *base, const struct retro_keybind *bind)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char key[64] = {0};
|
|
|
|
char btn[64] = {0};
|
2013-04-26 09:08:51 +00:00
|
|
|
|
2015-06-22 18:42:41 +00:00
|
|
|
fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
|
|
|
|
|
2015-01-12 01:52:52 +00:00
|
|
|
input_keymaps_translate_rk_to_str(bind->key, btn, sizeof(btn));
|
2013-04-26 09:08:51 +00:00
|
|
|
config_set_string(conf, key, btn);
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
static void save_keybind_hat(config_file_t *conf, const char *key,
|
|
|
|
const struct retro_keybind *bind)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char config[16] = {0};
|
|
|
|
unsigned hat = GET_HAT(bind->joykey);
|
|
|
|
const char *dir = NULL;
|
2012-02-20 19:36:21 +00:00
|
|
|
|
2013-10-06 14:51:50 +00:00
|
|
|
switch (GET_HAT_DIR(bind->joykey))
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
|
|
|
case HAT_UP_MASK:
|
|
|
|
dir = "up";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HAT_DOWN_MASK:
|
|
|
|
dir = "down";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HAT_LEFT_MASK:
|
|
|
|
dir = "left";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HAT_RIGHT_MASK:
|
|
|
|
dir = "right";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_assert(0);
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(config, sizeof(config), "h%u%s", hat, dir);
|
2013-04-26 09:08:51 +00:00
|
|
|
config_set_string(conf, key, config);
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
static void save_keybind_joykey(config_file_t *conf, const char *prefix,
|
|
|
|
const char *base, const struct retro_keybind *bind)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char key[64] = {0};
|
|
|
|
|
2015-06-22 18:42:41 +00:00
|
|
|
fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
|
|
|
|
strlcat(key, "_btn", sizeof(key));
|
2013-04-26 09:08:51 +00:00
|
|
|
|
2012-02-20 19:36:21 +00:00
|
|
|
if (bind->joykey == NO_BTN)
|
2013-04-26 09:08:51 +00:00
|
|
|
config_set_string(conf, key, "nul");
|
2012-02-20 19:36:21 +00:00
|
|
|
else if (GET_HAT_DIR(bind->joykey))
|
2013-04-26 09:08:51 +00:00
|
|
|
save_keybind_hat(conf, key, bind);
|
2012-02-20 19:36:21 +00:00
|
|
|
else
|
2013-04-26 09:08:51 +00:00
|
|
|
config_set_uint64(conf, key, bind->joykey);
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
static void save_keybind_axis(config_file_t *conf, const char *prefix,
|
|
|
|
const char *base, const struct retro_keybind *bind)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char key[64] = {0};
|
|
|
|
char config[16] = {0};
|
|
|
|
unsigned axis = 0;
|
|
|
|
char dir = '\0';
|
2012-02-20 19:36:21 +00:00
|
|
|
|
2015-06-22 18:42:41 +00:00
|
|
|
fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
|
|
|
|
strlcat(key, "_axis", sizeof(key));
|
2014-10-01 14:08:07 +00:00
|
|
|
|
2012-02-20 19:36:21 +00:00
|
|
|
if (bind->joyaxis == AXIS_NONE)
|
2013-04-26 09:08:51 +00:00
|
|
|
config_set_string(conf, key, "nul");
|
2012-03-09 17:17:53 +00:00
|
|
|
else if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
|
|
|
dir = '-';
|
|
|
|
axis = AXIS_NEG_GET(bind->joyaxis);
|
|
|
|
}
|
2012-03-09 17:17:53 +00:00
|
|
|
else if (AXIS_POS_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
|
|
|
dir = '+';
|
|
|
|
axis = AXIS_POS_GET(bind->joyaxis);
|
|
|
|
}
|
|
|
|
|
2013-04-26 09:08:51 +00:00
|
|
|
if (dir)
|
|
|
|
{
|
|
|
|
snprintf(config, sizeof(config), "%c%u", dir, axis);
|
|
|
|
config_set_string(conf, key, config);
|
|
|
|
}
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 17:01:13 +00:00
|
|
|
/**
|
|
|
|
* save_keybind:
|
|
|
|
* @conf : pointer to config file object
|
|
|
|
* @prefix : prefix name of keybind
|
|
|
|
* @base : base name of keybind
|
|
|
|
* @bind : pointer to key binding object
|
|
|
|
*
|
|
|
|
* Save a key binding to the config file.
|
|
|
|
*/
|
2014-09-01 23:27:46 +00:00
|
|
|
static void save_keybind(config_file_t *conf, const char *prefix,
|
|
|
|
const char *base, const struct retro_keybind *bind)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
2013-04-26 09:08:51 +00:00
|
|
|
if (!bind->valid)
|
2012-02-20 19:36:21 +00:00
|
|
|
return;
|
|
|
|
|
2013-04-26 09:08:51 +00:00
|
|
|
save_keybind_key(conf, prefix, base, bind);
|
|
|
|
save_keybind_joykey(conf, prefix, base, bind);
|
|
|
|
save_keybind_axis(conf, prefix, base, bind);
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 17:01:13 +00:00
|
|
|
/**
|
|
|
|
* save_keybinds_user:
|
|
|
|
* @conf : pointer to config file object
|
|
|
|
* @user : user number
|
|
|
|
*
|
|
|
|
* Save the current keybinds of a user (@user) to the config file (@conf).
|
|
|
|
*/
|
2014-12-05 12:48:54 +00:00
|
|
|
static void save_keybinds_user(config_file_t *conf, unsigned user)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i = 0;
|
2015-03-20 19:52:54 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-01-11 04:29:32 +00:00
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; input_config_bind_map[i].valid; i++)
|
2013-04-26 09:08:51 +00:00
|
|
|
{
|
2014-12-05 12:48:54 +00:00
|
|
|
const char *prefix = input_config_get_prefix(user,
|
2014-09-01 23:27:46 +00:00
|
|
|
input_config_bind_map[i].meta);
|
2015-01-11 04:29:32 +00:00
|
|
|
|
2013-04-26 09:08:51 +00:00
|
|
|
if (prefix)
|
2014-09-01 23:27:46 +00:00
|
|
|
save_keybind(conf, prefix, input_config_bind_map[i].base,
|
2015-03-20 19:52:54 +00:00
|
|
|
&settings->input.binds[user][i]);
|
2013-04-26 09:08:51 +00:00
|
|
|
}
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 17:01:13 +00:00
|
|
|
/**
|
|
|
|
* config_load:
|
|
|
|
*
|
|
|
|
* Loads a config file and reads all the values into memory.
|
|
|
|
*
|
|
|
|
*/
|
2014-10-03 11:39:19 +00:00
|
|
|
void config_load(void)
|
|
|
|
{
|
2015-03-20 19:52:54 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-03-21 04:42:49 +00:00
|
|
|
global_t *global = global_get_ptr();
|
2015-03-20 19:52:54 +00:00
|
|
|
|
2014-10-03 11:39:19 +00:00
|
|
|
/* Flush out per-core configs before loading a new config. */
|
2015-03-21 04:42:49 +00:00
|
|
|
if (*global->core_specific_config_path &&
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->config_save_on_exit && settings->core_specific_config)
|
2015-03-21 04:42:49 +00:00
|
|
|
config_save_file(global->core_specific_config_path);
|
2014-10-03 11:39:19 +00:00
|
|
|
|
2014-12-04 12:45:56 +00:00
|
|
|
/* Flush out some states that could have been set by core environment variables */
|
2015-03-21 04:42:49 +00:00
|
|
|
global->has_set_input_descriptors = false;
|
2014-12-04 12:45:56 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->block_config_read)
|
2014-10-03 11:39:19 +00:00
|
|
|
{
|
|
|
|
config_set_defaults();
|
|
|
|
parse_config_file();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Per-core config handling. */
|
|
|
|
config_load_core_specific();
|
|
|
|
}
|
|
|
|
|
2015-01-19 06:43:28 +00:00
|
|
|
/**
|
|
|
|
* config_save_keybinds_file:
|
|
|
|
* @path : Path that shall be written to.
|
|
|
|
*
|
|
|
|
* Writes a keybinds config file to disk.
|
|
|
|
*
|
|
|
|
* Returns: true (1) on success, otherwise returns false (0).
|
|
|
|
**/
|
|
|
|
bool config_save_keybinds_file(const char *path)
|
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
unsigned i = 0;
|
|
|
|
bool ret = false;
|
2015-01-19 06:43:28 +00:00
|
|
|
config_file_t *conf = config_file_new(path);
|
|
|
|
|
|
|
|
if (!conf)
|
|
|
|
conf = config_file_new(NULL);
|
|
|
|
|
|
|
|
if (!conf)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
RARCH_LOG("Saving keybinds config at path: \"%s\"\n", path);
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
|
|
|
save_keybinds_user(conf, i);
|
|
|
|
|
|
|
|
ret = config_file_write(conf, path);
|
|
|
|
config_file_free(conf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-01-08 17:01:13 +00:00
|
|
|
/**
|
|
|
|
* config_save_file:
|
|
|
|
* @path : Path that shall be written to.
|
|
|
|
*
|
|
|
|
* Writes a config file to disk.
|
|
|
|
*
|
|
|
|
* Returns: true (1) on success, otherwise returns false (0).
|
2015-01-19 06:43:28 +00:00
|
|
|
**/
|
2013-01-05 21:18:59 +00:00
|
|
|
bool config_save_file(const char *path)
|
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
unsigned i = 0;
|
|
|
|
bool ret = false;
|
2015-03-20 19:52:54 +00:00
|
|
|
config_file_t *conf = config_file_new(path);
|
|
|
|
settings_t *settings = config_get_ptr();
|
2015-03-21 04:42:49 +00:00
|
|
|
global_t *global = global_get_ptr();
|
2015-05-20 21:13:39 +00:00
|
|
|
const video_viewport_t *custom_vp = (const video_viewport_t*)
|
|
|
|
video_viewport_get_custom();
|
2014-10-01 14:08:07 +00:00
|
|
|
|
2013-01-05 21:18:59 +00:00
|
|
|
if (!conf)
|
|
|
|
conf = config_file_new(NULL);
|
2014-10-01 14:08:07 +00:00
|
|
|
|
2015-04-07 04:32:49 +00:00
|
|
|
if (!conf || global->overrides_active)
|
2013-01-05 21:18:59 +00:00
|
|
|
return false;
|
|
|
|
|
2013-01-10 06:12:37 +00:00
|
|
|
RARCH_LOG("Saving config at path: \"%s\"\n", path);
|
2013-01-10 06:11:37 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, "input_max_users", settings->input.max_users);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_float(conf, "input_axis_threshold",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.axis_threshold);
|
2015-04-13 00:12:28 +00:00
|
|
|
config_set_bool(conf, "ui_companion_start_on_boot", settings->ui.companion_start_on_boot);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_bool(conf, "video_gpu_record", settings->video.gpu_record);
|
2015-01-05 21:53:21 +00:00
|
|
|
config_set_bool(conf, "input_remap_binds_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.remap_binds_enable);
|
2014-12-04 12:26:27 +00:00
|
|
|
config_set_bool(conf, "netplay_client_swap_input",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.netplay_client_swap_input);
|
2014-12-04 12:26:27 +00:00
|
|
|
config_set_bool(conf, "input_descriptor_label_show",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.input_descriptor_label_show);
|
2014-12-16 05:21:18 +00:00
|
|
|
config_set_bool(conf, "autoconfig_descriptor_label_show",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.autoconfig_descriptor_label_show);
|
2014-12-05 13:13:29 +00:00
|
|
|
config_set_bool(conf, "input_descriptor_hide_unbound",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.input_descriptor_hide_unbound);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "load_dummy_on_core_shutdown",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->load_dummy_on_core_shutdown);
|
2015-06-23 05:09:24 +00:00
|
|
|
config_set_bool(conf, "builtin_mediaplayer_enable",
|
2015-06-28 15:21:32 +00:00
|
|
|
settings->multimedia.builtin_mediaplayer_enable);
|
|
|
|
config_set_bool(conf, "builtin_imageviewer_enable",
|
|
|
|
settings->multimedia.builtin_imageviewer_enable);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_bool(conf, "fps_show", settings->fps_show);
|
|
|
|
config_set_bool(conf, "ui_menubar_enable", settings->ui.menubar_enable);
|
2015-04-08 02:56:47 +00:00
|
|
|
config_set_path(conf, "libretro_path", settings->libretro);
|
|
|
|
config_set_path(conf, "core_options_path", settings->core_options_path);
|
2015-04-08 03:08:30 +00:00
|
|
|
|
2015-04-15 10:42:36 +00:00
|
|
|
config_set_path(conf, "recording_output_directory", global->record.output_dir);
|
|
|
|
config_set_path(conf, "recording_config_directory", global->record.config_dir);
|
2015-04-14 19:13:54 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_bool(conf, "suspend_screensaver_enable", settings->ui.suspend_screensaver_enable);
|
|
|
|
config_set_path(conf, "libretro_directory", settings->libretro_directory);
|
|
|
|
config_set_path(conf, "libretro_info_path", settings->libretro_info_path);
|
|
|
|
config_set_path(conf, "content_database_path", settings->content_database);
|
|
|
|
config_set_path(conf, "cheat_database_path", settings->cheat_database);
|
|
|
|
config_set_path(conf, "cursor_directory", settings->cursor_directory);
|
|
|
|
config_set_path(conf, "content_history_dir", settings->content_history_directory);
|
|
|
|
config_set_bool(conf, "rewind_enable", settings->rewind_enable);
|
|
|
|
config_set_int(conf, "audio_latency", settings->audio.latency);
|
|
|
|
config_set_bool(conf, "audio_sync", settings->audio.sync);
|
|
|
|
config_set_int(conf, "audio_block_frames", settings->audio.block_frames);
|
|
|
|
config_set_int(conf, "rewind_granularity", settings->rewind_granularity);
|
|
|
|
config_set_path(conf, "video_shader", settings->video.shader_path);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "video_shader_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.shader_enable);
|
|
|
|
config_set_float(conf, "video_aspect_ratio", settings->video.aspect_ratio);
|
|
|
|
config_set_bool(conf, "video_aspect_ratio_auto", settings->video.aspect_ratio_auto);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "video_windowed_fullscreen",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.windowed_fullscreen);
|
|
|
|
config_set_float(conf, "video_scale", settings->video.scale);
|
|
|
|
config_set_int(conf, "autosave_interval", settings->autosave_interval);
|
|
|
|
config_set_bool(conf, "video_crop_overscan", settings->video.crop_overscan);
|
|
|
|
config_set_bool(conf, "video_scale_integer", settings->video.scale_integer);
|
2014-08-11 09:00:11 +00:00
|
|
|
#ifdef GEKKO
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, "video_viwidth", settings->video.viwidth);
|
|
|
|
config_set_bool(conf, "video_vfilter", settings->video.vfilter);
|
2014-08-11 09:00:11 +00:00
|
|
|
#endif
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_bool(conf, "video_smooth", settings->video.smooth);
|
|
|
|
config_set_bool(conf, "video_threaded", settings->video.threaded);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "video_shared_context",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.shared_context);
|
2014-09-21 03:23:51 +00:00
|
|
|
config_set_bool(conf, "video_force_srgb_disable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.force_srgb_disable);
|
|
|
|
config_set_bool(conf, "video_fullscreen", settings->video.fullscreen);
|
|
|
|
config_set_float(conf, "video_refresh_rate", settings->video.refresh_rate);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "video_monitor_index",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.monitor_index);
|
2015-06-21 07:07:47 +00:00
|
|
|
config_set_int(conf, "video_fullscreen_x", settings->video.fullscreen_x);
|
|
|
|
config_set_int(conf, "video_fullscreen_y", settings->video.fullscreen_y);
|
|
|
|
config_set_string(conf, "video_driver", settings->video.driver);
|
|
|
|
config_set_string(conf, "record_driver", settings->record.driver);
|
|
|
|
config_set_string(conf, "camera_driver", settings->camera.driver);
|
|
|
|
config_set_string(conf, "location_driver", settings->location.driver);
|
2014-09-05 16:14:00 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-03-18 20:33:04 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-07-01 22:35:46 +00:00
|
|
|
config_set_bool(conf,"threaded_data_runloop_enable",
|
|
|
|
settings->menu.threaded_data_runloop_enable);
|
2015-03-18 20:33:04 +00:00
|
|
|
#endif
|
2015-04-24 14:37:09 +00:00
|
|
|
|
|
|
|
config_set_bool(conf, "dpi_override_enable", settings->menu.dpi.override_enable);
|
|
|
|
config_set_int (conf, "dpi_override_value", settings->menu.dpi.override_value);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_string(conf,"menu_driver", settings->menu.driver);
|
|
|
|
config_set_bool(conf,"menu_pause_libretro", settings->menu.pause_libretro);
|
|
|
|
config_set_bool(conf,"menu_mouse_enable", settings->menu.mouse.enable);
|
2015-03-30 04:18:30 +00:00
|
|
|
config_set_bool(conf,"menu_pointer_enable", settings->menu.pointer.enable);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_bool(conf,"menu_timedate_enable", settings->menu.timedate_enable);
|
|
|
|
config_set_bool(conf,"menu_core_enable", settings->menu.core_enable);
|
2015-07-01 22:35:46 +00:00
|
|
|
config_set_bool(conf,"menu_dynamic_wallpaper_enable",
|
|
|
|
settings->menu.dynamic_wallpaper_enable);
|
2015-06-18 02:32:56 +00:00
|
|
|
config_set_bool(conf,"menu_boxart_enable", settings->menu.boxart_enable);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_path(conf, "menu_wallpaper", settings->menu.wallpaper);
|
2014-09-05 16:14:00 +00:00
|
|
|
#endif
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_bool(conf, "video_vsync", settings->video.vsync);
|
|
|
|
config_set_bool(conf, "video_hard_sync", settings->video.hard_sync);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "video_hard_sync_frames",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.hard_sync_frames);
|
|
|
|
config_set_int(conf, "video_frame_delay", settings->video.frame_delay);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "video_black_frame_insertion",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.black_frame_insertion);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "video_disable_composition",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->video.disable_composition);
|
|
|
|
config_set_bool(conf, "pause_nonactive", settings->pause_nonactive);
|
|
|
|
config_set_int(conf, "video_swap_interval", settings->video.swap_interval);
|
|
|
|
config_set_bool(conf, "video_gpu_screenshot", settings->video.gpu_screenshot);
|
|
|
|
config_set_int(conf, "video_rotation", settings->video.rotation);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "screenshot_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->screenshot_directory ?
|
|
|
|
settings->screenshot_directory : "default");
|
|
|
|
config_set_int(conf, "aspect_ratio_index", settings->video.aspect_ratio_idx);
|
|
|
|
config_set_string(conf, "audio_device", settings->audio.device);
|
|
|
|
config_set_string(conf, "video_filter", settings->video.softfilter_plugin);
|
|
|
|
config_set_string(conf, "audio_dsp_plugin", settings->audio.dsp_plugin);
|
2015-07-01 22:35:46 +00:00
|
|
|
config_set_string(conf, "core_updater_buildbot_url",
|
|
|
|
settings->network.buildbot_url);
|
|
|
|
config_set_string(conf, "core_updater_buildbot_assets_url",
|
|
|
|
settings->network.buildbot_assets_url);
|
|
|
|
config_set_bool(conf, "core_updater_auto_extract_archive",
|
|
|
|
settings->network.buildbot_auto_extract_archive);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_string(conf, "camera_device", settings->camera.device);
|
|
|
|
config_set_bool(conf, "camera_allow", settings->camera.allow);
|
|
|
|
config_set_bool(conf, "audio_rate_control", settings->audio.rate_control);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_float(conf, "audio_rate_control_delta",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->audio.rate_control_delta);
|
2014-11-16 14:24:58 +00:00
|
|
|
config_set_float(conf, "audio_max_timing_skew",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->audio.max_timing_skew);
|
|
|
|
config_set_float(conf, "audio_volume", settings->audio.volume);
|
|
|
|
config_set_string(conf, "video_context_driver", settings->video.context_driver);
|
|
|
|
config_set_string(conf, "audio_driver", settings->audio.driver);
|
|
|
|
config_set_bool(conf, "audio_enable", settings->audio.enable);
|
|
|
|
config_set_bool(conf, "audio_mute_enable", settings->audio.mute_enable);
|
|
|
|
config_set_int(conf, "audio_out_rate", settings->audio.out_rate);
|
2013-05-21 02:18:34 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_bool(conf, "location_allow", settings->location.allow);
|
2014-04-07 16:50:52 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_float(conf, "video_font_size", settings->video.font_size);
|
|
|
|
config_set_bool(conf, "video_font_enable", settings->video.font_enable);
|
2014-04-07 20:12:23 +00:00
|
|
|
|
2015-03-21 04:42:49 +00:00
|
|
|
if (!global->has_set_ups_pref)
|
|
|
|
config_set_bool(conf, "ups_pref", global->ups_pref);
|
|
|
|
if (!global->has_set_bps_pref)
|
|
|
|
config_set_bool(conf, "bps_pref", global->bps_pref);
|
|
|
|
if (!global->has_set_ips_pref)
|
|
|
|
config_set_bool(conf, "ips_pref", global->ips_pref);
|
2015-01-13 02:13:19 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "system_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->system_directory ?
|
|
|
|
settings->system_directory : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "extraction_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->extraction_directory);
|
2015-01-19 06:24:12 +00:00
|
|
|
config_set_path(conf, "input_remapping_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input_remapping_directory);
|
2015-01-24 22:42:31 +00:00
|
|
|
config_set_path(conf, "input_remapping_path",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.remapping_path);
|
2014-09-27 13:55:55 +00:00
|
|
|
config_set_path(conf, "resampler_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->resampler_directory);
|
|
|
|
config_set_string(conf, "audio_resampler", settings->audio.resampler);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "savefile_directory",
|
2015-03-21 04:42:49 +00:00
|
|
|
*global->savefile_dir ? global->savefile_dir : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "savestate_directory",
|
2015-03-21 04:42:49 +00:00
|
|
|
*global->savestate_dir ? global->savestate_dir : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "video_shader_dir",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->video.shader_dir ?
|
|
|
|
settings->video.shader_dir : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "video_filter_dir",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->video.filter_dir ?
|
|
|
|
settings->video.filter_dir : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "audio_filter_dir",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->audio.filter_dir ?
|
|
|
|
settings->audio.filter_dir : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
|
2015-03-16 01:59:30 +00:00
|
|
|
config_set_path(conf, "core_assets_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->core_assets_directory ?
|
|
|
|
settings->core_assets_directory : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "assets_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->assets_directory ?
|
|
|
|
settings->assets_directory : "default");
|
2015-06-04 10:17:23 +00:00
|
|
|
config_set_path(conf, "dynamic_wallpapers_directory",
|
|
|
|
*settings->dynamic_wallpapers_directory ?
|
|
|
|
settings->dynamic_wallpapers_directory : "default");
|
2015-06-18 02:32:56 +00:00
|
|
|
config_set_path(conf, "boxarts_directory",
|
|
|
|
*settings->boxarts_directory ?
|
|
|
|
settings->boxarts_directory : "default");
|
2014-09-15 02:12:27 +00:00
|
|
|
config_set_path(conf, "playlist_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->playlist_directory ?
|
|
|
|
settings->playlist_directory : "default");
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "rgui_browser_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->menu_content_directory ?
|
|
|
|
settings->menu_content_directory : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "rgui_config_directory",
|
2015-03-20 19:52:54 +00:00
|
|
|
*settings->menu_config_directory ?
|
|
|
|
settings->menu_config_directory : "default");
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "rgui_show_start_screen",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu_show_start_screen);
|
2014-11-17 15:16:52 +00:00
|
|
|
config_set_bool(conf, "menu_navigation_wraparound_horizontal_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.navigation.wraparound.horizontal_enable);
|
2014-11-17 15:16:52 +00:00
|
|
|
config_set_bool(conf, "menu_navigation_wraparound_vertical_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.navigation.wraparound.vertical_enable);
|
2015-07-01 22:35:46 +00:00
|
|
|
config_set_bool(conf,
|
|
|
|
"menu_navigation_browser_filter_supported_extensions_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.navigation.browser.filter.supported_extensions_enable);
|
2015-01-30 04:58:57 +00:00
|
|
|
config_set_bool(conf, "menu_collapse_subgroups_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.collapse_subgroups_enable);
|
2015-03-06 16:09:48 +00:00
|
|
|
config_set_bool(conf, "menu_show_advanced_settings",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.show_advanced_settings);
|
2015-03-14 22:21:55 +00:00
|
|
|
config_set_hex(conf, "menu_entry_normal_color",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.entry_normal_color);
|
2015-03-14 22:21:55 +00:00
|
|
|
config_set_hex(conf, "menu_entry_hover_color",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.entry_hover_color);
|
2015-03-14 22:21:55 +00:00
|
|
|
config_set_hex(conf, "menu_title_color",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->menu.title_color);
|
2013-04-18 16:33:03 +00:00
|
|
|
#endif
|
|
|
|
|
2015-05-25 22:12:49 +00:00
|
|
|
config_set_path(conf, "content_history_path", settings->content_history_path);
|
|
|
|
config_set_int(conf, "content_history_size", settings->content_history_size);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "joypad_autoconfig_dir",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.autoconfig_dir);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "input_autodetect_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.autodetect_enable);
|
2013-09-22 10:48:54 +00:00
|
|
|
|
2013-05-22 20:31:16 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_path(conf, "overlay_directory",
|
2015-03-21 04:42:49 +00:00
|
|
|
*global->overlay_dir ? global->overlay_dir : "default");
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_path(conf, "input_overlay", settings->input.overlay);
|
|
|
|
config_set_bool(conf, "input_overlay_enable", settings->input.overlay_enable);
|
2015-07-03 17:27:16 +00:00
|
|
|
config_set_bool(conf, "input_overlay_enable_autopreferred", settings->input.overlay_enable_autopreferred);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_float(conf, "input_overlay_opacity",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.overlay_opacity);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_float(conf, "input_overlay_scale",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.overlay_scale);
|
2015-01-29 19:33:27 +00:00
|
|
|
|
|
|
|
config_set_path(conf, "osk_overlay_directory",
|
2015-03-21 04:42:49 +00:00
|
|
|
*global->osk_overlay_dir ? global->osk_overlay_dir : "default");
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_path(conf, "input_osk_overlay", settings->osk.overlay);
|
|
|
|
config_set_bool(conf, "input_osk_overlay_enable", settings->osk.enable);
|
2013-05-22 20:31:16 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_path(conf, "video_font_path", settings->video.font_path);
|
|
|
|
config_set_float(conf, "video_message_pos_x", settings->video.msg_pos_x);
|
|
|
|
config_set_float(conf, "video_message_pos_y", settings->video.msg_pos_y);
|
2014-09-11 03:48:35 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "gamma_correction",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.screen.gamma_correction);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "soft_filter_enable",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.softfilter_enable);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "flicker_filter_enable",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.flickerfilter_enable);
|
2014-09-01 23:27:46 +00:00
|
|
|
|
2015-07-06 05:29:51 +00:00
|
|
|
config_set_int(conf, "console_resolution_width",
|
|
|
|
global->console.screen.resolutions.width);
|
|
|
|
config_set_int(conf, "console_resolution_height",
|
|
|
|
global->console.screen.resolutions.height);
|
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "flicker_filter_index",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.screen.flicker_filter_index);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "soft_filter_index",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.screen.soft_filter_index);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "current_resolution_id",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.screen.resolutions.current.id);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "custom_viewport_width",
|
2015-05-20 17:12:27 +00:00
|
|
|
custom_vp->width);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "custom_viewport_height",
|
2015-05-20 17:12:27 +00:00
|
|
|
custom_vp->height);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "custom_viewport_x",
|
2015-05-20 17:12:27 +00:00
|
|
|
custom_vp->x);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_int(conf, "custom_viewport_y",
|
2015-05-20 17:12:27 +00:00
|
|
|
custom_vp->y);
|
2015-05-20 21:13:39 +00:00
|
|
|
|
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_float(conf, "video_font_size", settings->video.font_size);
|
2013-01-11 20:04:51 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "block_sram_overwrite",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->block_sram_overwrite);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "savestate_auto_index",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->savestate_auto_index);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "savestate_auto_save",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->savestate_auto_save);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "savestate_auto_load",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->savestate_auto_load);
|
2014-10-17 02:17:28 +00:00
|
|
|
config_set_bool(conf, "history_list_enable",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->history_list_enable);
|
2014-02-15 10:12:34 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_float(conf, "fastforward_ratio", settings->fastforward_ratio);
|
2015-07-01 22:35:46 +00:00
|
|
|
config_set_bool(conf, "fastforward_ratio_throttle_enable",
|
|
|
|
settings->fastforward_ratio_throttle_enable);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_float(conf, "slowmotion_ratio", settings->slowmotion_ratio);
|
2014-05-25 11:13:55 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "config_save_on_exit",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->config_save_on_exit);
|
2015-03-21 04:42:49 +00:00
|
|
|
config_set_int(conf, "sound_mode", global->console.sound.mode);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, "state_slot", settings->state_slot);
|
2013-09-27 16:30:27 +00:00
|
|
|
|
2014-06-09 21:21:48 +00:00
|
|
|
#ifdef HAVE_NETPLAY
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "netplay_spectator_mode_enable",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->netplay_is_spectate);
|
|
|
|
config_set_bool(conf, "netplay_mode", global->netplay_is_client);
|
|
|
|
config_set_string(conf, "netplay_ip_address", global->netplay_server);
|
|
|
|
config_set_int(conf, "netplay_ip_port", global->netplay_port);
|
|
|
|
config_set_int(conf, "netplay_delay_frames", global->netplay_sync_frames);
|
2014-06-09 21:21:48 +00:00
|
|
|
#endif
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_string(conf, "netplay_nickname", settings->username);
|
|
|
|
config_set_int(conf, "user_language", settings->user_language);
|
2014-06-09 20:50:44 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "custom_bgm_enable",
|
2015-03-21 04:42:49 +00:00
|
|
|
global->console.sound.system_bgm_enable);
|
2013-01-05 21:18:59 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_string(conf, "input_driver", settings->input.driver);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_string(conf, "input_joypad_driver",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.joypad_driver);
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_string(conf, "input_keyboard_layout",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->input.keyboard_layout);
|
2015-01-05 00:58:00 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
2013-01-05 21:18:59 +00:00
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char cfg[64] = {0};
|
2015-01-11 04:29:32 +00:00
|
|
|
|
2013-01-05 21:18:59 +00:00
|
|
|
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, cfg, settings->input.device[i]);
|
2013-09-03 12:30:25 +00:00
|
|
|
snprintf(cfg, sizeof(cfg), "input_player%u_joypad_index", i + 1);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, cfg, settings->input.joypad_map[i]);
|
2013-09-22 09:08:09 +00:00
|
|
|
snprintf(cfg, sizeof(cfg), "input_libretro_device_p%u", i + 1);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, cfg, settings->input.libretro_device[i]);
|
2014-01-08 16:31:14 +00:00
|
|
|
snprintf(cfg, sizeof(cfg), "input_player%u_analog_dpad_mode", i + 1);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, cfg, settings->input.analog_dpad_mode[i]);
|
2013-01-05 21:18:59 +00:00
|
|
|
}
|
|
|
|
|
2015-01-05 00:58:00 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
2014-12-05 12:48:54 +00:00
|
|
|
save_keybinds_user(conf, i);
|
2013-09-29 17:37:48 +00:00
|
|
|
|
2014-09-01 23:27:46 +00:00
|
|
|
config_set_bool(conf, "core_specific_config",
|
2015-03-20 19:52:54 +00:00
|
|
|
settings->core_specific_config);
|
2015-04-18 01:07:15 +00:00
|
|
|
config_set_bool(conf, "auto_overrides_enable",
|
|
|
|
settings->auto_overrides_enable);
|
2015-04-18 01:10:26 +00:00
|
|
|
config_set_bool(conf, "auto_remaps_enable",
|
|
|
|
settings->auto_remaps_enable);
|
2015-05-07 23:06:14 +00:00
|
|
|
config_set_bool(conf, "sort_savefiles_enable",
|
|
|
|
settings->sort_savefiles_enable);
|
|
|
|
config_set_bool(conf, "sort_savestates_enable",
|
|
|
|
settings->sort_savestates_enable);
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, "libretro_log_level", settings->libretro_log_level);
|
2015-03-21 04:42:49 +00:00
|
|
|
config_set_bool(conf, "log_verbosity", global->verbosity);
|
|
|
|
config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable);
|
2014-01-01 19:52:35 +00:00
|
|
|
|
2015-07-01 22:35:46 +00:00
|
|
|
config_set_bool(conf, "core_set_supports_no_game_enable",
|
|
|
|
settings->core.set_supports_no_game_enable);
|
2015-04-28 01:22:04 +00:00
|
|
|
|
2015-03-20 19:52:54 +00:00
|
|
|
config_set_int(conf, "archive_mode", settings->archive.mode);
|
2014-11-14 15:30:55 +00:00
|
|
|
|
2015-05-07 01:55:15 +00:00
|
|
|
config_set_int(conf, "menu_ok_btn", settings->menu_ok_btn);
|
|
|
|
config_set_int(conf, "menu_cancel_btn", settings->menu_cancel_btn);
|
|
|
|
config_set_int(conf, "menu_search_btn", settings->menu_search_btn);
|
|
|
|
config_set_int(conf, "menu_info_btn", settings->menu_info_btn);
|
|
|
|
config_set_int(conf, "menu_default_btn", settings->menu_default_btn);
|
|
|
|
config_set_int(conf, "menu_scroll_down_btn", settings->menu_scroll_down_btn);
|
|
|
|
config_set_int(conf, "menu_scroll_up_btn", settings->menu_scroll_up_btn);
|
|
|
|
|
2014-10-01 14:08:07 +00:00
|
|
|
ret = config_file_write(conf, path);
|
2013-01-05 21:18:59 +00:00
|
|
|
config_file_free(conf);
|
2013-09-22 10:48:33 +00:00
|
|
|
return ret;
|
2013-01-05 21:18:59 +00:00
|
|
|
}
|
2015-03-20 18:32:46 +00:00
|
|
|
|
|
|
|
settings_t *config_get_ptr(void)
|
|
|
|
{
|
2015-03-21 00:47:06 +00:00
|
|
|
return g_config;
|
|
|
|
}
|
|
|
|
|
|
|
|
void config_free(void)
|
|
|
|
{
|
|
|
|
if (!g_config)
|
|
|
|
return;
|
|
|
|
|
|
|
|
free(g_config);
|
|
|
|
g_config = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
settings_t *config_init(void)
|
|
|
|
{
|
|
|
|
g_config = (settings_t*)calloc(1, sizeof(settings_t));
|
|
|
|
|
|
|
|
if (!g_config)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return g_config;
|
2015-03-20 18:32:46 +00:00
|
|
|
}
|