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 89 additions and 93 deletions

View file

@ -320,7 +320,6 @@ void Settings::Load(SettingsInterface& si)
audio_fast_forward_volume = si.GetUIntValue("Audio", "FastForwardVolume", 100); audio_fast_forward_volume = si.GetUIntValue("Audio", "FastForwardVolume", 100);
audio_output_muted = si.GetBoolValue("Audio", "OutputMuted", false); 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); use_old_mdec_routines = si.GetBoolValue("Hacks", "UseOldMDECRoutines", false);
pcdrv_enable = si.GetBoolValue("PCDrv", "Enabled", 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", "OutputVolume", audio_output_volume);
si.SetUIntValue("Audio", "FastForwardVolume", audio_fast_forward_volume); si.SetUIntValue("Audio", "FastForwardVolume", audio_fast_forward_volume);
si.SetBoolValue("Audio", "OutputMuted", audio_output_muted); si.SetBoolValue("Audio", "OutputMuted", audio_output_muted);
si.SetBoolValue("Audio", "DumpOnBoot", audio_dump_on_boot);
si.SetBoolValue("Hacks", "UseOldMDECRoutines", use_old_mdec_routines); si.SetBoolValue("Hacks", "UseOldMDECRoutines", use_old_mdec_routines);

View file

@ -187,7 +187,6 @@ struct Settings
u32 audio_output_volume = 100; u32 audio_output_volume = 100;
u32 audio_fast_forward_volume = 100; u32 audio_fast_forward_volume = 100;
bool audio_output_muted : 1 = false; bool audio_output_muted : 1 = false;
bool audio_dump_on_boot : 1 = false;
bool use_old_mdec_routines : 1 = false; bool use_old_mdec_routines : 1 = false;
bool pcdrv_enable : 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) if (parameters.fast_forward_to_first_frame)
FastForwardToFirstFrame(); FastForwardToFirstFrame();
if (g_settings.audio_dump_on_boot) if (parameters.start_audio_dump)
StartDumpingAudio(); StartDumpingAudio();
if (g_settings.start_paused || parameters.override_start_paused.value_or(false)) 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 force_software_renderer = false;
bool fast_forward_to_first_frame = false; bool fast_forward_to_first_frame = false;
bool disable_achievements_hardcore_mode = false; bool disable_achievements_hardcore_mode = false;
bool start_audio_dump = false;
}; };
struct SaveStateInfo struct SaveStateInfo

View file

