GS: Rearrange GS Dump names to be less annoying to navigate

This commit is contained in:
refractionpcsx2 2022-07-30 05:27:57 +01:00
parent f6bcd8a2c2
commit f218e11d78
1 changed files with 21 additions and 16 deletions

View File

@ -762,6 +762,23 @@ void GSRenderer::QueueSnapshot(const std::string& path, u32 gsdump_frames)
}
else
{
m_snapshot = "";
// append the game serial and title
if (std::string name(GetDumpName()); !name.empty())
{
Path::SanitizeFileName(name);
if (name.length() > 219)
name.resize(219);
m_snapshot += name;
}
if (std::string serial(GetDumpSerial()); !serial.empty())
{
Path::SanitizeFileName(serial);
m_snapshot += '_';
m_snapshot += serial;
}
time_t cur_time = time(nullptr);
char local_time[16];
@ -774,30 +791,18 @@ void GSRenderer::QueueSnapshot(const std::string& path, u32 gsdump_frames)
// the captured image is the 2nd image captured at this specific time.
static int n = 2;
m_snapshot += '_';
if (cur_time == prev_snap)
m_snapshot = fmt::format("gs_{0}_({1})", local_time, n++);
m_snapshot += fmt::format("{0}_({1})", local_time, n++);
else
{
n = 2;
m_snapshot = fmt::format("gs_{}", local_time);
m_snapshot += fmt::format("{}", local_time);
}
prev_snap = cur_time;
}
// append the game serial and title
if (std::string name(GetDumpName()); !name.empty())
{
Path::SanitizeFileName(name);
m_snapshot += '_';
m_snapshot += name;
}
if (std::string serial(GetDumpSerial()); !serial.empty())
{
Path::SanitizeFileName(serial);
m_snapshot += '_';
m_snapshot += serial;
}
// prepend snapshots directory
m_snapshot = Path::Combine(EmuFolders::Snapshots, m_snapshot);
}