Qt: Move dump audio on startup out of settings

This commit is contained in:
Stenzek 2024-04-21 20:28:20 +10:00
parent 2871a26f54
commit d3c12fecb3
No known key found for this signature in database
8 changed files with 101 additions and 105 deletions

View File

@ -320,7 +320,6 @@ void Settings::Load(SettingsInterface& si)
audio_fast_forward_volume = si.GetUIntValue("Audio", "FastForwardVolume", 100);
audio_output_muted = si.GetBoolValue("Audio", "OutputMuted", false);
audio_dump_on_boot = si.GetBoolValue("Audio", "DumpOnBoot", false);
use_old_mdec_routines = si.GetBoolValue("Hacks", "UseOldMDECRoutines", false);
pcdrv_enable = si.GetBoolValue("PCDrv", "Enabled", false);
@ -573,7 +572,6 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const
si.SetUIntValue("Audio", "OutputVolume", audio_output_volume);
si.SetUIntValue("Audio", "FastForwardVolume", audio_fast_forward_volume);
si.SetBoolValue("Audio", "OutputMuted", audio_output_muted);
si.SetBoolValue("Audio", "DumpOnBoot", audio_dump_on_boot);
si.SetBoolValue("Hacks", "UseOldMDECRoutines", use_old_mdec_routines);

View File

@ -187,7 +187,6 @@ struct Settings
u32 audio_output_volume = 100;
u32 audio_fast_forward_volume = 100;
bool audio_output_muted : 1 = false;
bool audio_dump_on_boot : 1 = false;
bool use_old_mdec_routines : 1 = false;
bool pcdrv_enable : 1 = false;

View File

@ -1549,7 +1549,7 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
if (parameters.fast_forward_to_first_frame)
FastForwardToFirstFrame();
if (g_settings.audio_dump_on_boot)
if (parameters.start_audio_dump)
StartDumpingAudio();
if (g_settings.start_paused || parameters.override_start_paused.value_or(false))

View File

@ -56,6 +56,7 @@ struct SystemBootParameters
bool force_software_renderer = false;
bool fast_forward_to_first_frame = false;
bool disable_achievements_hardcore_mode = false;
bool start_audio_dump = false;
};
struct SaveStateInfo

View File

@ -29,7 +29,6 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsWindow* dialog, QWidget* parent
Settings::DEFAULT_AUDIO_BUFFER_MS);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.outputLatencyMS, "Audio", "OutputLatencyMS",
Settings::DEFAULT_AUDIO_OUTPUT_LATENCY_MS);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.startDumpingOnBoot, "Audio", "DumpOnBoot", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.muteCDAudio, "CDROM", "MuteCDAudio", false);
connect(m_ui.audioBackend, &QComboBox::currentIndexChanged, this, &AudioSettingsWidget::updateDriverNames);
updateDriverNames();
@ -71,9 +70,6 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsWindow* dialog, QWidget* parent
"host. Smaller values reduce the output latency, but may cause hitches if the emulation "
"speed is inconsistent. Note that the Cubeb backend uses smaller chunks regardless of "
"this value, so using a low value here may not significantly change latency."));
dialog->registerWidgetHelp(
m_ui.startDumpingOnBoot, tr("Start Dumping On Boot"), tr("Unchecked"),
tr("Start dumping audio to file as soon as the emulator is started. Mainly useful as a debug option."));
dialog->registerWidgetHelp(m_ui.volume, tr("Output Volume"), "100%",
tr("Controls the volume of the audio played on the host."));
dialog->registerWidgetHelp(m_ui.fastForwardVolume, tr("Fast Forward Volume"), "100%",

View File

@ -29,6 +29,23 @@
<string>Configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QComboBox" name="audioBackend"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Output Latency:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Output Device:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSlider" name="bufferMS">
<property name="minimum">
@ -47,16 +64,30 @@
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>20</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Backend:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Driver:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="driver"/>
</item>
@ -67,6 +98,36 @@
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSlider" name="outputLatencyMS">
<property name="maximum">
<number>500</number>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>20</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="outputLatencyMinimal">
<property name="text">
<string>Minimal</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="outputDevice"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@ -74,6 +135,16 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="bufferingLabel">
<property name="text">
<string>Maximum latency: 0 frames (0.00ms)</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="stretchMode">
<item>
@ -93,84 +164,6 @@
</item>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="bufferingLabel">
<property name="text">
<string>Maximum latency: 0 frames (0.00ms)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Backend:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="audioBackend"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Output Latency:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Driver:</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="startDumpingOnBoot">
<property name="text">
<string>Start Dumping On Boot</string>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSlider" name="outputLatencyMS">
<property name="maximum">
<number>500</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>20</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="outputLatencyMinimal">
<property name="text">
<string>Minimal</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Output Device:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="outputDevice"/>
</item>
</layout>
</widget>
</item>
@ -198,10 +191,10 @@
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>10</number>
@ -220,7 +213,7 @@
<string>100%</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
@ -237,10 +230,10 @@
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>10</number>
@ -259,7 +252,7 @@
<string>100%</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
@ -292,7 +285,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>

View File

@ -1117,6 +1117,13 @@ void MainWindow::populateCheatsMenu(QMenu* menu)
}
}
std::shared_ptr<SystemBootParameters> MainWindow::getSystemBootParameters(std::string file)
{
std::shared_ptr<SystemBootParameters> ret = std::make_shared<SystemBootParameters>(std::move(file));
ret->start_audio_dump = m_ui.actionDumpAudio->isChecked();
return ret;
}
std::optional<bool> MainWindow::promptForResumeState(const std::string& save_state_path)
{
FILESYSTEM_STAT_DATA sd;
@ -1163,8 +1170,7 @@ std::optional<bool> MainWindow::promptForResumeState(const std::string& save_sta
void MainWindow::startFile(std::string path, std::optional<std::string> save_path, std::optional<bool> fast_boot)
{
std::shared_ptr<SystemBootParameters> params = std::make_shared<SystemBootParameters>();
params->filename = std::move(path);
std::shared_ptr<SystemBootParameters> params = getSystemBootParameters(std::move(path));
params->override_fast_boot = fast_boot;
if (save_path.has_value())
params->save_state = std::move(save_path.value());
@ -1237,12 +1243,12 @@ void MainWindow::onStartDiscActionTriggered()
if (path.empty())
return;
g_emu_thread->bootSystem(std::make_shared<SystemBootParameters>(std::move(path)));
g_emu_thread->bootSystem(getSystemBootParameters(std::move(path)));
}
void MainWindow::onStartBIOSActionTriggered()
{
g_emu_thread->bootSystem(std::make_shared<SystemBootParameters>());
g_emu_thread->bootSystem(getSystemBootParameters(std::string()));
}
void MainWindow::onChangeDiscFromFileActionTriggered()
@ -1477,16 +1483,16 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
menu.addSeparator();
connect(menu.addAction(tr("Default Boot")), &QAction::triggered,
[entry]() { g_emu_thread->bootSystem(std::make_shared<SystemBootParameters>(entry->path)); });
[this, entry]() { g_emu_thread->bootSystem(getSystemBootParameters(entry->path)); });
connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [entry]() {
auto boot_params = std::make_shared<SystemBootParameters>(entry->path);
connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
std::shared_ptr<SystemBootParameters> boot_params = getSystemBootParameters(entry->path);
boot_params->override_fast_boot = true;
g_emu_thread->bootSystem(std::move(boot_params));
});
connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [entry]() {
auto boot_params = std::make_shared<SystemBootParameters>(entry->path);
connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [this, entry]() {
std::shared_ptr<SystemBootParameters> boot_params = getSystemBootParameters(entry->path);
boot_params->override_fast_boot = false;
g_emu_thread->bootSystem(std::move(boot_params));
});
@ -1496,7 +1502,7 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
connect(menu.addAction(tr("Boot and Debug")), &QAction::triggered, [this, entry]() {
m_open_debugger_on_start = true;
auto boot_params = std::make_shared<SystemBootParameters>(entry->path);
std::shared_ptr<SystemBootParameters> boot_params = getSystemBootParameters(entry->path);
boot_params->override_start_paused = true;
g_emu_thread->bootSystem(std::move(boot_params));
});

View File

@ -33,6 +33,8 @@ class CheatManagerWindow;
class DebuggerWindow;
class MemoryScannerWindow;
struct SystemBootParameters;
class GPUDevice;
namespace Achievements {
enum class LoginRequestReason;
@ -269,6 +271,7 @@ private:
/// Fills menu with the current cheat options.
void populateCheatsMenu(QMenu* menu);
std::shared_ptr<SystemBootParameters> getSystemBootParameters(std::string file);
std::optional<bool> promptForResumeState(const std::string& save_state_path);
void startFile(std::string path, std::optional<std::string> save_path, std::optional<bool> fast_boot);
void startFileOrChangeDisc(const QString& path);