@ -29,7 +29,6 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsWindow* dialog, QWidget* parent
Settings::DEFAULT_AUDIO_BUFFER_MS); Settings::DEFAULT_AUDIO_BUFFER_MS);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.outputLatencyMS, "Audio", "OutputLatencyMS", SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.outputLatencyMS, "Audio", "OutputLatencyMS",
Settings::DEFAULT_AUDIO_OUTPUT_LATENCY_MS); Settings::DEFAULT_AUDIO_OUTPUT_LATENCY_MS);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.startDumpingOnBoot, "Audio", "DumpOnBoot", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.muteCDAudio, "CDROM", "MuteCDAudio", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.muteCDAudio, "CDROM", "MuteCDAudio", false);
connect(m_ui.audioBackend, &QComboBox::currentIndexChanged, this, &AudioSettingsWidget::updateDriverNames); connect(m_ui.audioBackend, &QComboBox::currentIndexChanged, this, &AudioSettingsWidget::updateDriverNames);
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 " "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 " "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.")); "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%", dialog->registerWidgetHelp(m_ui.volume, tr("Output Volume"), "100%",
tr("Controls the volume of the audio played on the host.")); tr("Controls the volume of the audio played on the host."));
dialog->registerWidgetHelp(m_ui.fastForwardVolume, tr("Fast Forward Volume"), "100%", dialog->registerWidgetHelp(m_ui.fastForwardVolume, tr("Fast Forward Volume"), "100%",

View file

@ -29,6 +29,23 @@
<string>Configuration</string> <string>Configuration</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <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"> <item row="4" column="1">
<widget class="QSlider" name="bufferMS"> <widget class="QSlider" name="bufferMS">
<property name="minimum"> <property name="minimum">
@ -47,62 +64,16 @@
<number>50</number> <number>50</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksBothSides</enum> <enum>QSlider::TickPosition::TicksBothSides</enum>
</property> </property>
<property name="tickInterval"> <property name="tickInterval">
<number>20</number> <number>20</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QComboBox" name="driver"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Stretch Mode:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Buffer Size:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="stretchMode">
<item>
<property name="text">
<string>Off (Noisy)</string>
</property>
</item>
<item>
<property name="text">
<string>Resampling (Pitch Shift)</string>
</property>
</item>
<item>
<property name="text">
<string>Time Stretch (Tempo Change, Best Sound)</string>
</property>
</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"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -110,16 +81,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="1" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
@ -127,10 +88,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2"> <item row="1" column="1">
<widget class="QCheckBox" name="startDumpingOnBoot"> <widget class="QComboBox" name="driver"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Start Dumping On Boot</string> <string>Stretch Mode:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -142,10 +106,10 @@
<number>500</number> <number>500</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksBothSides</enum> <enum>QSlider::TickPosition::TicksBothSides</enum>
</property> </property>
<property name="tickInterval"> <property name="tickInterval">
<number>20</number> <number>20</number>
@ -161,15 +125,44 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0"> <item row="2" column="1">
<widget class="QLabel" name="label_8"> <widget class="QComboBox" name="outputDevice"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Output Device:</string> <string>Buffer Size:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="6" column="0" colspan="2">
<widget class="QComboBox" name="outputDevice"/> <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>
<property name="text">
<string>Off (Noisy)</string>
</property>
</item>
<item>
<property name="text">
<string>Resampling (Pitch Shift)</string>
</property>
</item>
<item>
<property name="text">
<string>Time Stretch (Tempo Change, Best Sound)</string>
</property>
</item>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -198,10 +191,10 @@
<number>100</number> <number>100</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksBothSides</enum> <enum>QSlider::TickPosition::TicksBothSides</enum>
</property> </property>
<property name="tickInterval"> <property name="tickInterval">
<number>10</number> <number>10</number>
@ -220,7 +213,7 @@
<string>100%</string> <string>100%</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignmentFlag::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -237,10 +230,10 @@
<number>100</number> <number>100</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksBothSides</enum> <enum>QSlider::TickPosition::TicksBothSides</enum>
</property> </property>
<property name="tickInterval"> <property name="tickInterval">
<number>10</number> <number>10</number>
@ -259,7 +252,7 @@
<string>100%</string> <string>100%</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignmentFlag::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -292,7 +285,7 @@
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Orientation::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <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) std::optional<bool> MainWindow::promptForResumeState(const std::string& save_state_path)
{ {
FILESYSTEM_STAT_DATA sd; 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) 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>(); std::shared_ptr<SystemBootParameters> params = getSystemBootParameters(std::move(path));
params->filename = std::move(path);
params->override_fast_boot = fast_boot; params->override_fast_boot = fast_boot;
if (save_path.has_value()) if (save_path.has_value())
params->save_state = std::move(save_path.value()); params->save_state = std::move(save_path.value());
@ -1237,12 +1243,12 @@ void MainWindow::onStartDiscActionTriggered()
if (path.empty()) if (path.empty())
return; return;
g_emu_thread->bootSystem(std::make_shared<SystemBootParameters>(std::move(path))); g_emu_thread->bootSystem(getSystemBootParameters(std::move(path)));
} }
void MainWindow::onStartBIOSActionTriggered() void MainWindow::onStartBIOSActionTriggered()
{ {
g_emu_thread->bootSystem(std::make_shared<SystemBootParameters>()); g_emu_thread->bootSystem(getSystemBootParameters(std::string()));
} }
void MainWindow::onChangeDiscFromFileActionTriggered() void MainWindow::onChangeDiscFromFileActionTriggered()
@ -1477,16 +1483,16 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
menu.addSeparator(); menu.addSeparator();
connect(menu.addAction(tr("Default Boot")), &QAction::triggered, 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]() { connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
auto boot_params = std::make_shared<SystemBootParameters>(entry->path); std::shared_ptr<SystemBootParameters> boot_params = getSystemBootParameters(entry->path);
boot_params->override_fast_boot = true; boot_params->override_fast_boot = true;
g_emu_thread->bootSystem(std::move(boot_params)); g_emu_thread->bootSystem(std::move(boot_params));
}); });
connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [entry]() { connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [this, entry]() {
auto boot_params = std::make_shared<SystemBootParameters>(entry->path); std::shared_ptr<SystemBootParameters> boot_params = getSystemBootParameters(entry->path);
boot_params->override_fast_boot = false; boot_params->override_fast_boot = false;
g_emu_thread->bootSystem(std::move(boot_params)); 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]() { connect(menu.addAction(tr("Boot and Debug")), &QAction::triggered, [this, entry]() {
m_open_debugger_on_start = true; 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; boot_params->override_start_paused = true;
g_emu_thread->bootSystem(std::move(boot_params)); g_emu_thread->bootSystem(std::move(boot_params));
}); });

View file

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