mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
Merge pull request #2238 from CookiePLMonster/hardcore-mode-improvements
Misc improvements
This commit is contained in:
commit
44da13358d
|
@ -83,14 +83,14 @@ s32 HostInterface::GetAudioOutputVolume() const
|
||||||
return g_settings.audio_output_muted ? 0 : g_settings.audio_output_volume;
|
return g_settings.audio_output_muted ? 0 : g_settings.audio_output_volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HostInterface::BootSystem(const SystemBootParameters& parameters)
|
bool HostInterface::BootSystem(std::shared_ptr<SystemBootParameters> parameters)
|
||||||
{
|
{
|
||||||
if (!parameters.state_stream)
|
if (!parameters->state_stream)
|
||||||
{
|
{
|
||||||
if (parameters.filename.empty())
|
if (parameters->filename.empty())
|
||||||
Log_InfoPrintf("Boot Filename: <BIOS/Shell>");
|
Log_InfoPrintf("Boot Filename: <BIOS/Shell>");
|
||||||
else
|
else
|
||||||
Log_InfoPrintf("Boot Filename: %s", parameters.filename.c_str());
|
Log_InfoPrintf("Boot Filename: %s", parameters->filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AcquireHostDisplay())
|
if (!AcquireHostDisplay())
|
||||||
|
@ -108,7 +108,7 @@ bool HostInterface::BootSystem(const SystemBootParameters& parameters)
|
||||||
// create the audio stream. this will never fail, since we'll just fall back to null
|
// create the audio stream. this will never fail, since we'll just fall back to null
|
||||||
CreateAudioStream();
|
CreateAudioStream();
|
||||||
|
|
||||||
if (!System::Boot(parameters))
|
if (!System::Boot(*parameters))
|
||||||
{
|
{
|
||||||
if (!System::IsStartupCancelled())
|
if (!System::IsStartupCancelled())
|
||||||
{
|
{
|
||||||
|
@ -417,9 +417,9 @@ bool HostInterface::LoadState(const char* filename)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SystemBootParameters boot_params;
|
auto boot_params = std::make_shared<SystemBootParameters>();
|
||||||
boot_params.state_stream = std::move(stream);
|
boot_params->state_stream = std::move(stream);
|
||||||
if (!BootSystem(boot_params))
|
if (!BootSystem(std::move(boot_params)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,9 +1164,9 @@ void HostInterface::RecreateSystem()
|
||||||
|
|
||||||
DestroySystem();
|
DestroySystem();
|
||||||
|
|
||||||
SystemBootParameters boot_params;
|
auto boot_params = std::make_shared<SystemBootParameters>();
|
||||||
boot_params.state_stream = std::move(stream);
|
boot_params->state_stream = std::move(stream);
|
||||||
if (!BootSystem(boot_params))
|
if (!BootSystem(std::move(boot_params)))
|
||||||
{
|
{
|
||||||
ReportError("Failed to boot system after recreation.");
|
ReportError("Failed to boot system after recreation.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
/// Shuts down the emulator frontend.
|
/// Shuts down the emulator frontend.
|
||||||
virtual void Shutdown();
|
virtual void Shutdown();
|
||||||
|
|
||||||
virtual bool BootSystem(const SystemBootParameters& parameters);
|
virtual bool BootSystem(std::shared_ptr<SystemBootParameters> parameters);
|
||||||
virtual void PauseSystem(bool paused);
|
virtual void PauseSystem(bool paused);
|
||||||
virtual void ResetSystem();
|
virtual void ResetSystem();
|
||||||
virtual void DestroySystem();
|
virtual void DestroySystem();
|
||||||
|
|
|
@ -68,8 +68,7 @@ static int Run(std::unique_ptr<NoGUIHostInterface> host_interface, std::unique_p
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot_params)
|
if (boot_params)
|
||||||
host_interface->BootSystem(*boot_params);
|
host_interface->BootSystem(std::move(boot_params));
|
||||||
boot_params.reset(); // Need to free resume file handle so auto save on exit works
|
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
if (System::IsValid() || !host_interface->InBatchMode())
|
if (System::IsValid() || !host_interface->InBatchMode())
|
||||||
|
|
|
@ -311,6 +311,7 @@ void GamePropertiesDialog::populateGameSettings()
|
||||||
|
|
||||||
populateBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, gs.cpu_overclock_enable);
|
populateBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, gs.cpu_overclock_enable);
|
||||||
populateBooleanUserSetting(m_ui.userEnable8MBRAM, gs.enable_8mb_ram);
|
populateBooleanUserSetting(m_ui.userEnable8MBRAM, gs.enable_8mb_ram);
|
||||||
|
m_ui.userCPUClockSpeed->setEnabled(m_ui.userEnableCPUClockSpeedControl->checkState() != Qt::Unchecked);
|
||||||
updateCPUClockSpeedLabel();
|
updateCPUClockSpeedLabel();
|
||||||
|
|
||||||
if (gs.cdrom_read_speedup.has_value())
|
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.userEnableCPUClockSpeedControl, &m_game_settings.cpu_overclock_enable);
|
||||||
connectBooleanUserSetting(m_ui.userEnable8MBRAM, &m_game_settings.enable_8mb_ram);
|
connectBooleanUserSetting(m_ui.userEnable8MBRAM, &m_game_settings.enable_8mb_ram);
|
||||||
connect(m_ui.userEnableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
|
connect(m_ui.userEnableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
|
||||||
&GamePropertiesDialog::updateCPUClockSpeedLabel);
|
&GamePropertiesDialog::onEnableCPUClockSpeedControlChecked);
|
||||||
|
|
||||||
connect(m_ui.userCPUClockSpeed, &QSlider::valueChanged, [this](int value) {
|
connect(m_ui.userCPUClockSpeed, &QSlider::valueChanged, [this](int value) {
|
||||||
if (value == 100)
|
if (value == 100)
|
||||||
|
@ -856,11 +857,18 @@ void GamePropertiesDialog::connectUi()
|
||||||
|
|
||||||
void GamePropertiesDialog::updateCPUClockSpeedLabel()
|
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;
|
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));
|
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()
|
void GamePropertiesDialog::onUserAspectRatioChanged()
|
||||||
{
|
{
|
||||||
const int index = m_ui.userAspectRatio->currentIndex();
|
const int index = m_ui.userAspectRatio->currentIndex();
|
||||||
|
|
|
@ -37,6 +37,7 @@ private Q_SLOTS:
|
||||||
void onVerifyDumpClicked();
|
void onVerifyDumpClicked();
|
||||||
void onExportCompatibilityInfoClicked();
|
void onExportCompatibilityInfoClicked();
|
||||||
void updateCPUClockSpeedLabel();
|
void updateCPUClockSpeedLabel();
|
||||||
|
void onEnableCPUClockSpeedControlChecked(int state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupAdditionalUi();
|
void setupAdditionalUi();
|
||||||
|
|
|
@ -478,12 +478,12 @@ void MainWindow::onStartDiscActionTriggered()
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
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()
|
void MainWindow::onStartBIOSActionTriggered()
|
||||||
{
|
{
|
||||||
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>());
|
m_host_interface->bootSystem(std::make_shared<SystemBootParameters>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onChangeDiscFromFileActionTriggered()
|
void MainWindow::onChangeDiscFromFileActionTriggered()
|
||||||
|
@ -655,9 +655,8 @@ void MainWindow::onGameListContextMenuRequested(const QPoint& point, const GameL
|
||||||
m_host_interface->populateGameListContextMenu(entry, this, &menu);
|
m_host_interface->populateGameListContextMenu(entry, this, &menu);
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
connect(menu.addAction(tr("Default Boot")), &QAction::triggered, [this, entry]() {
|
connect(menu.addAction(tr("Default Boot")), &QAction::triggered,
|
||||||
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(entry->path));
|
[this, entry]() { m_host_interface->bootSystem(std::make_shared<SystemBootParameters>(entry->path)); });
|
||||||
});
|
|
||||||
|
|
||||||
connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
|
connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
|
||||||
auto boot_params = std::make_shared<SystemBootParameters>(entry->path);
|
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()))
|
if (m_host_interface->CanResumeSystemFromFile(path.c_str()))
|
||||||
m_host_interface->resumeSystemFromState(QString::fromStdString(path), true);
|
m_host_interface->resumeSystemFromState(QString::fromStdString(path), true);
|
||||||
else
|
else
|
||||||
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(path));
|
m_host_interface->bootSystem(std::make_shared<SystemBootParameters>(path));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ Log_SetChannel(QtHostInterface);
|
||||||
|
|
||||||
QtHostInterface::QtHostInterface(QObject* parent) : QObject(parent), CommonHostInterface()
|
QtHostInterface::QtHostInterface(QObject* parent) : QObject(parent), CommonHostInterface()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<std::shared_ptr<const SystemBootParameters>>();
|
qRegisterMetaType<std::shared_ptr<SystemBootParameters>>();
|
||||||
qRegisterMetaType<const GameListEntry*>();
|
qRegisterMetaType<const GameListEntry*>();
|
||||||
qRegisterMetaType<GPURenderer>();
|
qRegisterMetaType<GPURenderer>();
|
||||||
}
|
}
|
||||||
|
@ -333,17 +333,17 @@ void QtHostInterface::setMainWindow(MainWindow* window)
|
||||||
m_main_window = window;
|
m_main_window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtHostInterface::bootSystem(std::shared_ptr<const SystemBootParameters> params)
|
void QtHostInterface::bootSystem(std::shared_ptr<SystemBootParameters> params)
|
||||||
{
|
{
|
||||||
if (!isOnWorkerThread())
|
if (!isOnWorkerThread())
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, "bootSystem", Qt::QueuedConnection,
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit emulationStarting();
|
emit emulationStarting();
|
||||||
if (!BootSystem(*params))
|
if (!BootSystem(std::move(params)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// force a frame to be drawn to repaint the window
|
// force a frame to be drawn to repaint the window
|
||||||
|
|
|
@ -32,7 +32,7 @@ class INISettingsInterface;
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class QtDisplayWidget;
|
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(const GameListEntry*);
|
||||||
Q_DECLARE_METATYPE(GPURenderer);
|
Q_DECLARE_METATYPE(GPURenderer);
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public Q_SLOTS:
|
||||||
void applySettings(bool display_osd_messages = false);
|
void applySettings(bool display_osd_messages = false);
|
||||||
void updateInputMap();
|
void updateInputMap();
|
||||||
void applyInputProfile(const QString& profile_path);
|
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 resumeSystemFromState(const QString& filename, bool boot_on_failure);
|
||||||
void resumeSystemFromMostRecentState();
|
void resumeSystemFromMostRecentState();
|
||||||
void powerOffSystem();
|
void powerOffSystem();
|
||||||
|
|
|
@ -168,13 +168,18 @@ void CommonHostInterface::InitializeUserDirectory()
|
||||||
ReportError("Failed to create one or more user directories. This may cause issues at runtime.");
|
ReportError("Failed to create one or more user directories. This may cause issues at runtime.");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommonHostInterface::BootSystem(const SystemBootParameters& parameters)
|
bool CommonHostInterface::BootSystem(std::shared_ptr<SystemBootParameters> parameters)
|
||||||
{
|
{
|
||||||
// If the fullscreen UI is enabled, make sure it's finished loading the game list so we don't race it.
|
// If the fullscreen UI is enabled, make sure it's finished loading the game list so we don't race it.
|
||||||
if (m_display && m_fullscreen_ui_enabled)
|
if (m_display && m_fullscreen_ui_enabled)
|
||||||
FullscreenUI::EnsureGameListLoaded();
|
FullscreenUI::EnsureGameListLoaded();
|
||||||
|
|
||||||
ApplyRendererFromGameSettings(parameters.filename);
|
// In Challenge mode, do not allow loading a save state under any circumstances
|
||||||
|
// If it's present, drop it
|
||||||
|
if (IsCheevosChallengeModeActive())
|
||||||
|
parameters->state_stream.reset();
|
||||||
|
|
||||||
|
ApplyRendererFromGameSettings(parameters->filename);
|
||||||
|
|
||||||
if (!HostInterface::BootSystem(parameters))
|
if (!HostInterface::BootSystem(parameters))
|
||||||
{
|
{
|
||||||
|
@ -186,8 +191,8 @@ bool CommonHostInterface::BootSystem(const SystemBootParameters& parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
// enter fullscreen if requested in the parameters
|
// enter fullscreen if requested in the parameters
|
||||||
if (!g_settings.start_paused && ((parameters.override_fullscreen.has_value() && *parameters.override_fullscreen) ||
|
if (!g_settings.start_paused && ((parameters->override_fullscreen.has_value() && *parameters->override_fullscreen) ||
|
||||||
(!parameters.override_fullscreen.has_value() && g_settings.start_fullscreen)))
|
(!parameters->override_fullscreen.has_value() && g_settings.start_fullscreen)))
|
||||||
{
|
{
|
||||||
SetFullscreen(true);
|
SetFullscreen(true);
|
||||||
}
|
}
|
||||||
|
@ -739,9 +744,7 @@ bool CommonHostInterface::CanResumeSystemFromFile(const char* filename)
|
||||||
|
|
||||||
bool CommonHostInterface::ResumeSystemFromState(const char* filename, bool boot_on_failure)
|
bool CommonHostInterface::ResumeSystemFromState(const char* filename, bool boot_on_failure)
|
||||||
{
|
{
|
||||||
SystemBootParameters boot_params;
|
if (!BootSystem(std::make_shared<SystemBootParameters>(filename)))
|
||||||
boot_params.filename = filename;
|
|
||||||
if (!BootSystem(boot_params))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const bool global = System::GetRunningCode().empty();
|
const bool global = System::GetRunningCode().empty();
|
||||||
|
@ -2909,6 +2912,11 @@ void CommonHostInterface::FixIncompatibleSettings(bool display_osd_messages)
|
||||||
g_settings.turbo_speed = (g_settings.turbo_speed != 0.0f) ? std::max(g_settings.turbo_speed, 1.0f) : 0.0f;
|
g_settings.turbo_speed = (g_settings.turbo_speed != 0.0f) ? std::max(g_settings.turbo_speed, 1.0f) : 0.0f;
|
||||||
g_settings.rewind_enable = false;
|
g_settings.rewind_enable = false;
|
||||||
g_settings.auto_load_cheats = false;
|
g_settings.auto_load_cheats = false;
|
||||||
|
if (g_settings.cpu_overclock_enable && g_settings.GetCPUOverclockPercent() < 100)
|
||||||
|
{
|
||||||
|
g_settings.cpu_overclock_enable = false;
|
||||||
|
g_settings.UpdateOverclockActive();
|
||||||
|
}
|
||||||
g_settings.debugging.enable_gdb_server = false;
|
g_settings.debugging.enable_gdb_server = false;
|
||||||
g_settings.debugging.show_vram = false;
|
g_settings.debugging.show_vram = false;
|
||||||
g_settings.debugging.show_gpu_state = false;
|
g_settings.debugging.show_gpu_state = false;
|
||||||
|
|
|
@ -129,7 +129,7 @@ public:
|
||||||
|
|
||||||
virtual void Shutdown() override;
|
virtual void Shutdown() override;
|
||||||
|
|
||||||
virtual bool BootSystem(const SystemBootParameters& parameters) override;
|
virtual bool BootSystem(std::shared_ptr<SystemBootParameters> parameters) override;
|
||||||
virtual void ResetSystem() override;
|
virtual void ResetSystem() override;
|
||||||
virtual void DestroySystem() override;
|
virtual void DestroySystem() override;
|
||||||
|
|
||||||
|
|
|
@ -551,9 +551,7 @@ static void DoStartPath(const std::string& path, bool allow_resume)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemBootParameters params;
|
s_host_interface->BootSystem(std::make_shared<SystemBootParameters>(path));
|
||||||
params.filename = path;
|
|
||||||
s_host_interface->BootSystem(params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DoStartFile()
|
static void DoStartFile()
|
||||||
|
@ -571,10 +569,7 @@ static void DoStartFile()
|
||||||
|
|
||||||
static void DoStartBIOS()
|
static void DoStartBIOS()
|
||||||
{
|
{
|
||||||
s_host_interface->RunLater([]() {
|
s_host_interface->RunLater([]() { s_host_interface->BootSystem(std::make_shared<SystemBootParameters>()); });
|
||||||
SystemBootParameters boot_params;
|
|
||||||
s_host_interface->BootSystem(boot_params);
|
|
||||||
});
|
|
||||||
ClearImGuiFocus();
|
ClearImGuiFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,12 +278,16 @@ void SaveStateSelectorUI::Draw()
|
||||||
ImGui::SetCursorPosX(padding);
|
ImGui::SetCursorPosX(padding);
|
||||||
ImGui::BeginTable("table", 2);
|
ImGui::BeginTable("table", 2);
|
||||||
|
|
||||||
|
const bool hide_load_button = m_host_interface->IsCheevosChallengeModeActive();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextUnformatted(m_load_legend.c_str());
|
ImGui::TextUnformatted(!hide_load_button ? m_load_legend.c_str() : m_save_legend.c_str());
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextUnformatted(m_prev_legend.c_str());
|
ImGui::TextUnformatted(m_prev_legend.c_str());
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
if (!hide_load_button)
|
||||||
|
{
|
||||||
ImGui::TextUnformatted(m_save_legend.c_str());
|
ImGui::TextUnformatted(m_save_legend.c_str());
|
||||||
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextUnformatted(m_next_legend.c_str());
|
ImGui::TextUnformatted(m_next_legend.c_str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue