Merge pull request #2238 from CookiePLMonster/hardcore-mode-improvements

Misc improvements
This commit is contained in:
Connor McLaughlin
2021-06-09 21:01:54 +10:00
committed by GitHub
12 changed files with 59 additions and 45 deletions

View File

@ -311,6 +311,7 @@ void GamePropertiesDialog::populateGameSettings()
populateBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, gs.cpu_overclock_enable);
populateBooleanUserSetting(m_ui.userEnable8MBRAM, gs.enable_8mb_ram);
m_ui.userCPUClockSpeed->setEnabled(m_ui.userEnableCPUClockSpeedControl->checkState() != Qt::Unchecked);
updateCPUClockSpeedLabel();
if (gs.cdrom_read_speedup.has_value())
@ -567,7 +568,7 @@ void GamePropertiesDialog::connectUi()
connectBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, &m_game_settings.cpu_overclock_enable);
connectBooleanUserSetting(m_ui.userEnable8MBRAM, &m_game_settings.enable_8mb_ram);
connect(m_ui.userEnableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
&GamePropertiesDialog::updateCPUClockSpeedLabel);
&GamePropertiesDialog::onEnableCPUClockSpeedControlChecked);
connect(m_ui.userCPUClockSpeed, &QSlider::valueChanged, [this](int value) {
if (value == 100)
@ -856,11 +857,18 @@ void GamePropertiesDialog::connectUi()
void GamePropertiesDialog::updateCPUClockSpeedLabel()
{
const int percent = m_ui.userCPUClockSpeed->value();
const int percent =
m_ui.userEnableCPUClockSpeedControl->checkState() != Qt::Unchecked ? m_ui.userCPUClockSpeed->value() : 100;
const double frequency = (static_cast<double>(System::MASTER_CLOCK) * static_cast<double>(percent)) / 100.0;
m_ui.userCPUClockSpeedLabel->setText(tr("%1% (%2MHz)").arg(percent).arg(frequency / 1000000.0, 0, 'f', 2));
}
void GamePropertiesDialog::onEnableCPUClockSpeedControlChecked(int state)
{
m_ui.userCPUClockSpeed->setEnabled(state != Qt::Unchecked);
updateCPUClockSpeedLabel();
}
void GamePropertiesDialog::onUserAspectRatioChanged()
{
const int index = m_ui.userAspectRatio->currentIndex();

View File

@ -37,6 +37,7 @@ private Q_SLOTS:
void onVerifyDumpClicked();
void onExportCompatibilityInfoClicked();
void updateCPUClockSpeedLabel();
void onEnableCPUClockSpeedControlChecked(int state);
private:
void setupAdditionalUi();

View File

@ -478,12 +478,12 @@ void MainWindow::onStartDiscActionTriggered()
if (filename.isEmpty())
return;
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(filename.toStdString()));
m_host_interface->bootSystem(std::make_shared<SystemBootParameters>(filename.toStdString()));
}
void MainWindow::onStartBIOSActionTriggered()
{
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>());
m_host_interface->bootSystem(std::make_shared<SystemBootParameters>());
}
void MainWindow::onChangeDiscFromFileActionTriggered()
@ -655,9 +655,8 @@ void MainWindow::onGameListContextMenuRequested(const QPoint& point, const GameL
m_host_interface->populateGameListContextMenu(entry, this, &menu);
menu.addSeparator();
connect(menu.addAction(tr("Default Boot")), &QAction::triggered, [this, entry]() {
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(entry->path));
});
connect(menu.addAction(tr("Default Boot")), &QAction::triggered,
[this, entry]() { m_host_interface->bootSystem(std::make_shared<SystemBootParameters>(entry->path)); });
connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
auto boot_params = std::make_shared<SystemBootParameters>(entry->path);
@ -976,7 +975,7 @@ void MainWindow::startGameOrChangeDiscs(const std::string& path)
if (m_host_interface->CanResumeSystemFromFile(path.c_str()))
m_host_interface->resumeSystemFromState(QString::fromStdString(path), true);
else
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(path));
m_host_interface->bootSystem(std::make_shared<SystemBootParameters>(path));
}
else
{

View File

@ -52,7 +52,7 @@ Log_SetChannel(QtHostInterface);
QtHostInterface::QtHostInterface(QObject* parent) : QObject(parent), CommonHostInterface()
{
qRegisterMetaType<std::shared_ptr<const SystemBootParameters>>();
qRegisterMetaType<std::shared_ptr<SystemBootParameters>>();
qRegisterMetaType<const GameListEntry*>();
qRegisterMetaType<GPURenderer>();
}
@ -333,17 +333,17 @@ void QtHostInterface::setMainWindow(MainWindow* window)
m_main_window = window;
}
void QtHostInterface::bootSystem(std::shared_ptr<const SystemBootParameters> params)
void QtHostInterface::bootSystem(std::shared_ptr<SystemBootParameters> params)
{
if (!isOnWorkerThread())
{
QMetaObject::invokeMethod(this, "bootSystem", Qt::QueuedConnection,
Q_ARG(std::shared_ptr<const SystemBootParameters>, std::move(params)));
Q_ARG(std::shared_ptr<SystemBootParameters>, std::move(params)));
return;
}
emit emulationStarting();
if (!BootSystem(*params))
if (!BootSystem(std::move(params)))
return;
// force a frame to be drawn to repaint the window

View File

@ -32,7 +32,7 @@ class INISettingsInterface;
class MainWindow;
class QtDisplayWidget;
Q_DECLARE_METATYPE(std::shared_ptr<const SystemBootParameters>);
Q_DECLARE_METATYPE(std::shared_ptr<SystemBootParameters>);
Q_DECLARE_METATYPE(const GameListEntry*);
Q_DECLARE_METATYPE(GPURenderer);
@ -149,7 +149,7 @@ public Q_SLOTS:
void applySettings(bool display_osd_messages = false);
void updateInputMap();
void applyInputProfile(const QString& profile_path);
void bootSystem(std::shared_ptr<const SystemBootParameters> params);
void bootSystem(std::shared_ptr<SystemBootParameters> params);
void resumeSystemFromState(const QString& filename, bool boot_on_failure);
void resumeSystemFromMostRecentState();
void powerOffSystem();