Fix crash with if image data is over 4mb and other VK changes

This commit is contained in:
Stossy11 2024-12-10 15:47:45 +11:00
parent 7025c32c4a
commit e02037d9c3
5 changed files with 18 additions and 10 deletions

View file

@ -1411,14 +1411,18 @@ public unsafe struct GameInfoNative
if (imageData == null || imageData.Length > 4096 * 4096)
{
throw new ArgumentException("Image data must not exceed 4 MB.");
// throw new ArgumentException("Image data must not exceed 4 MB.");
ImageSize = (uint)0;
ImageData = null;
}
ImageSize = (uint)imageData.Length;
else
{
ImageSize = (uint)imageData.Length;
ImageData = (byte*)Marshal.AllocHGlobal(imageData.Length);
ImageData = (byte*)Marshal.AllocHGlobal(imageData.Length);
Marshal.Copy(imageData, 0, (IntPtr)ImageData, imageData.Length);
Marshal.Copy(imageData, 0, (IntPtr)ImageData, imageData.Length);
}
}
// Don't forget to free the allocated memory