mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 06:59:57 -04:00
Answer NVN getters asked of no object with 0, and map a buffer with no pool to memory of its own.
The game's scene-loading thread makes a few NVN calls with a null object while an area loads or Kakariko's time of day changes: a memory pool's flags (and the other pool getters), a texture builder's storage size or alignment, and the mapping of a buffer that has no pool, into which it then writes 0x3d0 bytes. Each read the object at address 0 plus a field's offset, an access violation. The pool getters, nvnMemoryPoolInvalidateMappedRange and the two builder queries now answer 0 for a null object (nvn_no_object), and nvnBufferMap of a buffer with no pool returns a block of scratch memory (64 KiB, or the buffer's size when it records a larger one) instead of 0. The first such calls are logged with their caller. These fit the crash reports in Castle Town and in Kakariko before Death Mountain (#605, #602), which have not been confirmed to be this. Checked: --probe-nvn gains three checks (pool getters of no pool, builder queries of no builder, a 0x3d0-byte write through the mapping of a buffer with no pool) and they pass; its four other failures are the same on the baseline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -135,6 +135,7 @@ NVN_API(nvnTextureBuilderGetStorageClass) { ret_x(c, storage_class(&TB(c)->d));
|
||||
NVN_API(nvnTextureBuilderGetFlags) { ret_x(c, (uint32_t)TB(c)->d.flags); }
|
||||
// size_t nvnTextureBuilderGetStorageSize(const NVNtextureBuilder *b)
|
||||
NVN_API(nvnTextureBuilderGetStorageSize) {
|
||||
if (nvn_no_object(c, "nvnTextureBuilderGetStorageSize")) return;
|
||||
nvn_texlayout L;
|
||||
nvn_tex_layout(&TB(c)->d, &L);
|
||||
if (!L.bpb) rt_log("nvn: TextureBuilderGetStorageSize: unknown format %#x", TB(c)->d.format);
|
||||
@@ -142,6 +143,7 @@ NVN_API(nvnTextureBuilderGetStorageSize) {
|
||||
}
|
||||
// size_t nvnTextureBuilderGetStorageAlignment(const NVNtextureBuilder *b)
|
||||
NVN_API(nvnTextureBuilderGetStorageAlignment) {
|
||||
if (nvn_no_object(c, "nvnTextureBuilderGetStorageAlignment")) return;
|
||||
nvn_texlayout L;
|
||||
nvn_tex_layout(&TB(c)->d, &L);
|
||||
ret_x(c, L.align);
|
||||
|
||||
Reference in New Issue
Block a user