mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
Savestates: Facilitate multi slots
This commit is contained in:
parent
12fe55a258
commit
fce8e0fef0
3 changed files with 30 additions and 7 deletions
|
|
@ -146,9 +146,25 @@ bool is_savestate_version_compatible(const std::vector<std::pair<u16, u16>>& dat
|
|||
return ok;
|
||||
}
|
||||
|
||||
std::string get_savestate_path(std::string_view title_id, std::string_view boot_path)
|
||||
std::string get_savestate_file(std::string_view title_id, std::string_view boot_path, s64 abs_id, s64 rel_id)
|
||||
{
|
||||
return fs::get_cache_dir() + "/savestates/" + std::string{title_id.empty() ? boot_path.substr(boot_path.find_last_of(fs::delim) + 1) : title_id} + ".SAVESTAT";
|
||||
const std::string title = std::string{title_id.empty() ? boot_path.substr(boot_path.find_last_of(fs::delim) + 1) : title_id};
|
||||
|
||||
if (abs_id == -1 && rel_id == -1)
|
||||
{
|
||||
// Return directory
|
||||
return fs::get_cache_dir() + "/savestates/" + title + "/";
|
||||
}
|
||||
|
||||
ensure(rel_id < 0 || abs_id >= 0, "Unimplemented!");
|
||||
|
||||
const std::string save_id = fmt::format("%d", abs_id);
|
||||
|
||||
// Make sure that savestate file with higher IDs are placed at the bottom of "by name" file ordering in directory view by adding a single character prefix which tells the ID length
|
||||
// While not needing to keep a 59 chars long suffix at all times for this purpose
|
||||
const char prefix = ::at32("0123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"sv, save_id.size());
|
||||
|
||||
return fs::get_cache_dir() + "/savestates/" + title + "/" + title + '_' + prefix + '_' + save_id + ".SAVESTAT";
|
||||
}
|
||||
|
||||
bool is_savestate_compatible(const fs::file& file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue