// ((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 { /// The widest and tallest texture taken (the game's largest are far smaller; 16384 x 16384 x 4 bytes fits an int). 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"); } }