System: Remove unused function

And rename instances of "filename" to "path".
This commit is contained in:
Stenzek 2025-04-14 21:52:29 +10:00
parent a0de2febad
commit 4c1aba62fc
No known key found for this signature in database
11 changed files with 99 additions and 114 deletions

View File

@ -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)]() {

View File

@ -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))
{

View File

@ -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<ExtendedSaveStateInfo> 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<ExtendedSaveStateInfo> 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;

View File

@ -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);

View File

@ -533,7 +533,7 @@ MemoryCard* Pad::GetMemoryCard(u32 slot)
void Pad::SetMemoryCard(u32 slot, std::unique_ptr<MemoryCard> dev)
{
INFO_LOG("Memory card slot {}: {}", slot,
dev ? (dev->GetFilename().empty() ? "<no file configured>" : dev->GetFilename().c_str()) : "<unplugged>");
dev ? (dev->GetPath().empty() ? "<no file configured>" : dev->GetPath().c_str()) : "<unplugged>");
s_state.memory_cards[slot] = std::move(dev);
}

View File

@ -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<const u8> data)
GameHash System::GetGameHashFromBuffer(const std::string_view path, const std::span<const u8> 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: <BIOS/Shell>");
if (parameters.path.empty())
INFO_LOG("Boot Path: <BIOS/Shell>");
else
INFO_LOG("Boot Filename: {}", parameters.filename);
INFO_LOG("Boot Path: {}", parameters.path);
// Load CD image up and detect region.
std::unique_ptr<CDImage> disc;
@ -1656,21 +1656,21 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
BootMode boot_mode = BootMode::FullBoot;
std::string exe_override;
std::unique_ptr<GPUDump::Player> 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<MemoryCard> 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<MemoryCard> 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<MediaCapture> 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<SaveStateInfo> 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<SaveStateInfo> System::GetAvailableSaveStates(std::string_view seria
std::optional<SaveStateInfo> 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;

View File

@ -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<bool> 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<u8>* out_executable_data = nullptr);
GameHash GetGameHashFromFile(const char* path);
GameHash GetGameHashFromBuffer(const std::string_view filename, const std::span<const u8> data);
GameHash GetGameHashFromBuffer(const std::string_view path, const std::span<const u8> 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);

View File

@ -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

View File

@ -1154,7 +1154,7 @@ void MainWindow::startFileOrChangeDisc(const QString& path)
std::optional<std::string> 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<bool> resume = promptForResumeState(resume_path);
if (!resume.has_value())
{
@ -1421,7 +1421,7 @@ void MainWindow::onGameListEntryActivated()
std::optional<std::string> 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<bool> resume = promptForResumeState(resume_path);
if (!resume.has_value())
{

View File

@ -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

View File

@ -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());