mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-15 09:35:27 +00:00
UI: Fix empty homebrew icon (#5189)
* UI: Fix empty homebrew icon We currently don't check the icon size when we read it from the homebrew data. That could cause issues at UI side since the buffer isn't null but empty. Extra check have been added UI side too. (I cleaned up some files during my research too) Fixes #5188 * Remove additional check * Remove unused using
This commit is contained in:
parent
6966211e07
commit
b8f48bcf64
|
@ -21,6 +21,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||||
if (value is byte[] buffer && targetType == typeof(IImage))
|
if (value is byte[] buffer && targetType == typeof(IImage))
|
||||||
{
|
{
|
||||||
MemoryStream mem = new(buffer);
|
MemoryStream mem = new(buffer);
|
||||||
|
|
||||||
return new Bitmap(mem);
|
return new Bitmap(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@ using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.HLE.HOS;
|
|
||||||
using Ryujinx.Modules;
|
using Ryujinx.Modules;
|
||||||
using Ryujinx.Ui.App.Common;
|
|
||||||
using Ryujinx.Ui.Common;
|
using Ryujinx.Ui.Common;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
using Ryujinx.Ui.Common.Helper;
|
using Ryujinx.Ui.Common.Helper;
|
||||||
|
|
|
@ -343,7 +343,14 @@ namespace Ryujinx.Ui.App.Common
|
||||||
ulong nacpSize = reader.ReadUInt64();
|
ulong nacpSize = reader.ReadUInt64();
|
||||||
|
|
||||||
// Reads and stores game icon as byte array
|
// Reads and stores game icon as byte array
|
||||||
|
if (iconSize > 0)
|
||||||
|
{
|
||||||
applicationIcon = Read(assetOffset + iconOffset, (int)iconSize);
|
applicationIcon = Read(assetOffset + iconOffset, (int)iconSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
applicationIcon = _nroIcon;
|
||||||
|
}
|
||||||
|
|
||||||
// Read the NACP data
|
// Read the NACP data
|
||||||
Read(assetOffset + (int)nacpOffset, (int)nacpSize).AsSpan().CopyTo(controlHolder.ByteSpan);
|
Read(assetOffset + (int)nacpOffset, (int)nacpSize).AsSpan().CopyTo(controlHolder.ByteSpan);
|
||||||
|
@ -666,6 +673,8 @@ namespace Ryujinx.Ui.App.Common
|
||||||
long iconSize = BitConverter.ToInt64(iconSectionInfo, 8);
|
long iconSize = BitConverter.ToInt64(iconSectionInfo, 8);
|
||||||
|
|
||||||
// Reads and stores game icon as byte array
|
// Reads and stores game icon as byte array
|
||||||
|
if (iconSize > 0)
|
||||||
|
{
|
||||||
applicationIcon = Read(assetOffset + iconOffset, (int)iconSize);
|
applicationIcon = Read(assetOffset + iconOffset, (int)iconSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -673,6 +682,11 @@ namespace Ryujinx.Ui.App.Common
|
||||||
applicationIcon = _nroIcon;
|
applicationIcon = _nroIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
applicationIcon = _nroIcon;
|
||||||
|
}
|
||||||
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
|
Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
|
||||||
|
|
Loading…
Reference in a new issue