From a47492382c65529b60623bb099930b7268987808 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 16 Nov 2019 01:04:51 +1000 Subject: [PATCH] System: Add "fast boot" option (skip boot logo) --- src/core/settings.cpp | 4 ++++ src/core/settings.h | 3 +++ src/core/system.cpp | 21 ++++++++++++----- src/duckstation/sdl_host_interface.cpp | 31 ++++++++++++++++++-------- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/core/settings.cpp b/src/core/settings.cpp index d5e541ecd..c794f8977 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -45,6 +45,8 @@ void Settings::Load(const char* filename) display_linear_filtering = ini.GetBoolValue("Display", "LinearFiltering", true); bios_path = ini.GetValue("BIOS", "Path", "scph1001.bin"); + bios_patch_tty_enable = ini.GetBoolValue("BIOS", "PatchTTYEnable", true); + bios_patch_fast_boot = ini.GetBoolValue("BIOS", "PatchFastBoot", false); memory_card_a_path = ini.GetValue("MemoryCard", "CardAPath", "memory_card_a.mcd"); memory_card_b_path = ini.GetValue("MemoryCard", "CardBPath", ""); @@ -66,6 +68,8 @@ bool Settings::Save(const char* filename) const ini.SetBoolValue("Display", "LinearFiltering", display_linear_filtering); ini.SetValue("BIOS", "Path", bios_path.c_str()); + ini.SetBoolValue("BIOS", "PatchTTYEnable", bios_patch_tty_enable); + ini.SetBoolValue("BIOS", "PatchFastBoot", bios_patch_fast_boot); if (!memory_card_a_path.empty()) ini.SetValue("MemoryCard", "CardAPath", memory_card_a_path.c_str()); diff --git a/src/core/settings.h b/src/core/settings.h index 8974c91c1..801b295f1 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -42,6 +42,9 @@ struct Settings // TODO: Controllers, memory cards, etc. std::string bios_path; + bool bios_patch_tty_enable = true; + bool bios_patch_fast_boot = false; + std::string memory_card_a_path; std::string memory_card_b_path; diff --git a/src/core/system.cpp b/src/core/system.cpp index c468b07f3..2497659e5 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -155,14 +155,25 @@ bool System::LoadBIOS() bios_hash_string == BIOSHashes::SCPH_1002 || bios_hash_string == BIOSHashes::SCPH_5500 || bios_hash_string == BIOSHashes::SCPH_5501 || bios_hash_string == BIOSHashes::SCPH_5502) { - // Patch to enable TTY. - Log_InfoPrintf("Patching BIOS to enable TTY/printf"); - m_bus->PatchBIOS(0x1FC06F0C, 0x24010001); - m_bus->PatchBIOS(0x1FC06F14, 0xAF81A9C0); + if (GetSettings().bios_patch_tty_enable) + { + Log_InfoPrintf("Patching BIOS to enable TTY/printf"); + m_bus->PatchBIOS(0x1FC06F0C, 0x24010001); + m_bus->PatchBIOS(0x1FC06F14, 0xAF81A9C0); + } + + if (GetSettings().bios_patch_fast_boot) + { + Log_InfoPrintf("Patching BIOS for fast boot"); + + // Replace the shell entry point with a return back to the bootstrap. + m_bus->PatchBIOS(0x1FC18000, 0x03E00008); + m_bus->PatchBIOS(0x1FC18004, 0x00000000); + } } else { - Log_WarningPrintf("Unknown BIOS version, not patching TTY/printf"); + Log_WarningPrintf("Unknown BIOS version, not applying patches"); } return true; diff --git a/src/duckstation/sdl_host_interface.cpp b/src/duckstation/sdl_host_interface.cpp index f6f8c6505..27cb86387 100644 --- a/src/duckstation/sdl_host_interface.cpp +++ b/src/duckstation/sdl_host_interface.cpp @@ -924,18 +924,31 @@ void SDLHostInterface::DrawSettingsWindow() if (ImGui::BeginTabItem("General")) { - ImGui::Text("Region:"); - ImGui::SameLine(indent); - static int region = 0; - ImGui::Combo("##region", ®ion, "NTSC-U (US)\0NTSC-J (Japan)\0PAL (Europe, Australia)"); + if (DrawSettingsSectionHeader("Behavior")) + { + settings_changed |= ImGui::Checkbox("Enable Speed Limiter", &m_settings.speed_limiter_enabled); + settings_changed |= ImGui::Checkbox("Pause On Start", &m_settings.start_paused); + } - ImGui::Text("BIOS Path:"); - ImGui::SameLine(indent); - settings_changed |= DrawFileChooser("##bios_path", &m_settings.bios_path); + ImGui::NewLine(); + if (DrawSettingsSectionHeader("Console")) + { + ImGui::Text("Region:"); + ImGui::SameLine(indent); + static int region = 0; + ImGui::Combo("##region", ®ion, "NTSC-U (US)\0NTSC-J (Japan)\0PAL (Europe, Australia)"); + } - ImGui::Checkbox("Enable Speed Limiter", &m_settings.speed_limiter_enabled); + ImGui::NewLine(); + if (DrawSettingsSectionHeader("BIOS")) + { + ImGui::Text("ROM Path:"); + ImGui::SameLine(indent); + settings_changed |= DrawFileChooser("##bios_path", &m_settings.bios_path); - ImGui::Checkbox("Pause On Start", &m_settings.start_paused); + settings_changed |= ImGui::Checkbox("Enable TTY Output", &m_settings.bios_patch_tty_enable); + settings_changed |= ImGui::Checkbox("Fast Boot", &m_settings.bios_patch_fast_boot); + } ImGui::EndTabItem(); }