2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2019-10-04 05:00:32 +00:00
|
|
|
#pragma once
|
2020-04-30 14:58:32 +00:00
|
|
|
#include "common/log.h"
|
2022-07-08 14:14:48 +00:00
|
|
|
#include "common/settings_interface.h"
|
2023-09-20 13:49:14 +00:00
|
|
|
#include "common/small_string.h"
|
2019-10-04 05:00:32 +00:00
|
|
|
#include "types.h"
|
2022-07-27 14:42:41 +00:00
|
|
|
#include "util/audio_stream.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
|
|
|
|
2022-08-26 11:59:45 +00:00
|
|
|
enum class RenderAPI : u32;
|
|
|
|
|
2020-06-30 14:33:45 +00:00
|
|
|
struct SettingInfo
|
|
|
|
{
|
|
|
|
enum class Type
|
|
|
|
{
|
|
|
|
Boolean,
|
|
|
|
Integer,
|
2022-09-22 03:50:31 +00:00
|
|
|
IntegerList,
|
2020-06-30 14:33:45 +00:00
|
|
|
Float,
|
|
|
|
String,
|
|
|
|
Path,
|
|
|
|
};
|
|
|
|
|
|
|
|
Type type;
|
2022-08-10 03:03:15 +00:00
|
|
|
const char* name;
|
|
|
|
const char* display_name;
|
2020-06-30 14:33:45 +00:00
|
|
|
const char* description;
|
|
|
|
const char* default_value;
|
|
|
|
const char* min_value;
|
|
|
|
const char* max_value;
|
|
|
|
const char* step_value;
|
2022-08-10 03:03:15 +00:00
|
|
|
const char* format;
|
2022-09-22 03:50:31 +00:00
|
|
|
const char** options;
|
2022-08-10 03:03:15 +00:00
|
|
|
float multiplier;
|
2020-06-30 14:33:45 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
ConsoleRegion region = DEFAULT_CONSOLE_REGION;
|
2019-11-16 05:27:57 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
CPUExecutionMode cpu_execution_mode = DEFAULT_CPU_EXECUTION_MODE;
|
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;
|
2021-05-22 04:55:25 +00:00
|
|
|
bool cpu_recompiler_block_linking = true;
|
2020-08-29 12:07:33 +00:00
|
|
|
bool cpu_recompiler_icache = false;
|
2022-07-11 13:03:29 +00:00
|
|
|
CPUFastmemMode cpu_fastmem_mode = DEFAULT_CPU_FASTMEM_MODE;
|
2019-11-23 10:22:09 +00:00
|
|
|
|
2020-02-11 03:02:42 +00:00
|
|
|
float emulation_speed = 1.0f;
|
2020-11-03 11:21:11 +00:00
|
|
|
float fast_forward_speed = 0.0f;
|
2021-01-10 15:57:10 +00:00
|
|
|
float turbo_speed = 0.0f;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool sync_to_host_refresh_rate = false;
|
2020-02-15 15:14:37 +00:00
|
|
|
bool increase_timer_resolution = true;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool inhibit_screensaver = 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-12-04 14:16:22 +00:00
|
|
|
bool pause_on_focus_loss = false;
|
2020-02-15 15:14:49 +00:00
|
|
|
bool save_state_on_exit = true;
|
2022-08-18 11:21:22 +00:00
|
|
|
bool create_save_state_backups = DEFAULT_SAVE_STATE_BACKUPS;
|
|
|
|
bool compress_save_states = DEFAULT_SAVE_STATE_COMPRESSION;
|
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;
|
2022-07-22 14:13:55 +00:00
|
|
|
bool apply_compatibility_settings = true;
|
2020-08-20 14:08:40 +00:00
|
|
|
bool apply_game_settings = true;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool auto_load_cheats = true;
|
2020-12-30 07:39:29 +00:00
|
|
|
bool disable_all_enhancements = false;
|
2023-08-23 12:06:48 +00:00
|
|
|
bool enable_discord_presence = false;
|
2019-10-27 11:22:33 +00:00
|
|
|
|
2021-01-23 09:00:54 +00:00
|
|
|
bool rewind_enable = false;
|
|
|
|
float rewind_save_frequency = 10.0f;
|
|
|
|
u32 rewind_save_slots = 10;
|
2021-01-25 16:48:40 +00:00
|
|
|
u32 runahead_frames = 0;
|
2021-01-23 09:00:54 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
GPURenderer gpu_renderer = DEFAULT_GPU_RENDERER;
|
2020-06-19 17:33:57 +00:00
|
|
|
std::string gpu_adapter;
|
2019-10-04 05:00:32 +00:00
|
|
|
u32 gpu_resolution_scale = 1;
|
2020-10-30 14:38:06 +00:00
|
|
|
u32 gpu_multisamples = 1;
|
2020-11-21 03:32:58 +00:00
|
|
|
bool gpu_use_thread = true;
|
2021-05-19 03:43:49 +00:00
|
|
|
bool gpu_use_software_renderer_for_readbacks = false;
|
2020-12-26 13:22:24 +00:00
|
|
|
bool gpu_threaded_presentation = true;
|
2020-04-11 06:37:51 +00:00
|
|
|
bool gpu_use_debug_device = false;
|
2023-08-13 03:42:02 +00:00
|
|
|
bool gpu_disable_shader_cache = false;
|
2023-11-28 04:08:29 +00:00
|
|
|
bool gpu_disable_dual_source_blend = false;
|
|
|
|
bool gpu_disable_framebuffer_fetch = false;
|
2020-10-30 14:38:06 +00:00
|
|
|
bool gpu_per_sample_shading = false;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool gpu_true_color = true;
|
|
|
|
bool gpu_scaled_dithering = true;
|
|
|
|
GPUTextureFilter gpu_texture_filter = DEFAULT_GPU_TEXTURE_FILTER;
|
|
|
|
GPUDownsampleMode gpu_downsample_mode = DEFAULT_GPU_DOWNSAMPLE_MODE;
|
2023-09-03 07:10:40 +00:00
|
|
|
u8 gpu_downsample_scale = 1;
|
2023-09-02 12:26:03 +00:00
|
|
|
GPUWireframeMode gpu_wireframe_mode = DEFAULT_GPU_WIREFRAME_MODE;
|
2021-05-26 07:59:09 +00:00
|
|
|
bool gpu_disable_interlacing = true;
|
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;
|
2022-10-03 10:03:30 +00:00
|
|
|
bool gpu_pgxp_color_correction = false;
|
2020-08-01 14:25:07 +00:00
|
|
|
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-12-22 15:10:49 +00:00
|
|
|
bool gpu_pgxp_depth_buffer = false;
|
2022-07-11 13:03:29 +00:00
|
|
|
DisplayCropMode display_crop_mode = DEFAULT_DISPLAY_CROP_MODE;
|
|
|
|
DisplayAspectRatio display_aspect_ratio = DEFAULT_DISPLAY_ASPECT_RATIO;
|
2022-10-09 04:55:56 +00:00
|
|
|
DisplayAlignment display_alignment = DEFAULT_DISPLAY_ALIGNMENT;
|
2023-08-31 13:37:17 +00:00
|
|
|
DisplayScalingMode display_scaling = DEFAULT_DISPLAY_SCALING;
|
2021-04-28 16:42:08 +00:00
|
|
|
u16 display_aspect_ratio_custom_numerator = 0;
|
|
|
|
u16 display_aspect_ratio_custom_denominator = 0;
|
2020-08-20 11:30:11 +00:00
|
|
|
s16 display_active_start_offset = 0;
|
|
|
|
s16 display_active_end_offset = 0;
|
2020-12-03 12:31:21 +00:00
|
|
|
s8 display_line_start_offset = 0;
|
|
|
|
s8 display_line_end_offset = 0;
|
2020-09-26 05:11:45 +00:00
|
|
|
bool display_force_4_3_for_24bit = false;
|
2020-11-03 04:17:51 +00:00
|
|
|
bool gpu_24bit_chroma_smoothing = false;
|
2021-05-26 07:59:09 +00:00
|
|
|
bool display_show_osd_messages = true;
|
2020-03-21 13:05:04 +00:00
|
|
|
bool display_show_fps = false;
|
|
|
|
bool display_show_speed = false;
|
2020-08-15 14:17:10 +00:00
|
|
|
bool display_show_resolution = false;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool display_show_cpu = false;
|
2022-09-03 04:15:15 +00:00
|
|
|
bool display_show_gpu = false;
|
2023-01-07 03:09:20 +00:00
|
|
|
bool display_show_frame_times = false;
|
2021-08-10 14:03:44 +00:00
|
|
|
bool display_show_status_indicators = true;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool display_show_inputs = false;
|
2021-08-15 03:11:27 +00:00
|
|
|
bool display_show_enhancements = false;
|
2021-01-28 10:20:15 +00:00
|
|
|
bool display_all_frames = false;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool display_internal_resolution_screenshots = false;
|
2023-01-23 17:44:44 +00:00
|
|
|
bool display_stretch_vertically = false;
|
2021-05-26 07:59:09 +00:00
|
|
|
bool video_sync_enabled = DEFAULT_VSYNC_VALUE;
|
2022-07-28 10:08:54 +00:00
|
|
|
float display_osd_scale = 100.0f;
|
2021-05-26 07:59:09 +00:00
|
|
|
float display_max_fps = DEFAULT_DISPLAY_MAX_FPS;
|
2020-11-26 14:02:13 +00:00
|
|
|
float gpu_pgxp_tolerance = -1.0f;
|
2023-01-17 08:47:54 +00:00
|
|
|
float gpu_pgxp_depth_clear_threshold = DEFAULT_GPU_PGXP_DEPTH_THRESHOLD / GPU_PGXP_DEPTH_THRESHOLD_SCALE;
|
2019-12-23 07:02:37 +00:00
|
|
|
|
2021-07-12 11:08:04 +00:00
|
|
|
u8 cdrom_readahead_sectors = DEFAULT_CDROM_READAHEAD_SECTORS;
|
2023-11-05 04:43:38 +00:00
|
|
|
CDROMMechaconVersion cdrom_mechacon_version = DEFAULT_CDROM_MECHACON_VERSION;
|
2021-05-26 07:59:09 +00:00
|
|
|
bool cdrom_region_check = false;
|
2020-07-21 14:03:22 +00:00
|
|
|
bool cdrom_load_image_to_ram = false;
|
2022-08-27 06:52:24 +00:00
|
|
|
bool cdrom_load_image_patches = 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;
|
2021-05-23 03:35:10 +00:00
|
|
|
u32 cdrom_seek_speedup = 1;
|
2020-02-21 15:19:10 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
AudioBackend audio_backend = DEFAULT_AUDIO_BACKEND;
|
2022-07-27 14:42:41 +00:00
|
|
|
AudioStretchMode audio_stretch_mode = DEFAULT_AUDIO_STRETCH_MODE;
|
2022-08-05 07:50:28 +00:00
|
|
|
std::string audio_driver;
|
2022-12-14 07:58:14 +00:00
|
|
|
std::string audio_output_device;
|
2022-07-27 14:42:41 +00:00
|
|
|
u32 audio_output_latency_ms = DEFAULT_AUDIO_OUTPUT_LATENCY_MS;
|
|
|
|
u32 audio_buffer_ms = DEFAULT_AUDIO_BUFFER_MS;
|
|
|
|
u32 audio_output_volume = 100;
|
|
|
|
u32 audio_fast_forward_volume = 100;
|
2020-05-09 14:44:37 +00:00
|
|
|
bool audio_output_muted = false;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool audio_dump_on_boot = false;
|
2019-10-26 02:55:56 +00:00
|
|
|
|
2023-01-12 07:01:02 +00:00
|
|
|
bool use_old_mdec_routines = false;
|
2023-04-29 10:45:39 +00:00
|
|
|
bool pcdrv_enable = false;
|
2023-01-12 07:01:02 +00:00
|
|
|
|
2020-04-29 10:00:22 +00:00
|
|
|
// timing hacks section
|
2022-07-11 13:03:29 +00:00
|
|
|
TickCount dma_max_slice_ticks = DEFAULT_DMA_MAX_SLICE_TICKS;
|
|
|
|
TickCount dma_halt_ticks = DEFAULT_DMA_HALT_TICKS;
|
|
|
|
u32 gpu_fifo_size = DEFAULT_GPU_FIFO_SIZE;
|
|
|
|
TickCount gpu_max_run_ahead = DEFAULT_GPU_MAX_RUN_AHEAD;
|
|
|
|
|
|
|
|
// achievements
|
2022-10-09 04:21:01 +00:00
|
|
|
bool achievements_enabled = false;
|
2023-09-07 10:13:48 +00:00
|
|
|
bool achievements_hardcore_mode = false;
|
2022-11-05 05:01:48 +00:00
|
|
|
bool achievements_notifications = true;
|
2023-09-07 10:13:48 +00:00
|
|
|
bool achievements_leaderboard_notifications = true;
|
2022-10-09 04:21:01 +00:00
|
|
|
bool achievements_sound_effects = true;
|
2023-09-07 10:13:48 +00:00
|
|
|
bool achievements_overlays = true;
|
|
|
|
bool achievements_encore_mode = false;
|
|
|
|
bool achievements_spectator_mode = false;
|
|
|
|
bool achievements_unofficial_test_mode = false;
|
|
|
|
bool achievements_use_first_disc_from_playlist = true;
|
2023-08-23 12:06:48 +00:00
|
|
|
bool achievements_use_raintegration = false;
|
2023-09-18 12:29:47 +00:00
|
|
|
s32 achievements_notification_duration = DEFAULT_ACHIEVEMENT_NOTIFICATION_TIME;
|
|
|
|
s32 achievements_leaderboard_duration = DEFAULT_LEADERBOARD_NOTIFICATION_TIME;
|
2020-04-29 10:00:22 +00:00
|
|
|
|
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;
|
|
|
|
|
2020-12-09 17:07:49 +00:00
|
|
|
bool enable_gdb_server = false;
|
|
|
|
u16 gdb_server_port = 1234;
|
|
|
|
|
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;
|
|
|
|
|
2020-12-25 08:02:38 +00:00
|
|
|
// texture replacements
|
|
|
|
struct TextureReplacementSettings
|
|
|
|
{
|
|
|
|
bool enable_vram_write_replacements = false;
|
|
|
|
bool preload_textures = false;
|
|
|
|
|
|
|
|
bool dump_vram_writes = false;
|
|
|
|
bool dump_vram_write_force_alpha_channel = true;
|
|
|
|
u32 dump_vram_write_width_threshold = 128;
|
|
|
|
u32 dump_vram_write_height_threshold = 128;
|
|
|
|
|
|
|
|
ALWAYS_INLINE bool AnyReplacementsEnabled() const { return enable_vram_write_replacements; }
|
|
|
|
|
|
|
|
ALWAYS_INLINE bool ShouldDumpVRAMWrite(u32 width, u32 height)
|
|
|
|
{
|
|
|
|
return dump_vram_writes && width >= dump_vram_write_width_threshold && height >= dump_vram_write_height_threshold;
|
|
|
|
}
|
|
|
|
} texture_replacements;
|
|
|
|
|
2023-08-29 11:18:04 +00:00
|
|
|
bool bios_tty_logging = false;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool bios_patch_fast_boot = DEFAULT_FAST_BOOT_VALUE;
|
2021-05-02 10:46:48 +00:00
|
|
|
bool enable_8mb_ram = false;
|
2019-11-15 15:04:51 +00:00
|
|
|
|
2019-12-16 06:46:43 +00:00
|
|
|
std::array<ControllerType, NUM_CONTROLLER_AND_CARD_PORTS> controller_types{};
|
2020-12-11 08:59:40 +00:00
|
|
|
bool controller_disable_analog_mode_forcing = false;
|
|
|
|
|
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
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
MultitapMode multitap_mode = DEFAULT_MULTITAP_MODE;
|
2021-01-21 07:59:40 +00:00
|
|
|
|
2023-04-29 10:45:39 +00:00
|
|
|
std::string pcdrv_root;
|
|
|
|
bool pcdrv_enable_writes = false;
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
LOGLEVEL log_level = DEFAULT_LOG_LEVEL;
|
2020-04-30 14:58:32 +00:00
|
|
|
std::string log_filter;
|
2023-09-30 04:40:50 +00:00
|
|
|
bool log_timestamps = true;
|
2022-07-11 13:03:29 +00:00
|
|
|
bool log_to_console = DEFAULT_LOG_TO_CONSOLE;
|
2020-04-30 14:58:32 +00:00
|
|
|
bool log_to_debug = false;
|
|
|
|
bool log_to_window = false;
|
|
|
|
bool log_to_file = false;
|
|
|
|
|
2023-01-17 08:47:54 +00:00
|
|
|
ALWAYS_INLINE bool IsUsingSoftwareRenderer() const { return (gpu_renderer == GPURenderer::Software); }
|
|
|
|
ALWAYS_INLINE bool IsRunaheadEnabled() const { return (runahead_frames > 0); }
|
2020-07-31 07:09:18 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-01-17 08:47:54 +00:00
|
|
|
ALWAYS_INLINE bool UsingPGXPDepthBuffer() const { return gpu_pgxp_enable && gpu_pgxp_depth_buffer; }
|
|
|
|
ALWAYS_INLINE bool UsingPGXPCPUMode() const { return gpu_pgxp_enable && gpu_pgxp_cpu; }
|
2022-10-13 07:32:51 +00:00
|
|
|
ALWAYS_INLINE float GetPGXPDepthClearThreshold() const
|
|
|
|
{
|
2023-01-17 08:47:54 +00:00
|
|
|
return gpu_pgxp_depth_clear_threshold * GPU_PGXP_DEPTH_THRESHOLD_SCALE;
|
2022-10-13 07:32:51 +00:00
|
|
|
}
|
|
|
|
ALWAYS_INLINE void SetPGXPDepthClearThreshold(float value)
|
|
|
|
{
|
2023-01-17 08:47:54 +00:00
|
|
|
gpu_pgxp_depth_clear_threshold = value / GPU_PGXP_DEPTH_THRESHOLD_SCALE;
|
2022-10-13 07:32:51 +00:00
|
|
|
}
|
2020-12-22 15:10:49 +00:00
|
|
|
|
2020-12-08 14:48:00 +00:00
|
|
|
ALWAYS_INLINE s32 GetAudioOutputVolume(bool fast_forwarding) const
|
|
|
|
{
|
|
|
|
return audio_output_muted ? 0 : (fast_forwarding ? audio_fast_forward_volume : audio_output_volume);
|
|
|
|
}
|
|
|
|
|
2021-04-28 16:42:08 +00:00
|
|
|
float GetDisplayAspectRatioValue() const;
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
ALWAYS_INLINE bool IsPort1MultitapEnabled() const
|
|
|
|
{
|
|
|
|
return (multitap_mode == MultitapMode::Port1Only || multitap_mode == MultitapMode::BothPorts);
|
|
|
|
}
|
|
|
|
ALWAYS_INLINE bool IsPort2MultitapEnabled() const
|
|
|
|
{
|
|
|
|
return (multitap_mode == MultitapMode::Port1Only || multitap_mode == MultitapMode::BothPorts);
|
|
|
|
}
|
2022-08-15 13:54:27 +00:00
|
|
|
ALWAYS_INLINE bool IsMultitapPortEnabled(u32 port) const
|
|
|
|
{
|
|
|
|
return (port == 0) ? IsPort1MultitapEnabled() : IsPort2MultitapEnabled();
|
|
|
|
}
|
2022-07-11 13:03:29 +00:00
|
|
|
|
2021-05-24 09:55:07 +00:00
|
|
|
ALWAYS_INLINE static bool IsPerGameMemoryCardType(MemoryCardType type)
|
|
|
|
{
|
|
|
|
return (type == MemoryCardType::PerGame || type == MemoryCardType::PerGameTitle ||
|
|
|
|
type == MemoryCardType::PerGameFileTitle);
|
|
|
|
}
|
2020-06-03 16:15:27 +00:00
|
|
|
bool HasAnyPerGameMemoryCards() const;
|
2020-04-27 06:15:38 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
/// Returns the default path to a memory card.
|
|
|
|
static std::string GetDefaultSharedMemoryCardName(u32 slot);
|
|
|
|
std::string GetSharedMemoryCardPath(u32 slot) const;
|
|
|
|
|
|
|
|
/// Returns the default path to a memory card for a specific game.
|
2023-08-23 08:40:59 +00:00
|
|
|
static std::string GetGameMemoryCardPath(const std::string_view& serial, u32 slot);
|
2022-07-11 13:03:29 +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-12-25 08:02:38 +00:00
|
|
|
DEFAULT_GPU_MAX_RUN_AHEAD = 128,
|
|
|
|
DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD = 128,
|
|
|
|
DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD = 128,
|
2020-05-17 04:12:23 +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
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
void FixIncompatibleSettings(bool display_osd_messages);
|
|
|
|
|
2023-08-23 12:06:48 +00:00
|
|
|
/// Initializes configuration.
|
|
|
|
void UpdateLogSettings();
|
|
|
|
|
|
|
|
static void SetDefaultControllerConfig(SettingsInterface& si);
|
|
|
|
static void SetDefaultHotkeyConfig(SettingsInterface& si);
|
|
|
|
|
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);
|
2023-09-30 04:40:50 +00:00
|
|
|
static std::span<const char*> GetLogFilters();
|
2020-04-30 14:58:32 +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);
|
|
|
|
|
2020-11-22 15:06:25 +00:00
|
|
|
static std::optional<CPUFastmemMode> ParseCPUFastmemMode(const char* str);
|
|
|
|
static const char* GetCPUFastmemModeName(CPUFastmemMode mode);
|
|
|
|
static const char* GetCPUFastmemModeDisplayName(CPUFastmemMode 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);
|
2022-08-26 11:59:45 +00:00
|
|
|
static RenderAPI GetRenderAPIForRenderer(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-12-30 06:26:20 +00:00
|
|
|
static std::optional<GPUDownsampleMode> ParseDownsampleModeName(const char* str);
|
|
|
|
static const char* GetDownsampleModeName(GPUDownsampleMode mode);
|
|
|
|
static const char* GetDownsampleModeDisplayName(GPUDownsampleMode mode);
|
|
|
|
|
2023-09-02 12:26:03 +00:00
|
|
|
static std::optional<GPUWireframeMode> ParseGPUWireframeMode(const char* str);
|
|
|
|
static const char* GetGPUWireframeModeName(GPUWireframeMode mode);
|
|
|
|
static const char* GetGPUWireframeModeDisplayName(GPUWireframeMode mode);
|
|
|
|
|
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);
|
2023-08-20 03:25:43 +00:00
|
|
|
static const char* GetDisplayAspectRatioDisplayName(DisplayAspectRatio ar);
|
2020-04-10 05:12:16 +00:00
|
|
|
|
2022-10-09 04:55:56 +00:00
|
|
|
static std::optional<DisplayAlignment> ParseDisplayAlignment(const char* str);
|
|
|
|
static const char* GetDisplayAlignmentName(DisplayAlignment alignment);
|
|
|
|
static const char* GetDisplayAlignmentDisplayName(DisplayAlignment alignment);
|
|
|
|
|
2023-08-31 13:37:17 +00:00
|
|
|
static std::optional<DisplayScalingMode> ParseDisplayScaling(const char* str);
|
|
|
|
static const char* GetDisplayScalingName(DisplayScalingMode mode);
|
|
|
|
static const char* GetDisplayScalingDisplayName(DisplayScalingMode 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
|
|
|
|
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);
|
|
|
|
|
2021-01-21 07:59:40 +00:00
|
|
|
static std::optional<MultitapMode> ParseMultitapModeName(const char* str);
|
|
|
|
static const char* GetMultitapModeName(MultitapMode mode);
|
|
|
|
static const char* GetMultitapModeDisplayName(MultitapMode mode);
|
|
|
|
|
2023-11-05 04:43:38 +00:00
|
|
|
static std::optional<CDROMMechaconVersion> ParseCDROMMechVersionName(const char* str);
|
|
|
|
static const char* GetCDROMMechVersionName(CDROMMechaconVersion mode);
|
|
|
|
static const char* GetCDROMMechVersionDisplayName(CDROMMechaconVersion mode);
|
|
|
|
|
2023-09-23 03:24:18 +00:00
|
|
|
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::Automatic;
|
2020-09-11 12:20:19 +00:00
|
|
|
static constexpr GPUTextureFilter DEFAULT_GPU_TEXTURE_FILTER = GPUTextureFilter::Nearest;
|
2020-12-30 06:26:20 +00:00
|
|
|
static constexpr GPUDownsampleMode DEFAULT_GPU_DOWNSAMPLE_MODE = GPUDownsampleMode::Disabled;
|
2023-09-02 12:26:03 +00:00
|
|
|
static constexpr GPUWireframeMode DEFAULT_GPU_WIREFRAME_MODE = GPUWireframeMode::Disabled;
|
2020-07-21 14:03:31 +00:00
|
|
|
static constexpr ConsoleRegion DEFAULT_CONSOLE_REGION = ConsoleRegion::Auto;
|
2020-12-22 15:10:49 +00:00
|
|
|
static constexpr float DEFAULT_GPU_PGXP_DEPTH_THRESHOLD = 300.0f;
|
2023-01-17 08:47:54 +00:00
|
|
|
static constexpr float GPU_PGXP_DEPTH_THRESHOLD_SCALE = 4096.0f;
|
2020-10-13 13:11:28 +00:00
|
|
|
|
2023-10-03 14:39:18 +00:00
|
|
|
#if defined(ENABLE_RECOMPILER)
|
2020-06-30 14:33:53 +00:00
|
|
|
static constexpr CPUExecutionMode DEFAULT_CPU_EXECUTION_MODE = CPUExecutionMode::Recompiler;
|
2023-09-20 12:57:24 +00:00
|
|
|
|
|
|
|
// LUT still ends up faster on Apple Silicon for now, because of 16K pages.
|
|
|
|
#if defined(ENABLE_MMAP_FASTMEM) && (!defined(__APPLE__) || !defined(__aarch64__))
|
2020-11-22 15:06:25 +00:00
|
|
|
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::MMap;
|
|
|
|
#else
|
|
|
|
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::LUT;
|
|
|
|
#endif
|
2023-10-03 14:39:18 +00:00
|
|
|
#elif defined(ENABLE_NEWREC)
|
|
|
|
static constexpr CPUExecutionMode DEFAULT_CPU_EXECUTION_MODE = CPUExecutionMode::NewRec;
|
|
|
|
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::MMap;
|
2020-11-22 15:06:25 +00:00
|
|
|
#else
|
|
|
|
static constexpr CPUExecutionMode DEFAULT_CPU_EXECUTION_MODE = CPUExecutionMode::CachedInterpreter;
|
|
|
|
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::Disabled;
|
|
|
|
#endif
|
2020-10-13 13:11:28 +00:00
|
|
|
|
2023-09-17 02:28:11 +00:00
|
|
|
#if defined(ENABLE_CUBEB)
|
2022-08-04 11:39:15 +00:00
|
|
|
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Cubeb;
|
|
|
|
#elif defined(_WIN32)
|
2021-07-04 09:09:58 +00:00
|
|
|
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::XAudio2;
|
2022-08-04 11:39:15 +00:00
|
|
|
#elif defined(__ANDROID__)
|
|
|
|
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::AAudio;
|
2021-07-04 09:09:58 +00:00
|
|
|
#else
|
2022-08-04 11:39:15 +00:00
|
|
|
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Null;
|
2020-10-13 13:11:28 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-30 14:33:53 +00:00
|
|
|
static constexpr DisplayCropMode DEFAULT_DISPLAY_CROP_MODE = DisplayCropMode::Overscan;
|
2020-12-12 05:37:53 +00:00
|
|
|
static constexpr DisplayAspectRatio DEFAULT_DISPLAY_ASPECT_RATIO = DisplayAspectRatio::Auto;
|
2022-10-09 04:55:56 +00:00
|
|
|
static constexpr DisplayAlignment DEFAULT_DISPLAY_ALIGNMENT = DisplayAlignment::Center;
|
2023-08-31 13:37:17 +00:00
|
|
|
static constexpr DisplayScalingMode DEFAULT_DISPLAY_SCALING = DisplayScalingMode::BilinearSmooth;
|
2022-07-11 13:03:29 +00:00
|
|
|
static constexpr float DEFAULT_OSD_SCALE = 100.0f;
|
2021-07-12 11:08:04 +00:00
|
|
|
|
|
|
|
static constexpr u8 DEFAULT_CDROM_READAHEAD_SECTORS = 8;
|
2023-11-05 04:43:38 +00:00
|
|
|
static constexpr CDROMMechaconVersion DEFAULT_CDROM_MECHACON_VERSION = CDROMMechaconVersion::VC1A;
|
2021-07-12 11:08:04 +00:00
|
|
|
|
2022-08-29 10:34:12 +00:00
|
|
|
static constexpr ControllerType DEFAULT_CONTROLLER_1_TYPE = ControllerType::AnalogController;
|
2020-06-30 14:33:53 +00:00
|
|
|
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;
|
2021-01-21 07:59:40 +00:00
|
|
|
static constexpr MultitapMode DEFAULT_MULTITAP_MODE = MultitapMode::Disabled;
|
|
|
|
|
2023-09-18 12:29:47 +00:00
|
|
|
static constexpr s32 DEFAULT_ACHIEVEMENT_NOTIFICATION_TIME = 5;
|
|
|
|
static constexpr s32 DEFAULT_LEADERBOARD_NOTIFICATION_TIME = 10;
|
2023-09-07 10:13:48 +00:00
|
|
|
|
2020-06-30 14:33:53 +00:00
|
|
|
static constexpr LOGLEVEL DEFAULT_LOG_LEVEL = LOGLEVEL_INFO;
|
2021-02-06 17:27:37 +00:00
|
|
|
|
2022-08-05 07:05:18 +00:00
|
|
|
#ifndef __ANDROID__
|
2022-07-27 14:42:41 +00:00
|
|
|
static constexpr u32 DEFAULT_AUDIO_BUFFER_MS = 50;
|
|
|
|
static constexpr u32 DEFAULT_AUDIO_OUTPUT_LATENCY_MS = 20;
|
2022-08-05 07:05:18 +00:00
|
|
|
#else
|
|
|
|
static constexpr u32 DEFAULT_AUDIO_BUFFER_MS = 100;
|
|
|
|
static constexpr u32 DEFAULT_AUDIO_OUTPUT_LATENCY_MS = 20;
|
|
|
|
#endif
|
2022-07-27 14:42:41 +00:00
|
|
|
static constexpr AudioStretchMode DEFAULT_AUDIO_STRETCH_MODE = AudioStretchMode::TimeStretch;
|
2022-07-11 13:03:29 +00:00
|
|
|
|
2021-02-06 17:27:37 +00:00
|
|
|
// Enable console logging by default on Linux platforms.
|
|
|
|
#if defined(__linux__) && !defined(__ANDROID__)
|
|
|
|
static constexpr bool DEFAULT_LOG_TO_CONSOLE = true;
|
|
|
|
#else
|
|
|
|
static constexpr bool DEFAULT_LOG_TO_CONSOLE = false;
|
|
|
|
#endif
|
2021-05-26 07:59:09 +00:00
|
|
|
|
|
|
|
// Android doesn't create settings until they're first opened, so we have to override the defaults here.
|
|
|
|
#ifndef __ANDROID__
|
2022-08-18 11:21:22 +00:00
|
|
|
static constexpr bool DEFAULT_SAVE_STATE_COMPRESSION = true;
|
|
|
|
static constexpr bool DEFAULT_SAVE_STATE_BACKUPS = true;
|
2021-05-26 07:59:09 +00:00
|
|
|
static constexpr bool DEFAULT_VSYNC_VALUE = false;
|
|
|
|
static constexpr bool DEFAULT_FAST_BOOT_VALUE = false;
|
|
|
|
static constexpr float DEFAULT_DISPLAY_MAX_FPS = 0.0f;
|
|
|
|
#else
|
2022-08-18 11:21:22 +00:00
|
|
|
static constexpr bool DEFAULT_SAVE_STATE_COMPRESSION = true;
|
|
|
|
static constexpr bool DEFAULT_SAVE_STATE_BACKUPS = false;
|
|
|
|
static constexpr bool DEFAULT_VSYNC_VALUE = false;
|
2021-05-26 07:59:09 +00:00
|
|
|
static constexpr bool DEFAULT_FAST_BOOT_VALUE = true;
|
|
|
|
static constexpr float DEFAULT_DISPLAY_MAX_FPS = 60.0f;
|
|
|
|
#endif
|
2019-10-04 05:00:32 +00:00
|
|
|
};
|
2020-07-31 07:09:18 +00:00
|
|
|
|
|
|
|
extern Settings g_settings;
|
2022-07-11 13:03:29 +00:00
|
|
|
|
|
|
|
namespace EmuFolders {
|
|
|
|
extern std::string AppRoot;
|
|
|
|
extern std::string DataRoot;
|
|
|
|
extern std::string Bios;
|
|
|
|
extern std::string Cache;
|
|
|
|
extern std::string Cheats;
|
|
|
|
extern std::string Covers;
|
|
|
|
extern std::string Dumps;
|
|
|
|
extern std::string GameSettings;
|
|
|
|
extern std::string InputProfiles;
|
|
|
|
extern std::string MemoryCards;
|
|
|
|
extern std::string Resources;
|
|
|
|
extern std::string SaveStates;
|
|
|
|
extern std::string Screenshots;
|
|
|
|
extern std::string Shaders;
|
|
|
|
extern std::string Textures;
|
|
|
|
|
|
|
|
// Assumes that AppRoot and DataRoot have been initialized.
|
|
|
|
void SetDefaults();
|
|
|
|
bool EnsureFoldersExist();
|
|
|
|
void LoadConfig(SettingsInterface& si);
|
|
|
|
void Save(SettingsInterface& si);
|
2022-07-22 15:28:19 +00:00
|
|
|
|
|
|
|
/// Updates the variables in the EmuFolders namespace, reloading subsystems if needed.
|
|
|
|
void Update();
|
2022-07-11 13:03:29 +00:00
|
|
|
} // namespace EmuFolders
|