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
|
2010-12-30 00:50:37 +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/>.
|
|
|
|
*/
|
|
|
|
|
2010-12-29 18:00:21 +00:00
|
|
|
#include "general.h"
|
|
|
|
#include "conf/config_file.h"
|
2012-01-29 13:10:57 +00:00
|
|
|
#include "conf/config_file_macros.h"
|
2012-03-16 22:26:57 +00:00
|
|
|
#include "compat/strl.h"
|
2011-01-08 21:15:02 +00:00
|
|
|
#include "config.def.h"
|
2011-08-24 13:47:39 +00:00
|
|
|
#include "file.h"
|
2012-03-16 22:26:57 +00:00
|
|
|
#include "compat/posix_string.h"
|
2013-04-26 09:44:54 +00:00
|
|
|
#include "input/input_common.h"
|
2014-06-01 02:50:00 +00:00
|
|
|
#include "frontend/frontend.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
|
|
|
|
|
2010-12-30 03:51:08 +00:00
|
|
|
#include <ctype.h>
|
2010-12-29 18:00:21 +00:00
|
|
|
|
|
|
|
struct settings g_settings;
|
2011-08-26 15:32:04 +00:00
|
|
|
struct global g_extern;
|
2014-06-12 16:06:29 +00:00
|
|
|
struct defaults g_defaults;
|
2010-12-29 18:00:21 +00:00
|
|
|
|
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";
|
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";
|
2013-08-28 04:03:25 +00:00
|
|
|
case AUDIO_RWEBAUDIO:
|
|
|
|
return "rwebaudio";
|
2012-06-19 22:43:41 +00:00
|
|
|
case AUDIO_NULL:
|
|
|
|
return "null";
|
2010-12-29 19:50:50 +00:00
|
|
|
default:
|
2012-05-07 21:20:13 +00:00
|
|
|
return NULL;
|
2010-12-29 19:50:50 +00:00
|
|
|
}
|
2012-05-07 21:20:13 +00:00
|
|
|
}
|
2010-12-29 19:50:50 +00:00
|
|
|
|
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";
|
2012-05-07 21:20:13 +00:00
|
|
|
case VIDEO_XVIDEO:
|
|
|
|
return "xvideo";
|
|
|
|
case VIDEO_SDL:
|
|
|
|
return "sdl";
|
|
|
|
case VIDEO_EXT:
|
|
|
|
return "ext";
|
2012-09-24 19:19:07 +00:00
|
|
|
case VIDEO_VG:
|
|
|
|
return "vg";
|
2012-06-19 22:43:41 +00:00
|
|
|
case VIDEO_NULL:
|
|
|
|
return "null";
|
2013-07-28 16:37:31 +00:00
|
|
|
case VIDEO_OMAP:
|
|
|
|
return "omap";
|
2012-05-07 21:20:13 +00:00
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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:
|
|
|
|
return "android_input";
|
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";
|
2011-01-06 17:34:11 +00:00
|
|
|
case INPUT_SDL:
|
2012-05-07 21:20:13 +00:00
|
|
|
return "sdl";
|
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";
|
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";
|
2013-07-07 20:01:58 +00:00
|
|
|
case INPUT_APPLE:
|
|
|
|
return "apple_input";
|
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";
|
2012-06-19 22:43:41 +00:00
|
|
|
case INPUT_NULL:
|
|
|
|
return "null";
|
2011-01-06 17:34:11 +00:00
|
|
|
default:
|
2012-05-07 21:20:13 +00:00
|
|
|
return NULL;
|
2011-01-06 17:34:11 +00:00
|
|
|
}
|
2012-05-07 21:20:13 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 15:13:53 +00:00
|
|
|
#ifdef HAVE_MENU
|
|
|
|
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";
|
|
|
|
case MENU_LAKKA:
|
|
|
|
return "lakka";
|
|
|
|
default:
|
|
|
|
return "NULL";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-11-12 23:27:31 +00:00
|
|
|
#ifdef HAVE_OSK
|
|
|
|
const char *config_get_default_osk(void)
|
|
|
|
{
|
|
|
|
switch (OSK_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case OSK_PS3:
|
|
|
|
return "ps3osk";
|
|
|
|
case OSK_NULL:
|
|
|
|
return "null";
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-11-11 13:26:57 +00:00
|
|
|
#ifdef HAVE_CAMERA
|
|
|
|
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-11 13:26:57 +00:00
|
|
|
case CAMERA_NULL:
|
|
|
|
return "null";
|
2013-11-17 18:47:37 +00:00
|
|
|
case CAMERA_ANDROID:
|
|
|
|
return "android";
|
2013-12-01 13:41:18 +00:00
|
|
|
case CAMERA_IOS:
|
|
|
|
return "ios";
|
2013-11-11 13:26:57 +00:00
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-12-19 00:51:51 +00:00
|
|
|
#ifdef HAVE_LOCATION
|
|
|
|
const char *config_get_default_location(void)
|
|
|
|
{
|
|
|
|
switch (LOCATION_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case LOCATION_ANDROID:
|
|
|
|
return "android";
|
|
|
|
case LOCATION_APPLE:
|
|
|
|
return "apple";
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-05-07 21:20:13 +00:00
|
|
|
void config_set_defaults(void)
|
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i, j;
|
2012-05-07 21:20:13 +00:00
|
|
|
const char *def_video = config_get_default_video();
|
|
|
|
const char *def_audio = config_get_default_audio();
|
|
|
|
const char *def_input = config_get_default_input();
|
2014-05-27 15:13:53 +00:00
|
|
|
#ifdef HAVE_MENU
|
|
|
|
const char *def_menu = config_get_default_menu();
|
|
|
|
#endif
|
2013-11-11 13:26:57 +00:00
|
|
|
#ifdef HAVE_CAMERA
|
|
|
|
const char *def_camera = config_get_default_camera();
|
2011-01-06 17:34:11 +00:00
|
|
|
|
2013-11-11 13:26:57 +00:00
|
|
|
if (def_camera)
|
|
|
|
strlcpy(g_settings.camera.driver, def_camera, sizeof(g_settings.camera.driver));
|
2013-11-12 23:27:31 +00:00
|
|
|
#endif
|
2013-12-19 00:51:51 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LOCATION
|
|
|
|
const char *def_location = config_get_default_location();
|
|
|
|
|
|
|
|
if (def_location)
|
|
|
|
strlcpy(g_settings.location.driver, def_location, sizeof(g_settings.location.driver));
|
|
|
|
#endif
|
|
|
|
|
2013-11-12 23:27:31 +00:00
|
|
|
#ifdef HAVE_OSK
|
|
|
|
const char *def_osk = config_get_default_osk();
|
|
|
|
|
|
|
|
if (def_osk)
|
|
|
|
strlcpy(g_settings.osk.driver, def_osk, sizeof(g_settings.osk.driver));
|
2013-11-11 13:26:57 +00:00
|
|
|
#endif
|
2010-12-29 19:50:50 +00:00
|
|
|
if (def_video)
|
2011-04-03 20:29:36 +00:00
|
|
|
strlcpy(g_settings.video.driver, def_video, sizeof(g_settings.video.driver));
|
2010-12-29 19:50:50 +00:00
|
|
|
if (def_audio)
|
2011-04-03 20:29:36 +00:00
|
|
|
strlcpy(g_settings.audio.driver, def_audio, sizeof(g_settings.audio.driver));
|
2011-01-06 17:34:11 +00:00
|
|
|
if (def_input)
|
2011-04-03 20:29:36 +00:00
|
|
|
strlcpy(g_settings.input.driver, def_input, sizeof(g_settings.input.driver));
|
2014-05-27 15:13:53 +00:00
|
|
|
#ifdef HAVE_MENU
|
|
|
|
if (def_menu)
|
|
|
|
strlcpy(g_settings.menu.driver, def_menu, sizeof(g_settings.menu.driver));
|
|
|
|
#endif
|
2010-12-29 19:50:50 +00:00
|
|
|
|
2014-04-14 04:07:17 +00:00
|
|
|
g_settings.load_dummy_on_core_shutdown = load_dummy_on_core_shutdown;
|
|
|
|
|
2010-12-29 18:00:21 +00:00
|
|
|
g_settings.video.xscale = xscale;
|
|
|
|
g_settings.video.yscale = yscale;
|
2011-07-09 06:37:08 +00:00
|
|
|
g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen;
|
2012-10-05 12:15:54 +00:00
|
|
|
g_settings.video.windowed_fullscreen = windowed_fullscreen;
|
2012-10-12 19:15:58 +00:00
|
|
|
g_settings.video.monitor_index = monitor_index;
|
2010-12-29 18:00:21 +00:00
|
|
|
g_settings.video.fullscreen_x = fullscreen_x;
|
|
|
|
g_settings.video.fullscreen_y = fullscreen_y;
|
2011-08-07 13:00:34 +00:00
|
|
|
g_settings.video.disable_composition = disable_composition;
|
2010-12-29 18:00:21 +00:00
|
|
|
g_settings.video.vsync = vsync;
|
2013-05-03 12:04:29 +00:00
|
|
|
g_settings.video.hard_sync = hard_sync;
|
2013-05-26 11:43:24 +00:00
|
|
|
g_settings.video.hard_sync_frames = hard_sync_frames;
|
2013-08-30 07:35:13 +00:00
|
|
|
g_settings.video.black_frame_insertion = black_frame_insertion;
|
2013-09-01 11:20:10 +00:00
|
|
|
g_settings.video.swap_interval = swap_interval;
|
2013-02-16 01:21:43 +00:00
|
|
|
g_settings.video.threaded = video_threaded;
|
2014-04-19 14:37:39 +00:00
|
|
|
g_settings.video.shared_context = video_shared_context;
|
2010-12-29 18:18:37 +00:00
|
|
|
g_settings.video.smooth = video_smooth;
|
2010-12-29 18:00:21 +00:00
|
|
|
g_settings.video.force_aspect = force_aspect;
|
2013-01-29 18:28:33 +00:00
|
|
|
g_settings.video.scale_integer = scale_integer;
|
2011-05-05 12:13:12 +00:00
|
|
|
g_settings.video.crop_overscan = crop_overscan;
|
2012-04-15 15:36:09 +00:00
|
|
|
g_settings.video.aspect_ratio = aspect_ratio;
|
|
|
|
g_settings.video.aspect_ratio_auto = aspect_ratio_auto; // Let implementation decide if automatic, or 1:1 PAR.
|
2013-04-20 08:56:04 +00:00
|
|
|
g_settings.video.aspect_ratio_idx = aspect_ratio_idx;
|
2013-04-06 23:38:11 +00:00
|
|
|
g_settings.video.shader_enable = shader_enable;
|
2012-04-01 14:12:04 +00:00
|
|
|
g_settings.video.allow_rotate = allow_rotate;
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2012-01-11 21:52:25 +00:00
|
|
|
g_settings.video.font_enable = font_enable;
|
2011-01-23 01:48:06 +00:00
|
|
|
g_settings.video.font_size = font_size;
|
2011-01-23 01:59:44 +00:00
|
|
|
g_settings.video.msg_pos_x = message_pos_offset_x;
|
|
|
|
g_settings.video.msg_pos_y = message_pos_offset_y;
|
2011-09-05 15:00:28 +00:00
|
|
|
|
|
|
|
g_settings.video.msg_color_r = ((message_color >> 16) & 0xff) / 255.0f;
|
|
|
|
g_settings.video.msg_color_g = ((message_color >> 8) & 0xff) / 255.0f;
|
|
|
|
g_settings.video.msg_color_b = ((message_color >> 0) & 0xff) / 255.0f;
|
2011-01-23 01:48:06 +00:00
|
|
|
|
2011-11-18 14:14:56 +00:00
|
|
|
g_settings.video.refresh_rate = refresh_rate;
|
2011-08-11 03:25:31 +00:00
|
|
|
g_settings.video.post_filter_record = post_filter_record;
|
2012-08-25 20:38:49 +00:00
|
|
|
g_settings.video.gpu_record = gpu_record;
|
2012-08-26 19:18:00 +00:00
|
|
|
g_settings.video.gpu_screenshot = gpu_screenshot;
|
2013-09-22 09:45:04 +00:00
|
|
|
g_settings.video.rotation = ORIENTATION_NORMAL;
|
2011-08-11 03:25:31 +00:00
|
|
|
|
2010-12-29 18:00:21 +00:00
|
|
|
g_settings.audio.enable = audio_enable;
|
|
|
|
g_settings.audio.out_rate = out_rate;
|
2013-08-24 10:04:47 +00:00
|
|
|
g_settings.audio.block_frames = 0;
|
2013-01-08 03:58:41 +00:00
|
|
|
g_settings.audio.in_rate = out_rate;
|
2010-12-29 18:00:21 +00:00
|
|
|
if (audio_device)
|
2011-04-03 20:29:36 +00:00
|
|
|
strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device));
|
2014-06-12 16:30:41 +00:00
|
|
|
|
|
|
|
if (!g_defaults.settings.out_latency)
|
|
|
|
g_defaults.settings.out_latency = out_latency;
|
|
|
|
|
2014-06-12 20:31:25 +00:00
|
|
|
|
2014-06-12 16:30:41 +00:00
|
|
|
g_settings.audio.latency = g_defaults.settings.out_latency;
|
2010-12-29 18:00:21 +00:00
|
|
|
g_settings.audio.sync = audio_sync;
|
2012-02-14 00:16:37 +00:00
|
|
|
g_settings.audio.rate_control = rate_control;
|
|
|
|
g_settings.audio.rate_control_delta = rate_control_delta;
|
2012-11-03 13:15:03 +00:00
|
|
|
g_settings.audio.volume = audio_volume;
|
2014-02-08 15:24:21 +00:00
|
|
|
g_extern.audio_data.volume_db = g_settings.audio.volume;
|
|
|
|
g_extern.audio_data.volume_gain = db_to_gain(g_settings.audio.volume);
|
2014-02-25 01:55:05 +00:00
|
|
|
strlcpy(g_settings.audio.resampler, audio_resampler, sizeof(g_settings.audio.resampler));
|
2011-02-06 12:29:48 +00:00
|
|
|
|
2011-01-31 17:06:57 +00:00
|
|
|
g_settings.rewind_enable = rewind_enable;
|
|
|
|
g_settings.rewind_buffer_size = rewind_buffer_size;
|
2011-02-01 16:30:18 +00:00
|
|
|
g_settings.rewind_granularity = rewind_granularity;
|
2012-03-04 11:01:07 +00:00
|
|
|
g_settings.slowmotion_ratio = slowmotion_ratio;
|
2013-08-07 20:24:12 +00:00
|
|
|
g_settings.fastforward_ratio = fastforward_ratio;
|
2011-02-05 20:45:44 +00:00
|
|
|
g_settings.pause_nonactive = pause_nonactive;
|
2011-02-10 20:16:59 +00:00
|
|
|
g_settings.autosave_interval = autosave_interval;
|
2011-01-31 17:06:57 +00:00
|
|
|
|
2011-09-16 13:32:21 +00:00
|
|
|
g_settings.block_sram_overwrite = block_sram_overwrite;
|
2011-09-27 13:31:25 +00:00
|
|
|
g_settings.savestate_auto_index = savestate_auto_index;
|
2012-06-02 19:33:37 +00:00
|
|
|
g_settings.savestate_auto_save = savestate_auto_save;
|
2013-01-24 18:24:40 +00:00
|
|
|
g_settings.savestate_auto_load = savestate_auto_load;
|
2012-05-27 12:12:29 +00:00
|
|
|
g_settings.network_cmd_enable = network_cmd_enable;
|
|
|
|
g_settings.network_cmd_port = network_cmd_port;
|
2012-07-24 00:47:28 +00:00
|
|
|
g_settings.stdin_cmd_enable = stdin_cmd_enable;
|
2013-06-09 19:59:48 +00:00
|
|
|
g_settings.game_history_size = game_history_size;
|
2014-03-01 11:02:48 +00:00
|
|
|
g_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
|
2014-06-10 00:06:10 +00:00
|
|
|
g_settings.menu_show_start_screen = menu_show_start_screen;
|
2014-02-10 19:26:48 +00:00
|
|
|
#endif
|
2013-10-05 09:11:43 +00:00
|
|
|
|
2014-04-06 20:59:16 +00:00
|
|
|
#ifdef HAVE_LOCATION
|
|
|
|
g_settings.location.allow = false;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_CAMERA
|
|
|
|
g_settings.camera.allow = false;
|
|
|
|
#endif
|
|
|
|
|
2012-07-07 15:19:32 +00:00
|
|
|
rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1));
|
|
|
|
rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest));
|
|
|
|
memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1));
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 1; i < MAX_PLAYERS; i++)
|
2012-07-07 15:19:32 +00:00
|
|
|
memcpy(g_settings.input.binds[i], retro_keybinds_rest, sizeof(retro_keybinds_rest));
|
2010-12-29 18:43:17 +00:00
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; 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
|
|
|
{
|
|
|
|
g_settings.input.autoconf_binds[i][j].joykey = NO_BTN;
|
|
|
|
g_settings.input.autoconf_binds[i][j].joyaxis = AXIS_NONE;
|
|
|
|
}
|
|
|
|
}
|
2013-09-15 14:03:43 +00:00
|
|
|
memset(g_settings.input.autoconfigured, 0, sizeof(g_settings.input.autoconfigured));
|
2013-04-26 12:36:36 +00:00
|
|
|
|
2012-02-01 22:02:17 +00:00
|
|
|
// Verify that binds are in proper order.
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
for (j = 0; j < RARCH_BIND_LIST_END; j++)
|
2012-02-01 22:02:17 +00:00
|
|
|
if (g_settings.input.binds[i][j].valid)
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_assert(j == g_settings.input.binds[i][j].id);
|
2012-02-01 22:02:17 +00:00
|
|
|
|
2011-09-06 17:53:22 +00:00
|
|
|
g_settings.input.axis_threshold = axis_threshold;
|
2011-02-20 11:12:53 +00:00
|
|
|
g_settings.input.netplay_client_swap_input = netplay_client_swap_input;
|
2012-10-01 20:15:48 +00:00
|
|
|
g_settings.input.turbo_period = turbo_period;
|
|
|
|
g_settings.input.turbo_duty_cycle = turbo_duty_cycle;
|
2014-06-12 20:31:25 +00:00
|
|
|
|
2014-06-12 20:15:32 +00:00
|
|
|
g_settings.input.overlay_enable = false;
|
2014-06-12 20:31:25 +00:00
|
|
|
|
|
|
|
if (g_defaults.settings.input_overlay_enable)
|
|
|
|
g_settings.input.overlay_enable = g_defaults.settings.input_overlay_enable;
|
|
|
|
|
2013-12-22 02:03:26 +00:00
|
|
|
g_settings.input.overlay_opacity = 0.7f;
|
2013-05-17 21:37:48 +00:00
|
|
|
g_settings.input.overlay_scale = 1.0f;
|
2013-01-05 19:06:59 +00:00
|
|
|
g_settings.input.debug_enable = input_debug_enable;
|
|
|
|
g_settings.input.autodetect_enable = input_autodetect_enable;
|
2013-12-08 15:05:05 +00:00
|
|
|
*g_settings.input.keyboard_layout = '\0';
|
2013-01-05 19:06:59 +00:00
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2013-09-22 09:08:09 +00:00
|
|
|
{
|
2011-01-10 15:53:37 +00:00
|
|
|
g_settings.input.joypad_map[i] = i;
|
2014-01-08 16:31:14 +00:00
|
|
|
g_settings.input.analog_dpad_mode[i] = ANALOG_DPAD_NONE;
|
2013-09-22 09:08:09 +00:00
|
|
|
if (!g_extern.has_set_libretro_device[i])
|
|
|
|
g_settings.input.libretro_device[i] = RETRO_DEVICE_JOYPAD;
|
|
|
|
}
|
2012-05-28 21:14:18 +00:00
|
|
|
|
2013-06-04 12:43:54 +00:00
|
|
|
g_extern.console.screen.viewports.custom_vp.width = 0;
|
|
|
|
g_extern.console.screen.viewports.custom_vp.height = 0;
|
|
|
|
g_extern.console.screen.viewports.custom_vp.x = 0;
|
|
|
|
g_extern.console.screen.viewports.custom_vp.y = 0;
|
|
|
|
|
2013-09-15 14:03:43 +00:00
|
|
|
// Make sure settings from other configs carry over into defaults for another config.
|
2013-09-22 09:57:17 +00:00
|
|
|
if (!g_extern.has_set_save_path)
|
|
|
|
*g_extern.savefile_dir = '\0';
|
|
|
|
if (!g_extern.has_set_state_path)
|
|
|
|
*g_extern.savestate_dir = '\0';
|
2013-10-10 22:18:11 +00:00
|
|
|
*g_settings.libretro_info_path = '\0';
|
2014-05-09 16:51:20 +00:00
|
|
|
*g_settings.libretro_directory = '\0';
|
2013-09-15 14:03:43 +00:00
|
|
|
*g_settings.core_options_path = '\0';
|
|
|
|
*g_settings.game_history_path = '\0';
|
|
|
|
*g_settings.cheat_database = '\0';
|
|
|
|
*g_settings.cheat_settings_path = '\0';
|
|
|
|
*g_settings.screenshot_directory = '\0';
|
|
|
|
*g_settings.system_directory = '\0';
|
2014-04-04 15:33:19 +00:00
|
|
|
*g_settings.extraction_directory = '\0';
|
2013-09-15 14:03:43 +00:00
|
|
|
*g_settings.input.autoconfig_dir = '\0';
|
|
|
|
*g_settings.input.overlay = '\0';
|
2013-12-25 01:31:35 +00:00
|
|
|
*g_settings.content_directory = '\0';
|
2014-05-10 03:12:31 +00:00
|
|
|
*g_settings.assets_directory = '\0';
|
2014-01-15 08:34:51 +00:00
|
|
|
*g_settings.video.shader_path = '\0';
|
|
|
|
*g_settings.video.shader_dir = '\0';
|
2014-04-15 04:19:24 +00:00
|
|
|
*g_settings.video.filter_dir = '\0';
|
2014-04-15 10:22:01 +00:00
|
|
|
*g_settings.video.filter_path = '\0';
|
2014-04-27 16:15:41 +00:00
|
|
|
*g_settings.audio.filter_dir = '\0';
|
|
|
|
*g_settings.audio.dsp_plugin = '\0';
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2014-06-10 00:06:10 +00:00
|
|
|
*g_settings.menu_content_directory = '\0';
|
|
|
|
*g_settings.menu_config_directory = '\0';
|
2013-09-15 14:03:43 +00:00
|
|
|
#endif
|
2014-05-01 10:20:15 +00:00
|
|
|
g_settings.core_specific_config = default_core_specific_config;
|
2013-09-15 14:03:43 +00:00
|
|
|
|
2013-01-10 05:38:19 +00:00
|
|
|
#ifdef RARCH_CONSOLE
|
|
|
|
|
|
|
|
g_settings.video.msg_pos_x = 0.05f;
|
|
|
|
g_settings.video.msg_pos_y = 0.90f;
|
|
|
|
g_settings.video.aspect_ratio = -1.0f;
|
|
|
|
|
|
|
|
// g_extern
|
|
|
|
g_extern.console.screen.gamma_correction = DEFAULT_GAMMA;
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
2013-01-11 06:49:32 +00:00
|
|
|
|
2013-01-10 05:38:19 +00:00
|
|
|
g_extern.console.screen.resolutions.current.id = 0;
|
|
|
|
g_extern.console.sound.mode = SOUND_MODE_NORMAL;
|
2013-05-25 16:07:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_OVERLAY
|
2013-10-30 11:52:44 +00:00
|
|
|
if (default_overlay_dir)
|
2013-10-30 11:45:46 +00:00
|
|
|
{
|
2013-12-24 17:23:21 +00:00
|
|
|
fill_pathname_expand_special(g_extern.overlay_dir, default_overlay_dir, sizeof(g_extern.overlay_dir));
|
2014-06-12 20:31:25 +00:00
|
|
|
if (g_settings.input.overlay[0] == '\0')
|
2014-06-12 20:17:20 +00:00
|
|
|
fill_pathname_join(g_settings.input.overlay, g_extern.overlay_dir, "gamepads/retropad/retropad.cfg", sizeof(g_settings.input.overlay));
|
2013-10-30 11:45:46 +00:00
|
|
|
}
|
2013-05-29 11:29:48 +00:00
|
|
|
#endif
|
|
|
|
|
2013-10-30 11:52:44 +00:00
|
|
|
if (default_shader_dir)
|
2013-12-24 17:23:21 +00:00
|
|
|
fill_pathname_expand_special(g_settings.video.shader_dir, default_shader_dir, sizeof(g_settings.video.shader_dir));
|
2013-01-10 05:45:44 +00:00
|
|
|
|
2014-04-15 04:19:24 +00:00
|
|
|
if (default_filter_dir)
|
|
|
|
fill_pathname_expand_special(g_settings.video.filter_dir, default_filter_dir, sizeof(g_settings.video.filter_dir));
|
|
|
|
|
2014-04-27 16:15:41 +00:00
|
|
|
if (default_dsp_filter_dir)
|
|
|
|
fill_pathname_expand_special(g_settings.audio.filter_dir, default_dsp_filter_dir, sizeof(g_settings.audio.filter_dir));
|
|
|
|
|
2014-05-09 16:51:20 +00:00
|
|
|
if (default_libretro_path && !g_extern.has_set_libretro_directory)
|
|
|
|
fill_pathname_expand_special(g_settings.libretro_directory, default_libretro_path, sizeof(g_settings.libretro_directory));
|
2013-10-30 22:50:07 +00:00
|
|
|
|
2013-10-30 11:52:44 +00:00
|
|
|
if (default_libretro_info_path)
|
2013-12-24 17:23:21 +00:00
|
|
|
fill_pathname_expand_special(g_settings.libretro_info_path, default_libretro_info_path, sizeof(g_settings.libretro_info_path));
|
2013-10-14 20:28:59 +00:00
|
|
|
|
2013-10-31 01:34:49 +00:00
|
|
|
if (default_config_path)
|
2013-12-24 17:23:21 +00:00
|
|
|
fill_pathname_expand_special(g_extern.config_path, default_config_path, sizeof(g_extern.config_path));
|
2013-10-31 01:34:49 +00:00
|
|
|
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.audio_filter_dir)
|
|
|
|
strlcpy(g_settings.audio.filter_dir, g_defaults.audio_filter_dir, sizeof(g_settings.audio.filter_dir));
|
|
|
|
if (*g_defaults.assets_dir)
|
|
|
|
strlcpy(g_settings.assets_directory, g_defaults.assets_dir, sizeof(g_settings.assets_directory));
|
|
|
|
if (*g_defaults.core_dir)
|
|
|
|
strlcpy(g_settings.libretro_directory, g_defaults.core_dir, sizeof(g_settings.libretro_directory));
|
|
|
|
if (*g_defaults.core_path)
|
|
|
|
strlcpy(g_settings.libretro, g_defaults.core_path, sizeof(g_settings.libretro));
|
|
|
|
if (*g_defaults.core_info_dir)
|
|
|
|
strlcpy(g_settings.libretro_info_path, g_defaults.core_info_dir, sizeof(g_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)
|
|
|
|
strlcpy(g_extern.overlay_dir, g_defaults.overlay_dir, sizeof(g_extern.overlay_dir));
|
2014-06-03 23:44:38 +00:00
|
|
|
#endif
|
2014-06-12 16:06:29 +00:00
|
|
|
if (*g_defaults.shader_dir)
|
|
|
|
strlcpy(g_settings.video.shader_dir, g_defaults.shader_dir, sizeof(g_settings.video.shader_dir));
|
|
|
|
if (*g_defaults.savestate_dir)
|
|
|
|
strlcpy(g_extern.savestate_dir, g_defaults.savestate_dir, sizeof(g_extern.savestate_dir));
|
|
|
|
if (*g_defaults.sram_dir)
|
|
|
|
strlcpy(g_extern.savefile_dir, g_defaults.sram_dir, sizeof(g_extern.savefile_dir));
|
|
|
|
if (*g_defaults.system_dir)
|
|
|
|
strlcpy(g_settings.system_directory, g_defaults.system_dir, sizeof(g_settings.system_directory));
|
|
|
|
if (*g_defaults.screenshot_dir)
|
|
|
|
strlcpy(g_settings.screenshot_directory, g_defaults.screenshot_dir, sizeof(g_settings.screenshot_directory));
|
|
|
|
|
|
|
|
if (*g_defaults.config_path)
|
|
|
|
strlcpy(g_extern.config_path, g_defaults.config_path, sizeof(g_extern.config_path));
|
2014-05-31 06:15:57 +00:00
|
|
|
|
2013-05-22 13:35:28 +00:00
|
|
|
g_extern.config_save_on_exit = config_save_on_exit;
|
|
|
|
|
2013-03-22 16:01:59 +00:00
|
|
|
/* Avoid reloading config on every ROM load */
|
2013-10-30 12:58:35 +00:00
|
|
|
g_extern.block_config_read = default_block_config_read;
|
2013-01-10 05:38:19 +00:00
|
|
|
|
2012-05-28 21:30:29 +00:00
|
|
|
rarch_init_msg_queue();
|
2010-12-29 18:00:21 +00:00
|
|
|
}
|
|
|
|
|
2011-01-19 11:54:19 +00:00
|
|
|
static void parse_config_file(void);
|
|
|
|
|
2014-01-02 16:25:05 +00:00
|
|
|
static void config_load_core_specific(void)
|
2010-12-29 18:00:21 +00:00
|
|
|
{
|
2014-01-02 16:25:05 +00:00
|
|
|
*g_extern.core_specific_config_path = '\0';
|
|
|
|
|
2014-01-11 07:23:24 +00:00
|
|
|
if (!*g_settings.libretro
|
|
|
|
#ifdef HAVE_DYNAMIC
|
|
|
|
|| g_extern.libretro_dummy
|
|
|
|
#endif
|
|
|
|
)
|
2014-01-02 16:25:05 +00:00
|
|
|
return;
|
|
|
|
|
2014-02-10 19:26:48 +00:00
|
|
|
#ifdef HAVE_MENU
|
2014-06-10 00:06:10 +00:00
|
|
|
if (*g_settings.menu_config_directory)
|
2013-01-10 05:45:44 +00:00
|
|
|
{
|
2014-06-10 00:06:10 +00:00
|
|
|
path_resolve_realpath(g_settings.menu_config_directory, sizeof(g_settings.menu_config_directory));
|
|
|
|
strlcpy(g_extern.core_specific_config_path, g_settings.menu_config_directory, sizeof(g_extern.core_specific_config_path));
|
2013-01-10 05:45:44 +00:00
|
|
|
}
|
2014-01-02 16:25:05 +00:00
|
|
|
else
|
2014-02-10 19:26:48 +00:00
|
|
|
#endif
|
2014-01-01 19:44:20 +00:00
|
|
|
{
|
2014-01-02 16:25:05 +00:00
|
|
|
// Use original config file's directory as a fallback.
|
|
|
|
fill_pathname_basedir(g_extern.core_specific_config_path, g_extern.config_path, sizeof(g_extern.core_specific_config_path));
|
2014-01-01 20:34:56 +00:00
|
|
|
}
|
2014-01-02 16:25:05 +00:00
|
|
|
|
|
|
|
fill_pathname_dir(g_extern.core_specific_config_path, g_settings.libretro, ".cfg", sizeof(g_extern.core_specific_config_path));
|
|
|
|
|
|
|
|
if (g_settings.core_specific_config)
|
2014-01-01 20:34:56 +00:00
|
|
|
{
|
2014-01-02 16:25:05 +00:00
|
|
|
char tmp[PATH_MAX];
|
|
|
|
strlcpy(tmp, g_settings.libretro, sizeof(tmp));
|
|
|
|
RARCH_LOG("Loading core-specific config from: %s.\n", g_extern.core_specific_config_path);
|
2014-01-01 19:44:20 +00:00
|
|
|
|
2014-01-02 16:25:05 +00:00
|
|
|
if (!config_load_file(g_extern.core_specific_config_path, true))
|
|
|
|
RARCH_WARN("Core-specific config not found, reusing last config.\n");
|
2014-01-01 20:02:57 +00:00
|
|
|
|
2014-01-02 17:01:01 +00:00
|
|
|
// Force some parameters which are implied when using core specific configs.
|
|
|
|
|
|
|
|
// Don't have the core config file overwrite the libretro path.
|
2014-01-02 16:25:05 +00:00
|
|
|
strlcpy(g_settings.libretro, tmp, sizeof(g_settings.libretro));
|
2014-01-02 17:01:01 +00:00
|
|
|
// This must be true for core specific configs.
|
|
|
|
g_settings.core_specific_config = true;
|
2014-01-02 16:25:05 +00:00
|
|
|
}
|
|
|
|
}
|
2014-01-01 19:44:20 +00:00
|
|
|
|
2014-01-02 16:25:05 +00:00
|
|
|
void config_load(void)
|
|
|
|
{
|
|
|
|
// Flush out per-core configs before loading a new config.
|
2014-01-02 17:01:01 +00:00
|
|
|
if (*g_extern.core_specific_config_path && g_extern.config_save_on_exit && g_settings.core_specific_config)
|
2014-01-02 16:25:05 +00:00
|
|
|
config_save_file(g_extern.core_specific_config_path);
|
2014-01-01 20:34:56 +00:00
|
|
|
|
2014-01-02 16:25:05 +00:00
|
|
|
if (!g_extern.block_config_read)
|
|
|
|
{
|
|
|
|
config_set_defaults();
|
|
|
|
parse_config_file();
|
2014-01-01 19:44:20 +00:00
|
|
|
}
|
2014-01-02 16:25:05 +00:00
|
|
|
|
|
|
|
// Per-core config handling.
|
|
|
|
config_load_core_specific();
|
2011-01-19 11:54:19 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 10:28:28 +00:00
|
|
|
static config_file_t *open_default_config_file(void)
|
|
|
|
{
|
|
|
|
config_file_t *conf = NULL;
|
2012-12-25 13:51:08 +00:00
|
|
|
|
2012-01-05 16:27:18 +00:00
|
|
|
#if defined(_WIN32) && !defined(_XBOX)
|
2012-12-25 19:47:22 +00:00
|
|
|
char conf_path[PATH_MAX];
|
2013-04-28 21:16:33 +00:00
|
|
|
|
|
|
|
char app_path[PATH_MAX];
|
|
|
|
fill_pathname_application_path(app_path, sizeof(app_path));
|
|
|
|
fill_pathname_resolve_relative(conf_path, app_path, "retroarch.cfg", sizeof(conf_path));
|
|
|
|
|
2013-04-27 22:35:20 +00:00
|
|
|
conf = config_file_new(conf_path);
|
2011-02-22 10:28:28 +00:00
|
|
|
if (!conf)
|
|
|
|
{
|
|
|
|
const char *appdata = getenv("APPDATA");
|
|
|
|
if (appdata)
|
|
|
|
{
|
2013-04-28 21:19:51 +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
|
|
|
|
2013-10-01 09:57:07 +00:00
|
|
|
// Try to create a new config file.
|
|
|
|
if (!conf)
|
|
|
|
{
|
|
|
|
conf = config_file_new(NULL);
|
|
|
|
bool saved = false;
|
|
|
|
if (conf) // Since this is a clean config file, we can safely use config_save_on_exit.
|
|
|
|
{
|
|
|
|
fill_pathname_resolve_relative(conf_path, app_path, "retroarch.cfg", sizeof(conf_path));
|
|
|
|
config_set_bool(conf, "config_save_on_exit", true);
|
|
|
|
saved = config_file_write(conf, conf_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (saved)
|
|
|
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path); // WARN here to make sure user has a good chance of seeing it.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
|
|
|
config_file_free(conf);
|
|
|
|
conf = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-27 23:35:31 +00:00
|
|
|
if (conf)
|
|
|
|
strlcpy(g_extern.config_path, conf_path, sizeof(g_extern.config_path));
|
2014-01-03 22:16:02 +00:00
|
|
|
#elif defined(OSX)
|
|
|
|
char conf_path[PATH_MAX];
|
|
|
|
const char *home = getenv("HOME");
|
|
|
|
|
|
|
|
if (!home)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
fill_pathname_join(conf_path, home, "Library/Application Support/RetroArch", sizeof(conf_path));
|
|
|
|
path_mkdir(conf_path);
|
|
|
|
|
|
|
|
fill_pathname_join(conf_path, conf_path, "retroarch.cfg", sizeof(conf_path));
|
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
|
|
|
|
if (!conf)
|
|
|
|
{
|
|
|
|
conf = config_file_new(NULL);
|
|
|
|
bool saved = false;
|
|
|
|
if (conf)
|
|
|
|
{
|
|
|
|
config_set_bool(conf, "config_save_on_exit", true);
|
|
|
|
saved = config_file_write(conf, conf_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (saved)
|
|
|
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path); // WARN here to make sure user has a good chance of seeing it.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
|
|
|
config_file_free(conf);
|
|
|
|
conf = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conf)
|
|
|
|
strlcpy(g_extern.config_path, conf_path, sizeof(g_extern.config_path));
|
|
|
|
|
2012-02-27 16:29:59 +00:00
|
|
|
#elif !defined(__CELLOS_LV2__) && !defined(_XBOX)
|
2012-12-25 19:47:22 +00:00
|
|
|
char conf_path[PATH_MAX];
|
2013-02-26 17:46:07 +00:00
|
|
|
const char *xdg = getenv("XDG_CONFIG_HOME");
|
2011-02-22 10:28:28 +00:00
|
|
|
const char *home = getenv("HOME");
|
2013-02-26 17:46:07 +00:00
|
|
|
|
|
|
|
// XDG_CONFIG_HOME falls back to $HOME/.config.
|
2011-02-22 10:28:28 +00:00
|
|
|
if (xdg)
|
2013-10-01 09:57:07 +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)
|
2013-10-01 09:57:07 +00:00
|
|
|
fill_pathname_join(conf_path, home, ".config/retroarch/retroarch.cfg", sizeof(conf_path));
|
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
|
|
|
|
|
|
|
// Fallback to $HOME/.retroarch.cfg.
|
|
|
|
if (!conf && home)
|
2011-02-22 10:28:28 +00:00
|
|
|
{
|
2013-10-01 09:57:07 +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
|
|
|
|
2013-10-01 09:57:07 +00:00
|
|
|
// Try to create a new config file.
|
|
|
|
if (!conf && (home || xdg))
|
|
|
|
{
|
|
|
|
// 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)
|
|
|
|
fill_pathname_join(conf_path, home, ".config/retroarch/retroarch.cfg", sizeof(conf_path));
|
|
|
|
|
|
|
|
char basedir[PATH_MAX];
|
|
|
|
fill_pathname_basedir(basedir, conf_path, sizeof(basedir));
|
|
|
|
|
|
|
|
if (path_mkdir(basedir))
|
|
|
|
{
|
2013-10-04 13:38:57 +00:00
|
|
|
#ifndef GLOBAL_CONFIG_DIR
|
|
|
|
#define GLOBAL_CONFIG_DIR "/etc"
|
|
|
|
#endif
|
|
|
|
char skeleton_conf[PATH_MAX];
|
|
|
|
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);
|
|
|
|
|
2013-10-01 09:57:07 +00:00
|
|
|
bool saved = false;
|
|
|
|
if (conf)
|
|
|
|
{
|
|
|
|
config_set_bool(conf, "config_save_on_exit", true); // Since this is a clean config file, we can safely use config_save_on_exit.
|
|
|
|
saved = config_file_write(conf, conf_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (saved)
|
|
|
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path); // WARN here to make sure user has a good chance of seeing it.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
|
|
|
config_file_free(conf);
|
|
|
|
conf = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-27 22:35:20 +00:00
|
|
|
if (conf)
|
2013-04-27 23:35:31 +00:00
|
|
|
strlcpy(g_extern.config_path, conf_path, sizeof(g_extern.config_path));
|
|
|
|
#endif
|
2013-04-27 22:35:20 +00:00
|
|
|
|
2011-02-22 10:28:28 +00:00
|
|
|
return conf;
|
|
|
|
}
|
|
|
|
|
2012-02-29 18:25:54 +00:00
|
|
|
static void config_read_keybinds_conf(config_file_t *conf);
|
|
|
|
|
2011-01-19 11:54:19 +00:00
|
|
|
static void parse_config_file(void)
|
2012-01-28 14:41:57 +00:00
|
|
|
{
|
2012-01-28 14:47:02 +00:00
|
|
|
bool ret;
|
2012-01-28 14:41:57 +00:00
|
|
|
if (*g_extern.config_path)
|
2013-01-09 12:31:41 +00:00
|
|
|
{
|
|
|
|
RARCH_LOG("Loading config from: %s.\n", g_extern.config_path);
|
2014-01-02 16:25:05 +00:00
|
|
|
ret = config_load_file(g_extern.config_path, false);
|
2013-01-09 12:31:41 +00:00
|
|
|
}
|
2012-01-28 14:41:57 +00:00
|
|
|
else
|
2013-01-09 12:31:41 +00:00
|
|
|
{
|
2013-01-20 11:45:34 +00:00
|
|
|
RARCH_LOG("Loading default config.\n");
|
2014-01-02 16:25:05 +00:00
|
|
|
ret = config_load_file(NULL, false);
|
2013-04-28 21:27:38 +00:00
|
|
|
if (*g_extern.config_path)
|
|
|
|
RARCH_LOG("Found default config: %s.\n", g_extern.config_path);
|
2013-01-09 12:31:41 +00:00
|
|
|
}
|
2012-01-28 14:47:02 +00:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("Couldn't find config at path: \"%s\"\n", g_extern.config_path);
|
2012-01-28 14:47:02 +00:00
|
|
|
}
|
2012-01-28 14:41:57 +00:00
|
|
|
}
|
|
|
|
|
2014-01-02 16:25:05 +00:00
|
|
|
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;
|
2010-12-29 18:00:21 +00:00
|
|
|
config_file_t *conf = NULL;
|
|
|
|
|
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
|
|
|
|
|
|
|
if (conf == NULL)
|
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();
|
|
|
|
|
2012-09-10 22:10:44 +00:00
|
|
|
char *save;
|
|
|
|
char tmp_append_path[PATH_MAX]; // Don't destroy append_config_path.
|
|
|
|
strlcpy(tmp_append_path, g_extern.append_config_path, sizeof(tmp_append_path));
|
|
|
|
const char *extra_path = strtok_r(tmp_append_path, ",", &save);
|
|
|
|
while (extra_path)
|
|
|
|
{
|
|
|
|
RARCH_LOG("Appending config \"%s\"\n", extra_path);
|
|
|
|
bool ret = config_append_file(conf, extra_path);
|
|
|
|
if (!ret)
|
|
|
|
RARCH_ERR("Failed to append config \"%s\"\n", extra_path);
|
|
|
|
extra_path = strtok_r(NULL, ";", &save);
|
|
|
|
}
|
|
|
|
|
2011-01-09 14:50:30 +00:00
|
|
|
if (g_extern.verbose)
|
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
|
|
|
}
|
2011-01-09 14:50:30 +00:00
|
|
|
|
2012-01-02 12:32:25 +00:00
|
|
|
char tmp_str[PATH_MAX];
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2012-01-30 14:14:30 +00:00
|
|
|
CONFIG_GET_FLOAT(video.xscale, "video_xscale");
|
|
|
|
CONFIG_GET_FLOAT(video.yscale, "video_yscale");
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_INT(video.fullscreen_x, "video_fullscreen_x");
|
|
|
|
CONFIG_GET_INT(video.fullscreen_y, "video_fullscreen_y");
|
2011-07-09 06:37:08 +00:00
|
|
|
|
|
|
|
if (!g_extern.force_fullscreen)
|
|
|
|
CONFIG_GET_BOOL(video.fullscreen, "video_fullscreen");
|
|
|
|
|
2012-10-05 12:15:54 +00:00
|
|
|
CONFIG_GET_BOOL(video.windowed_fullscreen, "video_windowed_fullscreen");
|
2012-10-12 20:03:17 +00:00
|
|
|
CONFIG_GET_INT(video.monitor_index, "video_monitor_index");
|
2011-08-07 13:00:34 +00:00
|
|
|
CONFIG_GET_BOOL(video.disable_composition, "video_disable_composition");
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_BOOL(video.vsync, "video_vsync");
|
2013-05-03 12:04:29 +00:00
|
|
|
CONFIG_GET_BOOL(video.hard_sync, "video_hard_sync");
|
2013-05-26 11:43:24 +00:00
|
|
|
|
|
|
|
CONFIG_GET_INT(video.hard_sync_frames, "video_hard_sync_frames");
|
|
|
|
if (g_settings.video.hard_sync_frames > 3)
|
|
|
|
g_settings.video.hard_sync_frames = 3;
|
|
|
|
|
2013-08-30 07:35:13 +00:00
|
|
|
CONFIG_GET_BOOL(video.black_frame_insertion, "video_black_frame_insertion");
|
2013-09-01 11:20:10 +00:00
|
|
|
CONFIG_GET_INT(video.swap_interval, "video_swap_interval");
|
|
|
|
g_settings.video.swap_interval = max(g_settings.video.swap_interval, 1);
|
|
|
|
g_settings.video.swap_interval = min(g_settings.video.swap_interval, 4);
|
2013-02-16 01:21:43 +00:00
|
|
|
CONFIG_GET_BOOL(video.threaded, "video_threaded");
|
2014-04-19 14:37:39 +00:00
|
|
|
CONFIG_GET_BOOL(video.shared_context, "video_shared_context");
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_BOOL(video.smooth, "video_smooth");
|
|
|
|
CONFIG_GET_BOOL(video.force_aspect, "video_force_aspect");
|
2013-01-29 18:28:33 +00:00
|
|
|
CONFIG_GET_BOOL(video.scale_integer, "video_scale_integer");
|
2011-05-05 12:13:12 +00:00
|
|
|
CONFIG_GET_BOOL(video.crop_overscan, "video_crop_overscan");
|
2012-01-30 14:14:30 +00:00
|
|
|
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
2013-05-25 09:06:40 +00:00
|
|
|
CONFIG_GET_INT(video.aspect_ratio_idx, "aspect_ratio_index");
|
2012-04-15 15:36:09 +00:00
|
|
|
CONFIG_GET_BOOL(video.aspect_ratio_auto, "video_aspect_ratio_auto");
|
2012-01-30 14:14:30 +00:00
|
|
|
CONFIG_GET_FLOAT(video.refresh_rate, "video_refresh_rate");
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2013-04-06 23:38:11 +00:00
|
|
|
CONFIG_GET_PATH(video.shader_path, "video_shader");
|
|
|
|
CONFIG_GET_BOOL(video.shader_enable, "video_shader_enable");
|
|
|
|
|
2012-04-01 14:12:04 +00:00
|
|
|
CONFIG_GET_BOOL(video.allow_rotate, "video_allow_rotate");
|
2011-01-23 01:48:06 +00:00
|
|
|
|
2012-09-07 22:31:30 +00:00
|
|
|
CONFIG_GET_PATH(video.font_path, "video_font_path");
|
2013-01-11 20:04:51 +00:00
|
|
|
CONFIG_GET_FLOAT(video.font_size, "video_font_size");
|
2011-11-09 23:15:41 +00:00
|
|
|
CONFIG_GET_BOOL(video.font_enable, "video_font_enable");
|
2012-01-30 14:14:30 +00:00
|
|
|
CONFIG_GET_FLOAT(video.msg_pos_x, "video_message_pos_x");
|
|
|
|
CONFIG_GET_FLOAT(video.msg_pos_y, "video_message_pos_y");
|
2013-09-22 09:45:04 +00:00
|
|
|
CONFIG_GET_INT(video.rotation, "video_rotation");
|
2011-09-05 15:00:28 +00:00
|
|
|
|
2014-04-29 20:55:37 +00:00
|
|
|
#if defined(HAVE_FILTERS_BUILTIN)
|
2014-04-20 01:34:26 +00:00
|
|
|
CONFIG_GET_INT(video.filter_idx, "filter_index");
|
2014-04-29 20:55:37 +00:00
|
|
|
#endif
|
2014-05-20 10:28:33 +00:00
|
|
|
|
2013-01-10 05:38:19 +00:00
|
|
|
#ifdef RARCH_CONSOLE
|
|
|
|
/* TODO - will be refactored later to make it more clean - it's more
|
|
|
|
* important that it works for consoles right now */
|
|
|
|
|
|
|
|
CONFIG_GET_BOOL_EXTERN(console.screen.gamma_correction, "gamma_correction");
|
2013-01-11 06:49:32 +00:00
|
|
|
|
2013-01-11 18:44:13 +00:00
|
|
|
bool triple_buffering_enable = false;
|
|
|
|
bool custom_bgm_enable = false;
|
|
|
|
bool flicker_filter_enable = false;
|
|
|
|
bool soft_filter_enable = false;
|
|
|
|
|
2013-03-09 16:42:19 +00:00
|
|
|
#ifdef HAVE_RMENU
|
2013-02-01 08:13:29 +00:00
|
|
|
if (config_get_path(conf, "menu_texture_path", tmp_str, sizeof(tmp_str)))
|
2013-04-10 02:26:18 +00:00
|
|
|
strlcpy(g_extern.menu_texture_path, tmp_str, sizeof(g_extern.menu_texture_path));
|
2013-03-09 16:42:19 +00:00
|
|
|
#endif
|
2013-02-01 08:13:29 +00:00
|
|
|
|
2013-01-11 18:44:13 +00:00
|
|
|
if (config_get_bool(conf, "triple_buffering_enable", &triple_buffering_enable))
|
|
|
|
{
|
|
|
|
if (triple_buffering_enable)
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
else
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "custom_bgm_enable", &custom_bgm_enable))
|
|
|
|
{
|
|
|
|
if (custom_bgm_enable)
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
else
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state &= ~(1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "flicker_filter_enable", &flicker_filter_enable))
|
|
|
|
{
|
|
|
|
if (flicker_filter_enable)
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
else
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "soft_filter_enable", &soft_filter_enable))
|
|
|
|
{
|
|
|
|
if (soft_filter_enable)
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
else
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
2013-01-11 18:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.flicker_filter_index, "flicker_filter_index");
|
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.soft_filter_index, "soft_filter_index");
|
2013-01-10 05:38:19 +00:00
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.resolutions.current.id, "current_resolution_id");
|
|
|
|
CONFIG_GET_INT_EXTERN(console.sound.mode, "sound_mode");
|
2013-06-04 12:43:54 +00:00
|
|
|
#endif
|
2013-10-10 23:31:08 +00:00
|
|
|
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
2013-06-04 12:43:54 +00:00
|
|
|
|
2013-01-10 05:38:19 +00:00
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.x, "custom_viewport_x");
|
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.y, "custom_viewport_y");
|
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.width, "custom_viewport_width");
|
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.height, "custom_viewport_height");
|
|
|
|
|
2013-01-06 00:32:36 +00:00
|
|
|
unsigned msg_color = 0;
|
2011-09-05 15:00:28 +00:00
|
|
|
if (config_get_hex(conf, "video_message_color", &msg_color))
|
|
|
|
{
|
|
|
|
g_settings.video.msg_color_r = ((msg_color >> 16) & 0xff) / 255.0f;
|
|
|
|
g_settings.video.msg_color_g = ((msg_color >> 8) & 0xff) / 255.0f;
|
|
|
|
g_settings.video.msg_color_b = ((msg_color >> 0) & 0xff) / 255.0f;
|
|
|
|
}
|
2011-01-23 01:59:44 +00:00
|
|
|
|
2011-08-11 03:25:31 +00:00
|
|
|
CONFIG_GET_BOOL(video.post_filter_record, "video_post_filter_record");
|
2012-08-25 20:38:49 +00:00
|
|
|
CONFIG_GET_BOOL(video.gpu_record, "video_gpu_record");
|
2012-08-26 19:18:00 +00:00
|
|
|
CONFIG_GET_BOOL(video.gpu_screenshot, "video_gpu_screenshot");
|
2011-08-11 03:25:31 +00:00
|
|
|
|
2011-05-11 15:52:16 +00:00
|
|
|
#ifdef HAVE_DYLIB
|
2012-09-07 22:31:30 +00:00
|
|
|
CONFIG_GET_PATH(video.filter_path, "video_filter");
|
2010-12-30 00:33:40 +00:00
|
|
|
#endif
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2012-09-07 22:31:30 +00:00
|
|
|
CONFIG_GET_PATH(video.shader_dir, "video_shader_dir");
|
2013-06-01 10:42:38 +00:00
|
|
|
if (!strcmp(g_settings.video.shader_dir, "default"))
|
|
|
|
*g_settings.video.shader_dir = '\0';
|
2011-03-29 16:04:41 +00:00
|
|
|
|
2014-04-15 04:19:24 +00:00
|
|
|
CONFIG_GET_PATH(video.filter_dir, "video_filter_dir");
|
|
|
|
if (!strcmp(g_settings.video.filter_dir, "default"))
|
|
|
|
*g_settings.video.filter_dir = '\0';
|
|
|
|
|
2014-04-27 16:15:41 +00:00
|
|
|
CONFIG_GET_PATH(audio.filter_dir, "audio_filter_dir");
|
|
|
|
if (!strcmp(g_settings.audio.filter_dir, "default"))
|
|
|
|
*g_settings.audio.filter_dir = '\0';
|
|
|
|
|
2012-01-30 14:14:30 +00:00
|
|
|
CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold");
|
2011-02-20 11:12:53 +00:00
|
|
|
CONFIG_GET_BOOL(input.netplay_client_swap_input, "netplay_client_swap_input");
|
2012-02-02 20:02:36 +00:00
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2012-02-02 20:02:36 +00:00
|
|
|
{
|
|
|
|
char buf[64];
|
2012-02-18 11:09:20 +00:00
|
|
|
snprintf(buf, sizeof(buf), "input_player%u_joypad_index", i + 1);
|
2012-02-02 20:02:36 +00:00
|
|
|
CONFIG_GET_INT(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);
|
|
|
|
CONFIG_GET_INT(input.analog_dpad_mode[i], buf);
|
|
|
|
|
2013-09-22 09:08:09 +00:00
|
|
|
if (!g_extern.has_set_libretro_device[i])
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1);
|
|
|
|
CONFIG_GET_INT(input.libretro_device[i], buf);
|
|
|
|
}
|
2012-02-02 20:02:36 +00:00
|
|
|
}
|
2011-01-10 15:53:37 +00:00
|
|
|
|
2010-12-29 18:00:21 +00:00
|
|
|
// Audio settings.
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_BOOL(audio.enable, "audio_enable");
|
|
|
|
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
|
2013-08-24 10:04:47 +00:00
|
|
|
CONFIG_GET_INT(audio.block_frames, "audio_block_frames");
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_STRING(audio.device, "audio_device");
|
|
|
|
CONFIG_GET_INT(audio.latency, "audio_latency");
|
|
|
|
CONFIG_GET_BOOL(audio.sync, "audio_sync");
|
2012-02-14 00:16:37 +00:00
|
|
|
CONFIG_GET_BOOL(audio.rate_control, "audio_rate_control");
|
|
|
|
CONFIG_GET_FLOAT(audio.rate_control_delta, "audio_rate_control_delta");
|
2012-11-03 13:15:03 +00:00
|
|
|
CONFIG_GET_FLOAT(audio.volume, "audio_volume");
|
2014-02-25 01:55:05 +00:00
|
|
|
CONFIG_GET_STRING(audio.resampler, "audio_resampler");
|
2014-02-08 15:24:21 +00:00
|
|
|
g_extern.audio_data.volume_db = g_settings.audio.volume;
|
|
|
|
g_extern.audio_data.volume_gain = db_to_gain(g_settings.audio.volume);
|
2010-12-29 18:00:21 +00:00
|
|
|
|
2013-11-16 02:28:45 +00:00
|
|
|
#ifdef HAVE_CAMERA
|
|
|
|
CONFIG_GET_STRING(camera.device, "camera_device");
|
2014-04-06 20:59:16 +00:00
|
|
|
CONFIG_GET_BOOL(camera.allow, "camera_allow");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_LOCATION
|
|
|
|
CONFIG_GET_BOOL(location.allow, "location_allow");
|
2013-11-16 02:28:45 +00:00
|
|
|
#endif
|
|
|
|
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_STRING(video.driver, "video_driver");
|
2014-05-26 23:13:43 +00:00
|
|
|
CONFIG_GET_STRING(menu.driver, "menu_driver");
|
2013-02-23 13:49:49 +00:00
|
|
|
CONFIG_GET_STRING(video.gl_context, "video_gl_context");
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_STRING(audio.driver, "audio_driver");
|
2012-09-07 22:31:30 +00:00
|
|
|
CONFIG_GET_PATH(audio.dsp_plugin, "audio_dsp_plugin");
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_STRING(input.driver, "input_driver");
|
2013-05-04 08:22:31 +00:00
|
|
|
CONFIG_GET_STRING(input.joypad_driver, "input_joypad_driver");
|
2013-12-08 15:05:05 +00:00
|
|
|
CONFIG_GET_STRING(input.keyboard_layout, "input_keyboard_layout");
|
2011-11-15 20:15:12 +00:00
|
|
|
|
2013-12-28 22:29:34 +00:00
|
|
|
if (!g_extern.has_set_libretro)
|
2012-09-07 22:31:30 +00:00
|
|
|
CONFIG_GET_PATH(libretro, "libretro_path");
|
2014-05-09 16:51:20 +00:00
|
|
|
if (!g_extern.has_set_libretro_directory)
|
|
|
|
CONFIG_GET_PATH(libretro_directory, "libretro_directory");
|
|
|
|
|
|
|
|
// Safe-guard against older behavior.
|
|
|
|
if (path_is_directory(g_settings.libretro))
|
|
|
|
{
|
|
|
|
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
|
|
|
|
strlcpy(g_settings.libretro_directory, g_settings.libretro, sizeof(g_settings.libretro_directory));
|
|
|
|
*g_settings.libretro = '\0';
|
|
|
|
}
|
2012-09-07 20:20:49 +00:00
|
|
|
|
2013-10-10 23:19:54 +00:00
|
|
|
CONFIG_GET_BOOL(fps_show, "fps_show");
|
2014-04-14 04:07:17 +00:00
|
|
|
CONFIG_GET_BOOL(load_dummy_on_core_shutdown, "load_dummy_on_core_shutdown");
|
2013-10-10 23:19:54 +00:00
|
|
|
|
2013-10-10 22:36:08 +00:00
|
|
|
CONFIG_GET_PATH(libretro_info_path, "libretro_info_path");
|
|
|
|
|
2013-04-04 11:58:30 +00:00
|
|
|
CONFIG_GET_PATH(core_options_path, "core_options_path");
|
2012-09-07 22:31:30 +00:00
|
|
|
CONFIG_GET_PATH(screenshot_directory, "screenshot_directory");
|
2013-09-16 21:30:42 +00:00
|
|
|
if (*g_settings.screenshot_directory)
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2013-09-16 21:30:42 +00:00
|
|
|
if (!strcmp(g_settings.screenshot_directory, "default"))
|
|
|
|
*g_settings.screenshot_directory = '\0';
|
|
|
|
else if (!path_is_directory(g_settings.screenshot_directory))
|
|
|
|
{
|
|
|
|
RARCH_WARN("screenshot_directory is not an existing directory, ignoring ...\n");
|
|
|
|
*g_settings.screenshot_directory = '\0';
|
|
|
|
}
|
2011-08-24 13:47:39 +00:00
|
|
|
}
|
2011-01-31 17:06:57 +00:00
|
|
|
|
2014-04-04 15:33:19 +00:00
|
|
|
CONFIG_GET_PATH(extraction_directory, "extraction_directory");
|
2013-12-26 01:03:11 +00:00
|
|
|
CONFIG_GET_PATH(content_directory, "content_directory");
|
2014-05-10 03:12:31 +00:00
|
|
|
CONFIG_GET_PATH(assets_directory, "assets_directory");
|
2013-12-25 01:31:35 +00:00
|
|
|
if (!strcmp(g_settings.content_directory, "default"))
|
|
|
|
*g_settings.content_directory = '\0';
|
2014-05-10 03:12:31 +00:00
|
|
|
if (!strcmp(g_settings.assets_directory, "default"))
|
|
|
|
*g_settings.assets_directory = '\0';
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2014-06-10 00:06:10 +00:00
|
|
|
CONFIG_GET_PATH(menu_content_directory, "rgui_browser_directory");
|
|
|
|
if (!strcmp(g_settings.menu_content_directory, "default"))
|
|
|
|
*g_settings.menu_content_directory = '\0';
|
|
|
|
CONFIG_GET_PATH(menu_config_directory, "rgui_config_directory");
|
|
|
|
if (!strcmp(g_settings.menu_config_directory, "default"))
|
|
|
|
*g_settings.menu_config_directory = '\0';
|
|
|
|
CONFIG_GET_BOOL(menu_show_start_screen, "rgui_show_start_screen");
|
2013-03-17 20:37:41 +00:00
|
|
|
#endif
|
2014-03-01 11:02:48 +00:00
|
|
|
CONFIG_GET_INT(libretro_log_level, "libretro_log_level");
|
2014-05-26 09:07:59 +00:00
|
|
|
|
|
|
|
if (!g_extern.has_set_verbosity)
|
|
|
|
CONFIG_GET_BOOL_EXTERN(verbose, "log_verbosity");
|
2013-03-17 20:37:41 +00:00
|
|
|
|
2014-06-01 20:06:52 +00:00
|
|
|
CONFIG_GET_BOOL_EXTERN(perfcnt_enable, "perfcnt_enable");
|
|
|
|
|
2013-05-22 20:31:16 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
CONFIG_GET_PATH_EXTERN(overlay_dir, "overlay_directory");
|
|
|
|
if (!strcmp(g_extern.overlay_dir, "default"))
|
|
|
|
*g_extern.overlay_dir = '\0';
|
2013-05-24 16:35:28 +00:00
|
|
|
|
2014-06-12 20:15:32 +00:00
|
|
|
CONFIG_GET_BOOL(input.overlay_enable, "input_overlay_enable");
|
2013-08-18 12:00:18 +00:00
|
|
|
CONFIG_GET_PATH(input.overlay, "input_overlay");
|
|
|
|
CONFIG_GET_FLOAT(input.overlay_opacity, "input_overlay_opacity");
|
|
|
|
CONFIG_GET_FLOAT(input.overlay_scale, "input_overlay_scale");
|
2013-05-22 20:31:16 +00:00
|
|
|
#endif
|
|
|
|
|
2011-02-01 16:13:26 +00:00
|
|
|
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
|
2011-02-05 10:31:35 +00:00
|
|
|
|
2012-03-28 21:32:29 +00:00
|
|
|
int buffer_size = 0;
|
2012-01-29 14:52:59 +00:00
|
|
|
if (config_get_int(conf, "rewind_buffer_size", &buffer_size))
|
|
|
|
g_settings.rewind_buffer_size = buffer_size * UINT64_C(1000000);
|
2011-02-05 10:31:35 +00:00
|
|
|
|
2011-02-01 16:30:18 +00:00
|
|
|
CONFIG_GET_INT(rewind_granularity, "rewind_granularity");
|
2012-03-04 11:01:07 +00:00
|
|
|
CONFIG_GET_FLOAT(slowmotion_ratio, "slowmotion_ratio");
|
|
|
|
if (g_settings.slowmotion_ratio < 1.0f)
|
|
|
|
g_settings.slowmotion_ratio = 1.0f;
|
2011-01-31 17:06:57 +00:00
|
|
|
|
2013-08-07 20:24:12 +00:00
|
|
|
CONFIG_GET_FLOAT(fastforward_ratio, "fastforward_ratio");
|
|
|
|
|
2011-02-05 20:45:44 +00:00
|
|
|
CONFIG_GET_BOOL(pause_nonactive, "pause_nonactive");
|
2011-02-10 20:16:59 +00:00
|
|
|
CONFIG_GET_INT(autosave_interval, "autosave_interval");
|
2011-02-05 20:45:44 +00:00
|
|
|
|
2012-09-07 22:31:30 +00:00
|
|
|
CONFIG_GET_PATH(cheat_database, "cheat_database_path");
|
|
|
|
CONFIG_GET_PATH(cheat_settings_path, "cheat_settings_path");
|
2011-04-17 11:30:59 +00:00
|
|
|
|
2011-09-16 13:32:21 +00:00
|
|
|
CONFIG_GET_BOOL(block_sram_overwrite, "block_sram_overwrite");
|
2011-09-27 13:31:25 +00:00
|
|
|
CONFIG_GET_BOOL(savestate_auto_index, "savestate_auto_index");
|
2012-06-02 19:33:37 +00:00
|
|
|
CONFIG_GET_BOOL(savestate_auto_save, "savestate_auto_save");
|
2013-01-24 18:24:40 +00:00
|
|
|
CONFIG_GET_BOOL(savestate_auto_load, "savestate_auto_load");
|
2011-09-16 13:32:21 +00:00
|
|
|
|
2012-05-27 12:12:29 +00:00
|
|
|
CONFIG_GET_BOOL(network_cmd_enable, "network_cmd_enable");
|
|
|
|
CONFIG_GET_INT(network_cmd_port, "network_cmd_port");
|
2012-07-24 00:47:28 +00:00
|
|
|
CONFIG_GET_BOOL(stdin_cmd_enable, "stdin_cmd_enable");
|
2012-05-27 12:12:29 +00:00
|
|
|
|
2013-06-09 19:59:48 +00:00
|
|
|
CONFIG_GET_PATH(game_history_path, "game_history_path");
|
|
|
|
CONFIG_GET_INT(game_history_size, "game_history_size");
|
|
|
|
|
2012-10-01 20:15:48 +00:00
|
|
|
CONFIG_GET_INT(input.turbo_period, "input_turbo_period");
|
|
|
|
CONFIG_GET_INT(input.turbo_duty_cycle, "input_duty_cycle");
|
|
|
|
|
2013-01-05 19:06:59 +00:00
|
|
|
CONFIG_GET_BOOL(input.debug_enable, "input_debug_enable");
|
2013-02-17 21:30:04 +00:00
|
|
|
|
2013-01-05 03:58:30 +00:00
|
|
|
CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable");
|
2013-04-26 12:36:36 +00:00
|
|
|
CONFIG_GET_PATH(input.autoconfig_dir, "joypad_autoconfig_dir");
|
|
|
|
|
2014-06-09 21:21:48 +00:00
|
|
|
#ifdef HAVE_NETPLAY
|
2014-06-09 22:01:03 +00:00
|
|
|
if (!g_extern.has_set_netplay_mode)
|
|
|
|
CONFIG_GET_BOOL_EXTERN(netplay_is_spectate, "netplay_spectator_mode_enable");
|
|
|
|
if (!g_extern.has_set_netplay_mode)
|
|
|
|
CONFIG_GET_BOOL_EXTERN(netplay_is_client, "netplay_mode");
|
|
|
|
if (!g_extern.has_set_netplay_nickname)
|
|
|
|
CONFIG_GET_PATH_EXTERN(netplay_nick, "netplay_nickname");
|
|
|
|
if (!g_extern.has_set_netplay_ip_address)
|
|
|
|
CONFIG_GET_PATH_EXTERN(netplay_server, "netplay_ip_address");
|
|
|
|
if (!g_extern.has_set_netplay_delay_frames)
|
|
|
|
CONFIG_GET_INT_EXTERN(netplay_sync_frames, "netplay_delay_frames");
|
|
|
|
if (!g_extern.has_set_netplay_ip_port)
|
|
|
|
CONFIG_GET_INT_EXTERN(netplay_port, "netplay_ip_port");
|
2014-06-09 21:21:48 +00:00
|
|
|
#endif
|
2014-06-09 20:50:44 +00:00
|
|
|
|
2013-05-22 13:35:28 +00:00
|
|
|
CONFIG_GET_BOOL_EXTERN(config_save_on_exit, "config_save_on_exit");
|
|
|
|
|
2012-09-07 22:31:30 +00:00
|
|
|
if (!g_extern.has_set_save_path && 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"))
|
2013-05-21 06:46:51 +00:00
|
|
|
*g_extern.savefile_dir = '\0';
|
2013-05-21 02:18:34 +00:00
|
|
|
else if (path_is_directory(tmp_str))
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2013-04-16 10:22:27 +00:00
|
|
|
strlcpy(g_extern.savefile_dir, tmp_str, sizeof(g_extern.savefile_dir));
|
2014-04-04 12:58:42 +00:00
|
|
|
strlcpy(g_extern.savefile_name, tmp_str, sizeof(g_extern.savefile_name));
|
|
|
|
fill_pathname_dir(g_extern.savefile_name, g_extern.basename, ".srm", sizeof(g_extern.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
|
|
|
|
2012-09-07 22:31:30 +00:00
|
|
|
if (!g_extern.has_set_state_path && 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"))
|
2013-05-21 06:46:51 +00:00
|
|
|
*g_extern.savestate_dir = '\0';
|
2013-05-21 02:18:34 +00:00
|
|
|
else if (path_is_directory(tmp_str))
|
2011-08-24 13:47:39 +00:00
|
|
|
{
|
2013-04-16 10:22:27 +00:00
|
|
|
strlcpy(g_extern.savestate_dir, tmp_str, sizeof(g_extern.savestate_dir));
|
2012-09-07 22:31:30 +00:00
|
|
|
strlcpy(g_extern.savestate_name, tmp_str, sizeof(g_extern.savestate_name));
|
2011-08-24 13:47:39 +00:00
|
|
|
fill_pathname_dir(g_extern.savestate_name, g_extern.basename, ".state", sizeof(g_extern.savestate_name));
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2012-09-18 21:55:36 +00:00
|
|
|
if (!config_get_path(conf, "system_directory", g_settings.system_directory, sizeof(g_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",
|
|
|
|
g_settings.system_directory);
|
|
|
|
}
|
2012-06-11 22:28:34 +00:00
|
|
|
|
2013-05-21 02:18:34 +00:00
|
|
|
if (!strcmp(g_settings.system_directory, "default"))
|
2013-05-21 06:46:51 +00:00
|
|
|
*g_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
|
|
|
|
2014-01-01 19:44:20 +00:00
|
|
|
CONFIG_GET_BOOL(core_specific_config, "core_specific_config");
|
|
|
|
|
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
|
|
|
|
2013-04-26 09:08:51 +00:00
|
|
|
static void read_keybinds_keyboard(config_file_t *conf, unsigned player, unsigned index,
|
|
|
|
struct retro_keybind *bind)
|
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
if (input_config_bind_map[index].valid && input_config_bind_map[index].base)
|
2013-04-26 09:08:51 +00:00
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
const char *prefix = input_config_get_prefix(player, input_config_bind_map[index].meta);
|
2013-04-26 09:08:51 +00:00
|
|
|
if (prefix)
|
2013-04-26 09:44:54 +00:00
|
|
|
input_config_parse_key(conf, prefix, input_config_bind_map[index].base, bind);
|
2010-12-30 03:51:08 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-30 00:20:35 +00:00
|
|
|
|
2013-04-26 09:08:51 +00:00
|
|
|
static void read_keybinds_button(config_file_t *conf, unsigned player, unsigned index,
|
|
|
|
struct retro_keybind *bind)
|
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
if (input_config_bind_map[index].valid && input_config_bind_map[index].base)
|
2013-04-26 09:08:51 +00:00
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
const char *prefix = input_config_get_prefix(player, input_config_bind_map[index].meta);
|
2013-04-26 09:08:51 +00:00
|
|
|
if (prefix)
|
2013-04-26 09:44:54 +00:00
|
|
|
input_config_parse_joy_button(conf, prefix, input_config_bind_map[index].base, bind);
|
2013-04-26 09:08:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void read_keybinds_axis(config_file_t *conf, unsigned player, unsigned index,
|
|
|
|
struct retro_keybind *bind)
|
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
if (input_config_bind_map[index].valid && input_config_bind_map[index].base)
|
2013-04-26 09:08:51 +00:00
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
const char *prefix = input_config_get_prefix(player, input_config_bind_map[index].meta);
|
2013-04-26 09:08:51 +00:00
|
|
|
if (prefix)
|
2013-04-26 09:44:54 +00:00
|
|
|
input_config_parse_joy_axis(conf, prefix, input_config_bind_map[index].base, bind);
|
2013-04-26 09:08:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-30 00:20:35 +00:00
|
|
|
static void read_keybinds_player(config_file_t *conf, unsigned player)
|
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; input_config_bind_map[i].valid; i++)
|
2012-01-30 00:20:35 +00:00
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
struct retro_keybind *bind = &g_settings.input.binds[player][i];
|
|
|
|
if (!bind->valid)
|
2013-04-26 09:08:51 +00:00
|
|
|
continue;
|
2012-01-30 00:20:35 +00:00
|
|
|
|
|
|
|
read_keybinds_keyboard(conf, player, i, bind);
|
|
|
|
read_keybinds_button(conf, player, i, bind);
|
|
|
|
read_keybinds_axis(conf, player, i, bind);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-29 18:25:54 +00:00
|
|
|
static void config_read_keybinds_conf(config_file_t *conf)
|
2012-01-30 00:20:35 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2012-01-30 00:20:35 +00:00
|
|
|
read_keybinds_player(conf, i);
|
|
|
|
}
|
|
|
|
|
2012-02-29 18:25:54 +00:00
|
|
|
bool config_read_keybinds(const char *path)
|
|
|
|
{
|
|
|
|
config_file_t *conf = config_file_new(path);
|
|
|
|
if (!conf)
|
|
|
|
return false;
|
|
|
|
config_read_keybinds_conf(conf);
|
|
|
|
config_file_free(conf);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-04-26 09:08:51 +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
|
|
|
{
|
2013-04-26 09:08:51 +00:00
|
|
|
char key[64];
|
|
|
|
snprintf(key, sizeof(key), "%s_%s", prefix, base);
|
|
|
|
|
2013-09-30 16:27:35 +00:00
|
|
|
char btn[64];
|
|
|
|
input_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
|
|
|
}
|
|
|
|
|
2013-04-26 09:08:51 +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
|
|
|
{
|
|
|
|
unsigned hat = GET_HAT(bind->joykey);
|
|
|
|
const char *dir = NULL;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
char config[16];
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-04-26 09:08:51 +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
|
|
|
{
|
2013-04-26 09:08:51 +00:00
|
|
|
char key[64];
|
|
|
|
snprintf(key, sizeof(key), "%s_%s_btn", prefix, base);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-04-26 09:08:51 +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
|
|
|
{
|
2013-04-26 09:08:51 +00:00
|
|
|
char key[64];
|
|
|
|
snprintf(key, sizeof(key), "%s_%s_axis", prefix, base);
|
|
|
|
|
2012-02-20 19:36:21 +00:00
|
|
|
unsigned axis = 0;
|
|
|
|
char dir = '\0';
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
char config[16];
|
|
|
|
snprintf(config, sizeof(config), "%c%u", dir, axis);
|
|
|
|
config_set_string(conf, key, config);
|
|
|
|
}
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2013-04-26 09:08:51 +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
|
|
|
}
|
|
|
|
|
2013-04-26 09:08:51 +00:00
|
|
|
static void save_keybinds_player(config_file_t *conf, unsigned player)
|
2012-02-20 19:36:21 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i = 0;
|
|
|
|
for (i = 0; input_config_bind_map[i].valid; i++)
|
2013-04-26 09:08:51 +00:00
|
|
|
{
|
2013-04-26 09:44:54 +00:00
|
|
|
const char *prefix = input_config_get_prefix(player, input_config_bind_map[i].meta);
|
2013-04-26 09:08:51 +00:00
|
|
|
if (prefix)
|
2013-04-26 09:44:54 +00:00
|
|
|
save_keybind(conf, prefix, input_config_bind_map[i].base, &g_settings.input.binds[player][i]);
|
2013-04-26 09:08:51 +00:00
|
|
|
}
|
2012-02-20 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2013-01-05 21:18:59 +00:00
|
|
|
bool config_save_file(const char *path)
|
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i = 0;
|
2013-01-05 21:18:59 +00:00
|
|
|
config_file_t *conf = config_file_new(path);
|
|
|
|
if (!conf)
|
|
|
|
conf = config_file_new(NULL);
|
|
|
|
if (!conf)
|
|
|
|
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
|
|
|
|
2014-04-26 13:57:53 +00:00
|
|
|
config_set_float(conf, "input_axis_threshold", g_settings.input.axis_threshold);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_bool(conf, "load_dummy_on_core_shutdown", g_settings.load_dummy_on_core_shutdown);
|
|
|
|
config_set_bool(conf, "fps_show", g_settings.fps_show);
|
|
|
|
config_set_path(conf, "libretro_path", g_settings.libretro);
|
2014-05-09 16:51:20 +00:00
|
|
|
config_set_path(conf, "libretro_directory", g_settings.libretro_directory);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_path(conf, "libretro_info_path", g_settings.libretro_info_path);
|
|
|
|
config_set_path(conf, "cheat_database_path", g_settings.cheat_database);
|
|
|
|
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
2014-04-20 01:34:26 +00:00
|
|
|
#ifdef HAVE_FILTERS_BUILTIN
|
|
|
|
config_set_int(conf, "filter_index", g_settings.video.filter_idx);
|
|
|
|
#endif
|
2014-04-30 19:59:41 +00:00
|
|
|
config_set_int(conf, "audio_latency", g_settings.audio.latency);
|
|
|
|
config_set_bool(conf, "audio_sync", g_settings.audio.sync);
|
|
|
|
config_set_int(conf, "audio_block_frames", g_settings.audio.block_frames);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_int(conf, "rewind_granularity", g_settings.rewind_granularity);
|
|
|
|
config_set_path(conf, "video_shader", g_settings.video.shader_path);
|
|
|
|
config_set_bool(conf, "video_shader_enable", g_settings.video.shader_enable);
|
2013-05-24 14:24:49 +00:00
|
|
|
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_bool(conf, "video_windowed_fullscreen", g_settings.video.windowed_fullscreen);
|
2013-09-01 11:46:35 +00:00
|
|
|
config_set_float(conf, "video_xscale", g_settings.video.xscale);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_int(conf, "autosave_interval", g_settings.autosave_interval);
|
2013-09-01 11:46:35 +00:00
|
|
|
config_set_float(conf, "video_yscale", g_settings.video.yscale);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_bool(conf, "video_crop_overscan", g_settings.video.crop_overscan);
|
|
|
|
config_set_bool(conf, "video_scale_integer", g_settings.video.scale_integer);
|
|
|
|
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
|
|
|
config_set_bool(conf, "video_threaded", g_settings.video.threaded);
|
|
|
|
config_set_bool(conf, "video_shared_context", g_settings.video.shared_context);
|
|
|
|
config_set_bool(conf, "video_fullscreen", g_settings.video.fullscreen);
|
2013-06-07 12:38:37 +00:00
|
|
|
config_set_float(conf, "video_refresh_rate", g_settings.video.refresh_rate);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_int(conf, "video_monitor_index", g_settings.video.monitor_index);
|
|
|
|
config_set_int(conf, "video_fullscreen_x", g_settings.video.fullscreen_x);
|
|
|
|
config_set_int(conf, "video_fullscreen_y", g_settings.video.fullscreen_y);
|
|
|
|
config_set_string(conf,"video_driver", g_settings.video.driver);
|
2014-05-26 23:13:43 +00:00
|
|
|
config_set_string(conf,"menu_driver", g_settings.menu.driver);
|
2014-04-20 01:27:55 +00:00
|
|
|
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
|
|
|
config_set_bool(conf, "video_hard_sync", g_settings.video.hard_sync);
|
|
|
|
config_set_int(conf, "video_hard_sync_frames", g_settings.video.hard_sync_frames);
|
|
|
|
config_set_bool(conf, "video_black_frame_insertion", g_settings.video.black_frame_insertion);
|
|
|
|
config_set_bool(conf, "video_disable_composition", g_settings.video.disable_composition);
|
|
|
|
config_set_bool(conf, "pause_nonactive", g_settings.pause_nonactive);
|
2013-09-01 11:20:10 +00:00
|
|
|
config_set_int(conf, "video_swap_interval", g_settings.video.swap_interval);
|
2013-09-16 21:10:15 +00:00
|
|
|
config_set_bool(conf, "video_gpu_screenshot", g_settings.video.gpu_screenshot);
|
2013-09-22 09:45:04 +00:00
|
|
|
config_set_int(conf, "video_rotation", g_settings.video.rotation);
|
2013-12-24 17:23:21 +00:00
|
|
|
config_set_path(conf, "screenshot_directory", *g_settings.screenshot_directory ? g_settings.screenshot_directory : "default");
|
2013-01-05 21:18:59 +00:00
|
|
|
config_set_int(conf, "aspect_ratio_index", g_settings.video.aspect_ratio_idx);
|
|
|
|
config_set_string(conf, "audio_device", g_settings.audio.device);
|
2014-04-27 16:15:41 +00:00
|
|
|
config_set_string(conf, "audio_dsp_plugin", g_settings.audio.dsp_plugin);
|
2013-11-16 02:28:45 +00:00
|
|
|
#ifdef HAVE_CAMERA
|
|
|
|
config_set_string(conf, "camera_device", g_settings.camera.device);
|
2014-04-07 16:50:52 +00:00
|
|
|
config_set_bool(conf, "camera_allow", g_settings.camera.allow);
|
2013-11-16 02:28:45 +00:00
|
|
|
#endif
|
2013-01-05 21:18:59 +00:00
|
|
|
config_set_bool(conf, "audio_rate_control", g_settings.audio.rate_control);
|
|
|
|
config_set_float(conf, "audio_rate_control_delta", g_settings.audio.rate_control_delta);
|
2013-09-22 12:23:41 +00:00
|
|
|
config_set_string(conf, "audio_driver", g_settings.audio.driver);
|
|
|
|
config_set_int(conf, "audio_out_rate", g_settings.audio.out_rate);
|
2013-05-21 02:18:34 +00:00
|
|
|
|
2014-04-07 16:50:52 +00:00
|
|
|
#ifdef HAVE_LOCATION
|
|
|
|
config_set_bool(conf, "location_allow", g_settings.location.allow);
|
|
|
|
#endif
|
|
|
|
|
2014-04-07 20:12:23 +00:00
|
|
|
config_set_float(conf, "video_font_size", g_settings.video.font_size);
|
|
|
|
config_set_bool(conf, "video_font_enable", g_settings.video.font_enable);
|
|
|
|
|
2013-12-24 17:23:21 +00:00
|
|
|
config_set_path(conf, "system_directory", *g_settings.system_directory ? g_settings.system_directory : "default");
|
2014-04-04 15:33:19 +00:00
|
|
|
config_set_path(conf, "extraction_directory", g_settings.extraction_directory);
|
2014-02-25 01:55:05 +00:00
|
|
|
config_set_string(conf, "audio_resampler", g_settings.audio.resampler);
|
2013-12-24 17:23:21 +00:00
|
|
|
config_set_path(conf, "savefile_directory", *g_extern.savefile_dir ? g_extern.savefile_dir : "default");
|
|
|
|
config_set_path(conf, "savestate_directory", *g_extern.savestate_dir ? g_extern.savestate_dir : "default");
|
|
|
|
config_set_path(conf, "video_shader_dir", *g_settings.video.shader_dir ? g_settings.video.shader_dir : "default");
|
2014-04-15 10:22:01 +00:00
|
|
|
config_set_path(conf, "video_filter", g_settings.video.filter_path);
|
2014-04-15 04:19:24 +00:00
|
|
|
config_set_path(conf, "video_filter_dir", *g_settings.video.filter_dir ? g_settings.video.filter_dir : "default");
|
2014-04-27 16:15:41 +00:00
|
|
|
config_set_path(conf, "audio_filter_dir", *g_settings.audio.filter_dir ? g_settings.audio.filter_dir : "default");
|
2013-06-01 10:42:38 +00:00
|
|
|
|
2013-12-26 01:03:11 +00:00
|
|
|
config_set_path(conf, "content_directory", *g_settings.content_directory ? g_settings.content_directory : "default");
|
2014-05-10 03:12:31 +00:00
|
|
|
config_set_path(conf, "assets_directory", *g_settings.assets_directory ? g_settings.assets_directory : "default");
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2014-06-10 00:06:10 +00:00
|
|
|
config_set_path(conf, "rgui_browser_directory", *g_settings.menu_content_directory ? g_settings.menu_content_directory : "default");
|
|
|
|
config_set_path(conf, "rgui_config_directory", *g_settings.menu_config_directory ? g_settings.menu_config_directory : "default");
|
|
|
|
config_set_bool(conf, "rgui_show_start_screen", g_settings.menu_show_start_screen);
|
2013-04-18 16:33:03 +00:00
|
|
|
#endif
|
|
|
|
|
2013-12-24 17:23:21 +00:00
|
|
|
config_set_path(conf, "game_history_path", g_settings.game_history_path);
|
2013-09-22 10:48:54 +00:00
|
|
|
config_set_int(conf, "game_history_size", g_settings.game_history_size);
|
2013-12-24 17:23:21 +00:00
|
|
|
config_set_path(conf, "joypad_autoconfig_dir", g_settings.input.autoconfig_dir);
|
2013-12-12 21:14:10 +00:00
|
|
|
config_set_bool(conf, "input_autodetect_enable", g_settings.input.autodetect_enable);
|
2013-09-22 10:48:54 +00:00
|
|
|
|
2013-05-22 20:31:16 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2013-12-24 17:23:21 +00:00
|
|
|
config_set_path(conf, "overlay_directory", *g_extern.overlay_dir ? g_extern.overlay_dir : "default");
|
|
|
|
config_set_path(conf, "input_overlay", g_settings.input.overlay);
|
2014-06-12 20:15:32 +00:00
|
|
|
config_set_bool(conf, "input_overlay_enable", g_settings.input.overlay_enable);
|
2013-08-18 12:00:18 +00:00
|
|
|
config_set_float(conf, "input_overlay_opacity", g_settings.input.overlay_opacity);
|
|
|
|
config_set_float(conf, "input_overlay_scale", g_settings.input.overlay_scale);
|
2013-05-22 20:31:16 +00:00
|
|
|
#endif
|
|
|
|
|
2013-01-05 21:18:59 +00:00
|
|
|
config_set_bool(conf, "gamma_correction", g_extern.console.screen.gamma_correction);
|
2013-11-07 20:44:44 +00:00
|
|
|
bool triple_buffering_enable_val = g_extern.lifecycle_state & (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
|
|
|
bool soft_filter_enable_val = g_extern.lifecycle_state & (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
|
|
|
bool flicker_filter_enable_val = g_extern.lifecycle_state & (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
2013-09-27 16:30:27 +00:00
|
|
|
|
|
|
|
config_set_bool(conf, "triple_buffering_enable", triple_buffering_enable_val);
|
|
|
|
config_set_bool(conf, "soft_filter_enable", soft_filter_enable_val);
|
|
|
|
config_set_bool(conf, "flicker_filter_enable", flicker_filter_enable_val);
|
2013-01-11 18:44:13 +00:00
|
|
|
|
|
|
|
config_set_int(conf, "flicker_filter_index", g_extern.console.screen.flicker_filter_index);
|
|
|
|
config_set_int(conf, "soft_filter_index", g_extern.console.screen.soft_filter_index);
|
2013-01-05 21:18:59 +00:00
|
|
|
config_set_int(conf, "current_resolution_id", g_extern.console.screen.resolutions.current.id);
|
|
|
|
config_set_int(conf, "custom_viewport_width", g_extern.console.screen.viewports.custom_vp.width);
|
|
|
|
config_set_int(conf, "custom_viewport_height", g_extern.console.screen.viewports.custom_vp.height);
|
|
|
|
config_set_int(conf, "custom_viewport_x", g_extern.console.screen.viewports.custom_vp.x);
|
|
|
|
config_set_int(conf, "custom_viewport_y", g_extern.console.screen.viewports.custom_vp.y);
|
2013-03-09 16:42:19 +00:00
|
|
|
#ifdef HAVE_RMENU
|
2013-12-24 17:23:21 +00:00
|
|
|
config_set_path(conf, "menu_texture_path", g_extern.menu_texture_path);
|
2013-03-09 16:42:19 +00:00
|
|
|
#endif
|
2013-01-11 20:04:51 +00:00
|
|
|
config_set_float(conf, "video_font_size", g_settings.video.font_size);
|
|
|
|
|
2014-02-15 10:12:34 +00:00
|
|
|
config_set_bool(conf, "block_sram_overwrite", g_settings.block_sram_overwrite);
|
|
|
|
config_set_bool(conf, "savestate_auto_index", g_settings.savestate_auto_index);
|
|
|
|
config_set_bool(conf, "savestate_auto_save", g_settings.savestate_auto_save);
|
|
|
|
config_set_bool(conf, "savestate_auto_load", g_settings.savestate_auto_load);
|
|
|
|
|
2014-05-25 11:13:55 +00:00
|
|
|
config_set_float(conf, "fastforward_ratio", g_settings.fastforward_ratio);
|
|
|
|
config_set_float(conf, "slowmotion_ratio", g_settings.slowmotion_ratio);
|
|
|
|
|
2013-01-05 21:18:59 +00:00
|
|
|
// g_extern
|
2013-05-22 13:35:28 +00:00
|
|
|
config_set_bool(conf, "config_save_on_exit", g_extern.config_save_on_exit);
|
2013-01-05 21:18:59 +00:00
|
|
|
config_set_int(conf, "sound_mode", g_extern.console.sound.mode);
|
|
|
|
config_set_int(conf, "state_slot", g_extern.state_slot);
|
2013-09-27 16:30:27 +00:00
|
|
|
|
2014-06-09 21:21:48 +00:00
|
|
|
#ifdef HAVE_NETPLAY
|
2014-06-09 20:50:44 +00:00
|
|
|
config_set_bool(conf, "netplay_spectator_mode_enable", g_extern.netplay_is_spectate);
|
|
|
|
config_set_bool(conf, "netplay_mode", g_extern.netplay_is_client);
|
|
|
|
config_set_string(conf, "netplay_nickname", g_extern.netplay_nick);
|
|
|
|
config_set_string(conf, "netplay_ip_address", g_extern.netplay_server);
|
|
|
|
config_set_int(conf, "netplay_ip_port", g_extern.netplay_port);
|
|
|
|
config_set_int(conf, "netplay_delay_frames", g_extern.netplay_sync_frames);
|
2014-06-09 21:21:48 +00:00
|
|
|
#endif
|
2014-06-09 20:50:44 +00:00
|
|
|
|
2013-11-07 20:44:44 +00:00
|
|
|
bool custom_bgm_enable_val = g_extern.lifecycle_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
2013-09-27 16:30:27 +00:00
|
|
|
config_set_bool(conf, "custom_bgm_enable", custom_bgm_enable_val);
|
2013-01-05 21:18:59 +00:00
|
|
|
|
2013-09-22 12:23:41 +00:00
|
|
|
config_set_string(conf, "input_driver", g_settings.input.driver);
|
2013-09-26 09:25:59 +00:00
|
|
|
config_set_string(conf, "input_joypad_driver", g_settings.input.joypad_driver);
|
2013-12-08 15:05:05 +00:00
|
|
|
config_set_string(conf, "input_keyboard_layout", g_settings.input.keyboard_layout);
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2013-01-05 21:18:59 +00:00
|
|
|
{
|
|
|
|
char cfg[64];
|
|
|
|
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
|
|
|
config_set_int(conf, cfg, g_settings.input.device[i]);
|
2013-09-03 12:30:25 +00:00
|
|
|
snprintf(cfg, sizeof(cfg), "input_player%u_joypad_index", i + 1);
|
|
|
|
config_set_int(conf, cfg, g_settings.input.joypad_map[i]);
|
2013-09-22 09:08:09 +00:00
|
|
|
snprintf(cfg, sizeof(cfg), "input_libretro_device_p%u", i + 1);
|
|
|
|
config_set_int(conf, cfg, g_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);
|
|
|
|
config_set_int(conf, cfg, g_settings.input.analog_dpad_mode[i]);
|
2013-01-05 21:18:59 +00:00
|
|
|
}
|
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2013-09-29 17:37:48 +00:00
|
|
|
save_keybinds_player(conf, i);
|
|
|
|
|
2014-01-01 19:52:35 +00:00
|
|
|
config_set_bool(conf, "core_specific_config", g_settings.core_specific_config);
|
2014-03-01 11:02:48 +00:00
|
|
|
config_set_int(conf, "libretro_log_level", g_settings.libretro_log_level);
|
2014-05-26 00:44:58 +00:00
|
|
|
config_set_bool(conf, "log_verbosity", g_extern.verbose);
|
2014-06-01 20:06:52 +00:00
|
|
|
config_set_bool(conf, "perfcnt_enable", g_extern.perfcnt_enable);
|
2014-01-01 19:52:35 +00:00
|
|
|
|
2013-09-22 10:48:33 +00:00
|
|
|
bool 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
|
|
|
}
|