mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Try using first screenshot as an icon if no icon is present.
This commit is contained in:
parent
939b26475d
commit
737152f9ef
1 changed files with 36 additions and 9 deletions
|
@ -421,8 +421,16 @@ public:
|
||||||
std::lock_guard<std::mutex> lock(info_->lock);
|
std::lock_guard<std::mutex> lock(info_->lock);
|
||||||
pbp.GetSubFileAsString(PBP_ICON0_PNG, &info_->icon.data);
|
pbp.GetSubFileAsString(PBP_ICON0_PNG, &info_->icon.data);
|
||||||
} else {
|
} else {
|
||||||
// Read standard icon
|
std::string screenshot_jpg = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.jpg";
|
||||||
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
|
std::string screenshot_png = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.png";
|
||||||
|
// Try using png/jpg screenshots first
|
||||||
|
if (File::Exists(screenshot_png))
|
||||||
|
readFileToString(false, screenshot_png.c_str(), info_->icon.data);
|
||||||
|
else if (File::Exists(screenshot_jpg))
|
||||||
|
readFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
|
||||||
|
else
|
||||||
|
// Read standard icon
|
||||||
|
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
|
||||||
}
|
}
|
||||||
info_->icon.dataLoaded = true;
|
info_->icon.dataLoaded = true;
|
||||||
|
|
||||||
|
@ -459,11 +467,21 @@ handleELF:
|
||||||
|
|
||||||
info_->paramSFOLoaded = true;
|
info_->paramSFOLoaded = true;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
// Read standard icon
|
std::string screenshot_jpg = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.jpg";
|
||||||
DEBUG_LOG(LOADER, "Loading unknown.png because there was an ELF");
|
std::string screenshot_png = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.png";
|
||||||
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
|
// Try using png/jpg screenshots first
|
||||||
info_->icon.dataLoaded = true;
|
if (File::Exists(screenshot_png))
|
||||||
|
readFileToString(false, screenshot_png.c_str(), info_->icon.data);
|
||||||
|
else if (File::Exists(screenshot_jpg))
|
||||||
|
readFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
|
||||||
|
else {
|
||||||
|
// Read standard icon
|
||||||
|
DEBUG_LOG(LOADER, "Loading unknown.png because there was an ELF");
|
||||||
|
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
|
||||||
|
}
|
||||||
|
info_->icon.dataLoaded = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||||
|
@ -570,8 +588,17 @@ handleELF:
|
||||||
|
|
||||||
// Fall back to unknown icon if ISO is broken/is a homebrew ISO, override is allowed though
|
// Fall back to unknown icon if ISO is broken/is a homebrew ISO, override is allowed though
|
||||||
if (!ReadFileToString(&umd, "/PSP_GAME/ICON0.PNG", &info_->icon.data, &info_->lock)) {
|
if (!ReadFileToString(&umd, "/PSP_GAME/ICON0.PNG", &info_->icon.data, &info_->lock)) {
|
||||||
DEBUG_LOG(LOADER, "Loading unknown.png because no icon was found");
|
std::string screenshot_jpg = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.jpg";
|
||||||
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
|
std::string screenshot_png = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.png";
|
||||||
|
// Try using png/jpg screenshots first
|
||||||
|
if (File::Exists(screenshot_png))
|
||||||
|
readFileToString(false, screenshot_png.c_str(), info_->icon.data);
|
||||||
|
else if (File::Exists(screenshot_jpg))
|
||||||
|
readFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
|
||||||
|
else {
|
||||||
|
DEBUG_LOG(LOADER, "Loading unknown.png because no icon was found");
|
||||||
|
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
info_->icon.dataLoaded = true;
|
info_->icon.dataLoaded = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue