Files
Triforce-Source/launcher/Core/GameFiles/ImageLimits.cs
ruckus7382sfgsgdf b527e29adb Triforce v0.8.5
A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
2026-11-28 10:54:41 -06:00

17 lines
873 B
C#

// ((Triforce, 11-26) The sizes a texture of the game may have. A texture's width and height come from its file's header: before
// they size an output buffer (width * height * 4, in int), they are checked, so a damaged or crafted file is refused with a
// reason instead of asking for gigabytes, wrapping to a negative size, or throwing OverflowException.
namespace Triforce.Core.GameFiles;
public static class ImageLimits
{
/// <summary>The widest and tallest texture taken (the game's largest are far smaller; 16384 x 16384 x 4 bytes fits an int).</summary>
public const int MaxSide = 16384;
public static void Check(int width, int height)
{
if (width <= 0 || height <= 0 || width > MaxSide || height > MaxSide)
throw new InvalidDataException("a texture of " + width + " x " + height + ", which no texture of the game is");
}
}