2012-04-21 23:13:50 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2013-01-01 01:37:37 +01:00
|
|
|
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
2010-12-30 01:50:37 +01:00
|
|
|
*
|
2012-04-21 23:13:50 +02:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2010-12-30 01:50:37 +01: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 23:13:50 +02:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2010-12-30 01:50:37 +01: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 23:31:57 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2010-12-30 01:50:37 +01:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-12-29 19:00:21 +01:00
|
|
|
#include "general.h"
|
|
|
|
#include "conf/config_file.h"
|
2012-01-29 14:10:57 +01:00
|
|
|
#include "conf/config_file_macros.h"
|
2012-03-16 23:26:57 +01:00
|
|
|
#include "compat/strl.h"
|
2011-01-08 22:15:02 +01:00
|
|
|
#include "config.def.h"
|
2011-08-24 15:47:39 +02:00
|
|
|
#include "file.h"
|
2012-03-16 23:26:57 +01:00
|
|
|
#include "compat/posix_string.h"
|
2011-01-07 17:59:53 +01:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2010-12-30 03:02:30 +01:00
|
|
|
#include "config.h"
|
2011-01-07 17:59:53 +01:00
|
|
|
#endif
|
|
|
|
|
2010-12-30 04:51:08 +01:00
|
|
|
#include <ctype.h>
|
2010-12-29 19:00:21 +01:00
|
|
|
|
|
|
|
struct settings g_settings;
|
2011-08-26 17:32:04 +02:00
|
|
|
struct global g_extern;
|
2010-12-29 19:00:21 +01:00
|
|
|
|
2012-05-07 23:20:13 +02:00
|
|
|
const char *config_get_default_audio(void)
|
2010-12-29 19:00:21 +01:00
|
|
|
{
|
2010-12-29 20:50:50 +01:00
|
|
|
switch (AUDIO_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case AUDIO_RSOUND:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "rsound";
|
2010-12-29 20:50:50 +01:00
|
|
|
case AUDIO_OSS:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "oss";
|
2010-12-29 20:50:50 +01:00
|
|
|
case AUDIO_ALSA:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "alsa";
|
2013-01-04 14:58:34 -05:00
|
|
|
case AUDIO_ALSATHREAD:
|
|
|
|
return "alsathread";
|
2010-12-29 20:50:50 +01:00
|
|
|
case AUDIO_ROAR:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "roar";
|
2011-08-08 17:27:52 +02:00
|
|
|
case AUDIO_COREAUDIO:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "coreaudio";
|
2010-12-29 20:50:50 +01:00
|
|
|
case AUDIO_AL:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "openal";
|
2012-10-18 05:45:21 +02:00
|
|
|
case AUDIO_SL:
|
|
|
|
return "opensl";
|
2011-01-07 17:59:53 +01:00
|
|
|
case AUDIO_SDL:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "sdl";
|
2011-08-04 18:45:40 +02:00
|
|
|
case AUDIO_DSOUND:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "dsound";
|
2011-01-27 01:46:00 +01:00
|
|
|
case AUDIO_XAUDIO:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "xaudio";
|
2011-01-29 01:15:09 +01:00
|
|
|
case AUDIO_PULSE:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "pulse";
|
2011-05-15 01:46:11 +02:00
|
|
|
case AUDIO_EXT:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "ext";
|
2011-12-13 23:17:37 +01:00
|
|
|
case AUDIO_XENON360:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "xenon360";
|
2011-12-14 12:49:13 +01:00
|
|
|
case AUDIO_PS3:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "ps3";
|
2011-12-14 12:49:13 +01:00
|
|
|
case AUDIO_WII:
|
2012-08-09 03:54:27 +02:00
|
|
|
return "gx";
|
2012-06-20 00:43:41 +02:00
|
|
|
case AUDIO_NULL:
|
|
|
|
return "null";
|
2010-12-29 20:50:50 +01:00
|
|
|
default:
|
2012-05-07 23:20:13 +02:00
|
|
|
return NULL;
|
2010-12-29 20:50:50 +01:00
|
|
|
}
|
2012-05-07 23:20:13 +02:00
|
|
|
}
|
2010-12-29 20:50:50 +01:00
|
|
|
|
2012-05-07 23:20:13 +02:00
|
|
|
const char *config_get_default_video(void)
|
|
|
|
{
|
|
|
|
switch (VIDEO_DEFAULT_DRIVER)
|
|
|
|
{
|
|
|
|
case VIDEO_GL:
|
|
|
|
return "gl";
|
|
|
|
case VIDEO_WII:
|
2012-08-09 03:54:27 +02:00
|
|
|
return "gx";
|
2012-05-07 23:20:13 +02:00
|
|
|
case VIDEO_XENON360:
|
|
|
|
return "xenon360";
|
2012-07-07 20:15:06 +03:00
|
|
|
case VIDEO_XDK_D3D:
|
2012-07-07 17:53:33 +03:00
|
|
|
return "xdk_d3d";
|
2012-10-26 21:09:30 +02:00
|
|
|
case VIDEO_D3D9:
|
|
|
|
return "d3d9";
|
2012-11-23 05:20:05 +01:00
|
|
|
case VIDEO_PSP1:
|
|
|
|
return "psp1";
|
2012-11-26 03:16:20 +01:00
|
|
|
case VIDEO_VITA:
|
|
|
|
return "vita";
|
2012-05-07 23:20:13 +02:00
|
|
|
case VIDEO_XVIDEO:
|
|
|
|
return "xvideo";
|
|
|
|
case VIDEO_SDL:
|
|
|
|
return "sdl";
|
|
|
|
case VIDEO_EXT:
|
|
|
|
return "ext";
|
2012-09-24 15:19:07 -04:00
|
|
|
case VIDEO_VG:
|
|
|
|
return "vg";
|
2012-06-20 00:43:41 +02:00
|
|
|
case VIDEO_NULL:
|
|
|
|
return "null";
|
2012-05-07 23:20:13 +02:00
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *config_get_default_input(void)
|
|
|
|
{
|
2011-01-06 18:34:11 +01:00
|
|
|
switch (INPUT_DEFAULT_DRIVER)
|
|
|
|
{
|
2012-10-16 19:46:31 +02:00
|
|
|
case INPUT_ANDROID:
|
|
|
|
return "android_input";
|
2011-11-30 17:24:18 +01:00
|
|
|
case INPUT_PS3:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "ps3";
|
2012-11-23 02:40:03 +01:00
|
|
|
case INPUT_PSP:
|
|
|
|
return "psp";
|
2011-01-06 18:34:11 +01:00
|
|
|
case INPUT_SDL:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "sdl";
|
2012-09-30 11:26:26 +02:00
|
|
|
case INPUT_DINPUT:
|
|
|
|
return "dinput";
|
2011-03-13 04:51:09 +01:00
|
|
|
case INPUT_X:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "x";
|
2011-12-14 01:35:17 +01:00
|
|
|
case INPUT_XENON360:
|
2012-05-07 23:20:13 +02:00
|
|
|
return "xenon360";
|
2012-07-07 20:56:46 +03:00
|
|
|
case INPUT_XINPUT:
|
|
|
|
return "xinput";
|
2011-12-14 13:20:22 +01:00
|
|
|
case INPUT_WII:
|
2012-08-09 03:54:27 +02:00
|
|
|
return "gx";
|
2012-05-25 15:44:39 -04:00
|
|
|
case INPUT_LINUXRAW:
|
|
|
|
return "linuxraw";
|
2012-06-20 00:43:41 +02:00
|
|
|
case INPUT_NULL:
|
|
|
|
return "null";
|
2011-01-06 18:34:11 +01:00
|
|
|
default:
|
2012-05-07 23:20:13 +02:00
|
|
|
return NULL;
|
2011-01-06 18:34:11 +01:00
|
|
|
}
|
2012-05-07 23:20:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void config_set_defaults(void)
|
|
|
|
{
|
|
|
|
const char *def_video = config_get_default_video();
|
|
|
|
const char *def_audio = config_get_default_audio();
|
|
|
|
const char *def_input = config_get_default_input();
|
2011-01-06 18:34:11 +01:00
|
|
|
|
2010-12-29 20:50:50 +01:00
|
|
|
if (def_video)
|
2011-04-03 22:29:36 +02:00
|
|
|
strlcpy(g_settings.video.driver, def_video, sizeof(g_settings.video.driver));
|
2010-12-29 20:50:50 +01:00
|
|
|
if (def_audio)
|
2011-04-03 22:29:36 +02:00
|
|
|
strlcpy(g_settings.audio.driver, def_audio, sizeof(g_settings.audio.driver));
|
2011-01-06 18:34:11 +01:00
|
|
|
if (def_input)
|
2011-04-03 22:29:36 +02:00
|
|
|
strlcpy(g_settings.input.driver, def_input, sizeof(g_settings.input.driver));
|
2010-12-29 20:50:50 +01:00
|
|
|
|
2010-12-29 19:00:21 +01:00
|
|
|
g_settings.video.xscale = xscale;
|
|
|
|
g_settings.video.yscale = yscale;
|
2011-07-09 08:37:08 +02:00
|
|
|
g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen;
|
2012-10-05 14:15:54 +02:00
|
|
|
g_settings.video.windowed_fullscreen = windowed_fullscreen;
|
2012-10-12 21:15:58 +02:00
|
|
|
g_settings.video.monitor_index = monitor_index;
|
2010-12-29 19:00:21 +01:00
|
|
|
g_settings.video.fullscreen_x = fullscreen_x;
|
|
|
|
g_settings.video.fullscreen_y = fullscreen_y;
|
2011-08-07 15:00:34 +02:00
|
|
|
g_settings.video.disable_composition = disable_composition;
|
2010-12-29 19:00:21 +01:00
|
|
|
g_settings.video.vsync = vsync;
|
2013-02-16 02:21:43 +01:00
|
|
|
g_settings.video.threaded = video_threaded;
|
2010-12-29 19:18:37 +01:00
|
|
|
g_settings.video.smooth = video_smooth;
|
2010-12-29 19:00:21 +01:00
|
|
|
g_settings.video.force_aspect = force_aspect;
|
2013-01-29 19:28:33 +01:00
|
|
|
g_settings.video.scale_integer = scale_integer;
|
2011-05-05 14:13:12 +02:00
|
|
|
g_settings.video.crop_overscan = crop_overscan;
|
2012-04-15 17:36:09 +02: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-01-11 08:38:02 +01:00
|
|
|
g_settings.video.shader_type = DEFAULT_SHADER_TYPE;
|
2012-04-01 16:12:04 +02:00
|
|
|
g_settings.video.allow_rotate = allow_rotate;
|
2010-12-29 19:00:21 +01:00
|
|
|
|
2012-01-11 22:52:25 +01:00
|
|
|
g_settings.video.font_enable = font_enable;
|
2011-01-23 02:48:06 +01:00
|
|
|
g_settings.video.font_size = font_size;
|
2012-01-11 22:52:25 +01:00
|
|
|
g_settings.video.font_scale = font_scale;
|
2011-01-23 02:59:44 +01:00
|
|
|
g_settings.video.msg_pos_x = message_pos_offset_x;
|
|
|
|
g_settings.video.msg_pos_y = message_pos_offset_y;
|
2011-09-05 17:00:28 +02: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 02:48:06 +01:00
|
|
|
|
2013-01-22 16:30:35 +01:00
|
|
|
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
2011-03-06 18:19:31 +01:00
|
|
|
g_settings.video.render_to_texture = render_to_texture;
|
2013-01-22 16:30:35 +01:00
|
|
|
g_settings.video.second_pass_smooth = second_pass_smooth;
|
2012-10-15 06:24:39 +02:00
|
|
|
g_settings.video.fbo.scale_x = fbo_scale_x;
|
|
|
|
g_settings.video.fbo.scale_y = fbo_scale_y;
|
2011-03-06 18:19:31 +01:00
|
|
|
#endif
|
|
|
|
|
2011-11-18 15:14:56 +01:00
|
|
|
g_settings.video.refresh_rate = refresh_rate;
|
2011-08-11 05:25:31 +02:00
|
|
|
g_settings.video.post_filter_record = post_filter_record;
|
2012-08-25 22:38:49 +02:00
|
|
|
g_settings.video.gpu_record = gpu_record;
|
2012-08-26 21:18:00 +02:00
|
|
|
g_settings.video.gpu_screenshot = gpu_screenshot;
|
2011-08-11 05:25:31 +02:00
|
|
|
|
2010-12-29 19:00:21 +01:00
|
|
|
g_settings.audio.enable = audio_enable;
|
|
|
|
g_settings.audio.out_rate = out_rate;
|
2013-01-08 04:58:41 +01:00
|
|
|
g_settings.audio.in_rate = out_rate;
|
2011-01-29 18:42:21 +01:00
|
|
|
g_settings.audio.rate_step = audio_rate_step;
|
2010-12-29 19:00:21 +01:00
|
|
|
if (audio_device)
|
2011-04-03 22:29:36 +02:00
|
|
|
strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device));
|
2010-12-29 19:00:21 +01:00
|
|
|
g_settings.audio.latency = out_latency;
|
|
|
|
g_settings.audio.sync = audio_sync;
|
2012-02-14 01:16:37 +01:00
|
|
|
g_settings.audio.rate_control = rate_control;
|
|
|
|
g_settings.audio.rate_control_delta = rate_control_delta;
|
2012-11-03 14:15:03 +01:00
|
|
|
g_settings.audio.volume = audio_volume;
|
2013-02-08 14:50:14 +01:00
|
|
|
strlcpy(g_settings.audio.resampler, audio_resampler, sizeof(g_settings.audio.resampler));
|
2011-02-06 13:29:48 +01:00
|
|
|
|
2011-01-31 18:06:57 +01:00
|
|
|
g_settings.rewind_enable = rewind_enable;
|
|
|
|
g_settings.rewind_buffer_size = rewind_buffer_size;
|
2011-02-01 17:30:18 +01:00
|
|
|
g_settings.rewind_granularity = rewind_granularity;
|
2012-03-04 12:01:07 +01:00
|
|
|
g_settings.slowmotion_ratio = slowmotion_ratio;
|
2011-02-05 21:45:44 +01:00
|
|
|
g_settings.pause_nonactive = pause_nonactive;
|
2011-02-10 21:16:59 +01:00
|
|
|
g_settings.autosave_interval = autosave_interval;
|
2011-01-31 18:06:57 +01:00
|
|
|
|
2011-09-16 15:32:21 +02:00
|
|
|
g_settings.block_sram_overwrite = block_sram_overwrite;
|
2011-09-27 15:31:25 +02:00
|
|
|
g_settings.savestate_auto_index = savestate_auto_index;
|
2012-06-02 21:33:37 +02:00
|
|
|
g_settings.savestate_auto_save = savestate_auto_save;
|
2013-01-24 19:24:40 +01:00
|
|
|
g_settings.savestate_auto_load = savestate_auto_load;
|
2012-05-27 14:12:29 +02:00
|
|
|
g_settings.network_cmd_enable = network_cmd_enable;
|
|
|
|
g_settings.network_cmd_port = network_cmd_port;
|
2012-07-24 02:47:28 +02:00
|
|
|
g_settings.stdin_cmd_enable = stdin_cmd_enable;
|
2011-09-16 15:32:21 +02:00
|
|
|
|
2012-07-07 17:19:32 +02: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));
|
2012-02-02 21:02:36 +01:00
|
|
|
for (unsigned i = 1; i < MAX_PLAYERS; i++)
|
2012-07-07 17:19:32 +02:00
|
|
|
memcpy(g_settings.input.binds[i], retro_keybinds_rest, sizeof(retro_keybinds_rest));
|
2010-12-29 19:43:17 +01:00
|
|
|
|
2012-02-01 23:02:17 +01:00
|
|
|
// Verify that binds are in proper order.
|
2012-02-06 16:13:29 +01:00
|
|
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
2012-04-21 23:25:32 +02:00
|
|
|
for (int j = 0; j < RARCH_BIND_LIST_END; j++)
|
2012-02-01 23:02:17 +01:00
|
|
|
if (g_settings.input.binds[i][j].valid)
|
2012-04-21 23:25:32 +02:00
|
|
|
rarch_assert(j == g_settings.input.binds[i][j].id);
|
2012-02-01 23:02:17 +01:00
|
|
|
|
2011-09-06 19:53:22 +02:00
|
|
|
g_settings.input.axis_threshold = axis_threshold;
|
2011-02-20 12:12:53 +01:00
|
|
|
g_settings.input.netplay_client_swap_input = netplay_client_swap_input;
|
2012-10-01 22:15:48 +02:00
|
|
|
g_settings.input.turbo_period = turbo_period;
|
|
|
|
g_settings.input.turbo_duty_cycle = turbo_duty_cycle;
|
2013-02-01 20:29:33 -05:00
|
|
|
g_settings.input.overlay_opacity = 1.0f;
|
2013-01-05 20:06:59 +01:00
|
|
|
g_settings.input.debug_enable = input_debug_enable;
|
|
|
|
#ifdef ANDROID
|
|
|
|
g_settings.input.autodetect_enable = input_autodetect_enable;
|
2013-03-07 15:21:17 +01:00
|
|
|
g_settings.input.back_behavior = BACK_BUTTON_QUIT;
|
2013-01-05 20:06:59 +01:00
|
|
|
#endif
|
|
|
|
|
2011-01-27 23:05:20 +01:00
|
|
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
2011-01-10 16:53:37 +01:00
|
|
|
g_settings.input.joypad_map[i] = i;
|
2012-05-28 23:14:18 +02:00
|
|
|
|
2013-01-10 06:38:19 +01:00
|
|
|
#ifdef RARCH_CONSOLE
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= ((1ULL << MODE_INFO_DRAW) | (1ULL << MODE_MENU));
|
2013-01-10 06:38:19 +01:00
|
|
|
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
|
|
|
strlcpy(g_settings.video.cg_shader_path, default_paths.shader_file, sizeof(g_settings.video.cg_shader_path));
|
|
|
|
strlcpy(g_settings.video.second_pass_shader, default_paths.shader_file, sizeof(g_settings.video.second_pass_shader));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));
|
|
|
|
|
|
|
|
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
|
2013-01-13 04:12:10 +01:00
|
|
|
strlcpy(g_extern.console.main_wrap.default_sram_dir, default_paths.sram_dir, sizeof(g_extern.console.main_wrap.default_sram_dir));
|
2013-01-10 06:38:19 +01:00
|
|
|
g_extern.console.screen.overscan_amount = 0.0f;
|
|
|
|
g_extern.console.screen.gamma_correction = DEFAULT_GAMMA;
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_OVERSCAN_ENABLE);
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SCREENSHOTS_ENABLE);
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_THROTTLE_ENABLE);
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
2013-01-11 07:49:32 +01:00
|
|
|
|
2013-01-10 06:38:19 +01:00
|
|
|
g_extern.console.screen.orientation = ORIENTATION_NORMAL;
|
|
|
|
g_extern.console.screen.resolutions.current.id = 0;
|
2013-01-13 04:12:10 +01:00
|
|
|
strlcpy(g_extern.console.main_wrap.default_rom_startup_dir, default_paths.filebrowser_startup_dir, sizeof(g_extern.console.main_wrap.default_rom_startup_dir));
|
|
|
|
strlcpy(g_extern.console.main_wrap.default_savestate_dir, default_paths.savestate_dir, sizeof(g_extern.console.main_wrap.default_savestate_dir));
|
2013-03-09 17:42:19 +01:00
|
|
|
#ifdef HAVE_RMENU
|
2013-02-01 09:13:29 +01:00
|
|
|
strlcpy(g_extern.console.menu_texture_path, default_paths.menu_border_file, sizeof(g_extern.console.menu_texture_path));
|
2013-03-09 17:42:19 +01:00
|
|
|
#endif
|
2013-01-23 18:43:00 +01:00
|
|
|
|
|
|
|
#if defined(__CELLOS_LV2) || defined(_XBOX360)
|
|
|
|
g_settings.video.aspect_ratio_idx = ASPECT_RATIO_16_9;
|
2013-02-09 08:30:25 +01:00
|
|
|
#elif defined(GEKKO) || defined(_XBOX1)
|
|
|
|
g_settings.video.aspect_ratio_idx = ASPECT_RATIO_4_3;
|
2013-01-23 18:43:00 +01:00
|
|
|
#else
|
2013-01-10 06:38:19 +01:00
|
|
|
g_settings.video.aspect_ratio_idx = 0;
|
2013-01-23 18:43:00 +01:00
|
|
|
#endif
|
2013-01-10 06:38:19 +01:00
|
|
|
g_extern.state_slot = 0;
|
|
|
|
g_extern.audio_data.mute = 0;
|
|
|
|
g_extern.verbose = true;
|
|
|
|
|
|
|
|
g_extern.console.sound.mode = SOUND_MODE_NORMAL;
|
|
|
|
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;
|
|
|
|
#ifdef _XBOX1
|
|
|
|
g_extern.console.sound.volume_level = 0;
|
|
|
|
#endif
|
2013-01-10 06:45:44 +01:00
|
|
|
|
|
|
|
g_extern.block_config_read = true;
|
2013-01-10 06:38:19 +01:00
|
|
|
#endif
|
|
|
|
|
2012-05-28 23:30:29 +02:00
|
|
|
rarch_init_msg_queue();
|
2010-12-29 19:00:21 +01:00
|
|
|
}
|
|
|
|
|
2011-01-19 12:54:19 +01:00
|
|
|
static void parse_config_file(void);
|
|
|
|
|
2012-01-28 15:47:02 +01:00
|
|
|
void config_load(void)
|
2010-12-29 19:00:21 +01:00
|
|
|
{
|
2013-01-10 06:45:44 +01:00
|
|
|
if (!g_extern.block_config_read)
|
|
|
|
{
|
|
|
|
config_set_defaults();
|
|
|
|
parse_config_file();
|
|
|
|
}
|
2011-01-19 12:54:19 +01:00
|
|
|
}
|
|
|
|
|
2011-02-22 11:28:28 +01:00
|
|
|
static config_file_t *open_default_config_file(void)
|
|
|
|
{
|
|
|
|
config_file_t *conf = NULL;
|
2012-12-25 14:51:08 +01:00
|
|
|
|
2012-01-05 17:27:18 +01:00
|
|
|
#if defined(_WIN32) && !defined(_XBOX)
|
2011-02-22 11:28:28 +01:00
|
|
|
// Just do something for now.
|
2012-12-25 20:47:22 +01:00
|
|
|
char conf_path[PATH_MAX];
|
2012-04-21 23:31:57 +02:00
|
|
|
conf = config_file_new("retroarch.cfg");
|
2011-02-22 11:28:28 +01:00
|
|
|
if (!conf)
|
|
|
|
{
|
|
|
|
const char *appdata = getenv("APPDATA");
|
|
|
|
if (appdata)
|
|
|
|
{
|
2012-12-25 14:51:08 +01:00
|
|
|
snprintf(conf_path, sizeof(conf_path), "%s/retroarch.cfg", appdata);
|
2011-02-22 11:28:28 +01:00
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
}
|
|
|
|
}
|
2012-02-27 17:29:59 +01:00
|
|
|
#elif !defined(__CELLOS_LV2__) && !defined(_XBOX)
|
2012-12-25 20:47:22 +01:00
|
|
|
char conf_path[PATH_MAX];
|
2013-02-26 18:46:07 +01:00
|
|
|
const char *xdg = getenv("XDG_CONFIG_HOME");
|
2011-02-22 11:28:28 +01:00
|
|
|
const char *home = getenv("HOME");
|
2013-02-26 18:46:07 +01:00
|
|
|
|
|
|
|
// XDG_CONFIG_HOME falls back to $HOME/.config.
|
2011-02-22 11:28:28 +01:00
|
|
|
if (xdg)
|
2012-12-25 14:51:08 +01:00
|
|
|
snprintf(conf_path, sizeof(conf_path), "%s/retroarch/retroarch.cfg", xdg);
|
2013-02-26 18:46:07 +01:00
|
|
|
else if (home)
|
|
|
|
snprintf(conf_path, sizeof(conf_path), "%s/.config/retroarch/retroarch.cfg", home);
|
|
|
|
|
|
|
|
if (xdg || home)
|
|
|
|
{
|
|
|
|
RARCH_LOG("Looking for config in: \"%s\".\n", conf_path);
|
2011-02-22 11:28:28 +01:00
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
}
|
2013-02-26 18:46:07 +01:00
|
|
|
|
|
|
|
// Fallback to $HOME/.retroarch.cfg.
|
|
|
|
if (!conf && home)
|
2011-02-22 11:28:28 +01:00
|
|
|
{
|
2012-12-25 14:51:08 +01:00
|
|
|
snprintf(conf_path, sizeof(conf_path), "%s/.retroarch.cfg", home);
|
2013-02-26 18:46:07 +01:00
|
|
|
RARCH_LOG("Looking for config in: \"%s\".\n", conf_path);
|
2011-02-22 11:28:28 +01:00
|
|
|
conf = config_file_new(conf_path);
|
|
|
|
}
|
2013-02-26 18:46:07 +01:00
|
|
|
|
|
|
|
// Try this as a last chance ...
|
2011-02-22 11:28:28 +01:00
|
|
|
if (!conf)
|
2013-02-26 18:46:07 +01:00
|
|
|
{
|
2012-04-21 23:31:57 +02:00
|
|
|
conf = config_file_new("/etc/retroarch.cfg");
|
2013-02-26 18:46:07 +01:00
|
|
|
RARCH_LOG("Looking for config in: \"/etc/retroarch.cfg\".\n");
|
|
|
|
}
|
2011-02-22 11:28:28 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return conf;
|
|
|
|
}
|
|
|
|
|
2012-02-29 19:25:54 +01:00
|
|
|
static void config_read_keybinds_conf(config_file_t *conf);
|
|
|
|
|
2011-01-19 12:54:19 +01:00
|
|
|
static void parse_config_file(void)
|
2012-01-28 15:41:57 +01:00
|
|
|
{
|
2012-01-28 15:47:02 +01:00
|
|
|
bool ret;
|
2012-01-28 15:41:57 +01:00
|
|
|
if (*g_extern.config_path)
|
2013-01-09 13:31:41 +01:00
|
|
|
{
|
|
|
|
RARCH_LOG("Loading config from: %s.\n", g_extern.config_path);
|
2012-01-28 15:47:02 +01:00
|
|
|
ret = config_load_file(g_extern.config_path);
|
2013-01-09 13:31:41 +01:00
|
|
|
}
|
2012-01-28 15:41:57 +01:00
|
|
|
else
|
2013-01-09 13:31:41 +01:00
|
|
|
{
|
2013-01-20 12:45:34 +01:00
|
|
|
RARCH_LOG("Loading default config.\n");
|
2012-01-28 15:47:02 +01:00
|
|
|
ret = config_load_file(NULL);
|
2013-01-09 13:31:41 +01:00
|
|
|
}
|
2012-01-28 15:47:02 +01:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
2012-04-21 23:25:32 +02:00
|
|
|
RARCH_ERR("Couldn't find config at path: \"%s\"\n", g_extern.config_path);
|
2013-01-22 15:10:15 +01:00
|
|
|
#ifndef RARCH_CONSOLE
|
2012-04-21 23:25:32 +02:00
|
|
|
rarch_fail(1, "parse_config_file()");
|
2013-01-22 15:10:15 +01:00
|
|
|
#endif
|
2012-01-28 15:47:02 +01:00
|
|
|
}
|
2012-01-28 15:41:57 +01:00
|
|
|
}
|
|
|
|
|
2012-01-28 15:47:02 +01:00
|
|
|
bool config_load_file(const char *path)
|
2011-01-19 12:54:19 +01:00
|
|
|
{
|
2010-12-29 19:00:21 +01:00
|
|
|
config_file_t *conf = NULL;
|
|
|
|
|
2012-01-28 15:41:57 +01:00
|
|
|
if (path)
|
2010-12-29 19:00:21 +01:00
|
|
|
{
|
2012-01-28 15:41:57 +01:00
|
|
|
conf = config_file_new(path);
|
2010-12-30 01:33:40 +01:00
|
|
|
if (!conf)
|
2012-01-29 22:00:21 +01:00
|
|
|
return false;
|
2010-12-29 19:00:21 +01:00
|
|
|
}
|
|
|
|
else
|
2011-02-22 11:28:28 +01:00
|
|
|
conf = open_default_config_file();
|
2010-12-29 19:00:21 +01:00
|
|
|
|
|
|
|
if (conf == NULL)
|
2012-01-28 15:47:02 +01:00
|
|
|
return true;
|
2010-12-29 19:00:21 +01:00
|
|
|
|
2012-09-11 00:10:44 +02: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 15:50:30 +01:00
|
|
|
if (g_extern.verbose)
|
2011-10-17 19:11:31 +02:00
|
|
|
{
|
2012-10-16 13:57:35 +02:00
|
|
|
RARCH_LOG_OUTPUT("=== Config ===\n");
|
2011-10-17 19:11:31 +02:00
|
|
|
config_file_dump_all(conf, stderr);
|
2012-10-16 13:57:35 +02:00
|
|
|
RARCH_LOG_OUTPUT("=== Config end ===\n");
|
2011-10-17 19:11:31 +02:00
|
|
|
}
|
2011-01-09 15:50:30 +01:00
|
|
|
|
2012-01-02 13:32:25 +01:00
|
|
|
char tmp_str[PATH_MAX];
|
2010-12-29 19:00:21 +01:00
|
|
|
|
2012-01-30 15:14:30 +01:00
|
|
|
CONFIG_GET_FLOAT(video.xscale, "video_xscale");
|
|
|
|
CONFIG_GET_FLOAT(video.yscale, "video_yscale");
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_INT(video.fullscreen_x, "video_fullscreen_x");
|
|
|
|
CONFIG_GET_INT(video.fullscreen_y, "video_fullscreen_y");
|
2011-07-09 08:37:08 +02:00
|
|
|
|
|
|
|
if (!g_extern.force_fullscreen)
|
|
|
|
CONFIG_GET_BOOL(video.fullscreen, "video_fullscreen");
|
|
|
|
|
2012-10-05 14:15:54 +02:00
|
|
|
CONFIG_GET_BOOL(video.windowed_fullscreen, "video_windowed_fullscreen");
|
2012-10-12 22:03:17 +02:00
|
|
|
CONFIG_GET_INT(video.monitor_index, "video_monitor_index");
|
2011-08-07 15:00:34 +02:00
|
|
|
CONFIG_GET_BOOL(video.disable_composition, "video_disable_composition");
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_BOOL(video.vsync, "video_vsync");
|
2013-02-16 02:21:43 +01:00
|
|
|
CONFIG_GET_BOOL(video.threaded, "video_threaded");
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_BOOL(video.smooth, "video_smooth");
|
|
|
|
CONFIG_GET_BOOL(video.force_aspect, "video_force_aspect");
|
2013-01-29 19:28:33 +01:00
|
|
|
CONFIG_GET_BOOL(video.scale_integer, "video_scale_integer");
|
2011-05-05 14:13:12 +02:00
|
|
|
CONFIG_GET_BOOL(video.crop_overscan, "video_crop_overscan");
|
2012-01-30 15:14:30 +01:00
|
|
|
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
2012-04-15 17:36:09 +02:00
|
|
|
CONFIG_GET_BOOL(video.aspect_ratio_auto, "video_aspect_ratio_auto");
|
2012-01-30 15:14:30 +01:00
|
|
|
CONFIG_GET_FLOAT(video.refresh_rate, "video_refresh_rate");
|
2010-12-29 19:00:21 +01:00
|
|
|
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(video.cg_shader_path, "video_cg_shader");
|
|
|
|
CONFIG_GET_PATH(video.bsnes_shader_path, "video_bsnes_shader");
|
|
|
|
CONFIG_GET_PATH(video.second_pass_shader, "video_second_pass_shader");
|
2011-03-06 18:19:31 +01:00
|
|
|
CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture");
|
2012-10-15 06:24:39 +02:00
|
|
|
CONFIG_GET_FLOAT(video.fbo.scale_x, "video_fbo_scale_x");
|
|
|
|
CONFIG_GET_FLOAT(video.fbo.scale_y, "video_fbo_scale_y");
|
2011-03-06 18:19:31 +01:00
|
|
|
CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth");
|
2012-04-01 16:12:04 +02:00
|
|
|
CONFIG_GET_BOOL(video.allow_rotate, "video_allow_rotate");
|
2011-01-23 02:48:06 +01:00
|
|
|
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(video.font_path, "video_font_path");
|
2013-01-11 21:04:51 +01:00
|
|
|
CONFIG_GET_FLOAT(video.font_size, "video_font_size");
|
2011-11-10 00:15:41 +01:00
|
|
|
CONFIG_GET_BOOL(video.font_enable, "video_font_enable");
|
2012-01-11 22:52:25 +01:00
|
|
|
CONFIG_GET_BOOL(video.font_scale, "video_font_scale");
|
2012-01-30 15:14:30 +01:00
|
|
|
CONFIG_GET_FLOAT(video.msg_pos_x, "video_message_pos_x");
|
|
|
|
CONFIG_GET_FLOAT(video.msg_pos_y, "video_message_pos_y");
|
2011-09-05 17:00:28 +02:00
|
|
|
|
2013-01-10 06:38:19 +01: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_INT(video.aspect_ratio_idx, "aspect_ratio_index");
|
|
|
|
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
|
|
|
|
2013-02-09 11:44:32 +01:00
|
|
|
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
2013-01-10 06:38:19 +01:00
|
|
|
{
|
|
|
|
char cfg[64];
|
|
|
|
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
|
|
|
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
|
|
|
|
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
|
|
|
CONFIG_GET_INT(input.device[i], cfg);
|
|
|
|
}
|
|
|
|
|
|
|
|
CONFIG_GET_BOOL_EXTERN(console.screen.gamma_correction, "gamma_correction");
|
2013-01-11 07:49:32 +01:00
|
|
|
|
|
|
|
bool msg_enable = false;
|
2013-01-11 19:44:13 +01:00
|
|
|
bool throttle_enable = false;
|
|
|
|
bool triple_buffering_enable = false;
|
|
|
|
bool custom_bgm_enable = false;
|
|
|
|
bool overscan_enable = false;
|
|
|
|
bool screenshots_enable = false;
|
|
|
|
bool flicker_filter_enable = false;
|
|
|
|
bool soft_filter_enable = false;
|
2013-01-13 04:12:10 +01:00
|
|
|
bool sram_dir_enable = false;
|
|
|
|
bool state_dir_enable = false;
|
2013-01-11 19:44:13 +01:00
|
|
|
|
2013-01-13 16:31:05 +01:00
|
|
|
if (config_get_path(conf, "default_rom_startup_dir", tmp_str, sizeof(tmp_str)))
|
|
|
|
strlcpy(g_extern.console.main_wrap.default_rom_startup_dir, tmp_str, sizeof(g_extern.console.main_wrap.default_rom_startup_dir));
|
2013-01-13 04:56:59 +01:00
|
|
|
|
2013-03-09 17:42:19 +01:00
|
|
|
#ifdef HAVE_RMENU
|
2013-02-01 09:13:29 +01:00
|
|
|
if (config_get_path(conf, "menu_texture_path", tmp_str, sizeof(tmp_str)))
|
|
|
|
strlcpy(g_extern.console.menu_texture_path, tmp_str, sizeof(g_extern.console.menu_texture_path));
|
2013-03-09 17:42:19 +01:00
|
|
|
#endif
|
2013-02-01 09:13:29 +01:00
|
|
|
|
2013-01-11 07:49:32 +01:00
|
|
|
if (config_get_bool(conf, "info_msg_enable", &msg_enable))
|
|
|
|
{
|
|
|
|
if (msg_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_INFO_DRAW);
|
2013-01-11 07:49:32 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_INFO_DRAW);
|
2013-01-11 07:49:32 +01:00
|
|
|
}
|
|
|
|
|
2013-01-11 19:44:13 +01:00
|
|
|
if (config_get_bool(conf, "throttle_enable", &throttle_enable))
|
|
|
|
{
|
|
|
|
if (throttle_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_THROTTLE_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_THROTTLE_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "triple_buffering_enable", &triple_buffering_enable))
|
|
|
|
{
|
|
|
|
if (triple_buffering_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "overscan_enable", &overscan_enable))
|
|
|
|
{
|
|
|
|
if (overscan_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_OVERSCAN_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_OVERSCAN_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "custom_bgm_enable", &custom_bgm_enable))
|
|
|
|
{
|
|
|
|
if (custom_bgm_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "screenshots_enable", &screenshots_enable))
|
|
|
|
{
|
|
|
|
if (screenshots_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SCREENSHOTS_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_SCREENSHOTS_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "flicker_filter_enable", &flicker_filter_enable))
|
|
|
|
{
|
|
|
|
if (flicker_filter_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "soft_filter_enable", &soft_filter_enable))
|
|
|
|
{
|
|
|
|
if (soft_filter_enable)
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
else
|
2013-01-12 03:13:03 +01:00
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
2013-01-11 19:44:13 +01:00
|
|
|
}
|
|
|
|
|
2013-01-13 04:12:10 +01:00
|
|
|
if (config_get_bool(conf, "sram_dir_enable", &sram_dir_enable))
|
|
|
|
{
|
|
|
|
if (sram_dir_enable)
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME_SRAM_DIR_ENABLE);
|
|
|
|
else
|
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_LOAD_GAME_SRAM_DIR_ENABLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config_get_bool(conf, "savestate_dir_enable", &state_dir_enable))
|
|
|
|
{
|
|
|
|
if (state_dir_enable)
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME_STATE_DIR_ENABLE);
|
|
|
|
else
|
|
|
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_LOAD_GAME_STATE_DIR_ENABLE);
|
|
|
|
}
|
|
|
|
|
2013-01-10 06:38:19 +01:00
|
|
|
CONFIG_GET_FLOAT_EXTERN(console.screen.overscan_amount, "overscan_amount");
|
2013-01-11 19:44:13 +01: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 06:38:19 +01:00
|
|
|
#ifdef _XBOX1
|
|
|
|
CONFIG_GET_INT_EXTERN(console.sound.volume_level, "sound_volume_level");
|
|
|
|
#endif
|
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.resolutions.current.id, "current_resolution_id");
|
|
|
|
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
|
|
|
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
|
|
|
|
CONFIG_GET_INT_EXTERN(console.screen.orientation, "screen_orientation");
|
|
|
|
CONFIG_GET_INT_EXTERN(console.sound.mode, "sound_mode");
|
|
|
|
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");
|
|
|
|
#endif
|
|
|
|
|
2013-01-06 01:32:36 +01:00
|
|
|
unsigned msg_color = 0;
|
2011-09-05 17:00:28 +02: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 02:59:44 +01:00
|
|
|
|
2011-08-11 05:25:31 +02:00
|
|
|
CONFIG_GET_BOOL(video.post_filter_record, "video_post_filter_record");
|
2012-08-25 22:38:49 +02:00
|
|
|
CONFIG_GET_BOOL(video.gpu_record, "video_gpu_record");
|
2012-08-26 21:18:00 +02:00
|
|
|
CONFIG_GET_BOOL(video.gpu_screenshot, "video_gpu_screenshot");
|
2011-08-11 05:25:31 +02:00
|
|
|
|
2011-05-11 17:52:16 +02:00
|
|
|
#ifdef HAVE_DYLIB
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(video.filter_path, "video_filter");
|
2010-12-30 01:33:40 +01:00
|
|
|
#endif
|
2010-12-29 19:00:21 +01:00
|
|
|
|
2011-08-25 16:15:34 +02:00
|
|
|
if (config_get_array(conf, "video_shader_type", tmp_str, sizeof(tmp_str)))
|
2011-02-28 16:59:31 +01:00
|
|
|
{
|
|
|
|
if (strcmp("cg", tmp_str) == 0)
|
2012-04-21 23:25:32 +02:00
|
|
|
g_settings.video.shader_type = RARCH_SHADER_CG;
|
2011-02-28 16:59:31 +01:00
|
|
|
else if (strcmp("bsnes", tmp_str) == 0)
|
2013-01-07 17:03:10 +01:00
|
|
|
g_settings.video.shader_type = RARCH_SHADER_GLSL;
|
2011-02-28 16:59:31 +01:00
|
|
|
else if (strcmp("auto", tmp_str) == 0)
|
2012-04-21 23:25:32 +02:00
|
|
|
g_settings.video.shader_type = RARCH_SHADER_AUTO;
|
2011-02-28 16:59:31 +01:00
|
|
|
else if (strcmp("none", tmp_str) == 0)
|
2012-04-21 23:25:32 +02:00
|
|
|
g_settings.video.shader_type = RARCH_SHADER_NONE;
|
2011-02-28 16:59:31 +01:00
|
|
|
}
|
|
|
|
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(video.shader_dir, "video_shader_dir");
|
2011-03-29 18:04:41 +02:00
|
|
|
|
2012-01-30 15:14:30 +01:00
|
|
|
CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold");
|
2011-02-20 12:12:53 +01:00
|
|
|
CONFIG_GET_BOOL(input.netplay_client_swap_input, "netplay_client_swap_input");
|
2012-02-02 21:02:36 +01:00
|
|
|
|
|
|
|
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
{
|
|
|
|
char buf[64];
|
2012-02-18 12:09:20 +01:00
|
|
|
snprintf(buf, sizeof(buf), "input_player%u_joypad_index", i + 1);
|
2012-02-02 21:02:36 +01:00
|
|
|
CONFIG_GET_INT(input.joypad_map[i], buf);
|
|
|
|
}
|
2011-01-10 16:53:37 +01:00
|
|
|
|
2010-12-29 19:00:21 +01:00
|
|
|
// Audio settings.
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_BOOL(audio.enable, "audio_enable");
|
|
|
|
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
|
2012-01-30 15:14:30 +01:00
|
|
|
CONFIG_GET_FLOAT(audio.rate_step, "audio_rate_step");
|
2011-02-01 17:13:26 +01: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 01:16:37 +01:00
|
|
|
CONFIG_GET_BOOL(audio.rate_control, "audio_rate_control");
|
|
|
|
CONFIG_GET_FLOAT(audio.rate_control_delta, "audio_rate_control_delta");
|
2012-11-03 14:15:03 +01:00
|
|
|
CONFIG_GET_FLOAT(audio.volume, "audio_volume");
|
2013-02-08 11:49:51 +01:00
|
|
|
CONFIG_GET_STRING(audio.resampler, "audio_resampler");
|
2010-12-29 19:00:21 +01:00
|
|
|
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_STRING(video.driver, "video_driver");
|
2013-02-23 14:49:49 +01:00
|
|
|
CONFIG_GET_STRING(video.gl_context, "video_gl_context");
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_STRING(audio.driver, "audio_driver");
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(audio.dsp_plugin, "audio_dsp_plugin");
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_STRING(input.driver, "input_driver");
|
2011-11-15 21:15:12 +01:00
|
|
|
|
2012-04-07 12:17:40 +02:00
|
|
|
if (!*g_settings.libretro)
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(libretro, "libretro_path");
|
2012-09-07 22:20:49 +02:00
|
|
|
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(screenshot_directory, "screenshot_directory");
|
2011-08-24 15:47:39 +02:00
|
|
|
if (*g_settings.screenshot_directory && !path_is_directory(g_settings.screenshot_directory))
|
|
|
|
{
|
2012-04-21 23:25:32 +02:00
|
|
|
RARCH_WARN("screenshot_directory is not an existing directory, ignoring ...\n");
|
2011-08-24 15:47:39 +02:00
|
|
|
*g_settings.screenshot_directory = '\0';
|
|
|
|
}
|
2011-01-31 18:06:57 +01:00
|
|
|
|
2011-02-01 17:13:26 +01:00
|
|
|
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
|
2011-02-05 11:31:35 +01:00
|
|
|
|
2012-03-28 23:32:29 +02:00
|
|
|
int buffer_size = 0;
|
2012-01-29 15:52:59 +01:00
|
|
|
if (config_get_int(conf, "rewind_buffer_size", &buffer_size))
|
|
|
|
g_settings.rewind_buffer_size = buffer_size * UINT64_C(1000000);
|
2011-02-05 11:31:35 +01:00
|
|
|
|
2011-02-01 17:30:18 +01:00
|
|
|
CONFIG_GET_INT(rewind_granularity, "rewind_granularity");
|
2012-03-04 12:01:07 +01:00
|
|
|
CONFIG_GET_FLOAT(slowmotion_ratio, "slowmotion_ratio");
|
|
|
|
if (g_settings.slowmotion_ratio < 1.0f)
|
|
|
|
g_settings.slowmotion_ratio = 1.0f;
|
2011-01-31 18:06:57 +01:00
|
|
|
|
2011-02-05 21:45:44 +01:00
|
|
|
CONFIG_GET_BOOL(pause_nonactive, "pause_nonactive");
|
2011-02-10 21:16:59 +01:00
|
|
|
CONFIG_GET_INT(autosave_interval, "autosave_interval");
|
2011-02-05 21:45:44 +01:00
|
|
|
|
2012-09-08 00:31:30 +02:00
|
|
|
CONFIG_GET_PATH(cheat_database, "cheat_database_path");
|
|
|
|
CONFIG_GET_PATH(cheat_settings_path, "cheat_settings_path");
|
2011-04-17 13:30:59 +02:00
|
|
|
|
2011-09-16 15:32:21 +02:00
|
|
|
CONFIG_GET_BOOL(block_sram_overwrite, "block_sram_overwrite");
|
2011-09-27 15:31:25 +02:00
|
|
|
CONFIG_GET_BOOL(savestate_auto_index, "savestate_auto_index");
|
2012-06-02 21:33:37 +02:00
|
|
|
CONFIG_GET_BOOL(savestate_auto_save, "savestate_auto_save");
|
2013-01-24 19:24:40 +01:00
|
|
|
CONFIG_GET_BOOL(savestate_auto_load, "savestate_auto_load");
|
2011-09-16 15:32:21 +02:00
|
|
|
|
2012-05-27 14:12:29 +02:00
|
|
|
CONFIG_GET_BOOL(network_cmd_enable, "network_cmd_enable");
|
|
|
|
CONFIG_GET_INT(network_cmd_port, "network_cmd_port");
|
2012-07-24 02:47:28 +02:00
|
|
|
CONFIG_GET_BOOL(stdin_cmd_enable, "stdin_cmd_enable");
|
2012-05-27 14:12:29 +02:00
|
|
|
|
2012-10-01 22:15:48 +02:00
|
|
|
CONFIG_GET_INT(input.turbo_period, "input_turbo_period");
|
|
|
|
CONFIG_GET_INT(input.turbo_duty_cycle, "input_duty_cycle");
|
|
|
|
|
2012-12-20 20:23:53 +01:00
|
|
|
CONFIG_GET_PATH(input.overlay, "input_overlay");
|
2013-02-01 20:29:33 -05:00
|
|
|
CONFIG_GET_FLOAT(input.overlay_opacity, "input_overlay_opacity");
|
2013-01-05 20:06:59 +01:00
|
|
|
CONFIG_GET_BOOL(input.debug_enable, "input_debug_enable");
|
2013-02-17 22:30:04 +01:00
|
|
|
|
2013-01-05 04:58:30 +01:00
|
|
|
#ifdef ANDROID
|
|
|
|
CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable");
|
2013-03-07 15:21:17 +01:00
|
|
|
CONFIG_GET_INT(input.back_behavior, "input_back_behavior");
|
2013-02-17 22:30:04 +01:00
|
|
|
CONFIG_GET_INT(input.icade_profile[0], "input_autodetect_icade_profile_pad1");
|
|
|
|
CONFIG_GET_INT(input.icade_profile[1], "input_autodetect_icade_profile_pad2");
|
|
|
|
CONFIG_GET_INT(input.icade_profile[2], "input_autodetect_icade_profile_pad3");
|
|
|
|
CONFIG_GET_INT(input.icade_profile[3], "input_autodetect_icade_profile_pad4");
|
2013-01-05 04:58:30 +01:00
|
|
|
#endif
|
2012-12-20 20:23:53 +01:00
|
|
|
|
2013-02-17 20:23:27 +01:00
|
|
|
int low_ram_mode = 0;
|
|
|
|
if (config_get_int(conf, "rmenu_low_ram_mode_enable", &low_ram_mode))
|
2013-02-17 22:01:08 +01:00
|
|
|
{
|
|
|
|
if (low_ram_mode == 1)
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
|
|
|
}
|
2013-02-17 20:23:27 +01:00
|
|
|
|
2012-02-06 15:51:35 +01:00
|
|
|
if (config_get_string(conf, "environment_variables",
|
|
|
|
&g_extern.system.environment))
|
|
|
|
{
|
|
|
|
g_extern.system.environment_split = strdup(g_extern.system.environment);
|
|
|
|
if (!g_extern.system.environment_split)
|
|
|
|
{
|
2012-04-21 23:25:32 +02:00
|
|
|
RARCH_ERR("Failed to allocate environment variables. Will ignore them.\n");
|
2012-02-06 15:51:35 +01:00
|
|
|
free(g_extern.system.environment);
|
|
|
|
g_extern.system.environment = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-08 00:31:30 +02:00
|
|
|
if (!g_extern.has_set_save_path && config_get_path(conf, "savefile_directory", tmp_str, sizeof(tmp_str)))
|
2011-08-24 15:47:39 +02:00
|
|
|
{
|
2012-09-08 00:31:30 +02:00
|
|
|
if (path_is_directory(tmp_str))
|
2011-08-24 15:47:39 +02:00
|
|
|
{
|
2012-09-08 00:31:30 +02:00
|
|
|
strlcpy(g_extern.savefile_name_srm, tmp_str, sizeof(g_extern.savefile_name_srm));
|
2011-08-24 15:47:39 +02:00
|
|
|
fill_pathname_dir(g_extern.savefile_name_srm, g_extern.basename, ".srm", sizeof(g_extern.savefile_name_srm));
|
|
|
|
}
|
|
|
|
else
|
2012-04-21 23:25:32 +02:00
|
|
|
RARCH_WARN("savefile_directory is not a directory, ignoring ....\n");
|
2011-08-24 15:47:39 +02:00
|
|
|
}
|
2012-06-12 00:28:34 +02:00
|
|
|
|
2012-09-08 00:31:30 +02:00
|
|
|
if (!g_extern.has_set_state_path && config_get_path(conf, "savestate_directory", tmp_str, sizeof(tmp_str)))
|
2011-08-24 15:47:39 +02:00
|
|
|
{
|
2012-09-08 00:31:30 +02:00
|
|
|
if (path_is_directory(tmp_str))
|
2011-08-24 15:47:39 +02:00
|
|
|
{
|
2012-09-08 00:31:30 +02:00
|
|
|
strlcpy(g_extern.savestate_name, tmp_str, sizeof(g_extern.savestate_name));
|
2011-08-24 15:47:39 +02:00
|
|
|
fill_pathname_dir(g_extern.savestate_name, g_extern.basename, ".state", sizeof(g_extern.savestate_name));
|
|
|
|
}
|
|
|
|
else
|
2012-04-21 23:25:32 +02:00
|
|
|
RARCH_WARN("savestate_directory is not a directory, ignoring ...\n");
|
2011-08-24 15:47:39 +02:00
|
|
|
}
|
|
|
|
|
2012-09-18 23:55:36 +02:00
|
|
|
if (!config_get_path(conf, "system_directory", g_settings.system_directory, sizeof(g_settings.system_directory)))
|
2012-09-18 23:48:50 +02: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-12 00:28:34 +02:00
|
|
|
|
2012-02-29 19:25:54 +01:00
|
|
|
config_read_keybinds_conf(conf);
|
2010-12-29 21:12:56 +01:00
|
|
|
|
2010-12-29 19:00:21 +01:00
|
|
|
config_file_free(conf);
|
2012-01-28 15:47:02 +01:00
|
|
|
return true;
|
2010-12-29 19:00:21 +01:00
|
|
|
}
|
2010-12-30 04:51:08 +01:00
|
|
|
|
|
|
|
struct bind_map
|
|
|
|
{
|
2012-01-30 01:20:35 +01:00
|
|
|
bool valid;
|
2010-12-30 04:51:08 +01:00
|
|
|
const char *key;
|
2010-12-30 05:30:47 +01:00
|
|
|
const char *btn;
|
|
|
|
const char *axis;
|
2012-07-07 17:19:32 +02:00
|
|
|
int retro_key;
|
2010-12-30 04:51:08 +01:00
|
|
|
};
|
|
|
|
|
2012-01-30 01:20:35 +01:00
|
|
|
#define DECLARE_BIND(x, bind) { true, "input_" #x, "input_" #x "_btn", "input_" #x "_axis", bind }
|
2011-11-30 17:25:44 +01:00
|
|
|
#define DECL_PLAYER(P) \
|
2012-06-28 17:57:50 +02:00
|
|
|
DECLARE_BIND(player##P##_b, RETRO_DEVICE_ID_JOYPAD_B), \
|
|
|
|
DECLARE_BIND(player##P##_y, RETRO_DEVICE_ID_JOYPAD_Y), \
|
|
|
|
DECLARE_BIND(player##P##_select, RETRO_DEVICE_ID_JOYPAD_SELECT), \
|
|
|
|
DECLARE_BIND(player##P##_start, RETRO_DEVICE_ID_JOYPAD_START), \
|
|
|
|
DECLARE_BIND(player##P##_up, RETRO_DEVICE_ID_JOYPAD_UP), \
|
|
|
|
DECLARE_BIND(player##P##_down, RETRO_DEVICE_ID_JOYPAD_DOWN), \
|
|
|
|
DECLARE_BIND(player##P##_left, RETRO_DEVICE_ID_JOYPAD_LEFT), \
|
|
|
|
DECLARE_BIND(player##P##_right, RETRO_DEVICE_ID_JOYPAD_RIGHT), \
|
|
|
|
DECLARE_BIND(player##P##_a, RETRO_DEVICE_ID_JOYPAD_A), \
|
|
|
|
DECLARE_BIND(player##P##_x, RETRO_DEVICE_ID_JOYPAD_X), \
|
|
|
|
DECLARE_BIND(player##P##_l, RETRO_DEVICE_ID_JOYPAD_L), \
|
|
|
|
DECLARE_BIND(player##P##_r, RETRO_DEVICE_ID_JOYPAD_R), \
|
|
|
|
DECLARE_BIND(player##P##_l2, RETRO_DEVICE_ID_JOYPAD_L2), \
|
|
|
|
DECLARE_BIND(player##P##_r2, RETRO_DEVICE_ID_JOYPAD_R2), \
|
|
|
|
DECLARE_BIND(player##P##_l3, RETRO_DEVICE_ID_JOYPAD_L3), \
|
|
|
|
DECLARE_BIND(player##P##_r3, RETRO_DEVICE_ID_JOYPAD_R3), \
|
2012-10-01 22:15:48 +02:00
|
|
|
DECLARE_BIND(player##P##_turbo, RARCH_TURBO_ENABLE), \
|
2012-06-28 17:57:50 +02:00
|
|
|
DECLARE_BIND(player##P##_l_x_plus, RARCH_ANALOG_LEFT_X_PLUS), \
|
|
|
|
DECLARE_BIND(player##P##_l_x_minus, RARCH_ANALOG_LEFT_X_MINUS), \
|
|
|
|
DECLARE_BIND(player##P##_l_y_plus, RARCH_ANALOG_LEFT_Y_PLUS), \
|
|
|
|
DECLARE_BIND(player##P##_l_y_minus, RARCH_ANALOG_LEFT_Y_MINUS), \
|
|
|
|
DECLARE_BIND(player##P##_r_x_plus, RARCH_ANALOG_RIGHT_X_PLUS), \
|
|
|
|
DECLARE_BIND(player##P##_r_x_minus, RARCH_ANALOG_RIGHT_X_MINUS), \
|
|
|
|
DECLARE_BIND(player##P##_r_y_plus, RARCH_ANALOG_RIGHT_Y_PLUS), \
|
|
|
|
DECLARE_BIND(player##P##_r_y_minus, RARCH_ANALOG_RIGHT_Y_MINUS)
|
2011-01-08 18:37:45 +01:00
|
|
|
|
2010-12-31 03:00:19 +01:00
|
|
|
// Big and nasty bind map... :)
|
2012-05-09 23:24:50 +02:00
|
|
|
static const struct bind_map bind_maps[MAX_PLAYERS][RARCH_BIND_LIST_END_NULL] = {
|
2011-01-10 16:53:37 +01:00
|
|
|
{
|
2012-06-28 17:57:50 +02:00
|
|
|
DECL_PLAYER(1),
|
2012-01-30 01:20:35 +01:00
|
|
|
|
2012-04-21 23:25:32 +02:00
|
|
|
DECLARE_BIND(toggle_fast_forward, RARCH_FAST_FORWARD_KEY),
|
|
|
|
DECLARE_BIND(hold_fast_forward, RARCH_FAST_FORWARD_HOLD_KEY),
|
|
|
|
DECLARE_BIND(load_state, RARCH_LOAD_STATE_KEY),
|
|
|
|
DECLARE_BIND(save_state, RARCH_SAVE_STATE_KEY),
|
|
|
|
DECLARE_BIND(toggle_fullscreen, RARCH_FULLSCREEN_TOGGLE_KEY),
|
|
|
|
DECLARE_BIND(exit_emulator, RARCH_QUIT_KEY),
|
|
|
|
DECLARE_BIND(state_slot_increase, RARCH_STATE_SLOT_PLUS),
|
|
|
|
DECLARE_BIND(state_slot_decrease, RARCH_STATE_SLOT_MINUS),
|
|
|
|
DECLARE_BIND(rewind, RARCH_REWIND),
|
|
|
|
DECLARE_BIND(movie_record_toggle, RARCH_MOVIE_RECORD_TOGGLE),
|
|
|
|
DECLARE_BIND(pause_toggle, RARCH_PAUSE_TOGGLE),
|
|
|
|
DECLARE_BIND(frame_advance, RARCH_FRAMEADVANCE),
|
|
|
|
DECLARE_BIND(reset, RARCH_RESET),
|
|
|
|
DECLARE_BIND(shader_next, RARCH_SHADER_NEXT),
|
|
|
|
DECLARE_BIND(shader_prev, RARCH_SHADER_PREV),
|
|
|
|
DECLARE_BIND(cheat_index_plus, RARCH_CHEAT_INDEX_PLUS),
|
|
|
|
DECLARE_BIND(cheat_index_minus, RARCH_CHEAT_INDEX_MINUS),
|
|
|
|
DECLARE_BIND(cheat_toggle, RARCH_CHEAT_TOGGLE),
|
|
|
|
DECLARE_BIND(screenshot, RARCH_SCREENSHOT),
|
|
|
|
DECLARE_BIND(dsp_config, RARCH_DSP_CONFIG),
|
|
|
|
DECLARE_BIND(audio_mute, RARCH_MUTE),
|
|
|
|
DECLARE_BIND(netplay_flip_players, RARCH_NETPLAY_FLIP),
|
|
|
|
DECLARE_BIND(slowmotion, RARCH_SLOWMOTION),
|
2012-11-02 23:24:53 +01:00
|
|
|
DECLARE_BIND(enable_hotkey, RARCH_ENABLE_HOTKEY),
|
2012-11-03 14:15:03 +01:00
|
|
|
DECLARE_BIND(volume_up, RARCH_VOLUME_UP),
|
|
|
|
DECLARE_BIND(volume_down, RARCH_VOLUME_DOWN),
|
2012-12-22 15:33:28 +01:00
|
|
|
DECLARE_BIND(overlay_next, RARCH_OVERLAY_NEXT),
|
2013-02-21 23:44:07 +01:00
|
|
|
DECLARE_BIND(disk_eject_toggle, RARCH_DISK_EJECT_TOGGLE),
|
|
|
|
DECLARE_BIND(disk_next, RARCH_DISK_NEXT),
|
2011-01-10 16:53:37 +01:00
|
|
|
},
|
2011-11-30 17:25:44 +01:00
|
|
|
|
2012-06-28 17:57:50 +02:00
|
|
|
{ DECL_PLAYER(2) },
|
|
|
|
{ DECL_PLAYER(3) },
|
|
|
|
{ DECL_PLAYER(4) },
|
|
|
|
{ DECL_PLAYER(5) },
|
|
|
|
{ DECL_PLAYER(6) },
|
|
|
|
{ DECL_PLAYER(7) },
|
|
|
|
{ DECL_PLAYER(8) },
|
2010-12-30 04:51:08 +01:00
|
|
|
};
|
|
|
|
|
2011-01-06 18:34:11 +01:00
|
|
|
struct key_map
|
2010-12-30 04:51:08 +01:00
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
int key;
|
|
|
|
};
|
|
|
|
|
2011-09-13 14:40:33 +02:00
|
|
|
static const struct key_map sk_map[] = {
|
2012-07-28 03:21:37 +02:00
|
|
|
{ "left", RETROK_LEFT },
|
|
|
|
{ "right", RETROK_RIGHT },
|
|
|
|
{ "up", RETROK_UP },
|
|
|
|
{ "down", RETROK_DOWN },
|
|
|
|
{ "enter", RETROK_RETURN },
|
|
|
|
{ "kp_enter", RETROK_KP_ENTER },
|
|
|
|
{ "tab", RETROK_TAB },
|
|
|
|
{ "insert", RETROK_INSERT },
|
|
|
|
{ "del", RETROK_DELETE },
|
|
|
|
{ "end", RETROK_END },
|
|
|
|
{ "home", RETROK_HOME },
|
|
|
|
{ "rshift", RETROK_RSHIFT },
|
|
|
|
{ "shift", RETROK_LSHIFT },
|
|
|
|
{ "ctrl", RETROK_LCTRL },
|
|
|
|
{ "alt", RETROK_LALT },
|
|
|
|
{ "space", RETROK_SPACE },
|
|
|
|
{ "escape", RETROK_ESCAPE },
|
|
|
|
{ "add", RETROK_KP_PLUS },
|
|
|
|
{ "subtract", RETROK_KP_MINUS },
|
|
|
|
{ "kp_plus", RETROK_KP_PLUS },
|
|
|
|
{ "kp_minus", RETROK_KP_MINUS },
|
|
|
|
{ "f1", RETROK_F1 },
|
|
|
|
{ "f2", RETROK_F2 },
|
|
|
|
{ "f3", RETROK_F3 },
|
|
|
|
{ "f4", RETROK_F4 },
|
|
|
|
{ "f5", RETROK_F5 },
|
|
|
|
{ "f6", RETROK_F6 },
|
|
|
|
{ "f7", RETROK_F7 },
|
|
|
|
{ "f8", RETROK_F8 },
|
|
|
|
{ "f9", RETROK_F9 },
|
|
|
|
{ "f10", RETROK_F10 },
|
|
|
|
{ "f11", RETROK_F11 },
|
|
|
|
{ "f12", RETROK_F12 },
|
|
|
|
{ "num0", RETROK_0 },
|
|
|
|
{ "num1", RETROK_1 },
|
|
|
|
{ "num2", RETROK_2 },
|
|
|
|
{ "num3", RETROK_3 },
|
|
|
|
{ "num4", RETROK_4 },
|
|
|
|
{ "num5", RETROK_5 },
|
|
|
|
{ "num6", RETROK_6 },
|
|
|
|
{ "num7", RETROK_7 },
|
|
|
|
{ "num8", RETROK_8 },
|
|
|
|
{ "num9", RETROK_9 },
|
|
|
|
{ "pageup", RETROK_PAGEUP },
|
|
|
|
{ "pagedown", RETROK_PAGEDOWN },
|
|
|
|
{ "keypad0", RETROK_KP0 },
|
|
|
|
{ "keypad1", RETROK_KP1 },
|
|
|
|
{ "keypad2", RETROK_KP2 },
|
|
|
|
{ "keypad3", RETROK_KP3 },
|
|
|
|
{ "keypad4", RETROK_KP4 },
|
|
|
|
{ "keypad5", RETROK_KP5 },
|
|
|
|
{ "keypad6", RETROK_KP6 },
|
|
|
|
{ "keypad7", RETROK_KP7 },
|
|
|
|
{ "keypad8", RETROK_KP8 },
|
|
|
|
{ "keypad9", RETROK_KP9 },
|
|
|
|
{ "period", RETROK_PERIOD },
|
|
|
|
{ "capslock", RETROK_CAPSLOCK },
|
|
|
|
{ "numlock", RETROK_NUMLOCK },
|
|
|
|
{ "backspace", RETROK_BACKSPACE },
|
|
|
|
{ "multiply", RETROK_KP_MULTIPLY },
|
|
|
|
{ "divide", RETROK_KP_DIVIDE },
|
|
|
|
{ "print_screen", RETROK_PRINT },
|
|
|
|
{ "scroll_lock", RETROK_SCROLLOCK },
|
|
|
|
{ "tilde", RETROK_BACKQUOTE },
|
|
|
|
{ "backquote", RETROK_BACKQUOTE },
|
|
|
|
{ "pause", RETROK_PAUSE },
|
|
|
|
{ "nul", RETROK_UNKNOWN },
|
2010-12-30 04:51:08 +01:00
|
|
|
};
|
|
|
|
|
2012-07-07 17:19:32 +02:00
|
|
|
static struct retro_keybind *find_retro_bind(unsigned port, int id)
|
2010-12-30 04:51:08 +01:00
|
|
|
{
|
2012-07-07 17:19:32 +02:00
|
|
|
struct retro_keybind *binds = g_settings.input.binds[port];
|
2012-01-30 01:20:35 +01:00
|
|
|
return binds[id].valid ? &binds[id] : NULL;
|
2010-12-30 04:51:08 +01:00
|
|
|
}
|
|
|
|
|
2011-09-13 14:40:33 +02:00
|
|
|
static int find_sk_bind(const char *str)
|
2010-12-30 04:51:08 +01:00
|
|
|
{
|
2012-10-26 23:15:34 +02:00
|
|
|
for (size_t i = 0; i < ARRAY_SIZE(sk_map); i++)
|
2010-12-30 04:51:08 +01:00
|
|
|
{
|
2011-09-13 14:40:33 +02:00
|
|
|
if (strcasecmp(sk_map[i].str, str) == 0)
|
|
|
|
return sk_map[i].key;
|
2010-12-30 04:51:08 +01:00
|
|
|
}
|
2012-01-30 01:20:35 +01:00
|
|
|
|
2010-12-30 04:51:08 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-09-13 14:40:33 +02:00
|
|
|
static int find_sk_key(const char *str)
|
2010-12-30 04:51:08 +01:00
|
|
|
{
|
2010-12-30 05:30:47 +01:00
|
|
|
if (strlen(str) == 1 && isalpha(*str))
|
2012-07-28 03:21:37 +02:00
|
|
|
return (int)RETROK_a + (tolower(*str) - (int)'a');
|
2012-01-30 01:20:35 +01:00
|
|
|
else
|
2011-09-13 14:40:33 +02:00
|
|
|
return find_sk_bind(str);
|
2010-12-30 05:30:47 +01:00
|
|
|
}
|
|
|
|
|
2012-07-07 17:19:32 +02:00
|
|
|
static void read_keybinds_keyboard(config_file_t *conf, unsigned player, unsigned index, struct retro_keybind *bind)
|
2012-01-30 01:20:35 +01:00
|
|
|
{
|
|
|
|
char tmp[64];
|
|
|
|
|
|
|
|
if (bind_maps[player][index].key &&
|
|
|
|
config_get_array(conf, bind_maps[player][index].key, tmp, sizeof(tmp)))
|
|
|
|
{
|
|
|
|
int key = find_sk_key(tmp);
|
|
|
|
|
|
|
|
if (key >= 0)
|
2012-07-28 03:21:37 +02:00
|
|
|
bind->key = (enum retro_key)key;
|
2012-01-30 01:20:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-07 17:19:32 +02:00
|
|
|
static void parse_hat(struct retro_keybind *bind, const char *str)
|
2012-01-30 01:20:35 +01:00
|
|
|
{
|
2012-02-18 13:00:14 +01:00
|
|
|
if (!isdigit(*str))
|
|
|
|
return;
|
2012-01-30 01:20:35 +01:00
|
|
|
|
2012-02-18 13:00:14 +01:00
|
|
|
char *dir = NULL;
|
|
|
|
uint16_t hat = strtoul(str, &dir, 0);
|
|
|
|
uint16_t hat_dir = 0;
|
|
|
|
|
|
|
|
if (!dir)
|
|
|
|
{
|
2012-04-21 23:25:32 +02:00
|
|
|
RARCH_WARN("Found invalid hat in config!\n");
|
2012-02-18 13:00:14 +01:00
|
|
|
return;
|
2012-01-30 01:20:35 +01:00
|
|
|
}
|
2012-02-18 13:00:14 +01:00
|
|
|
|
|
|
|
if (strcasecmp(dir, "up") == 0)
|
|
|
|
hat_dir = HAT_UP_MASK;
|
|
|
|
else if (strcasecmp(dir, "down") == 0)
|
|
|
|
hat_dir = HAT_DOWN_MASK;
|
|
|
|
else if (strcasecmp(dir, "left") == 0)
|
|
|
|
hat_dir = HAT_LEFT_MASK;
|
|
|
|
else if (strcasecmp(dir, "right") == 0)
|
|
|
|
hat_dir = HAT_RIGHT_MASK;
|
|
|
|
|
|
|
|
if (hat_dir)
|
|
|
|
bind->joykey = HAT_MAP(hat, hat_dir);
|
2012-01-30 01:20:35 +01:00
|
|
|
}
|
|
|
|
|
2012-07-07 17:19:32 +02:00
|
|
|
static void read_keybinds_button(config_file_t *conf, unsigned player, unsigned index, struct retro_keybind *bind)
|
2010-12-30 05:30:47 +01:00
|
|
|
{
|
2012-01-30 01:20:35 +01:00
|
|
|
char tmp[64];
|
|
|
|
if (bind_maps[player][index].btn &&
|
|
|
|
config_get_array(conf, bind_maps[player][index].btn, tmp, sizeof(tmp)))
|
|
|
|
{
|
|
|
|
const char *btn = tmp;
|
|
|
|
if (strcmp(btn, "nul") == 0)
|
|
|
|
bind->joykey = NO_BTN;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*btn == 'h')
|
|
|
|
parse_hat(bind, btn + 1);
|
|
|
|
else
|
2012-03-04 13:55:35 +01:00
|
|
|
bind->joykey = strtoull(tmp, NULL, 0);
|
2012-01-30 01:20:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-12-30 04:51:08 +01:00
|
|
|
|
2012-07-07 17:19:32 +02:00
|
|
|
static void read_keybinds_axis(config_file_t *conf, unsigned player, unsigned index, struct retro_keybind *bind)
|
2012-01-30 01:20:35 +01:00
|
|
|
{
|
|
|
|
char tmp[64];
|
|
|
|
if (bind_maps[player][index].axis &&
|
|
|
|
config_get_array(conf, bind_maps[player][index].axis, tmp, sizeof(tmp)))
|
2010-12-30 04:51:08 +01:00
|
|
|
{
|
2012-01-30 01:20:35 +01:00
|
|
|
if (strcmp(tmp, "nul") == 0)
|
|
|
|
bind->joyaxis = AXIS_NONE;
|
|
|
|
else if (strlen(tmp) >= 2 && (*tmp == '+' || *tmp == '-'))
|
2010-12-30 04:51:08 +01:00
|
|
|
{
|
2012-01-30 01:20:35 +01:00
|
|
|
int axis = strtol(tmp + 1, NULL, 0);
|
|
|
|
if (*tmp == '+')
|
|
|
|
bind->joyaxis = AXIS_POS(axis);
|
|
|
|
else
|
|
|
|
bind->joyaxis = AXIS_NEG(axis);
|
|
|
|
|
2010-12-30 04:51:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-01-30 01:20:35 +01:00
|
|
|
|
|
|
|
static void read_keybinds_player(config_file_t *conf, unsigned player)
|
|
|
|
{
|
|
|
|
for (unsigned i = 0; bind_maps[player][i].valid; i++)
|
|
|
|
{
|
2012-07-07 17:19:32 +02:00
|
|
|
struct retro_keybind *bind = find_retro_bind(player, bind_maps[player][i].retro_key);
|
2012-04-21 23:25:32 +02:00
|
|
|
rarch_assert(bind);
|
2012-01-30 01:20:35 +01: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 19:25:54 +01:00
|
|
|
static void config_read_keybinds_conf(config_file_t *conf)
|
2012-01-30 01:20:35 +01:00
|
|
|
{
|
|
|
|
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
read_keybinds_player(conf, i);
|
|
|
|
}
|
|
|
|
|
2012-02-29 19:25:54 +01: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;
|
|
|
|
}
|
|
|
|
|
2012-02-20 20:36:21 +01:00
|
|
|
static void save_keybind_key(config_file_t *conf,
|
2012-07-07 17:19:32 +02:00
|
|
|
const struct bind_map *map, const struct retro_keybind *bind)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
char ascii[2] = {0};
|
|
|
|
const char *btn = ascii;
|
|
|
|
|
2012-07-28 03:21:37 +02:00
|
|
|
if (bind->key >= RETROK_a && bind->key <= RETROK_z)
|
|
|
|
ascii[0] = 'a' + (bind->key - RETROK_a);
|
2012-02-20 20:36:21 +01:00
|
|
|
else
|
|
|
|
{
|
2012-10-26 23:15:34 +02:00
|
|
|
for (unsigned i = 0; i < ARRAY_SIZE(sk_map); i++)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
if (sk_map[i].key == bind->key)
|
|
|
|
{
|
|
|
|
btn = sk_map[i].str;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
config_set_string(conf, map->key, btn);
|
|
|
|
}
|
|
|
|
|
2012-04-21 23:25:32 +02:00
|
|
|
#ifndef RARCH_CONSOLE
|
2012-02-20 20:36:21 +01:00
|
|
|
static void save_keybind_hat(config_file_t *conf,
|
2012-07-07 17:19:32 +02:00
|
|
|
const struct bind_map *map, const struct retro_keybind *bind)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
unsigned hat = GET_HAT(bind->joykey);
|
|
|
|
const char *dir = NULL;
|
|
|
|
|
|
|
|
switch (GET_HAT_DIR(hat))
|
|
|
|
{
|
|
|
|
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 23:25:32 +02:00
|
|
|
rarch_assert(0);
|
2012-02-20 20:36:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char config[16];
|
|
|
|
snprintf(config, sizeof(config), "h%u%s", hat, dir);
|
|
|
|
config_set_string(conf, map->btn, config);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void save_keybind_joykey(config_file_t *conf,
|
2012-07-07 17:19:32 +02:00
|
|
|
const struct bind_map *map, const struct retro_keybind *bind)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
if (bind->joykey == NO_BTN)
|
|
|
|
config_set_string(conf, map->btn, "nul");
|
2012-04-21 23:25:32 +02:00
|
|
|
#ifndef RARCH_CONSOLE // Consoles don't understand hats.
|
2012-02-20 20:36:21 +01:00
|
|
|
else if (GET_HAT_DIR(bind->joykey))
|
|
|
|
save_keybind_hat(conf, map, bind);
|
|
|
|
#endif
|
|
|
|
else
|
2012-03-04 13:55:35 +01:00
|
|
|
config_set_uint64(conf, map->btn, bind->joykey);
|
2012-02-20 20:36:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void save_keybind_axis(config_file_t *conf,
|
2012-07-07 17:19:32 +02:00
|
|
|
const struct bind_map *map, const struct retro_keybind *bind)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
unsigned axis = 0;
|
|
|
|
char dir = '\0';
|
|
|
|
|
|
|
|
if (bind->joyaxis == AXIS_NONE)
|
|
|
|
config_set_string(conf, map->axis, "nul");
|
2012-03-09 18:17:53 +01:00
|
|
|
else if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
dir = '-';
|
|
|
|
axis = AXIS_NEG_GET(bind->joyaxis);
|
|
|
|
}
|
2012-03-09 18:17:53 +01:00
|
|
|
else if (AXIS_POS_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
dir = '+';
|
|
|
|
axis = AXIS_POS_GET(bind->joyaxis);
|
|
|
|
}
|
|
|
|
|
|
|
|
char config[16];
|
|
|
|
snprintf(config, sizeof(config), "%c%u", dir, axis);
|
|
|
|
config_set_string(conf, map->axis, config);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void save_keybind(config_file_t *conf,
|
2012-07-07 17:19:32 +02:00
|
|
|
const struct bind_map *map, const struct retro_keybind *bind)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
|
|
|
if (!map->valid)
|
|
|
|
return;
|
|
|
|
|
|
|
|
save_keybind_key(conf, map, bind);
|
|
|
|
save_keybind_joykey(conf, map, bind);
|
|
|
|
save_keybind_axis(conf, map, bind);
|
2013-01-05 22:18:59 +01:00
|
|
|
#ifdef RARCH_CONSOLE
|
|
|
|
#endif
|
2012-02-20 20:36:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void save_keybinds_player(config_file_t *conf, unsigned i)
|
|
|
|
{
|
2012-04-21 23:25:32 +02:00
|
|
|
for (unsigned j = 0; j < RARCH_BIND_LIST_END; j++)
|
2012-02-20 20:36:21 +01:00
|
|
|
save_keybind(conf, &bind_maps[i][j], &g_settings.input.binds[i][j]);
|
|
|
|
}
|
|
|
|
|
2013-01-05 22:18:59 +01:00
|
|
|
#ifdef RARCH_CONSOLE
|
|
|
|
bool config_save_file(const char *path)
|
|
|
|
{
|
|
|
|
config_file_t *conf = config_file_new(path);
|
|
|
|
if (!conf)
|
|
|
|
conf = config_file_new(NULL);
|
|
|
|
if (!conf)
|
|
|
|
return false;
|
|
|
|
|
2013-01-10 07:12:37 +01:00
|
|
|
RARCH_LOG("Saving config at path: \"%s\"\n", path);
|
2013-01-10 07:11:37 +01:00
|
|
|
|
2013-01-05 22:18:59 +01:00
|
|
|
config_set_string(conf, "libretro_path", g_settings.libretro);
|
|
|
|
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
|
|
|
|
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
2013-01-19 08:54:03 +01:00
|
|
|
config_set_int(conf, "rewind_granularity", g_settings.rewind_granularity);
|
2013-01-05 22:18:59 +01:00
|
|
|
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
|
|
|
|
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
|
|
|
#ifdef HAVE_FBO
|
|
|
|
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo.scale_x);
|
|
|
|
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo.scale_y);
|
|
|
|
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
|
|
|
|
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
|
|
|
|
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
|
|
|
|
#endif
|
|
|
|
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
|
|
|
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
|
|
|
config_set_int(conf, "aspect_ratio_index", g_settings.video.aspect_ratio_idx);
|
|
|
|
config_set_string(conf, "audio_device", g_settings.audio.device);
|
|
|
|
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);
|
|
|
|
config_set_string(conf, "system_directory", g_settings.system_directory);
|
2013-02-08 13:55:58 +01:00
|
|
|
config_set_string(conf, "audio_resampler", g_settings.audio.resampler);
|
2013-01-05 22:18:59 +01:00
|
|
|
|
2013-02-09 11:44:32 +01:00
|
|
|
#ifdef ANDROID
|
2013-03-07 15:21:17 +01:00
|
|
|
config_set_int(conf, "input_back_behavior", input.back_behavior);
|
2013-02-09 11:44:32 +01:00
|
|
|
config_set_int(conf, "input_autodetect_icade_profile_pad1", input.icade_profile[0]);
|
|
|
|
config_set_int(conf, "input_autodetect_icade_profile_pad2", input.icade_profile[1]);
|
|
|
|
config_set_int(conf, "input_autodetect_icade_profile_pad3", input.icade_profile[2]);
|
|
|
|
config_set_int(conf, "input_autodetect_icade_profile_pad4", input.icade_profile[3]);
|
|
|
|
#endif
|
|
|
|
|
2013-02-17 20:23:27 +01:00
|
|
|
#ifdef HAVE_RMENU
|
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE))
|
|
|
|
config_set_int(conf, "rmenu_low_ram_mode_enable", 1);
|
2013-02-17 22:01:08 +01:00
|
|
|
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING))
|
|
|
|
config_set_int(conf, "rmenu_low_ram_mode_enable", 1);
|
2013-02-17 20:23:27 +01:00
|
|
|
else
|
|
|
|
config_set_int(conf, "rmenu_low_ram_mode_enable", 0);
|
|
|
|
#endif
|
|
|
|
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_OVERSCAN_ENABLE))
|
2013-01-11 19:44:13 +01:00
|
|
|
config_set_bool(conf, "overscan_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "overscan_enable", false);
|
|
|
|
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_SCREENSHOTS_ENABLE))
|
2013-01-11 19:44:13 +01:00
|
|
|
config_set_bool(conf, "screenshots_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "screenshots_enable", false);
|
|
|
|
|
2013-01-05 22:18:59 +01:00
|
|
|
config_set_bool(conf, "gamma_correction", g_extern.console.screen.gamma_correction);
|
|
|
|
#ifdef _XBOX1
|
|
|
|
config_set_int(conf, "sound_volume_level", g_extern.console.sound.volume_level);
|
|
|
|
#endif
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_THROTTLE_ENABLE))
|
2013-01-11 19:44:13 +01:00
|
|
|
config_set_bool(conf, "throttle_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "throttle_enable", false);
|
|
|
|
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE))
|
2013-01-11 19:44:13 +01:00
|
|
|
config_set_bool(conf, "triple_buffering_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "triple_buffering_enable", false);
|
2013-01-11 07:49:32 +01:00
|
|
|
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW))
|
2013-01-11 07:49:32 +01:00
|
|
|
config_set_bool(conf, "info_msg_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "info_msg_enable", false);
|
|
|
|
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE))
|
2013-01-11 19:44:13 +01:00
|
|
|
config_set_bool(conf, "soft_filter_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "soft_filter_enable", false);
|
|
|
|
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE))
|
2013-01-11 19:44:13 +01:00
|
|
|
config_set_bool(conf, "flicker_filter_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "flicker_filter_enable", false);
|
|
|
|
|
|
|
|
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 22:18:59 +01: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-01-13 04:12:10 +01:00
|
|
|
config_set_string(conf, "default_rom_startup_dir", g_extern.console.main_wrap.default_rom_startup_dir);
|
2013-03-09 17:42:19 +01:00
|
|
|
#ifdef HAVE_RMENU
|
2013-02-01 09:13:29 +01:00
|
|
|
config_set_string(conf, "menu_texture_path", g_extern.console.menu_texture_path);
|
2013-03-09 17:42:19 +01:00
|
|
|
#endif
|
2013-01-05 22:18:59 +01:00
|
|
|
config_set_float(conf, "overscan_amount", g_extern.console.screen.overscan_amount);
|
2013-01-11 21:04:51 +01:00
|
|
|
config_set_float(conf, "video_font_size", g_settings.video.font_size);
|
|
|
|
|
2013-01-05 22:18:59 +01:00
|
|
|
// g_extern
|
|
|
|
config_set_int(conf, "sound_mode", g_extern.console.sound.mode);
|
|
|
|
config_set_int(conf, "state_slot", g_extern.state_slot);
|
|
|
|
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
|
|
|
config_set_int(conf, "screen_orientation", g_extern.console.screen.orientation);
|
2013-01-11 19:44:13 +01:00
|
|
|
|
2013-01-12 03:13:03 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE))
|
2013-01-11 19:44:13 +01:00
|
|
|
config_set_bool(conf, "custom_bgm_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "custom_bgm_enable", false);
|
2013-01-05 22:18:59 +01:00
|
|
|
|
2013-01-13 04:12:10 +01:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_LOAD_GAME_SRAM_DIR_ENABLE))
|
|
|
|
config_set_bool(conf, "sram_dir_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "sram_dir_enable", false);
|
|
|
|
|
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_LOAD_GAME_STATE_DIR_ENABLE))
|
|
|
|
config_set_bool(conf, "savestate_dir_enable", true);
|
|
|
|
else
|
|
|
|
config_set_bool(conf, "savestate_dir_enable", false);
|
2013-01-05 22:18:59 +01:00
|
|
|
|
|
|
|
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
{
|
|
|
|
char cfg[64];
|
|
|
|
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
|
|
|
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
|
|
|
|
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
|
|
|
config_set_int(conf, cfg, g_settings.input.device[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
config_file_write(conf, path);
|
|
|
|
config_file_free(conf);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-02-29 19:07:25 +01:00
|
|
|
bool config_save_keybinds(const char *path)
|
2012-02-20 20:36:21 +01:00
|
|
|
{
|
2012-02-29 19:07:25 +01:00
|
|
|
config_file_t *conf = config_file_new(path);
|
|
|
|
if (!conf)
|
|
|
|
conf = config_file_new(NULL);
|
|
|
|
if (!conf)
|
|
|
|
return NULL;
|
|
|
|
|
2012-02-20 20:36:21 +01:00
|
|
|
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
save_keybinds_player(conf, i);
|
2012-02-29 19:07:25 +01:00
|
|
|
|
|
|
|
config_file_write(conf, path);
|
|
|
|
config_file_free(conf);
|
|
|
|
return true;
|
2012-02-20 20:36:21 +01:00
|
|
|
}
|
|
|
|
|