mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-29 04:18:49 -04:00
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.
This commit is contained in:
@@ -40,14 +40,22 @@ public sealed class Bntx
|
||||
throw new InvalidDataException("not a BNTX archive");
|
||||
var count = U32(0x24);
|
||||
var table = (long)U64(0x28);
|
||||
// ((Triforce, 11-26) the count and the names as the file says them, checked: a few KB that named 131072 textures, each
|
||||
// with a 64K-character name, asked for about 17 GB)
|
||||
if (count > 4096 || table < 0 || table > data.Length || table + 8L * count > data.Length)
|
||||
throw new InvalidDataException("BNTX texture table out of the file");
|
||||
var list = new List<BntxTexture>();
|
||||
var seen = new HashSet<long>();
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var p = (long)U64(table + 8 * i);
|
||||
if (p < 0 || p + 0x80 > data.Length || !seen.Add(p)) throw new InvalidDataException("BNTX texture " + i + " is out of the file, or named twice");
|
||||
if (data[p] != 'B' || data[p + 1] != 'R' || data[p + 2] != 'T' || data[p + 3] != 'I')
|
||||
throw new InvalidDataException("BNTX texture " + i + " has no BRTI header");
|
||||
var nameAt = (long)U64(p + 0x60);
|
||||
if (nameAt < 0 || nameAt + 2 > data.Length) throw new InvalidDataException("BNTX texture " + i + "'s name is out of the file");
|
||||
var nameLength = U16(nameAt);
|
||||
if (nameLength > 1024 || nameAt + 2 + nameLength > data.Length) throw new InvalidDataException("BNTX texture " + i + "'s name is too long");
|
||||
var name = Encoding.UTF8.GetString(data, (int)nameAt + 2, nameLength);
|
||||
var mips = (long)U64(p + 0x70);
|
||||
var tex = new BntxTexture(name, (int)U32(p + 0x24), (int)U32(p + 0x28), U32(p + 0x1C), U16(p + 0x16), U16(p + 0x12),
|
||||
@@ -188,6 +196,7 @@ public static class BlockCompression
|
||||
var bytesPerBlock = kind is Kind.BC1 or Kind.BC4 ? 8 : 16;
|
||||
var wBlocks = (width + 3) / 4;
|
||||
var hBlocks = (height + 3) / 4;
|
||||
ImageLimits.Check(width, height);
|
||||
var output = new byte[width * height * 4];
|
||||
Span<byte> texels = stackalloc byte[64];
|
||||
Span<byte> channel = stackalloc byte[16];
|
||||
|
||||
Reference in New Issue
Block a user