From cf0b602476259a58c15f04fed7b283175893fb98 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 4 Oct 2025 18:19:37 +1000 Subject: [PATCH] Settings: Rearrange fields To make space in the bitfield. --- src/core/bus.cpp | 2 +- src/core/cheats.cpp | 4 +-- src/core/imgui_overlays.cpp | 2 +- src/core/mdec.cpp | 6 ++-- src/core/settings.cpp | 12 +++---- src/core/settings.h | 67 ++++++++++++++++++++----------------- src/core/system.cpp | 10 +++--- 7 files changed, 54 insertions(+), 49 deletions(-) diff --git a/src/core/bus.cpp b/src/core/bus.cpp index bf651276d..5ce9b3609 100644 --- a/src/core/bus.cpp +++ b/src/core/bus.cpp @@ -383,7 +383,7 @@ void Bus::CleanupMemoryMap() void Bus::Initialize() { - SetRAMSize(g_settings.enable_8mb_ram); + SetRAMSize(g_settings.cpu_enable_8mb_ram); MapFastmemViews(); } diff --git a/src/core/cheats.cpp b/src/core/cheats.cpp index f96caff56..2feb5dc7a 100644 --- a/src/core/cheats.cpp +++ b/src/core/cheats.cpp @@ -297,10 +297,10 @@ void Cheats::CheatCode::ApplySettingOverrides() DEV_LOG("Disabling widescreen rendering from {} patch.", GetName()); g_settings.gpu_widescreen_hack = false; } - if (m_metadata.enable_8mb_ram && !g_settings.enable_8mb_ram) + if (m_metadata.enable_8mb_ram && !g_settings.cpu_enable_8mb_ram) { DEV_LOG("Enabling 8MB ram from {} patch.", GetName()); - g_settings.enable_8mb_ram = true; + g_settings.cpu_enable_8mb_ram = true; } if (m_metadata.override_aspect_ratio.has_value() && g_settings.display_aspect_ratio == DisplayAspectRatio::Auto()) { diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index 1a5366551..581e3b6b2 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -565,7 +565,7 @@ void ImGuiManager::DrawEnhancementsOverlay(const GPUBackend* gpu) if (g_settings.cpu_overclock_active) text.append_format(" CPU={}%", g_settings.GetCPUOverclockPercent()); - if (g_settings.enable_8mb_ram) + if (g_settings.cpu_enable_8mb_ram) text.append(" 8MB"); if (g_settings.cdrom_read_speedup != 1) text.append_format(" CDR={}x", g_settings.cdrom_read_speedup); diff --git a/src/core/mdec.cpp b/src/core/mdec.cpp index 4363c4aeb..b44cea8dc 100644 --- a/src/core/mdec.cpp +++ b/src/core/mdec.cpp @@ -554,7 +554,7 @@ bool MDEC::DecodeMonoMacroblock() if (!s_state.data_out_fifo.IsEmpty()) return false; - if (g_settings.use_old_mdec_routines) [[unlikely]] + if (g_settings.mdec_use_old_routines) [[unlikely]] { if (!DecodeRLE_Old(s_state.blocks[0].data(), s_state.iq_y.data())) return false; @@ -585,7 +585,7 @@ bool MDEC::DecodeMonoMacroblock() bool MDEC::DecodeColoredMacroblock() { - if (g_settings.use_old_mdec_routines) [[unlikely]] + if (g_settings.mdec_use_old_routines) [[unlikely]] { for (; s_state.current_block < NUM_BLOCKS; s_state.current_block++) { @@ -762,7 +762,7 @@ void MDEC::CopyOutBlock(void* param, TickCount ticks, TickCount ticks_late) case DataOutputDepth_15Bit: { - if (g_settings.use_old_mdec_routines) [[unlikely]] + if (g_settings.mdec_use_old_routines) [[unlikely]] { const u16 a = ZeroExtend16(s_state.status.data_output_bit15.GetValue()) << 15; for (u32 i = 0; i < static_cast(s_state.block_rgb.size());) diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 0c348f979..496499897 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -195,7 +195,7 @@ void Settings::Load(const SettingsInterface& si, const SettingsInterface& contro ParseConsoleRegionName( si.GetStringValue("Console", "Region", Settings::GetConsoleRegionName(Settings::DEFAULT_CONSOLE_REGION)).c_str()) .value_or(DEFAULT_CONSOLE_REGION); - enable_8mb_ram = si.GetBoolValue("Console", "Enable8MBRAM", false); + cpu_enable_8mb_ram = si.GetBoolValue("Console", "Enable8MBRAM", false); emulation_speed = si.GetFloatValue("Main", "EmulationSpeed", 1.0f); fast_forward_speed = si.GetFloatValue("Main", "FastForwardSpeed", 0.0f); @@ -409,7 +409,7 @@ void Settings::Load(const SettingsInterface& si, const SettingsInterface& contro audio_output_muted = si.GetBoolValue("Audio", "OutputMuted", false); - use_old_mdec_routines = si.GetBoolValue("Hacks", "UseOldMDECRoutines", false); + mdec_use_old_routines = si.GetBoolValue("Hacks", "UseOldMDECRoutines", false); export_shared_memory = si.GetBoolValue("Hacks", "ExportSharedMemory", false); dma_max_slice_ticks = si.GetIntValue("Hacks", "DMAMaxSliceTicks", DEFAULT_DMA_MAX_SLICE_TICKS); @@ -573,7 +573,7 @@ void Settings::LoadPGXPSettings(const SettingsInterface& si) void Settings::Save(SettingsInterface& si, bool ignore_base) const { si.SetStringValue("Console", "Region", GetConsoleRegionName(region)); - si.SetBoolValue("Console", "Enable8MBRAM", enable_8mb_ram); + si.SetBoolValue("Console", "Enable8MBRAM", cpu_enable_8mb_ram); si.SetFloatValue("Main", "EmulationSpeed", emulation_speed); si.SetFloatValue("Main", "FastForwardSpeed", fast_forward_speed); @@ -728,7 +728,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const si.SetUIntValue("Audio", "FastForwardVolume", audio_fast_forward_volume); si.SetBoolValue("Audio", "OutputMuted", audio_output_muted); - si.SetBoolValue("Hacks", "UseOldMDECRoutines", use_old_mdec_routines); + si.SetBoolValue("Hacks", "UseOldMDECRoutines", mdec_use_old_routines); si.SetBoolValue("Hacks", "ExportSharedMemory", export_shared_memory); if (!ignore_base) @@ -1036,7 +1036,7 @@ void Settings::ApplySettingRestrictions() { g_settings.cpu_overclock_enable = false; g_settings.cpu_overclock_active = false; - g_settings.enable_8mb_ram = false; + g_settings.cpu_enable_8mb_ram = false; g_settings.gpu_resolution_scale = 1; g_settings.gpu_multisamples = 1; g_settings.gpu_automatic_resolution_scale = false; @@ -1058,7 +1058,7 @@ void Settings::ApplySettingRestrictions() g_settings.cdrom_seek_speedup = 1; g_settings.cdrom_mute_cd_audio = false; g_settings.texture_replacements.enable_vram_write_replacements = false; - g_settings.use_old_mdec_routines = false; + g_settings.mdec_use_old_routines = false; g_settings.bios_patch_fast_boot = false; g_settings.runahead_frames = 0; g_settings.rewind_enable = false; diff --git a/src/core/settings.h b/src/core/settings.h index 6da1c15de..6842d7b6d 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -294,21 +294,21 @@ struct Settings : public GPUSettings bool cpu_recompiler_memory_exceptions : 1 = false; bool cpu_recompiler_block_linking : 1 = true; bool cpu_recompiler_icache : 1 = false; + bool cpu_enable_8mb_ram : 1 = false; - bool sync_to_host_refresh_rate : 1 = false; - bool inhibit_screensaver : 1 = true; - bool pause_on_focus_loss : 1 = false; - bool pause_on_controller_disconnection : 1 = false; - bool save_state_on_exit : 1 = true; - bool create_save_state_backups : 1 = DEFAULT_SAVE_STATE_BACKUPS; - bool confim_power_off : 1 = true; - bool load_devices_from_save_states : 1 = false; - bool apply_compatibility_settings : 1 = true; - bool apply_game_settings : 1 = true; - bool disable_all_enhancements : 1 = false; - bool enable_discord_presence : 1 = false; + bool mdec_use_old_routines : 1 = false; + bool mdec_disable_cdrom_speedup : 1 = false; - bool rewind_enable : 1 = false; + bool pcdrv_enable : 1 = false; + bool pcdrv_enable_writes : 1 = false; + + bool pio_switch_active : 1 = true; + bool pio_flash_write_enable : 1 = false; + + bool sio_redirect_to_tty : 1 = false; + + bool memory_card_use_playlist_title : 1 = true; + bool memory_card_fast_forward_access : 1 = false; bool cdrom_region_check : 1 = false; bool cdrom_subq_skew : 1 = false; @@ -317,40 +317,45 @@ struct Settings : public GPUSettings bool cdrom_mute_cd_audio : 1 = false; bool cdrom_auto_disc_change : 1 = false; - u16 rewind_save_slots = 10; + bool bios_tty_logging : 1 = false; + bool bios_patch_fast_boot : 1 = DEFAULT_FAST_BOOT_VALUE; + bool bios_fast_forward_boot : 1 = false; + + bool rewind_enable : 1 = false; + + bool apply_compatibility_settings : 1 = true; + bool apply_game_settings : 1 = true; + bool load_devices_from_save_states : 1 = false; + u8 runahead_frames = 0; + u16 rewind_save_slots = 10; SaveStateCompressionMode save_state_compression = DEFAULT_SAVE_STATE_COMPRESSION_MODE; + u8 cdrom_readahead_sectors = DEFAULT_CDROM_READAHEAD_SECTORS; + CDROMMechaconVersion cdrom_mechacon_version = DEFAULT_CDROM_MECHACON_VERSION; + u8 cdrom_read_speedup = 1; u8 cdrom_seek_speedup = 1; u32 cdrom_max_seek_speedup_cycles = DEFAULT_CDROM_MAX_SEEK_SPEEDUP_CYCLES; u32 cdrom_max_read_speedup_cycles = DEFAULT_CDROM_MAX_READ_SPEEDUP_CYCLES; - u8 cdrom_readahead_sectors = DEFAULT_CDROM_READAHEAD_SECTORS; - CDROMMechaconVersion cdrom_mechacon_version = DEFAULT_CDROM_MECHACON_VERSION; - u8 audio_output_volume = 100; u8 audio_fast_forward_volume = 100; bool audio_output_muted : 1 = false; - bool use_old_mdec_routines : 1 = false; - bool mdec_disable_cdrom_speedup : 1 = false; - bool pcdrv_enable : 1 = false; + bool sync_to_host_refresh_rate : 1 = false; + bool inhibit_screensaver : 1 = true; + bool pause_on_focus_loss : 1 = false; + bool pause_on_controller_disconnection : 1 = false; + bool save_state_on_exit : 1 = true; + bool create_save_state_backups : 1 = DEFAULT_SAVE_STATE_BACKUPS; + bool confim_power_off : 1 = true; + bool disable_all_enhancements : 1 = false; + bool enable_discord_presence : 1 = false; bool export_shared_memory : 1 = false; - bool bios_tty_logging : 1 = false; - bool bios_patch_fast_boot : 1 = DEFAULT_FAST_BOOT_VALUE; - bool bios_fast_forward_boot : 1 = false; - bool enable_8mb_ram : 1 = false; - bool memory_card_use_playlist_title : 1 = true; - bool memory_card_fast_forward_access : 1 = false; - bool pio_switch_active : 1 = true; - bool pio_flash_write_enable : 1 = false; - bool sio_redirect_to_tty : 1 = false; - bool pcdrv_enable_writes : 1 = false; - // achievements bool achievements_enabled : 1 = false; bool achievements_hardcore_mode : 1 = false; diff --git a/src/core/system.cpp b/src/core/system.cpp index 57f106570..db5611f92 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -2902,7 +2902,7 @@ size_t System::GetMaxSaveStateSize() // 5 megabytes is sufficient for now, at the moment they're around 4.3MB, or 10.3MB with 8MB RAM enabled. static constexpr u32 MAX_2MB_SAVE_STATE_SIZE = 5 * 1024 * 1024; static constexpr u32 MAX_8MB_SAVE_STATE_SIZE = 11 * 1024 * 1024; - const bool is_8mb_ram = (System::IsValid() ? (Bus::g_ram_size > Bus::RAM_2MB_SIZE) : g_settings.enable_8mb_ram); + const bool is_8mb_ram = (System::IsValid() ? (Bus::g_ram_size > Bus::RAM_2MB_SIZE) : g_settings.cpu_enable_8mb_ram); return is_8mb_ram ? MAX_8MB_SAVE_STATE_SIZE : MAX_2MB_SAVE_STATE_SIZE; } @@ -4717,7 +4717,7 @@ void System::SetTaintsFromSettings() SetTaint(Taint::CPUOverclock); if (g_settings.gpu_force_video_timing != ForceVideoTimingMode::Disabled) SetTaint(Taint::ForceFrameTimings); - if (g_settings.enable_8mb_ram) + if (g_settings.cpu_enable_8mb_ram) SetTaint(Taint::RAM8MB); if (Cheats::GetActivePatchCount() > 0) SetTaint(Taint::Patches); @@ -4805,7 +4805,7 @@ void System::WarnAboutUnsafeSettings() TRANSLATE_SV("System", "PGXP Geometry Tolerance is not set to default. This may cause rendering errors.")); } } - if (g_settings.enable_8mb_ram) + if (g_settings.cpu_enable_8mb_ram) { append(ICON_EMOJI_WARNING, TRANSLATE_SV("System", "8MB RAM is enabled, this may be incompatible with some games.")); @@ -4848,7 +4848,7 @@ void System::WarnAboutUnsafeSettings() if (g_settings.cpu_overclock_active) APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Overclock disabled.")); - if (g_settings.enable_8mb_ram) + if (g_settings.cpu_enable_8mb_ram) APPEND_SUBMESSAGE(TRANSLATE_SV("System", "8MB RAM disabled.")); if (g_settings.gpu_resolution_scale != 1) APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Resolution scale set to 1x.")); @@ -4881,7 +4881,7 @@ void System::WarnAboutUnsafeSettings() APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Mute CD-ROM audio disabled.")); if (g_settings.texture_replacements.enable_vram_write_replacements) APPEND_SUBMESSAGE(TRANSLATE_SV("System", "VRAM write texture replacements disabled.")); - if (g_settings.use_old_mdec_routines) + if (g_settings.mdec_use_old_routines) APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Use old MDEC routines disabled.")); if (g_settings.pio_device_type != PIODeviceType::None) APPEND_SUBMESSAGE(TRANSLATE_SV("System", "PIO device removed."));