Improve display of homebrew without an icon in the game browser

This commit is contained in:
Henrik Rydgård
2026-02-10 11:06:57 +01:00
parent ab437becf8
commit 2bc43810a8
8 changed files with 28 additions and 22 deletions
-1
View File
@@ -2869,7 +2869,6 @@ set(NativeAssets
assets/ppge_atlas.zim
assets/ppge_atlas.meta
assets/rargray.png
assets/unknown.png
assets/zip.png
assets/sfx_back.wav
assets/sfx_confirm.wav
+7 -10
View File
@@ -630,8 +630,7 @@ public:
} else if (File::Exists(screenshot_jpg)) {
ReadLocalFileToString(screenshot_jpg, &info_->icon.data, &info_->lock);
} else {
// Read standard icon
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
// No icon.
}
}
info_->icon.dataLoaded = true;
@@ -688,9 +687,7 @@ handleELF:
} else if (File::Exists(screenshot_jpg)) {
ReadLocalFileToString(screenshot_jpg, &info_->icon.data, &info_->lock);
} else {
// Read standard icon
VERBOSE_LOG(Log::Loader, "Loading unknown.png because there was an ELF");
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
// No icon
}
info_->icon.dataLoaded = true;
}
@@ -854,13 +851,13 @@ handleELF:
Path screenshot_jpg = GetSysDirectory(DIRECTORY_SCREENSHOT) / (info_->id + "_00000.jpg");
Path screenshot_png = GetSysDirectory(DIRECTORY_SCREENSHOT) / (info_->id + "_00000.png");
// Try using png/jpg screenshots first
if (File::Exists(screenshot_png))
if (File::Exists(screenshot_png)) {
info_->icon.dataLoaded = ReadLocalFileToString(screenshot_png, &info_->icon.data, &info_->lock);
else if (File::Exists(screenshot_jpg))
} else if (File::Exists(screenshot_jpg)) {
info_->icon.dataLoaded = ReadLocalFileToString(screenshot_jpg, &info_->icon.data, &info_->lock);
else {
DEBUG_LOG(Log::Loader, "Loading unknown.png because no icon was found");
info_->icon.dataLoaded = ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
} else {
// This should be very rare.
info_->icon.dataLoaded = true;
}
}
}
+2 -2
View File
@@ -187,14 +187,14 @@ void GameScreen::CreateContentViews(UI::ViewGroup *parent) {
if (portrait) {
mainGameInfo = new LinearLayout(ORIENT_VERTICAL);
leftColumn->Add(new Spacer(8.0f));
if (fileTypeHasIcon) {
if (fileTypeHasIcon && !(info_->icon.dataLoaded && info_->icon.data.empty())) {
leftColumn->Add(new GameImageView(gamePath_, GameInfoFlags::ICON, 2.0f, new LinearLayoutParams(UI::Margins(0))));
}
leftColumn->Add(mainGameInfo);
} else {
mainGameInfo = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
ViewGroup *badgeHolder = new LinearLayout(ORIENT_HORIZONTAL);
if (fileTypeHasIcon) {
if (fileTypeHasIcon && !(info_->icon.dataLoaded && info_->icon.data.empty())) {
badgeHolder->Add(new GameImageView(gamePath_, GameInfoFlags::ICON, 2.0f, new LinearLayoutParams(144 * 2, 80 * 2, UI::Margins(0))));
}
badgeHolder->Add(mainGameInfo);
+8 -3
View File
@@ -295,7 +295,7 @@ void GameButton::Draw(UIContext &dc) {
bool drawBackground = true;
switch (ginfo->fileType) {
case IdentifiedFileType::PSP_ELF: imageIcon = ImageID("I_DEBUGGER"); drawBackground = false; break;
case IdentifiedFileType::UNKNOWN_ELF: imageIcon = ImageID("I_DEBUGGER"); break;
case IdentifiedFileType::UNKNOWN_ELF: imageIcon = ImageID("I_CROSS"); drawBackground = false; break;
case IdentifiedFileType::PPSSPP_GE_DUMP: imageIcon = ImageID("I_DISPLAY"); break;
case IdentifiedFileType::PSX_ISO:
case IdentifiedFileType::PSP_PS1_PBP: imageIcon = ImageID("I_PSX_ISO"); break;
@@ -325,8 +325,13 @@ void GameButton::Draw(UIContext &dc) {
}
}
if (ginfo->Ready(GameInfoFlags::ICON) && ginfo->icon.texture && drawBackground) {
texture = ginfo->icon.texture;
if (ginfo->Ready(GameInfoFlags::ICON)) {
if (ginfo->icon.texture && drawBackground) {
texture = ginfo->icon.texture;
} else if (drawBackground) {
// No icon, but drawBackground is set. Let's show a plain icon.
imageIcon = ImageID("I_APP");
}
}
int x = bounds_.x;
+1
View File
@@ -179,6 +179,7 @@ static const ImageMeta imageIDs[] = {
{"I_PS3_ISO", false},
{"I_UNKNOWN_ISO", false},
{"I_UMD_VIDEO_ISO", false},
{"I_APP", false},
};
static std::string PNGNameFromID(std::string_view id) {
-1
View File
@@ -1,7 +1,6 @@
mkdir -p assets
cp ../assets/7z.png assets/
cp ../assets/rargray.png assets/
cp ../assets/unknown.png assets/
cp ../assets/zip.png assets/
cp ../assets/*.zim assets/
cp ../assets/*.meta assets/
+10 -5
View File
@@ -25,8 +25,8 @@
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
inkscape:zoom="2.8284275"
inkscape:cx="86.797346"
inkscape:cy="251.19965"
inkscape:cx="173.06436"
inkscape:cy="581.41847"
inkscape:window-width="3840"
inkscape:window-height="2071"
inkscape:window-x="-9"
@@ -4354,11 +4354,11 @@
id="path3-5"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.0196305" /><path
class="st0"
d="m 16.377843,157.05281 v -0.6842 l -1.562555,1.04183 1.562555,0.91158 v -0.57043 c 0.805269,0.0887 1.526259,0.45089 2.070407,0.99451 0.628914,0.62942 1.016867,1.49539 1.017055,2.45548 h 0.694538 c -1.77e-4,-2.17163 -1.661056,-3.9541 -3.782,-4.14877 z"
d="m 16.003666,157.05281 v -0.6842 l -1.562555,1.04183 1.562555,0.91158 v -0.57043 c 0.805269,0.0887 1.526259,0.45089 2.070407,0.99451 0.628914,0.62942 1.016867,1.49539 1.017055,2.45548 h 0.694538 c -1.77e-4,-2.17163 -1.661056,-3.9541 -3.782,-4.14877 z"
id="path115"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.018787" /><path
class="st0"
d="m 15.654148,164.60529 c -1.73874,-0.16787 -3.110006,-1.6214 -3.133923,-3.40846 l -0.694537,0.01 c 0.03,2.17129 1.714486,3.93038 3.837778,4.09638 l 0.0093,0.68486 1.548315,-1.063 -1.574766,-0.89023 z"
d="m 15.279971,164.60529 c -1.73874,-0.16787 -3.110006,-1.6214 -3.133923,-3.40846 l -0.694537,0.01 c 0.03,2.17129 1.714486,3.93038 3.837778,4.09638 l 0.0093,0.68486 1.548315,-1.063 -1.574766,-0.89023 z"
id="path116"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.018787" /><g
id="I_DEVICE_ROTATION_PORTRAIT"><path
@@ -4526,7 +4526,12 @@
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#ffffff;stroke:none;marker:none;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="m 262.23828,244.68945 v 28.26953 h 9.06836 v -28.26953 z m 2.13086,2.13086 h 4.80664 v 24.00586 h -4.80664 z"
id="rect119"
transform="matrix(0.9517119,0,0,0.85404454,27.341328,63.169462)" /></g></g><path
transform="matrix(0.9517119,0,0,0.85404454,27.341328,63.169462)" /></g><g
id="g143"
transform="translate(-37.785833,89.847195)" /><path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0;stroke-dasharray:none"
d="m 21.130025,157.71074 v 9.26041 h 9.260417 v -9.26041 z m 0.79375,0.52916 h 4.233334 v 0.72761 h -4.233334 z m 0,1.32292 h 7.672917 v 6.61458 h -7.672917 z"
id="I_APP" /></g><path
id="I_GEAR"
style="fill:#ececec;fill-opacity:1;stroke-width:0.019487"
class="st0"

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB