forked from Ports/goldeneye-pc-port
c18c8b8366a4c8ca57281144144b669fe9ed9f65
The decomp declares ptr_texture_alloc_start as `struct texpool *` but no code ever dereferences it as a pointer -- every use takes its address and treats the storage itself as a `struct texpool` (texInitPool writes all four members through &ptr_texture_alloc_start; texLoad / texFindInPool read them back). On N64 the four members are 4 bytes each (16 total) and overlap the following split-out symbols (ptr_texture_alloc_end etc.); the layout happens to work. On x86-64 `struct texpool` is 32 bytes (four widened pointers), so texInitPool smashes 24 bytes past the 8-byte pointer global and, worse, reads of ->leftpos / ->rightpos (offsets 16 and 24) come back as unrelated BSS -- the stage texture pool then looks permanently exhausted (texFreeBytesInBuffer() < 0) the very first time texLoad() runs on the -level_09 path. Every room texLoad bails at its out-of-memory guard without adding to the pool, texFindInPool() returns NULL for every room texnum, and gfx_pc aborts with 'Bad size for RGBA texture in tile 0: 00'. Fix: under PORT, define ptr_texture_alloc_start as a real `struct texpool` (not a pointer). All call sites already do `&ptr_texture_alloc_start`, so they now get a correctly-typed `struct texpool *` and the N64 build is untouched. Verified: -level_09 stage texture pool now fills normally (no premature OOM), ~630 room textures resolve, and the 'Bad size for RGBA texture' FATAL is gone. Rendering now advances to a separate issue -- gfx_sp_matrix dereferencing an unrelocated N64 segment address (0x90000000) from a room GDL gsSPMatrix, the next D85 layer. Also renamed the D85 texLoad pool-full probe (GE_D85TEX) from 'OOM' since with this fix it now only fires on a genuinely full pool.
Goldeneye 007
About this repository
This is a WIP decompilation of Goldeneye 007!
It builds the following ROMs:
- ge007.u.z64
sha1: abe01e4aeb033b6c0836819f549c791b26cfde83 - ge007.j.z64
sha1: 2a5dade32f7fad6c73c659d2026994632c1b3174 - ge007.e.z64
sha1: 167c3c433dec1f1eb921736f7d53fac8cb45ee31
Note: This repository does not include all assets necessary for compiling the ROMs. A prior copy of the game is required to extract the assets.
Documentation
- Setup Guide: useful information about installing the necessary dependencies and how to use it
- Structure Guide: learn more about the project structure of this repository
- Style Guide: code style conventions if you want to contribute code
Languages
C
92.9%
C++
2.8%
Python
1.8%
Assembly
1.2%
HTML
0.4%
Other
0.7%