From 4c1aba62fc5b3a4b7841f71f1038bd3fd9e2229a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 14 Apr 2025 21:52:29 +1000 Subject: [PATCH] System: Remove unused function And rename instances of "filename" to "path". --- src/core/fullscreen_ui.cpp | 10 +-- src/core/hotkeys.cpp | 8 +- src/core/imgui_overlays.cpp | 8 +- src/core/memory_card.h | 3 +- src/core/pad.cpp | 2 +- src/core/system.cpp | 93 +++++++++++------------- src/core/system.h | 21 +++--- src/duckstation-mini/mini_host.cpp | 20 ++--- src/duckstation-qt/mainwindow.cpp | 4 +- src/duckstation-qt/qthost.cpp | 32 ++++---- src/duckstation-regtest/regtest_host.cpp | 12 +-- 11 files changed, 99 insertions(+), 114 deletions(-) diff --git a/src/core/fullscreen_ui.cpp b/src/core/fullscreen_ui.cpp index adb66188d..5ecb31519 100644 --- a/src/core/fullscreen_ui.cpp +++ b/src/core/fullscreen_ui.cpp @@ -1489,7 +1489,7 @@ void FullscreenUI::DoStartPath(std::string path, std::string state, std::optiona GPUThread::SetRunIdleReason(GPUThread::RunIdleReason::FullscreenUIActive, false); SystemBootParameters params; - params.filename = std::move(path); + params.path = std::move(path); params.save_state = std::move(state); params.override_fast_boot = std::move(fast_boot); Host::RunOnCPUThread([params = std::move(params)]() mutable { @@ -7067,7 +7067,7 @@ bool FullscreenUI::InitializeSaveStateListEntryFromSerial(SaveStateListEntry* li bool global) { const std::string path = - (global ? System::GetGlobalSaveStateFileName(slot) : System::GetGameSaveStateFileName(serial, slot)); + (global ? System::GetGlobalSaveStatePath(slot) : System::GetGameSaveStatePath(serial, slot)); if (!InitializeSaveStateListEntryFromPath(li, path.c_str(), slot, global)) { InitializePlaceholderSaveStateListEntry(li, slot, global); @@ -7233,8 +7233,8 @@ void FullscreenUI::DrawSaveStateSelector() if (!System::IsValid()) return; - std::string path(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetGameSerial(), slot)); + std::string path(global ? System::GetGlobalSaveStatePath(slot) : + System::GetGameSaveStatePath(System::GetGameSerial(), slot)); Error error; if (!System::SaveState(std::move(path), &error, g_settings.create_save_state_backups, false)) { @@ -8262,7 +8262,7 @@ void FullscreenUI::HandleGameListOptions(const GameList::Entry* entry) DoSetCoverImage(std::move(entry_path)); break; case 3: // Resume Game - DoStartPath(entry_path, System::GetGameSaveStateFileName(entry_serial, -1)); + DoStartPath(entry_path, System::GetGameSaveStatePath(entry_serial, -1)); break; case 4: // Load State BeginTransition([entry_serial = std::move(entry_serial), entry_path = std::move(entry_path)]() { diff --git a/src/core/hotkeys.cpp b/src/core/hotkeys.cpp index 5e45acef8..4896136db 100644 --- a/src/core/hotkeys.cpp +++ b/src/core/hotkeys.cpp @@ -78,8 +78,8 @@ static void HotkeyLoadStateSlot(bool global, s32 slot) return; } - std::string path(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetGameSerial(), slot)); + std::string path(global ? System::GetGlobalSaveStatePath(slot) : + System::GetGameSaveStatePath(System::GetGameSerial(), slot)); if (!FileSystem::FileExists(path.c_str())) { Host::AddKeyedOSDMessage("LoadState", @@ -110,8 +110,8 @@ static void HotkeySaveStateSlot(bool global, s32 slot) return; } - std::string path(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetGameSerial(), slot)); + std::string path(global ? System::GetGlobalSaveStatePath(slot) : + System::GetGameSaveStatePath(System::GetGameSerial(), slot)); Error error; if (!System::SaveState(std::move(path), &error, g_settings.create_save_state_backups, false)) { diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index 1d117c580..294de2212 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -925,7 +925,7 @@ void SaveStateSelectorUI::RefreshList() { for (s32 i = 1; i <= System::PER_GAME_SAVE_STATE_SLOTS; i++) { - std::string path(System::GetGameSaveStateFileName(serial, i)); + std::string path(System::GetGameSaveStatePath(serial, i)); std::optional ssi = System::GetExtendedSaveStateInfo(path.c_str()); ListEntry li; @@ -949,7 +949,7 @@ void SaveStateSelectorUI::RefreshList() for (s32 i = 1; i <= System::GLOBAL_SAVE_STATE_SLOTS; i++) { - std::string path(System::GetGlobalSaveStateFileName(i)); + std::string path(System::GetGlobalSaveStatePath(i)); std::optional ssi = System::GetExtendedSaveStateInfo(path.c_str()); ListEntry li; @@ -1278,11 +1278,11 @@ std::string SaveStateSelectorUI::GetCurrentSlotPath() if (!s_state.current_slot_global) { if (const std::string& serial = GPUThread::GetGameSerial(); !serial.empty()) - filename = System::GetGameSaveStateFileName(serial, s_state.current_slot + 1); + filename = System::GetGameSaveStatePath(serial, s_state.current_slot + 1); } else { - filename = System::GetGlobalSaveStateFileName(s_state.current_slot + 1); + filename = System::GetGlobalSaveStatePath(s_state.current_slot + 1); } return filename; diff --git a/src/core/memory_card.h b/src/core/memory_card.h index 4dc705579..93a446040 100644 --- a/src/core/memory_card.h +++ b/src/core/memory_card.h @@ -27,8 +27,7 @@ public: const MemoryCardImage::DataArray& GetData() const { return m_data; } MemoryCardImage::DataArray& GetData() { return m_data; } - const std::string& GetFilename() const { return m_path; } - void SetFilename(std::string filename) { m_path = std::move(filename); } + const std::string& GetPath() const { return m_path; } void Reset(); bool DoState(StateWrapper& sw); diff --git a/src/core/pad.cpp b/src/core/pad.cpp index f252a00d9..7b7b7861d 100644 --- a/src/core/pad.cpp +++ b/src/core/pad.cpp @@ -533,7 +533,7 @@ MemoryCard* Pad::GetMemoryCard(u32 slot) void Pad::SetMemoryCard(u32 slot, std::unique_ptr dev) { INFO_LOG("Memory card slot {}: {}", slot, - dev ? (dev->GetFilename().empty() ? "" : dev->GetFilename().c_str()) : ""); + dev ? (dev->GetPath().empty() ? "" : dev->GetPath().c_str()) : ""); s_state.memory_cards[slot] = std::move(dev); } diff --git a/src/core/system.cpp b/src/core/system.cpp index 98758f5c3..0cb1af31a 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -109,7 +109,7 @@ SystemBootParameters::SystemBootParameters(const SystemBootParameters&) = defaul SystemBootParameters::SystemBootParameters(SystemBootParameters&& other) = default; -SystemBootParameters::SystemBootParameters(std::string filename_) : filename(std::move(filename_)) +SystemBootParameters::SystemBootParameters(std::string path_) : path(std::move(path_)) { } @@ -939,9 +939,9 @@ GameHash System::GetGameHashFromFile(const char* path) return GetGameHashFromBuffer(FileSystem::GetDisplayNameFromPath(path), data->cspan()); } -GameHash System::GetGameHashFromBuffer(const std::string_view filename, const std::span data) +GameHash System::GetGameHashFromBuffer(const std::string_view path, const std::span data) { - return GetGameHashFromBuffer(filename, data, IsoReader::ISOPrimaryVolumeDescriptor{}, 0); + return GetGameHashFromBuffer(path, data, IsoReader::ISOPrimaryVolumeDescriptor{}, 0); } std::string System::GetExecutableNameForImage(IsoReader& iso, bool strip_subdirectories) @@ -1630,7 +1630,7 @@ bool System::SaveResumeState(Error* error) return false; } - std::string path(GetGameSaveStateFileName(s_state.running_game_serial, -1)); + std::string path(GetGameSaveStatePath(s_state.running_game_serial, -1)); return SaveState(std::move(path), error, false, true); } @@ -1641,13 +1641,13 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error) // loading a state, so pull the media path from the save state to avoid a double change std::string state_media(GetMediaPathFromSaveState(parameters.save_state.c_str())); if (FileSystem::FileExists(state_media.c_str())) - parameters.filename = std::move(state_media); + parameters.path = std::move(state_media); } - if (parameters.filename.empty()) - INFO_LOG("Boot Filename: "); + if (parameters.path.empty()) + INFO_LOG("Boot Path: "); else - INFO_LOG("Boot Filename: {}", parameters.filename); + INFO_LOG("Boot Path: {}", parameters.path); // Load CD image up and detect region. std::unique_ptr disc; @@ -1656,21 +1656,21 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error) BootMode boot_mode = BootMode::FullBoot; std::string exe_override; std::unique_ptr gpu_dump; - if (!parameters.filename.empty()) + if (!parameters.path.empty()) { - if (IsExePath(parameters.filename)) + if (IsExePath(parameters.path)) { boot_mode = BootMode::BootEXE; - exe_override = parameters.filename; + exe_override = parameters.path; } - else if (IsPsfPath(parameters.filename)) + else if (IsPsfPath(parameters.path)) { boot_mode = BootMode::BootPSF; - exe_override = parameters.filename; + exe_override = parameters.path; } - else if (IsGPUDumpPath(parameters.filename)) + else if (IsGPUDumpPath(parameters.path)) { - gpu_dump = GPUDump::Player::Open(parameters.filename, error); + gpu_dump = GPUDump::Player::Open(parameters.path, error); if (!gpu_dump) return false; @@ -1679,25 +1679,25 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error) if (boot_mode == BootMode::BootEXE || boot_mode == BootMode::BootPSF) { - const DiscRegion file_region = ((boot_mode == BootMode::BootEXE) ? GetRegionForExe(parameters.filename.c_str()) : - GetRegionForPsf(parameters.filename.c_str())); + const DiscRegion file_region = ((boot_mode == BootMode::BootEXE) ? GetRegionForExe(parameters.path.c_str()) : + GetRegionForPsf(parameters.path.c_str())); INFO_LOG("EXE/PSF Region: {}", Settings::GetDiscRegionDisplayName(file_region)); auto_console_region = GetConsoleRegionForDiscRegion(file_region); } else if (boot_mode != BootMode::ReplayGPUDump) { - INFO_LOG("Loading CD image '{}'...", Path::GetFileName(parameters.filename)); - disc = CDImage::Open(parameters.filename.c_str(), g_settings.cdrom_load_image_patches, error); + INFO_LOG("Loading CD image '{}'...", Path::GetFileName(parameters.path)); + disc = CDImage::Open(parameters.path.c_str(), g_settings.cdrom_load_image_patches, error); if (!disc) { - Error::AddPrefixFmt(error, "Failed to open CD image '{}':\n", Path::GetFileName(parameters.filename)); + Error::AddPrefixFmt(error, "Failed to open CD image '{}':\n", Path::GetFileName(parameters.path)); return false; } - disc_region = GameList::GetCustomRegionForPath(parameters.filename).value_or(GetRegionForImage(disc.get())); + disc_region = GameList::GetCustomRegionForPath(parameters.path).value_or(GetRegionForImage(disc.get())); auto_console_region = GetConsoleRegionForDiscRegion(disc_region); INFO_LOG("Auto-detected console {} region for '{}' (region {})", - Settings::GetConsoleRegionName(auto_console_region), parameters.filename, + Settings::GetConsoleRegionName(auto_console_region), parameters.path, Settings::GetDiscRegionName(disc_region)); } } @@ -1706,7 +1706,7 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error) if (disc && parameters.media_playlist_index != 0 && !disc->SwitchSubImage(parameters.media_playlist_index, error)) { Error::AddPrefixFmt(error, "Failed to switch to subimage {} in '{}':\n", parameters.media_playlist_index, - Path::GetFileName(parameters.filename)); + Path::GetFileName(parameters.path)); return false; } @@ -1721,7 +1721,7 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error) FullscreenUI::OnSystemStarting(); // Update running game, this will apply settings as well. - UpdateRunningGame(disc ? disc->GetPath() : parameters.filename, disc.get(), true); + UpdateRunningGame(disc ? disc->GetPath() : parameters.path, disc.get(), true); Achievements::OnSystemStarting(disc.get(), parameters.disable_achievements_hardcore_mode); // Determine console region. Has to be done here, because gamesettings can override it. @@ -3881,8 +3881,8 @@ void System::UpdateMemoryCardTypes() std::unique_ptr card = GetMemoryCardForSlot(i, type); if (card) { - if (const std::string& filename = card->GetFilename(); !filename.empty()) - INFO_LOG("Memory Card Slot {}: {}", i + 1, filename); + if (const std::string& path = card->GetPath(); !path.empty()) + INFO_LOG("Memory Card Slot {}: {}", i + 1, path); Pad::SetMemoryCard(i, std::move(card)); } @@ -3902,8 +3902,8 @@ void System::UpdatePerGameMemoryCards() std::unique_ptr card = GetMemoryCardForSlot(i, type); if (card) { - if (const std::string& filename = card->GetFilename(); !filename.empty()) - INFO_LOG("Memory Card Slot {}: {}", i + 1, filename); + if (const std::string& path = card->GetPath(); !path.empty()) + INFO_LOG("Memory Card Slot {}: {}", i + 1, path); Pad::SetMemoryCard(i, std::move(card)); } @@ -4006,28 +4006,28 @@ void System::UpdateMultitaps() } } -bool System::DumpRAM(const char* filename) +bool System::DumpRAM(const char* path) { if (!IsValid()) return false; - return FileSystem::WriteBinaryFile(filename, Bus::g_unprotected_ram, Bus::g_ram_size); + return FileSystem::WriteBinaryFile(path, Bus::g_unprotected_ram, Bus::g_ram_size); } -bool System::DumpVRAM(const char* filename) +bool System::DumpVRAM(const char* path) { if (!IsValid()) return false; - return g_gpu.DumpVRAMToFile(filename); + return g_gpu.DumpVRAMToFile(path); } -bool System::DumpSPURAM(const char* filename) +bool System::DumpSPURAM(const char* path) { if (!IsValid()) return false; - return FileSystem::WriteBinaryFile(filename, SPU::GetRAM().data(), SPU::RAM_SIZE); + return FileSystem::WriteBinaryFile(path, SPU::GetRAM().data(), SPU::RAM_SIZE); } bool System::HasMedia() @@ -4035,7 +4035,7 @@ bool System::HasMedia() return CDROM::HasMedia(); } -std::string System::GetMediaFileName() +std::string System::GetMediaPath() { if (!CDROM::HasMedia()) return {}; @@ -5484,7 +5484,7 @@ void System::StopMediaCapture(std::unique_ptr cap) } } -std::string System::GetGameSaveStateFileName(std::string_view serial, s32 slot) +std::string System::GetGameSaveStatePath(std::string_view serial, s32 slot) { if (slot < 0) return Path::Combine(EmuFolders::SaveStates, fmt::format("{}_resume.sav", serial)); @@ -5492,7 +5492,7 @@ std::string System::GetGameSaveStateFileName(std::string_view serial, s32 slot) return Path::Combine(EmuFolders::SaveStates, fmt::format("{}_{}.sav", serial, slot)); } -std::string System::GetGlobalSaveStateFileName(s32 slot) +std::string System::GetGlobalSaveStatePath(s32 slot) { if (slot < 0) return Path::Combine(EmuFolders::SaveStates, "resume.sav"); @@ -5517,13 +5517,13 @@ std::vector System::GetAvailableSaveStates(std::string_view seria if (!serial.empty()) { - add_path(GetGameSaveStateFileName(serial, -1), -1, false); + add_path(GetGameSaveStatePath(serial, -1), -1, false); for (s32 i = 1; i <= PER_GAME_SAVE_STATE_SLOTS; i++) - add_path(GetGameSaveStateFileName(serial, i), i, false); + add_path(GetGameSaveStatePath(serial, i), i, false); } for (s32 i = 1; i <= GLOBAL_SAVE_STATE_SLOTS; i++) - add_path(GetGlobalSaveStateFileName(i), i, true); + add_path(GetGlobalSaveStatePath(i), i, true); return si; } @@ -5531,7 +5531,7 @@ std::vector System::GetAvailableSaveStates(std::string_view seria std::optional System::GetSaveStateInfo(std::string_view serial, s32 slot) { const bool global = serial.empty(); - std::string path = global ? GetGlobalSaveStateFileName(slot) : GetGameSaveStateFileName(serial, slot); + std::string path = global ? GetGlobalSaveStatePath(slot) : GetGameSaveStatePath(serial, slot); FlushSaveStates(); @@ -5705,17 +5705,6 @@ std::string System::GetMostRecentResumeSaveStatePath() return std::move(most_recent->FileName); } -std::string System::GetCheatFileName() -{ - std::string ret; - - const std::string& title = System::GetGameTitle(); - if (!title.empty()) - ret = Path::Combine(EmuFolders::Cheats, fmt::format("{}.cht", title.c_str())); - - return ret; -} - void System::ToggleWidescreen() { g_settings.gpu_widescreen_hack = !g_settings.gpu_widescreen_hack; diff --git a/src/core/system.h b/src/core/system.h index fb32f2b1c..3e9de9cb0 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -40,10 +40,10 @@ struct SystemBootParameters SystemBootParameters(); SystemBootParameters(const SystemBootParameters&); SystemBootParameters(SystemBootParameters&&); - SystemBootParameters(std::string filename_); + SystemBootParameters(std::string path_); ~SystemBootParameters(); - std::string filename; + std::string path; std::string save_state; std::string override_exe; std::optional override_fast_boot; @@ -147,7 +147,7 @@ bool GetGameDetailsFromImage(CDImage* cdi, std::string* out_id = nullptr, GameHa std::string* out_executable_name = nullptr, std::vector* out_executable_data = nullptr); GameHash GetGameHashFromFile(const char* path); -GameHash GetGameHashFromBuffer(const std::string_view filename, const std::span data); +GameHash GetGameHashFromBuffer(const std::string_view path, const std::span data); DiscRegion GetRegionForSerial(const std::string_view serial); DiscRegion GetRegionFromSystemArea(CDImage* cdi); DiscRegion GetRegionForImage(CDImage* cdi); @@ -298,16 +298,16 @@ bool IsSavingMemoryCards(); void SwapMemoryCards(); /// Dumps RAM to a file. -bool DumpRAM(const char* filename); +bool DumpRAM(const char* path); /// Dumps video RAM to a file. -bool DumpVRAM(const char* filename); +bool DumpVRAM(const char* path); /// Dumps sound RAM to a file. -bool DumpSPURAM(const char* filename); +bool DumpSPURAM(const char* path); bool HasMedia(); -std::string GetMediaFileName(); +std::string GetMediaPath(); bool InsertMedia(const char* path); void RemoveMedia(); @@ -347,17 +347,14 @@ void SetRewindState(bool enabled); void DoFrameStep(); /// Returns the path to a save state file. Specifying an index of -1 is the "resume" save state. -std::string GetGameSaveStateFileName(std::string_view serial, s32 slot); +std::string GetGameSaveStatePath(std::string_view serial, s32 slot); /// Returns the path to a save state file. Specifying an index of -1 is the "resume" save state. -std::string GetGlobalSaveStateFileName(s32 slot); +std::string GetGlobalSaveStatePath(s32 slot); /// Returns the most recent resume save state. std::string GetMostRecentResumeSaveStatePath(); -/// Returns the path to the cheat file for the specified game title. -std::string GetCheatFileName(); - /// Powers off the system, optionally saving the resume state. void ShutdownSystem(bool save_resume_state); diff --git a/src/duckstation-mini/mini_host.cpp b/src/duckstation-mini/mini_host.cpp index 146ff21e1..7fed49d08 100644 --- a/src/duckstation-mini/mini_host.cpp +++ b/src/duckstation-mini/mini_host.cpp @@ -1707,9 +1707,9 @@ bool MiniHost::ParseCommandLineParametersAndInitializeConfig(int argc, char* arg #undef CHECK_ARG_PARAM } - if (autoboot && !autoboot->filename.empty()) - autoboot->filename += ' '; - AutoBoot(autoboot)->filename += argv[i]; + if (autoboot && !autoboot->path.empty()) + autoboot->path += ' '; + AutoBoot(autoboot)->path += argv[i]; } // To do anything useful, we need the config initialized. @@ -1722,9 +1722,9 @@ bool MiniHost::ParseCommandLineParametersAndInitializeConfig(int argc, char* arg // Check the file we're starting actually exists. - if (autoboot && !autoboot->filename.empty() && !FileSystem::FileExists(autoboot->filename.c_str())) + if (autoboot && !autoboot->path.empty() && !FileSystem::FileExists(autoboot->path.c_str())) { - Host::ReportFatalError("Error", fmt::format("File '{}' does not exist.", autoboot->filename)); + Host::ReportFatalError("Error", fmt::format("File '{}' does not exist.", autoboot->path)); return false; } @@ -1732,19 +1732,19 @@ bool MiniHost::ParseCommandLineParametersAndInitializeConfig(int argc, char* arg { AutoBoot(autoboot); - if (autoboot->filename.empty()) + if (autoboot->path.empty()) { // loading global state, -1 means resume the last game if (state_index.value() < 0) autoboot->save_state = System::GetMostRecentResumeSaveStatePath(); else - autoboot->save_state = System::GetGlobalSaveStateFileName(state_index.value()); + autoboot->save_state = System::GetGlobalSaveStatePath(state_index.value()); } else { // loading game state - const std::string game_serial(GameDatabase::GetSerialForPath(autoboot->filename.c_str())); - autoboot->save_state = System::GetGameSaveStateFileName(game_serial, state_index.value()); + const std::string game_serial(GameDatabase::GetSerialForPath(autoboot->path.c_str())); + autoboot->save_state = System::GetGameSaveStatePath(game_serial, state_index.value()); } if (autoboot->save_state.empty() || !FileSystem::FileExists(autoboot->save_state.c_str())) @@ -1756,7 +1756,7 @@ bool MiniHost::ParseCommandLineParametersAndInitializeConfig(int argc, char* arg // check autoboot parameters, if we set something like fullscreen without a bios // or disc, we don't want to actually start. - if (autoboot && autoboot->filename.empty() && autoboot->save_state.empty() && !starting_bios) + if (autoboot && autoboot->path.empty() && autoboot->save_state.empty() && !starting_bios) autoboot.reset(); // if we don't have autoboot, we definitely don't want batch mode (because that'll skip diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 830e97252..638e9025f 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1154,7 +1154,7 @@ void MainWindow::startFileOrChangeDisc(const QString& path) std::optional save_path; if (!serial.empty()) { - std::string resume_path(System::GetGameSaveStateFileName(serial.c_str(), -1)); + std::string resume_path(System::GetGameSaveStatePath(serial.c_str(), -1)); std::optional resume = promptForResumeState(resume_path); if (!resume.has_value()) { @@ -1421,7 +1421,7 @@ void MainWindow::onGameListEntryActivated() std::optional save_path; if (!entry->serial.empty()) { - std::string resume_path(System::GetGameSaveStateFileName(entry->serial.c_str(), -1)); + std::string resume_path(System::GetGameSaveStatePath(entry->serial.c_str(), -1)); std::optional resume = promptForResumeState(resume_path); if (!resume.has_value()) { diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index 3870551c0..19b6818c9 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -1481,8 +1481,8 @@ void EmuThread::loadState(bool global, qint32 slot) if (!global && System::GetGameSerial().empty()) return; - bootOrLoadState(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetGameSerial(), slot)); + bootOrLoadState(global ? System::GetGlobalSaveStatePath(slot) : + System::GetGameSaveStatePath(System::GetGameSerial(), slot)); } void EmuThread::saveState(const QString& filename, bool block_until_done /* = false */) @@ -1515,10 +1515,10 @@ void EmuThread::saveState(bool global, qint32 slot, bool block_until_done /* = f return; Error error; - if (!System::SaveState((global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetGameSerial(), slot)) - .c_str(), - &error, g_settings.create_save_state_backups, false)) + if (!System::SaveState( + (global ? System::GetGlobalSaveStatePath(slot) : System::GetGameSaveStatePath(System::GetGameSerial(), slot)) + .c_str(), + &error, g_settings.create_save_state_backups, false)) { emit errorReported(tr("Error"), tr("Failed to save state: %1").arg(QString::fromStdString(error.GetDescription()))); } @@ -2866,9 +2866,9 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, #undef CHECK_ARG_PARAM } - if (autoboot && !autoboot->filename.empty()) - autoboot->filename += ' '; - AutoBoot(autoboot)->filename += args[i].toStdString(); + if (autoboot && !autoboot->path.empty()) + autoboot->path += ' '; + AutoBoot(autoboot)->path += args[i].toStdString(); } // To do anything useful, we need the config initialized. @@ -2881,11 +2881,11 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, // Check the file we're starting actually exists. - if (autoboot && !autoboot->filename.empty() && !FileSystem::FileExists(autoboot->filename.c_str())) + if (autoboot && !autoboot->path.empty() && !FileSystem::FileExists(autoboot->path.c_str())) { QMessageBox::critical( nullptr, qApp->translate("QtHost", "Error"), - qApp->translate("QtHost", "File '%1' does not exist.").arg(QString::fromStdString(autoboot->filename))); + qApp->translate("QtHost", "File '%1' does not exist.").arg(QString::fromStdString(autoboot->path))); return false; } @@ -2893,19 +2893,19 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, { AutoBoot(autoboot); - if (autoboot->filename.empty()) + if (autoboot->path.empty()) { // loading global state, -1 means resume the last game if (state_index.value() < 0) autoboot->save_state = System::GetMostRecentResumeSaveStatePath(); else - autoboot->save_state = System::GetGlobalSaveStateFileName(state_index.value()); + autoboot->save_state = System::GetGlobalSaveStatePath(state_index.value()); } else { // loading game state - const std::string game_serial(GameDatabase::GetSerialForPath(autoboot->filename.c_str())); - autoboot->save_state = System::GetGameSaveStateFileName(game_serial, state_index.value()); + const std::string game_serial = GameDatabase::GetSerialForPath(autoboot->path.c_str()); + autoboot->save_state = System::GetGameSaveStatePath(game_serial, state_index.value()); } if (autoboot->save_state.empty() || !FileSystem::FileExists(autoboot->save_state.c_str())) @@ -2918,7 +2918,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, // check autoboot parameters, if we set something like fullscreen without a bios // or disc, we don't want to actually start. - if (autoboot && autoboot->filename.empty() && autoboot->save_state.empty() && !starting_bios) + if (autoboot && autoboot->path.empty() && autoboot->save_state.empty() && !starting_bios) autoboot.reset(); // if we don't have autoboot, we definitely don't want batch mode (because that'll skip diff --git a/src/duckstation-regtest/regtest_host.cpp b/src/duckstation-regtest/regtest_host.cpp index f42cf8fbb..2dd5ec0b3 100644 --- a/src/duckstation-regtest/regtest_host.cpp +++ b/src/duckstation-regtest/regtest_host.cpp @@ -912,9 +912,9 @@ bool RegTestHost::ParseCommandLineParameters(int argc, char* argv[], std::option #undef CHECK_ARG_PARAM } - if (autoboot && !autoboot->filename.empty()) - autoboot->filename += ' '; - AutoBoot(autoboot)->filename += argv[i]; + if (autoboot && !autoboot->path.empty()) + autoboot->path += ' '; + AutoBoot(autoboot)->path += argv[i]; } return true; @@ -971,13 +971,13 @@ int main(int argc, char* argv[]) if (!RegTestHost::ParseCommandLineParameters(argc, argv, autoboot)) return EXIT_FAILURE; - if (!autoboot || autoboot->filename.empty()) + if (!autoboot || autoboot->path.empty()) { ERROR_LOG("No boot path specified."); return EXIT_FAILURE; } - if (!RegTestHost::SetNewDataRoot(autoboot->filename)) + if (!RegTestHost::SetNewDataRoot(autoboot->path)) return EXIT_FAILURE; // Only one async worker. @@ -992,7 +992,7 @@ int main(int argc, char* argv[]) Error error; int result = -1; - INFO_LOG("Trying to boot '{}'...", autoboot->filename); + INFO_LOG("Trying to boot '{}'...", autoboot->path); if (!System::BootSystem(std::move(autoboot.value()), &error)) { ERROR_LOG("Failed to boot system: {}", error.GetDescription());