2019-10-04 05:00:32 +00:00
|
|
|
#pragma once
|
|
|
|
#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 <string_view>
|
|
|
|
#include <vector>
|
2019-10-04 05:00:32 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
class SettingsInterface
|
|
|
|
{
|
|
|
|
public:
|
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;
|
|
|
|
virtual void SetStringList(const char* section, const char* key, const std::vector<std::string_view>& items) = 0;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
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-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;
|
|
|
|
bool save_state_on_exit = true;
|
2020-02-26 09:26:20 +00:00
|
|
|
bool confim_power_off = true;
|
2019-10-27 11:22:33 +00:00
|
|
|
|
2019-11-03 15:45:03 +00:00
|
|
|
GPURenderer gpu_renderer = GPURenderer::Software;
|
2019-10-04 05:00:32 +00:00
|
|
|
u32 gpu_resolution_scale = 1;
|
2020-02-29 14:05:31 +00:00
|
|
|
bool gpu_true_color = true;
|
|
|
|
bool gpu_scaled_dithering = false;
|
2019-12-07 07:03:54 +00:00
|
|
|
bool gpu_texture_filtering = false;
|
2020-01-19 04:53:49 +00:00
|
|
|
bool gpu_use_debug_device = false;
|
2020-02-28 07:01:01 +00:00
|
|
|
DisplayCropMode display_crop_mode = DisplayCropMode::None;
|
|
|
|
bool display_force_progressive_scan = false;
|
2019-10-26 14:02:01 +00:00
|
|
|
bool display_linear_filtering = true;
|
2019-11-07 13:52:19 +00:00
|
|
|
bool display_fullscreen = 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-02-15 15:14:35 +00:00
|
|
|
AudioBackend audio_backend = AudioBackend::Cubeb;
|
2019-12-23 07:02:37 +00:00
|
|
|
bool audio_sync_enabled = true;
|
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;
|
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-11-06 15:43:51 +00:00
|
|
|
std::string bios_path;
|
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{};
|
|
|
|
std::array<std::string, NUM_CONTROLLER_AND_CARD_PORTS> memory_card_paths{};
|
2019-11-06 15:43:51 +00:00
|
|
|
|
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
|
|
|
|
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-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);
|
|
|
|
|
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
|
|
|
|
|
|
|
// 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
|
2019-10-04 05:00:32 +00:00
|
|
|
};
|