RetroArch/configuration.h

686 lines
15 KiB
C
Raw Normal View History

2015-01-09 10:56:21 -05:00
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2016-01-09 22:06:50 -05:00
* Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2014-2016 - Jean-André Santoni
2016-10-27 11:47:10 -04:00
* Copyright (C) 2016 - Brad Parker
*
2015-01-09 10:56:21 -05:00
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RARCH_CONFIGURATION_H__
#define __RARCH_CONFIGURATION_H__
2015-01-09 10:56:21 -05:00
2015-03-21 02:05:08 -04:00
#include <stdint.h>
2015-12-05 01:45:36 -05:00
2015-12-06 07:12:27 -05:00
#include <boolean.h>
#include <retro_common_api.h>
2015-12-05 01:45:36 -05:00
2016-09-11 12:05:39 -04:00
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
2015-12-05 01:45:36 -05:00
#include "gfx/video_driver.h"
2016-09-05 11:29:19 -04:00
#include "input/input_defines.h"
2015-03-21 02:05:08 -04:00
2016-08-31 09:21:12 -04:00
enum override_type
{
OVERRIDE_NONE = 0,
OVERRIDE_CORE,
OVERRIDE_GAME
};
2016-08-26 01:44:05 -04:00
RETRO_BEGIN_DECLS
2015-01-09 10:56:21 -05:00
2015-03-20 14:32:46 -04:00
typedef struct settings
{
2017-04-27 18:00:43 -04:00
struct
{
bool placeholder;
2017-04-27 18:53:06 -04:00
2017-04-28 07:43:47 -04:00
/* Video */
2017-04-27 18:53:06 -04:00
bool video_fullscreen;
bool video_windowed_fullscreen;
bool video_vsync;
bool video_hard_sync;
bool video_black_frame_insertion;
#ifdef GEKKO
bool video_vfilter;
#endif
bool video_smooth;
bool video_force_aspect;
bool video_crop_overscan;
bool video_aspect_ratio_auto;
bool video_scale_integer;
bool video_shader_enable;
bool video_threaded;
bool video_font_enable;
bool video_disable_composition;
bool video_post_filter_record;
bool video_gpu_record;
bool video_gpu_screenshot;
bool video_allow_rotate;
bool video_shared_context;
bool video_force_srgb_disable;
2017-04-28 06:26:01 -04:00
bool video_fps_show;
2017-04-27 18:53:06 -04:00
2017-04-28 07:43:47 -04:00
/* Audio */
2017-04-28 06:23:59 -04:00
bool audio_enable;
bool audio_mute_enable;
bool audio_sync;
bool audio_rate_control;
#ifdef HAVE_WASAPI
bool audio_wasapi_exclusive_mode;
bool audio_wasapi_float_format;
#endif
2017-04-28 07:43:47 -04:00
/* Input */
bool input_swap_override;
bool input_remap_binds_enable;
bool input_autodetect_enable;
bool input_overlay_enable;
bool input_overlay_enable_autopreferred;
bool input_overlay_hide_in_menu;
bool input_descriptor_label_show;
bool input_descriptor_hide_unbound;
bool input_all_users_control_menu;
bool input_menu_swap_ok_cancel_buttons;
#if defined(VITA)
bool input_backtouch_enable;
bool input_backtouch_toggle;
#endif
#if TARGET_OS_IPHONE
bool input_small_keyboard_enable;
#endif
bool input_keyboard_gamepad_enable;
#ifdef HAVE_MENU
/* Menu */
bool menu_show_start_screen;
bool menu_pause_libretro;
bool menu_timedate_enable;
bool menu_battery_level_enable;
bool menu_core_enable;
bool menu_dynamic_wallpaper_enable;
bool menu_throttle;
bool menu_mouse_enable;
bool menu_pointer_enable;
bool menu_navigation_wraparound_enable;
bool menu_navigation_browser_filter_supported_extensions_enable;
bool menu_dpi_override_enable;
bool menu_show_advanced_settings;
bool menu_throttle_framerate;
bool menu_linear_filter;
bool menu_xmb_shadows_enable;
bool menu_xmb_show_settings;
bool menu_xmb_show_images;
bool menu_xmb_show_music;
bool menu_xmb_show_video;
bool menu_xmb_show_netplay;
bool menu_xmb_show_history;
bool menu_xmb_show_add;
bool menu_unified_controls;
#endif
#ifdef HAVE_NETWORKING
/* Netplay */
bool netplay_public_announce;
bool netplay_start_as_spectator;
bool netplay_allow_slaves;
bool netplay_require_slaves;
bool netplay_stateless_mode;
bool netplay_swap_input;
bool netplay_nat_traversal;
bool netplay_use_mitm_server;
#endif
/* Network */
bool network_buildbot_auto_extract_archive;
/* UI */
2017-04-27 18:53:06 -04:00
bool ui_menubar_enable;
bool ui_suspend_screensaver_enable;
bool ui_companion_start_on_boot;
bool ui_companion_enable;
2017-04-28 07:43:47 -04:00
#ifdef HAVE_CHEEVOS
/* Cheevos */
bool cheevos_enable;
bool cheevos_test_unofficial;
bool cheevos_hardcore_mode_enable;
#endif
/* Camera */
bool camera_allow;
/* WiFi */
bool wifi_allow;
/* Location */
bool location_allow;
/* Multimedia */
bool multimedia_builtin_mediaplayer_enable;
bool multimedia_builtin_imageviewer_enable;
/* Bundle */
bool bundle_finished;
bool bundle_assets_extract_enable;
/* Misc. */
#ifdef HAVE_THREADS
bool threaded_data_runloop_enable;
#endif
bool set_supports_no_game_enable;
bool auto_screenshot_filename;
bool history_list_enable;
bool playlist_entry_remove;
bool rewind_enable;
bool pause_nonactive;
bool block_sram_overwrite;
bool savestate_auto_index;
bool savestate_auto_save;
bool savestate_auto_load;
bool savestate_thumbnail_enable;
bool network_cmd_enable;
bool stdin_cmd_enable;
bool network_remote_enable;
bool network_remote_enable_user[MAX_USERS];
bool load_dummy_on_core_shutdown;
bool check_firmware_before_loading;
bool game_specific_options;
bool auto_overrides_enable;
bool auto_remaps_enable;
bool auto_shaders_enable;
bool sort_savefiles_enable;
bool sort_savestates_enable;
bool config_save_on_exit;
bool show_hidden_files;
#ifdef HAVE_LAKKA
bool ssh_enable;
bool samba_enable;
bool bluetooth_enable;
#endif
2017-04-27 18:00:43 -04:00
} bools;
bool modified;
video_viewport_t video_viewport_custom;
char playlist_names[PATH_MAX_LENGTH];
char playlist_cores[PATH_MAX_LENGTH];
struct
{
char driver[32];
char context_driver[32];
float scale;
2016-11-23 19:43:50 -05:00
unsigned window_x;
unsigned window_y;
unsigned monitor_index;
unsigned fullscreen_x;
unsigned fullscreen_y;
unsigned max_swapchain_images;
unsigned swap_interval;
unsigned hard_sync_frames;
unsigned frame_delay;
#ifdef GEKKO
unsigned viwidth;
#endif
float aspect_ratio;
unsigned aspect_ratio_idx;
unsigned rotation;
float refresh_rate;
float font_size;
float msg_pos_x;
float msg_pos_y;
float msg_color_r;
float msg_color_g;
float msg_color_b;
} video;
2015-04-15 07:37:38 -04:00
struct
{
char driver[32];
} record;
#ifdef HAVE_MENU
struct
{
char driver[32];
2017-04-28 07:43:47 -04:00
2016-04-07 14:42:53 -04:00
unsigned thumbnails;
2016-07-09 09:13:06 -04:00
struct
{
float opacity;
} wallpaper;
2016-07-11 11:27:36 -04:00
struct
{
float opacity;
} footer;
2016-07-11 11:41:06 -04:00
struct
{
float opacity;
} header;
struct
{
2015-04-24 10:37:09 -04:00
unsigned override_value;
} dpi;
unsigned entry_normal_color;
unsigned entry_hover_color;
unsigned title_color;
2016-07-09 07:05:58 -04:00
struct
{
unsigned shader_pipeline;
char font[PATH_MAX_LENGTH];
unsigned scale_factor;
unsigned alpha_factor;
unsigned theme;
unsigned menu_color_theme;
} xmb;
struct
{
unsigned menu_color_theme;
} materialui;
2016-12-10 19:29:53 -05:00
} menu;
#endif
2015-10-27 19:55:11 -04:00
struct
{
char driver[32];
2016-10-27 03:32:07 -04:00
char device[255];
unsigned width;
unsigned height;
} camera;
2016-09-21 10:06:14 -04:00
struct
{
char driver[32];
} wifi;
struct
{
char driver[32];
int update_interval_ms;
int update_interval_distance;
} location;
struct
{
char driver[32];
2016-04-28 14:49:13 -04:00
char resampler[32];
2016-10-27 03:32:07 -04:00
char device[255];
unsigned out_rate;
unsigned block_frames;
unsigned latency;
float rate_control_delta;
float max_timing_skew;
float volume; /* dB scale. */
#ifdef HAVE_WASAPI
struct
{
2017-04-24 23:09:57 -04:00
unsigned sh_buffer_length; /* in frames (0 disables buffering) */
} wasapi;
#endif
} audio;
struct
{
char driver[32];
char joypad_driver[32];
char keyboard_layout[64];
unsigned remap_ids[MAX_USERS][RARCH_BIND_LIST_END];
unsigned max_users;
2017-04-28 07:43:47 -04:00
/* Set by autoconfiguration in joypad_autoconfig_dir.
* Does not override main binds. */
unsigned libretro_device[MAX_USERS];
2016-12-07 00:16:12 -05:00
unsigned analog_dpad_mode[MAX_USERS];
float axis_threshold;
unsigned joypad_map[MAX_USERS];
unsigned device[MAX_USERS];
unsigned turbo_period;
unsigned turbo_duty_cycle;
float overlay_opacity;
float overlay_scale;
2016-06-26 02:22:40 -04:00
unsigned bind_timeout;
2015-07-09 00:27:17 -04:00
unsigned menu_toggle_gamepad_combo;
unsigned keyboard_gamepad_mapping_type;
2016-01-26 19:29:53 -05:00
unsigned poll_type_behavior;
} input;
struct
{
unsigned mode;
} archive;
struct
{
2016-10-27 04:33:50 -04:00
char buildbot_url[255];
char buildbot_assets_url[255];
} network;
#ifdef HAVE_CHEEVOS
struct
{
2015-10-18 16:08:17 -04:00
char username[32];
char password[32];
} cheevos;
#endif
2016-12-26 00:39:12 -05:00
char browse_url[4096];
int state_slot;
unsigned bundle_assets_extract_version_current;
unsigned bundle_assets_extract_last_version;
2016-04-28 13:52:25 -04:00
struct
{
2016-04-28 14:49:13 -04:00
char cheat_database[PATH_MAX_LENGTH];
char content_database[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char menu_wallpaper[PATH_MAX_LENGTH];
char audio_dsp_plugin[PATH_MAX_LENGTH];
char softfilter_plugin[PATH_MAX_LENGTH];
2016-04-28 13:52:25 -04:00
char core_options[PATH_MAX_LENGTH];
char content_history[PATH_MAX_LENGTH];
char content_music_history[PATH_MAX_LENGTH];
char content_image_history[PATH_MAX_LENGTH];
char content_video_history[PATH_MAX_LENGTH];
2016-04-28 13:52:25 -04:00
char libretro_info[PATH_MAX_LENGTH];
char cheat_settings[PATH_MAX_LENGTH];
char bundle_assets_src[PATH_MAX_LENGTH];
char bundle_assets_dst[PATH_MAX_LENGTH];
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
char shader[PATH_MAX_LENGTH];
char font[PATH_MAX_LENGTH];
} path;
2016-04-28 13:26:02 -04:00
struct
{
2016-04-28 14:49:13 -04:00
char audio_filter[PATH_MAX_LENGTH];
char autoconfig[PATH_MAX_LENGTH];
char video_filter[PATH_MAX_LENGTH];
char video_shader[PATH_MAX_LENGTH];
2016-04-28 13:26:02 -04:00
char content_history[PATH_MAX_LENGTH];
char libretro[PATH_MAX_LENGTH];
char cursor[PATH_MAX_LENGTH];
char input_remapping[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char resampler[PATH_MAX_LENGTH];
char screenshot[PATH_MAX_LENGTH];
char system[PATH_MAX_LENGTH];
char cache[PATH_MAX_LENGTH];
char playlist[PATH_MAX_LENGTH];
char core_assets[PATH_MAX_LENGTH];
char assets[PATH_MAX_LENGTH];
char dynamic_wallpapers[PATH_MAX_LENGTH];
char thumbnails[PATH_MAX_LENGTH];
char menu_config[PATH_MAX_LENGTH];
char menu_content[PATH_MAX_LENGTH];
} directory;
#ifdef HAVE_NETWORKING
struct
{
2016-10-27 03:32:07 -04:00
char server[255];
unsigned port;
int check_frames;
unsigned input_latency_frames_min;
unsigned input_latency_frames_range;
char password[128];
char spectate_password[128];
} netplay;
#endif
unsigned content_history_size;
unsigned libretro_log_level;
size_t rewind_buffer_size;
unsigned rewind_granularity;
float slowmotion_ratio;
float fastforward_ratio;
unsigned autosave_interval;
2015-06-03 12:07:29 -04:00
unsigned network_cmd_port;
unsigned network_remote_base_port;
char username[32];
2016-06-07 00:05:41 -04:00
#ifdef HAVE_LANGEXTRA
unsigned int user_language;
2016-06-07 00:05:41 -04:00
#endif
2015-03-20 14:32:46 -04:00
} settings_t;
2017-04-23 11:36:25 -04:00
#define configuration_set_float(settings, var, newvar) \
settings->modified = true; \
var = newvar
2017-04-23 07:32:16 -04:00
#define configuration_set_bool(settings, var, newvar) \
settings->modified = true; \
var = newvar
2017-04-25 09:31:32 -04:00
#define configuration_set_uint(settings, var, newvar) \
settings->modified = true; \
var = newvar
#define configuration_set_int(settings, var, newvar) \
settings->modified = true; \
var = newvar
2015-01-10 23:29:32 -05:00
/**
* config_get_default_camera:
*
* Gets default camera driver.
*
* Returns: Default camera driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_camera(void);
/**
* config_get_default_wifi:
*
* Gets default wifi driver.
*
* Returns: Default wifi driver.
**/
const char *config_get_default_wifi(void);
2015-01-10 23:29:32 -05:00
/**
* config_get_default_location:
*
* Gets default location driver.
*
* Returns: Default location driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_location(void);
2015-01-10 23:29:32 -05:00
/**
* config_get_default_video:
*
* Gets default video driver.
*
* Returns: Default video driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_video(void);
2015-01-10 23:29:32 -05:00
/**
* config_get_default_audio:
*
* Gets default audio driver.
*
* Returns: Default audio driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_audio(void);
2015-01-10 23:29:32 -05:00
/**
* config_get_default_audio_resampler:
*
* Gets default audio resampler driver.
*
* Returns: Default audio resampler driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_audio_resampler(void);
2015-01-10 23:29:32 -05:00
/**
* config_get_default_input:
*
* Gets default input driver.
*
* Returns: Default input driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_input(void);
2015-01-10 23:29:32 -05:00
/**
* config_get_default_joypad:
*
* Gets default input joypad driver.
*
* Returns: Default input joypad driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_joypad(void);
#ifdef HAVE_MENU
2015-01-10 23:29:32 -05:00
/**
* config_get_default_menu:
*
* Gets default menu driver.
*
* Returns: Default menu driver.
**/
2015-01-09 10:56:21 -05:00
const char *config_get_default_menu(void);
#endif
2015-04-15 07:37:38 -04:00
const char *config_get_default_record(void);
2015-01-09 10:56:21 -05:00
/**
* config_load:
*
* Loads a config file and reads all the values into memory.
*
*/
void config_load(void);
/**
* config_load_override:
*
* Tries to append game-specific and core-specific configuration.
* These settings will always have precedence, thus this feature
* can be used to enforce overrides.
*
* Returns: false if there was an error or no action was performed.
*
*/
bool config_load_override(void);
/**
* config_unload_override:
*
* Unloads configuration overrides if overrides are active.
*
*
* Returns: false if there was an error.
*/
bool config_unload_override(void);
/**
* config_load_remap:
*
* Tries to append game-specific and core-specific remap files.
*
* Returns: false if there was an error or no action was performed.
*
*/
bool config_load_remap(void);
2016-07-30 14:55:50 -04:00
/**
* config_load_shader_preset:
*
* Tries to append game-specific and core-specific shader presets.
*
* Returns: false if there was an error or no action was performed.
*
*/
bool config_load_shader_preset(void);
/**
* config_save_autoconf_profile:
* @path : Path that shall be written to.
* @user : Controller number to save
* Writes a controller autoconf file to disk.
**/
bool config_save_autoconf_profile(const char *path, unsigned user);
2015-01-09 10:56:21 -05:00
/**
* config_save_file:
* @path : Path that shall be written to.
*
* Writes a config file to disk.
*
* Returns: true (1) on success, otherwise returns false (0).
2015-01-19 01:43:28 -05:00
**/
2015-01-09 10:56:21 -05:00
bool config_save_file(const char *path);
2016-08-25 02:34:51 -04:00
/**
2016-08-26 10:43:29 -04:00
* config_save_overrides:
2016-08-25 02:34:51 -04:00
* @path : Path that shall be written to.
*
* Writes a config file override to disk.
*
* Returns: true (1) on success, otherwise returns false (0).
**/
2016-08-26 10:43:29 -04:00
bool config_save_overrides(int override_type);
2016-08-25 02:34:51 -04:00
2016-05-27 10:42:20 -04:00
/* Replaces currently loaded configuration file with
* another one. Will load a dummy core to flush state
* properly. */
2017-01-24 12:08:26 -05:00
bool config_replace(bool config_save_on_exit, char *path);
2016-05-27 10:42:20 -04:00
2016-05-26 23:05:27 -04:00
bool config_init(void);
2015-03-20 20:47:06 -04:00
2016-08-01 08:14:21 -04:00
bool config_overlay_enable_default(void);
2015-03-20 20:47:06 -04:00
void config_free(void);
2015-03-20 14:32:46 -04:00
settings_t *config_get_ptr(void);
RETRO_END_DECLS
2015-01-09 10:56:21 -05:00
#endif