Read a frame dump's game ID after a leading issue number in its name

Dumps before version 4 don't store the game ID, so it's taken from the file
name, which PPSSPP writes as ULUS10064_0001.ppdmp. The ppsspp-framedumps
collection prefixes the GitHub issue number ("11928 ULUS10064_0001 OutRun
water.ppdmp"); skip that, so those dumps get their compat settings too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-08 12:33:09 +02:00
1 parent 8e596032f1
commit ec8a590c81
3 files changed
+56 -6

No files matched your search

+28 -6
View File
@@ -226,15 +226,37 @@ bool DiscIDFromGEDumpPath(const Path &path, FileLoader *fileLoader, std::string
}
}
// Fall back to using the filename.
std::string filename = path.GetFilename();
// Could be more discerning, but hey..
if (filename.size() > 10 && (filename[0] == 'U' || filename[0] == 'N') && filename[9] == '_') {
*id = filename.substr(0, 9);
return true;
// Fall back to the file name.
return DiscIDFromGEDumpFilename(path.GetFilename(), id);
}
// PPSSPP names dumps ULUS10064_0001.ppdmp; the ppsspp-framedumps collection puts the GitHub issue number in
// front ("11928 ULUS10064_0001 OutRun water.ppdmp").
bool DiscIDFromGEDumpFilename(std::string_view filename, std::string *id) {
size_t start = 0;
while (start < filename.size() && filename[start] >= '0' && filename[start] <= '9') {
start++;
}
if (start > 0 && start < filename.size() && filename[start] == ' ') {
start++;
} else {
start = 0;
}
// The ID is followed by _NNNN, the extension, a description, or nothing.
if (filename.size() < start + 9) {
return false;
}
if (filename.size() > start + 9 && filename[start + 9] != '_' && filename[start + 9] != '.' && filename[start + 9] != ' ') {
return false;
}
for (size_t i = 0; i < 9; i++) {
const char c = filename[start + i];
if (i < 4 ? !(c >= 'A' && c <= 'Z') : !(c >= '0' && c <= '9')) {
return false;
}
}
*id = std::string(filename.substr(start, 9));
return true;
}
static void GetBootError(IdentifiedFileType type, std::string *errorString) {