CDROM: Add "Switch to Next Disc on Stop" option.

NOTE: THIS WILL NOT WORK FOR ALL GAMES.

Plenty of games don't stop the CD-ROM drive when they're expecting a
disc change, leaving us with no way of knowing when it's needed.
This commit is contained in:
Stenzek 2025-05-27 17:05:09 +10:00
parent 24cd6fa11b
commit 6b811df6d0
No known key found for this signature in database
6 changed files with 34 additions and 4 deletions

View File

@ -2590,10 +2590,18 @@ void CDROM::ExecuteCommandSecondResponse(void*, TickCount ticks, TickCount ticks
case Command::ReadTOC:
case Command::Pause:
case Command::MotorOn:
case Command::Stop:
DoStatSecondResponse();
break;
case Command::Stop:
{
DoStatSecondResponse();
if (g_settings.cdrom_auto_disc_change)
Host::RunOnCPUThread([]() { System::SwitchToNextDisc(false); });
}
break;
default:
break;
}

View File

@ -4539,6 +4539,10 @@ void FullscreenUI::DrawConsoleSettingsPage()
bsi, FSUI_ICONVSTR(ICON_FA_VEST_PATCHES, "Apply Image Patches"),
FSUI_VSTR("Automatically applies patches to disc images when they are present, currently only PPF is supported."),
"CDROM", "LoadImagePatches", false);
DrawToggleSetting(bsi, FSUI_ICONVSTR(ICON_FA_LIST_OL, "Switch to Next Disc on Stop"),
FSUI_VSTR("Automatically switches to the next disc in the game when the game stops the CD-ROM "
"motor. Does not work for all games."),
"CDROM", "AutoDiscChange", false);
EndMenuButtons();
}
@ -9166,6 +9170,7 @@ TRANSLATE_NOOP("FullscreenUI", "Automatically applies patches to disc images whe
TRANSLATE_NOOP("FullscreenUI", "Automatically resizes the window to match the internal resolution.");
TRANSLATE_NOOP("FullscreenUI", "Automatically saves the emulator state when powering down or exiting. You can then resume directly from where you left off next time.");
TRANSLATE_NOOP("FullscreenUI", "Automatically switches to fullscreen mode when the program is started.");
TRANSLATE_NOOP("FullscreenUI", "Automatically switches to the next disc in the game when the game stops the CD-ROM motor. Does not work for all games.");
TRANSLATE_NOOP("FullscreenUI", "Avoids calls to C++ code, significantly speeding up the recompiler.");
TRANSLATE_NOOP("FullscreenUI", "BIOS Directory");
TRANSLATE_NOOP("FullscreenUI", "BIOS Selection");
@ -9728,6 +9733,7 @@ TRANSLATE_NOOP("FullscreenUI", "Stores the current settings to a controller pres
TRANSLATE_NOOP("FullscreenUI", "Stretch Mode");
TRANSLATE_NOOP("FullscreenUI", "Summary");
TRANSLATE_NOOP("FullscreenUI", "Support for controllers that use the XInput protocol. XInput should only be used if you are using a XInput wrapper library.");
TRANSLATE_NOOP("FullscreenUI", "Switch to Next Disc on Stop");
TRANSLATE_NOOP("FullscreenUI", "Switches back to 4:3 display aspect ratio when displaying 24-bit content, usually FMVs.");
TRANSLATE_NOOP("FullscreenUI", "Switches between full screen and windowed when the window is double-clicked.");
TRANSLATE_NOOP("FullscreenUI", "Sync To Host Refresh Rate");

View File

@ -362,6 +362,7 @@ void Settings::Load(const SettingsInterface& si, const SettingsInterface& contro
cdrom_load_image_to_ram = si.GetBoolValue("CDROM", "LoadImageToRAM", false);
cdrom_load_image_patches = si.GetBoolValue("CDROM", "LoadImagePatches", false);
cdrom_mute_cd_audio = si.GetBoolValue("CDROM", "MuteCDAudio", false);
cdrom_auto_disc_change = si.GetBoolValue("CDROM", "AutoDiscChange", false);
cdrom_read_speedup =
Truncate8(std::min<u32>(si.GetUIntValue("CDROM", "ReadSpeedup", 1u), std::numeric_limits<u8>::max()));
cdrom_seek_speedup =
@ -679,6 +680,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const
si.SetBoolValue("CDROM", "LoadImageToRAM", cdrom_load_image_to_ram);
si.SetBoolValue("CDROM", "LoadImagePatches", cdrom_load_image_patches);
si.SetBoolValue("CDROM", "MuteCDAudio", cdrom_mute_cd_audio);
si.SetBoolValue("CDROM", "AutoDiscChange", cdrom_auto_disc_change);
si.SetUIntValue("CDROM", "ReadSpeedup", cdrom_read_speedup);
si.SetUIntValue("CDROM", "SeekSpeedup", cdrom_seek_speedup);
si.SetUIntValue("CDROM", "MaxReadSpeedupCycles", cdrom_max_seek_speedup_cycles);

View File

@ -308,6 +308,7 @@ struct Settings : public GPUSettings
bool cdrom_load_image_to_ram : 1 = false;
bool cdrom_load_image_patches : 1 = false;
bool cdrom_mute_cd_audio : 1 = false;
bool cdrom_auto_disc_change : 1 = false;
u16 rewind_save_slots = 10;
u8 runahead_frames = 0;

View File

@ -65,6 +65,7 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsWindow* dialog, QWidget* pa
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.recompilerICache, "CPU", "RecompilerICache", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.cdromLoadImageToRAM, "CDROM", "LoadImageToRAM", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.cdromLoadImagePatches, "CDROM", "LoadImagePatches", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.cdromAutoDiscChange, "CDROM", "AutoDiscChange", false);
if (!m_dialog->isPerGameSettings())
{
@ -73,6 +74,7 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsWindow* dialog, QWidget* pa
}
else
{
m_ui.cdromIgnoreDriveSubcode->setEnabled(false);
}
@ -131,6 +133,10 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsWindow* dialog, QWidget* pa
dialog->registerWidgetHelp(m_ui.cdromLoadImagePatches, tr("Apply Image Patches"), tr("Unchecked"),
tr("Automatically applies patches to disc images when they are present in the same "
"directory. Currently only PPF patches are supported with this option."));
dialog->registerWidgetHelp(
m_ui.cdromAutoDiscChange, tr("Switch to Next Disc on Stop"), tr("Unchecked"),
tr("Automatically switches to the next disc in the game when the game stops the CD-ROM motor. No switch will occur "
"if the last disc in the game is already selected. <strong>Does not work for all games.</strong>"));
dialog->registerWidgetHelp(
m_ui.cdromIgnoreDriveSubcode, tr("Ignore Drive Subcode"), tr("Unchecked"),
tr("Ignores the subchannel provided by the drive when using physical discs, instead always generating subchannel "

View File

@ -167,11 +167,11 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<widget class="QGroupBox" name="cdromGroup">
<property name="title">
<string>CD-ROM Emulation</string>
</property>
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,1">
<layout class="QGridLayout" name="cdromLayout" columnstretch="0,1">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@ -323,13 +323,20 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="1">
<widget class="QCheckBox" name="cdromIgnoreDriveSubcode">
<property name="text">
<string>Ignore Drive Subcode</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="cdromAutoDiscChange">
<property name="text">
<string>Switch to Next Disc on Stop</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>