mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 20:15:56 +00:00
The loader keeps a texture's place in its pool as a 32-bit word (main+0xad4294) and widens it with a sign extend for nvnTextureBuilderSetStorage's offset (main+0xad43f0) and for SetPackagedTextureData's source (main+0xad440c). Past 2 GiB the offset turns negative and the storage lands 4 GiB below the pool (MacNativeGames ca311e2d, seen with a 4K texture pack's heap table in a 3.58 GiB pool). The shipped heap table keeps every pool far below 2 GiB, but TOTK_APP_POOL raised with such a pack's heap table (RomFS mods replace it) can reach it. The new patch set pooloff (TOTK_POOL_OFFSET_PATCH, on by default) widens unsigned: the same value below 2 GiB, right up to 4 GiB. 1.4.3 needs no patch: both of its loaders (main+0x583c34, main+0x27ed214) keep the offset in 64 bits (str x25 / mov x2, x25 / add x1, x25, x8). gen.py accepts both original words, and the lifted C at the sites reads the offset as uint32_t with the set on and as int32_t with it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>