SOLVED: Don't use Old PPU setting
I have a rather annoying issue: I'm changing the background color mid-frame for a game i am porting. I've managed to get it looking good on both Mesen and Real Hardware (an NES-08 and a late toploader), but FCEUX is complaining about my shenanigans. Since it's a very popular emulator, i'd like it to work on there, but, if it comes at the expense of how it looks on hardware, FCEUX will have to suffer a glitchy fate. Anyway:
I'm using sprite 0 to wait for hBlank. The first part of the code turns off rendering, sets the address to $3F00 and writes $0F. It draws one black scanline while waiting for the next one. The PPU is in "vertical 32 increment mode" so the pointer and the next write will also be the background color. After waiting a scanline, it writes $11 (light blue) to the background color, restores the address, turns rendering back on, and continues on it's merry way. Cool right? Well not quite...
FCEUX is drawing the entire $0F (black) scanline using the color, $11 (light blue), that i write to the PPU at the end of that scanline. Sometimes... ugh. I can confirm this by adding a few NOP instructions before the $11 write... So yes, FCEUX is fetching background colors from the future! Wow! Isn't that something...
So, i'm not sure what to do here. When the code is more finalized, i suppose i can really try and sync it up so the console and FCEUX are both happy with my code. Otherwise, i'm kind of at a loss. I'd hate to have it all glitched out on a very popular emulator, but, oh well... Any advice would be appreciated. Thanks!
Video: https://i.imgur.com/2rq8O3Q.mp4
Code: (w/ FCEUX "fix")
[SOLVED] FCEUX: Fetching background colors from the future!
Moderator: Moderators
- Controllerhead
- Posts: 314
- Joined: Tue Nov 13, 2018 4:58 am
- Location: $4016
- Contact:
[SOLVED] FCEUX: Fetching background colors from the future!
Last edited by Controllerhead on Mon Apr 19, 2021 12:20 pm, edited 1 time in total.
Re: [BUG] FCEUX: Fetching background colors from the future!
Have you tried both PPU types FCEUX has ("old" and "new")? In the default setting, it looks like the PPU renders one scanline at a time, so it just samples everything (scroll, palettes, etc.) at a given point and uses that for the whole scanline. I guess it's just sampling the palette after you already changed it, to draw the scanline that just ended. FCEUX really sucks for raster effects.
- Controllerhead
- Posts: 314
- Joined: Tue Nov 13, 2018 4:58 am
- Location: $4016
- Contact:
Re: [BUG] FCEUX: Fetching background colors from the future!
Ah! I had it set to Old PPU. That looks much better... We're good now. Thanks!