2019-10-04 05:00:32 +00:00
|
|
|
#pragma once
|
2020-04-30 14:58:32 +00:00
|
|
|
#include "common/log.h"
|
2019-10-04 05:00:32 +00:00
|
|
|
#include "types.h"
|
2019-12-16 06:46:43 +00:00
|
|
|
#include <array>
|
2019-11-06 15:43:51 +00:00
|
|
|
#include <optional>
|
2019-11-27 15:55:33 +00:00
|
|
|
#include <string>
|
2019-12-31 02:41:21 +00:00
|
|
|
#include <vector>
|
2019-10-04 05:00:32 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
class SettingsInterface
|
|
|
|
{
|
|
|
|
public:
|
2020-09-13 01:54:51 +00:00
|
|
|
virtual ~SettingsInterface();
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
virtual void Clear() = 0;
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
virtual int GetIntValue(const char* section, const char* key, int default_value = 0) = 0;
|
|
|
|
virtual float GetFloatValue(const char* section, const char* key, float default_value = 0.0f) = 0;
|
|
|
|
virtual bool GetBoolValue(const char* section, const char* key, bool default_value = false) = 0;
|
|
|
|
virtual std::string GetStringValue(const char* section, const char* key, const char* default_value = "") = 0;
|
|
|
|
|
|
|
|
virtual void SetIntValue(const char* section, const char* key, int value) = 0;
|
|
|
|
virtual void SetFloatValue(const char* section, const char* key, float value) = 0;
|
|
|
|
virtual void SetBoolValue(const char* section, const char* key, bool value) = 0;
|
|
|
|
virtual void SetStringValue(const char* section, const char* key, const char* value) = 0;
|
|
|
|
|
2019-12-31 02:41:21 +00:00
|
|
|
virtual std::vector<std::string> GetStringList(const char* section, const char* key) = 0;
|
2020-07-21 09:49:04 +00:00
|
|
|
virtual void SetStringList(const char* section, const char* key, const std::vector<std::string>& items) = 0;
|
2019-12-31 02:41:21 +00:00
|
|
|
virtual bool RemoveFromStringList(const char* section, const char* key, const char* item) = 0;
|
|
|
|
virtual bool AddToStringList(const char* section, const char* key, const char* item) = 0;
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
virtual void DeleteValue(const char* section, const char* key) = 0;
|
|
|
|
};
|
|
|
|
|
2020-06-30 14:33:45 +00:00
|
|
|
struct SettingInfo
|
|
|
|
{
|
|
|
|
enum class Type
|
|
|
|
{
|
|
|
|
Boolean,
|
|
|
|
Integer,
|
|
|
|
Float,
|
|
|
|
String,
|
|
|
|
Path,
|
|
|
|
};
|
|
|
|
|
|
|
|
Type type;
|
|
|
|
const char* key;
|
|
|
|
const char* visible_name;
|
|
|
|
const char* description;
|
|
|
|
const char* default_value;
|
|
|
|
const char* min_value;
|
|
|
|
const char* max_value;
|
|
|
|
const char* step_value;
|
|
|
|
|
|
|
|
const char* StringDefaultValue() const;
|
|
|
|
bool BooleanDefaultValue() const;
|
|
|
|
s32 IntegerDefaultValue() const;
|
|
|
|
s32 IntegerMinValue() const;
|
|
|
|
s32 IntegerMaxValue() const;
|
|
|
|
s32 IntegerStepValue() const;
|
|
|
|
float FloatDefaultValue() const;
|
|
|
|
float FloatMinValue() const;
|
|
|
|
float FloatMaxValue() const;
|
|
|
|
float FloatStepValue() const;
|
|
|
|
};
|
|
|
|
|
2019-10-04 05:00:32 +00:00
|
|
|
struct Settings
|
|
|
|
{
|
|
|
|
Settings();
|
|
|
|
|
2019-11-16 10:50:11 +00:00
|
|
|
ConsoleRegion region = ConsoleRegion::Auto;
|
2019-11-16 05:27:57 +00:00
|
|
|
|
2019-11-23 10:22:09 +00:00
|
|
|
CPUExecutionMode cpu_execution_mode = CPUExecutionMode::Interpreter;
|
2020-09-29 13:29:28 +00:00
|
|
|
u32 cpu_overclock_numerator = 1;
|
|
|
|
u32 cpu_overclock_denominator = 1;
|
|
|
|
bool cpu_overclock_enable = false;
|
|
|
|
bool cpu_overclock_active = false;
|
2020-08-08 06:44:12 +00:00
|
|
|
bool cpu_recompiler_memory_exceptions = false;
|
2020-08-29 12:07:33 +00:00
|
|
|
bool cpu_recompiler_icache = false;
|
2020-10-18 04:43:55 +00:00
|
|
|
bool cpu_fastmem = true;
|
2019-11-23 10:22:09 +00:00
|
|
|
|
2020-02-11 03:02:42 +00:00
|
|
|
float emulation_speed = 1.0f;
|
2019-11-07 13:52:19 +00:00
|
|
|
bool speed_limiter_enabled = true;
|
2020-02-15 15:14:37 +00:00
|
|
|
bool increase_timer_resolution = true;
|
2020-02-15 15:14:49 +00:00
|
|
|
bool start_paused = false;
|
2020-03-12 03:53:58 +00:00
|
|
|
bool start_fullscreen = false;
|
2020-02-15 15:14:49 +00:00
|
|
|
bool save_state_on_exit = true;
|
2020-02-26 09:26:20 +00:00
|
|
|
bool confim_power_off = true;
|
2020-07-01 14:43:18 +00:00
|
|
|
bool load_devices_from_save_states = false;
|
2020-08-20 14:08:40 +00:00
|
|
|
bool apply_game_settings = true;
|
2020-09-09 13:44:02 +00:00
|
|
|
bool auto_load_cheats = false;
|
2019-10-27 11:22:33 +00:00
|
|
|
|
2019-11-03 15:45:03 +00:00
|
|
|
GPURenderer gpu_renderer = GPURenderer::Software;
|
2020-06-19 17:33:57 +00:00
|
|
|
std::string gpu_adapter;
|
2020-09-12 15:19:57 +00:00
|
|
|
std::string display_post_process_chain;
|
2019-10-04 05:00:32 +00:00
|
|
|
u32 gpu_resolution_scale = 1;
|
2020-04-11 06:37:51 +00:00
|
|
|
bool gpu_use_debug_device = false;
|
2020-02-29 14:05:31 +00:00
|
|
|
bool gpu_true_color = true;
|
|
|
|
bool gpu_scaled_dithering = false;
|
2020-09-11 12:20:19 +00:00
|
|
|
GPUTextureFilter gpu_texture_filter = GPUTextureFilter::Nearest;
|
2020-04-11 06:37:51 +00:00
|
|
|
bool gpu_disable_interlacing = false;
|
2020-04-10 03:34:12 +00:00
|
|
|
bool gpu_force_ntsc_timings = false;
|
2020-07-17 14:25:08 +00:00
|
|
|
bool gpu_widescreen_hack = false;
|
2020-08-01 14:25:07 +00:00
|
|
|
bool gpu_pgxp_enable = false;
|
|
|
|
bool gpu_pgxp_culling = true;
|
|
|
|
bool gpu_pgxp_texture_correction = true;
|
|
|
|
bool gpu_pgxp_vertex_cache = false;
|
2020-08-19 13:26:57 +00:00
|
|
|
bool gpu_pgxp_cpu = false;
|
2020-10-09 14:07:07 +00:00
|
|
|
bool gpu_pgxp_preserve_proj_fp = false;
|
2020-02-28 07:01:01 +00:00
|
|
|
DisplayCropMode display_crop_mode = DisplayCropMode::None;
|
2020-08-20 11:30:11 +00:00
|
|
|
s16 display_active_start_offset = 0;
|
|
|
|
s16 display_active_end_offset = 0;
|
2020-04-10 05:12:16 +00:00
|
|
|
DisplayAspectRatio display_aspect_ratio = DisplayAspectRatio::R4_3;
|
2020-09-26 05:11:45 +00:00
|
|
|
bool display_force_4_3_for_24bit = false;
|
2019-10-26 14:02:01 +00:00
|
|
|
bool display_linear_filtering = true;
|
2020-04-30 15:00:22 +00:00
|
|
|
bool display_integer_scaling = false;
|
2020-09-13 12:24:20 +00:00
|
|
|
bool display_post_processing = false;
|
2020-03-21 13:05:04 +00:00
|
|
|
bool display_show_osd_messages = false;
|
|
|
|
bool display_show_fps = false;
|
|
|
|
bool display_show_vps = false;
|
|
|
|
bool display_show_speed = false;
|
2020-08-15 14:17:10 +00:00
|
|
|
bool display_show_resolution = false;
|
2019-12-23 07:02:37 +00:00
|
|
|
bool video_sync_enabled = true;
|
|
|
|
|
2020-02-21 15:19:10 +00:00
|
|
|
bool cdrom_read_thread = true;
|
2020-03-31 15:48:37 +00:00
|
|
|
bool cdrom_region_check = true;
|
2020-07-21 14:03:22 +00:00
|
|
|
bool cdrom_load_image_to_ram = false;
|
2020-10-03 02:24:03 +00:00
|
|
|
bool cdrom_mute_cd_audio = false;
|
2020-10-04 14:05:14 +00:00
|
|
|
u32 cdrom_read_speedup = 1;
|
2020-02-21 15:19:10 +00:00
|
|
|
|
2020-02-15 15:14:35 +00:00
|
|
|
AudioBackend audio_backend = AudioBackend::Cubeb;
|
2020-05-09 14:44:37 +00:00
|
|
|
s32 audio_output_volume = 100;
|
|
|
|
u32 audio_buffer_size = 2048;
|
|
|
|
bool audio_output_muted = false;
|
2019-12-23 07:02:37 +00:00
|
|
|
bool audio_sync_enabled = true;
|
2020-03-15 12:04:17 +00:00
|
|
|
bool audio_dump_on_boot = true;
|
2019-10-26 02:55:56 +00:00
|
|
|
|
2020-04-29 10:00:22 +00:00
|
|
|
// timing hacks section
|
|
|
|
TickCount dma_max_slice_ticks = 1000;
|
|
|
|
TickCount dma_halt_ticks = 100;
|
|
|
|
u32 gpu_fifo_size = 128;
|
|
|
|
TickCount gpu_max_run_ahead = 128;
|
|
|
|
|
2019-10-26 02:55:56 +00:00
|
|
|
struct DebugSettings
|
|
|
|
{
|
|
|
|
bool show_vram = false;
|
|
|
|
bool dump_cpu_to_vram_copies = false;
|
|
|
|
bool dump_vram_to_cpu_copies = false;
|
|
|
|
|
2019-11-07 15:07:39 +00:00
|
|
|
// Mutable because the imgui window can close itself.
|
|
|
|
mutable bool show_gpu_state = false;
|
|
|
|
mutable bool show_cdrom_state = false;
|
|
|
|
mutable bool show_spu_state = false;
|
|
|
|
mutable bool show_timers_state = false;
|
|
|
|
mutable bool show_mdec_state = false;
|
2020-09-26 09:33:10 +00:00
|
|
|
mutable bool show_dma_state = false;
|
2019-10-26 02:55:56 +00:00
|
|
|
} debugging;
|
|
|
|
|
2019-10-04 05:00:32 +00:00
|
|
|
// TODO: Controllers, memory cards, etc.
|
2019-10-27 06:45:23 +00:00
|
|
|
|
2019-12-10 13:06:43 +00:00
|
|
|
bool bios_patch_tty_enable = false;
|
2019-11-15 15:04:51 +00:00
|
|
|
bool bios_patch_fast_boot = false;
|
|
|
|
|
2019-12-16 06:46:43 +00:00
|
|
|
std::array<ControllerType, NUM_CONTROLLER_AND_CARD_PORTS> controller_types{};
|
2020-04-27 06:15:38 +00:00
|
|
|
std::array<MemoryCardType, NUM_CONTROLLER_AND_CARD_PORTS> memory_card_types{};
|
2019-12-16 06:46:43 +00:00
|
|
|
std::array<std::string, NUM_CONTROLLER_AND_CARD_PORTS> memory_card_paths{};
|
2020-08-15 10:38:54 +00:00
|
|
|
bool memory_card_use_playlist_title = true;
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-04-30 14:58:32 +00:00
|
|
|
LOGLEVEL log_level = LOGLEVEL_INFO;
|
|
|
|
std::string log_filter;
|
|
|
|
bool log_to_console = false;
|
|
|
|
bool log_to_debug = false;
|
|
|
|
bool log_to_window = false;
|
|
|
|
bool log_to_file = false;
|
|
|
|
|
2020-08-01 14:25:07 +00:00
|
|
|
ALWAYS_INLINE bool IsUsingCodeCache() const { return (cpu_execution_mode != CPUExecutionMode::Interpreter); }
|
2020-07-31 07:09:18 +00:00
|
|
|
ALWAYS_INLINE bool IsUsingRecompiler() const { return (cpu_execution_mode == CPUExecutionMode::Recompiler); }
|
|
|
|
ALWAYS_INLINE bool IsUsingSoftwareRenderer() const { return (gpu_renderer == GPURenderer::Software); }
|
|
|
|
|
2020-08-19 13:26:57 +00:00
|
|
|
ALWAYS_INLINE PGXPMode GetPGXPMode()
|
|
|
|
{
|
|
|
|
return gpu_pgxp_enable ? (gpu_pgxp_cpu ? PGXPMode::CPU : PGXPMode::Memory) : PGXPMode::Disabled;
|
|
|
|
}
|
|
|
|
|
2020-10-18 04:43:55 +00:00
|
|
|
ALWAYS_INLINE bool IsUsingFastmem() const
|
|
|
|
{
|
|
|
|
return (cpu_fastmem && cpu_execution_mode == CPUExecutionMode::Recompiler && !cpu_recompiler_memory_exceptions);
|
|
|
|
}
|
|
|
|
|
2020-06-03 16:15:27 +00:00
|
|
|
bool HasAnyPerGameMemoryCards() const;
|
2020-04-27 06:15:38 +00:00
|
|
|
|
2020-09-29 13:29:28 +00:00
|
|
|
static void CPUOverclockPercentToFraction(u32 percent, u32* numerator, u32* denominator);
|
|
|
|
static u32 CPUOverclockFractionToPercent(u32 numerator, u32 denominator);
|
|
|
|
|
|
|
|
void SetCPUOverclockPercent(u32 percent);
|
|
|
|
u32 GetCPUOverclockPercent() const;
|
2020-09-30 13:46:35 +00:00
|
|
|
void UpdateOverclockActive();
|
2020-09-29 13:29:28 +00:00
|
|
|
|
2020-05-17 04:12:23 +00:00
|
|
|
enum : u32
|
|
|
|
{
|
|
|
|
DEFAULT_DMA_MAX_SLICE_TICKS = 1000,
|
|
|
|
DEFAULT_DMA_HALT_TICKS = 100,
|
2020-06-12 15:30:34 +00:00
|
|
|
DEFAULT_GPU_FIFO_SIZE = 16,
|
2020-05-17 04:12:23 +00:00
|
|
|
DEFAULT_GPU_MAX_RUN_AHEAD = 128
|
|
|
|
};
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
void Load(SettingsInterface& si);
|
|
|
|
void Save(SettingsInterface& si) const;
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-04-30 14:58:32 +00:00
|
|
|
static std::optional<LOGLEVEL> ParseLogLevelName(const char* str);
|
|
|
|
static const char* GetLogLevelName(LOGLEVEL level);
|
|
|
|
static const char* GetLogLevelDisplayName(LOGLEVEL level);
|
|
|
|
|
2019-11-16 05:27:57 +00:00
|
|
|
static std::optional<ConsoleRegion> ParseConsoleRegionName(const char* str);
|
|
|
|
static const char* GetConsoleRegionName(ConsoleRegion region);
|
|
|
|
static const char* GetConsoleRegionDisplayName(ConsoleRegion region);
|
|
|
|
|
2020-03-12 03:51:29 +00:00
|
|
|
static std::optional<DiscRegion> ParseDiscRegionName(const char* str);
|
|
|
|
static const char* GetDiscRegionName(DiscRegion region);
|
|
|
|
static const char* GetDiscRegionDisplayName(DiscRegion region);
|
|
|
|
|
2019-11-23 10:22:09 +00:00
|
|
|
static std::optional<CPUExecutionMode> ParseCPUExecutionMode(const char* str);
|
|
|
|
static const char* GetCPUExecutionModeName(CPUExecutionMode mode);
|
|
|
|
static const char* GetCPUExecutionModeDisplayName(CPUExecutionMode mode);
|
|
|
|
|
2019-11-06 15:43:51 +00:00
|
|
|
static std::optional<GPURenderer> ParseRendererName(const char* str);
|
|
|
|
static const char* GetRendererName(GPURenderer renderer);
|
2019-11-07 13:52:19 +00:00
|
|
|
static const char* GetRendererDisplayName(GPURenderer renderer);
|
2019-12-14 13:29:26 +00:00
|
|
|
|
2020-09-11 12:20:19 +00:00
|
|
|
static std::optional<GPUTextureFilter> ParseTextureFilterName(const char* str);
|
|
|
|
static const char* GetTextureFilterName(GPUTextureFilter filter);
|
|
|
|
static const char* GetTextureFilterDisplayName(GPUTextureFilter filter);
|
|
|
|
|
2020-02-28 07:01:01 +00:00
|
|
|
static std::optional<DisplayCropMode> ParseDisplayCropMode(const char* str);
|
|
|
|
static const char* GetDisplayCropModeName(DisplayCropMode crop_mode);
|
|
|
|
static const char* GetDisplayCropModeDisplayName(DisplayCropMode crop_mode);
|
|
|
|
|
2020-04-10 05:12:16 +00:00
|
|
|
static std::optional<DisplayAspectRatio> ParseDisplayAspectRatio(const char* str);
|
|
|
|
static const char* GetDisplayAspectRatioName(DisplayAspectRatio ar);
|
|
|
|
static float GetDisplayAspectRatioValue(DisplayAspectRatio ar);
|
|
|
|
|
2019-12-23 07:02:37 +00:00
|
|
|
static std::optional<AudioBackend> ParseAudioBackend(const char* str);
|
|
|
|
static const char* GetAudioBackendName(AudioBackend backend);
|
|
|
|
static const char* GetAudioBackendDisplayName(AudioBackend backend);
|
|
|
|
|
2019-12-14 13:29:26 +00:00
|
|
|
static std::optional<ControllerType> ParseControllerTypeName(const char* str);
|
|
|
|
static const char* GetControllerTypeName(ControllerType type);
|
|
|
|
static const char* GetControllerTypeDisplayName(ControllerType type);
|
2020-02-15 01:21:57 +00:00
|
|
|
|
2020-04-27 06:15:38 +00:00
|
|
|
static std::optional<MemoryCardType> ParseMemoryCardTypeName(const char* str);
|
|
|
|
static const char* GetMemoryCardTypeName(MemoryCardType type);
|
|
|
|
static const char* GetMemoryCardTypeDisplayName(MemoryCardType type);
|
|
|
|
|
2020-02-15 01:21:57 +00:00
|
|
|
// Default to D3D11 on Windows as it's more performant and at this point, less buggy.
|
|
|
|
#ifdef WIN32
|
|
|
|
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareD3D11;
|
|
|
|
#else
|
|
|
|
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareOpenGL;
|
|
|
|
#endif
|
2020-09-11 12:20:19 +00:00
|
|
|
static constexpr GPUTextureFilter DEFAULT_GPU_TEXTURE_FILTER = GPUTextureFilter::Nearest;
|
2020-07-21 14:03:31 +00:00
|
|
|
static constexpr ConsoleRegion DEFAULT_CONSOLE_REGION = ConsoleRegion::Auto;
|
2020-10-13 13:11:28 +00:00
|
|
|
|
2020-06-30 14:33:53 +00:00
|
|
|
static constexpr CPUExecutionMode DEFAULT_CPU_EXECUTION_MODE = CPUExecutionMode::Recompiler;
|
2020-10-13 13:11:28 +00:00
|
|
|
|
|
|
|
#ifndef ANDROID
|
2020-06-30 14:33:53 +00:00
|
|
|
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Cubeb;
|
2020-10-13 13:11:28 +00:00
|
|
|
#else
|
|
|
|
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::OpenSLES;
|
|
|
|
#endif
|
|
|
|
|
2020-06-30 14:33:53 +00:00
|
|
|
static constexpr DisplayCropMode DEFAULT_DISPLAY_CROP_MODE = DisplayCropMode::Overscan;
|
|
|
|
static constexpr DisplayAspectRatio DEFAULT_DISPLAY_ASPECT_RATIO = DisplayAspectRatio::R4_3;
|
|
|
|
static constexpr ControllerType DEFAULT_CONTROLLER_1_TYPE = ControllerType::DigitalController;
|
|
|
|
static constexpr ControllerType DEFAULT_CONTROLLER_2_TYPE = ControllerType::None;
|
2020-07-21 10:15:52 +00:00
|
|
|
static constexpr MemoryCardType DEFAULT_MEMORY_CARD_1_TYPE = MemoryCardType::PerGameTitle;
|
2020-06-30 14:33:53 +00:00
|
|
|
static constexpr MemoryCardType DEFAULT_MEMORY_CARD_2_TYPE = MemoryCardType::None;
|
|
|
|
static constexpr LOGLEVEL DEFAULT_LOG_LEVEL = LOGLEVEL_INFO;
|
2019-10-04 05:00:32 +00:00
|
|
|
};
|
2020-07-31 07:09:18 +00:00
|
|
|
|
|
|
|
extern Settings g_settings;
|