HostInterface: Add helper methods for getting paths to save states/memcards
This commit is contained in:
parent
a83cad5872
commit
b5e73a0be4
|
@ -474,7 +474,10 @@ void HostInterface::CreateUserDirectorySubdirectories()
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
|
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("bios").c_str(), false);
|
||||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("cache").c_str(), false);
|
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("cache").c_str(), false);
|
||||||
|
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("savestates").c_str(), false);
|
||||||
|
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("memcards").c_str(), false);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
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.");
|
||||||
|
@ -513,6 +516,32 @@ std::string HostInterface::GetGameListDatabaseFileName() const
|
||||||
return GetUserDirectoryRelativePath("cache/redump.dat");
|
return GetUserDirectoryRelativePath("cache/redump.dat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string HostInterface::GetGameSaveStateFileName(const char* game_code, s32 slot)
|
||||||
|
{
|
||||||
|
if (slot < 0)
|
||||||
|
return GetUserDirectoryRelativePath("savestates/%s_resume.sav", game_code);
|
||||||
|
else
|
||||||
|
return GetUserDirectoryRelativePath("savestates/%s_%d.sav", game_code, slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HostInterface::GetGlobalSaveStateFileName(s32 slot)
|
||||||
|
{
|
||||||
|
if (slot < 0)
|
||||||
|
return GetUserDirectoryRelativePath("savestates/resume.sav");
|
||||||
|
else
|
||||||
|
return GetUserDirectoryRelativePath("savestates/savestate_%d.sav", slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HostInterface::GetSharedMemoryCardPath(u32 slot)
|
||||||
|
{
|
||||||
|
return GetUserDirectoryRelativePath("memcards/shared_card_%d.mcd", slot + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HostInterface::GetGameMemoryCardPath(const char* game_code, u32 slot)
|
||||||
|
{
|
||||||
|
return GetUserDirectoryRelativePath("memcards/game_card_%s_%d.mcd", game_code, slot + 1);
|
||||||
|
}
|
||||||
|
|
||||||
void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
|
void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
|
||||||
{
|
{
|
||||||
const GPURenderer old_gpu_renderer = m_settings.gpu_renderer;
|
const GPURenderer old_gpu_renderer = m_settings.gpu_renderer;
|
||||||
|
|
|
@ -104,6 +104,18 @@ protected:
|
||||||
/// Returns the path of the game database cache file.
|
/// Returns the path of the game database cache file.
|
||||||
std::string GetGameListDatabaseFileName() const;
|
std::string GetGameListDatabaseFileName() const;
|
||||||
|
|
||||||
|
/// Returns the path to a save state file. Specifying an index of -1 is the "resume" save state.
|
||||||
|
std::string GetGameSaveStateFileName(const char* game_code, 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);
|
||||||
|
|
||||||
|
/// Returns the default path to a memory card.
|
||||||
|
std::string GetSharedMemoryCardPath(u32 slot);
|
||||||
|
|
||||||
|
/// Returns the default path to a memory card for a specific game.
|
||||||
|
std::string GetGameMemoryCardPath(const char* game_code, u32 slot);
|
||||||
|
|
||||||
/// Applies new settings, updating internal state as needed. apply_callback should call m_settings.Load() after
|
/// Applies new settings, updating internal state as needed. apply_callback should call m_settings.Load() after
|
||||||
/// locking any required mutexes.
|
/// locking any required mutexes.
|
||||||
void UpdateSettings(const std::function<void()>& apply_callback);
|
void UpdateSettings(const std::function<void()>& apply_callback);
|
||||||
|
|
Loading…
Reference in New Issue