REDIVIVUS

Proposals / #1076

Fix C pointer-scaling bugs in D3D sprite upload path

checked · by VTSTech · submitted 2026-11-02

D3D fullscreen crashes with HALT 0x16d (null surface) at first sprite upload. Root cause: three raw byte offsets added to typed pointers cause implicit sizeof(D3DTextureCacheNodeStrc)=0x20 scaling. The Glide renderer compiles the identical code byte-exact because it types pNodes as uint8_t*, while D3D types it as D3DTextureCacheNodeStrc*, so the C type system silently scales the offset. The fix rewrites three raw-offset sites to the byte-exact form (uint8_t*)pCacheNodeBase + (*piVar2 - 1) * 0x20 + OFF, matching Glide's implementation and fixing the bug.

Changes 1, applied together

  1. Set prototype win 0x006b5d40

    signatureint32_t RENDERER_DIRECT3D_UploadTextureToCache(D2D3DSpriteInfoStrc * pTexInfo, BYTE * pPalette, byte nOutlineColor, int32_t nMode)
    convention__thiscall→__fastcall