Open Screwtapello opened 3 years ago
Unverified guess: https://github.com/bsnes-emu/bsnes/blob/f57657f27ddec337b1960c7ddaa1b23894bc00c3/bsnes/sfc/ppu-fast/ppu.hpp#L361-L364 Maybe the 4 arrays are to short for this game/scene. If so, changing 32 to 240 for each one would solve the issue.
Why are the arrays fixed-length? Was it too expensive to dynamically allocate them?
Since struct ppufast is already 40 megabytes (40 679 184 bytes, of which 39 813 120 are the Pixel arrays in Line::above/below), boosting these arrays to 240 is an absolutely trivial cost (+3328 bytes). Let's do it.
I didn't think it's necessary (and wanted to keep the code simple for my C++ inexperience). TBH I still don't. I mean the arrays only exist once per emulator instance......... aaaaaaaaaaand Alcaro just covered the numbers, so I'm done 😁
Steps to reproduce
ee9bb8fe7fb52c57b84d8d0969ae97ff9440367158ebb75c28e72173f54ff103
Expected results
A Mode 7 roto-zoom effect displaying a "Game Over" message
Actual results
Crash!
Notes
The crash does not occur in accurate-PPU mode, or in fast-PPU mode with HD Mode 7 disabled (240p).
The crash occurs with the default
build=performance
compiler options. Building withbuild=debug
prevents the crash from occurring normally, but building in debug mode with the clang Address Sanitizer mode reports:The line where the crash occurs is this one: https://github.com/bsnes-emu/bsnes/blob/f57657f27ddec337b1960c7ddaa1b23894bc00c3/bsnes/sfc/ppu-fast/mode7hd.cpp#L43