Qt: Add crop mode, interlacing and NTSC timing to debug menu

This commit is contained in:
Connor McLaughlin 2020-10-09 17:52:05 +10:00
parent ff26881623
commit e1f83fc000
3 changed files with 58 additions and 1 deletions

View file

@ -575,6 +575,19 @@ void MainWindow::setupAdditionalUi()
}
updateDebugMenuGPURenderer();
for (u32 i = 0; i < static_cast<u32>(DisplayCropMode::Count); i++)
{
const DisplayCropMode crop_mode = static_cast<DisplayCropMode>(i);
QAction* action = m_ui.menuCropMode->addAction(tr(Settings::GetDisplayCropModeDisplayName(crop_mode)));
action->setCheckable(true);
connect(action, &QAction::triggered, [this, crop_mode]() {
m_host_interface->SetStringSettingValue("Display", "CropMode", Settings::GetDisplayCropModeName(crop_mode));
m_host_interface->applySettings();
updateDebugMenuCropMode();
});
}
updateDebugMenuCropMode();
const QString current_language(
QString::fromStdString(m_host_interface->GetStringSettingValue("Main", "Language", "")));
QActionGroup* language_group = new QActionGroup(m_ui.menuSettingsLanguage);
@ -786,6 +799,10 @@ void MainWindow::connectSignals()
m_host_interface->populateSaveStateMenus(nullptr, m_ui.menuLoadState, m_ui.menuSaveState);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDisableInterlacing, "GPU",
"DisableInterlacing");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionForceNTSCTimings, "GPU",
"ForceNTSCTimings");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugDumpCPUtoVRAMCopies, "Debug",
"DumpCPUToVRAMCopies");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugDumpVRAMtoCPUCopies, "Debug",
@ -1061,6 +1078,22 @@ void MainWindow::updateDebugMenuGPURenderer()
}
}
void MainWindow::updateDebugMenuCropMode()
{
std::optional<DisplayCropMode> current_crop_mode =
Settings::ParseDisplayCropMode(m_host_interface->GetStringSettingValue("Display", "CropMode").c_str());
if (!current_crop_mode.has_value())
return;
const QString current_crop_mode_display_name(tr(Settings::GetDisplayCropModeDisplayName(current_crop_mode.value())));
for (QObject* obj : m_ui.menuCropMode->children())
{
QAction* action = qobject_cast<QAction*>(obj);
if (action)
action->setChecked(action->text() == current_crop_mode_display_name);
}
}
void MainWindow::closeEvent(QCloseEvent* event)
{
m_host_interface->synchronousPowerOffSystem();

View file

@ -110,6 +110,7 @@ private:
void doSettings(SettingsDialog::Category category = SettingsDialog::Category::Count);
void updateDebugMenuCPUExecutionMode();
void updateDebugMenuGPURenderer();
void updateDebugMenuCropMode();
Ui::MainWindow m_ui;

View file

@ -161,8 +161,15 @@
<string>Switch CPU Emulation Mode</string>
</property>
</widget>
<addaction name="menuCPUExecutionMode"/>
<widget class="QMenu" name="menuCropMode">
<property name="title">
<string>Switch Crop Mode</string>
</property>
</widget> <addaction name="menuCPUExecutionMode"/>
<addaction name="menuRenderer"/>
<addaction name="menuCropMode"/>
<addaction name="actionDisableInterlacing"/>
<addaction name="actionForceNTSCTimings"/>
<addaction name="separator"/>
<addaction name="actionDebugDumpCPUtoVRAMCopies"/>
<addaction name="actionDebugDumpVRAMtoCPUCopies"/>
@ -560,6 +567,22 @@
<string>Dump VRAM to CPU Copies</string>
</property>
</action>
<action name="actionDisableInterlacing">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Disable Interlacing</string>
</property>
</action>
<action name="actionForceNTSCTimings">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Force NTSC Timings</string>
</property>
</action>
<action name="actionDumpAudio">
<property name="checkable">
<bool>true</bool>