From e51758104142bc93d3673aebb3c0c4fa5d9cad86 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 14 May 2024 13:57:29 +1000 Subject: [PATCH] System: Tidy up some unused code --- src/core/system.cpp | 53 +++++---------------------------------------- src/core/system.h | 2 -- 2 files changed, 5 insertions(+), 50 deletions(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index ebfc8d13a..5313fea87 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -102,7 +102,7 @@ static std::string GetExecutableNameForImage(IsoReader& iso, bool strip_subdirec static bool ReadExecutableFromImage(IsoReader& iso, std::string* out_executable_name, std::vector* out_executable_data); -static bool LoadBIOS(const std::string& override_bios_path, Error* error); +static bool LoadBIOS(Error* error); static void InternalReset(); static void ClearRunningGame(); static void DestroySystem(); @@ -127,7 +127,6 @@ static void SaveRunaheadState(); static bool DoRunahead(); static bool Initialize(bool force_software_renderer, Error* error); -static bool FastForwardToFirstFrame(); static bool UpdateGameSettingsLayer(); static void UpdateRunningGame(const char* path, CDImage* image, bool booting); @@ -1465,7 +1464,7 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error) } // Load BIOS image. - if (!LoadBIOS(parameters.override_bios, error)) + if (!LoadBIOS(error)) { s_state = State::Shutdown; ClearRunningGame(); @@ -1566,9 +1565,6 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error) if (parameters.load_image_to_ram || g_settings.cdrom_load_image_to_ram) CDROM::PrecacheMedia(); - if (parameters.fast_forward_to_first_frame) - FastForwardToFirstFrame(); - if (parameters.start_audio_dump) StartDumpingAudio(); @@ -1766,25 +1762,6 @@ void System::ClearRunningGame() #endif } -bool System::FastForwardToFirstFrame() -{ - // If we're taking more than 60 seconds to load the game, oof.. - static constexpr u32 MAX_FRAMES_TO_SKIP = 30 * 60; - const u32 current_frame_number = s_frame_number; - const u32 current_internal_frame_number = s_internal_frame_number; - - SPU::SetAudioOutputMuted(true); - while (s_internal_frame_number == current_internal_frame_number && - (s_frame_number - current_frame_number) <= MAX_FRAMES_TO_SKIP) - { - Panic("Fixme"); - // System::RunFrame(); - } - SPU::SetAudioOutputMuted(false); - - return (s_internal_frame_number != current_internal_frame_number); -} - void System::Execute() { for (;;) @@ -2251,31 +2228,11 @@ bool System::DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_di return !sw.HasError(); } -bool System::LoadBIOS(const std::string& override_bios_path, Error* error) +bool System::LoadBIOS(Error* error) { - std::optional bios_image; - if (!override_bios_path.empty()) - { - bios_image = FileSystem::ReadBinaryFile(override_bios_path.c_str(), error); - if (!bios_image.has_value()) - { - Error::AddPrefixFmt(error, TRANSLATE_FS("System", "Failed to load {} BIOS."), - Settings::GetConsoleRegionName(s_region)); - return false; - } - } - else - { - bios_image = BIOS::GetBIOSImage(s_region, error); - if (!bios_image.has_value()) - return false; - } - - if (bios_image->size() != static_cast(Bus::BIOS_SIZE)) - { - Error::SetStringView(error, TRANSLATE_SV("System", "Incorrect BIOS image size")); + std::optional bios_image = BIOS::GetBIOSImage(s_region, error); + if (!bios_image.has_value()) return false; - } s_bios_hash = BIOS::GetImageHash(bios_image.value()); s_bios_image_info = BIOS::GetInfoForImage(bios_image.value(), s_bios_hash); diff --git a/src/core/system.h b/src/core/system.h index 43aa69f84..b0dbd324f 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -47,14 +47,12 @@ struct SystemBootParameters std::string filename; std::string save_state; std::string override_exe; - std::string override_bios; std::optional override_fast_boot; std::optional override_fullscreen; std::optional override_start_paused; u32 media_playlist_index = 0; bool load_image_to_ram = false; bool force_software_renderer = false; - bool fast_forward_to_first_frame = false; bool disable_achievements_hardcore_mode = false; bool start_audio_dump = false; };