skylersaleh / SkyEmu

Game Boy Advance, Game Boy, Game Boy Color, and DS Emulator
http://skyemu.app
MIT License
821 stars 49 forks source link

[NDS] Monster Trucks DS (USA) graphic from the previous screen stuck on the title screen #383

Open benderscruffy opened 9 months ago

benderscruffy commented 9 months ago

start a one player game race for a bit the pause game then exit to the title screen and the truck and other graphics are still on the screen Screenshot 2024-01-02 181822

benderscruffy commented 8 months ago

from Desmume site

this game uses software rendered voxels. the game generates a depth buffer and passes it to the clear image hardware for the voxels to make geometry (cars, flags, etc.) rendered with the 3d engine to go in front of and behind. when exiting the main engine, the game does not clear its 3d memory. but it does set a depth buffer of frontmost on every pixel and continue passing it to the clear image hardware during the menu, which should prevent the cars from drawing.

the problem is that the real hardware renders 3d continuously, and changes to this depth buffer (which took effect while the screen was fading) happen immediately; whereas, in desmume, 3d renders only each time a frame is submitted by the 3d hardware. that means, in this case, that it never renders again, once the player enters the menu from in-game.

there are a few ways to fix this. one is to correctly emulate the constant-rendering that the hardware does. this is potentially somewhat costly.

next, the aforementioned approach could be made optional. while it fixes this one game, it isn't worth an option. if we find other games that need it, we may reconsider.

finally, we could detect the condition where flags have changed (even though the geometry has not) and take an opportunity to rerender, if so, each frame. But be careful--texture banks or contents may have changed also, since the geometry quit getting submitted, so all those conditions would have to trigger a re-render. I would prefer not to do this, since it is sort of bug city. dont know if this helps ???

skylersaleh commented 8 months ago

Yes, its definitely helpful, but looks like from that description I've got a couple areas I'll have to implement emulating before this will work correctly.