Sprite glitch on BSNES / Higan but not on actual hardware
Posted: Mon Dec 11, 2017 4:30 pm
Hi everyone!
A few months ago, I've started to make my first (tiny) SNES homebrew, the "newbie way": I'm using PVSNESlib and C coding. Thanks to all the docs and the many questions answered here, I've been able to come over a lot of my dev issues, but there is one that I couldn't find any answer for:
- My game use both 16x16 sprites (SMALL), for the player and ennemies, and 32x32 sprits (LARGE) , for the explosions.
- When an enemy (or the player) is hit, I hide his (16x16) sprite and I display a larger explosion Sprite over it (32x32). The OAM for explosion sprite is lower (#5-15) than player and enemies (#20-50)
- On an actual SNES it runs fine, as intended (unmodified PAL 50hz + SD2SNES).
- On ZNES and No$SNS it runs fines too, like on the SNES hardware
- On BSNES / Higan and on SNES9X, the 32x32 sprites are displayed only partially: only the top half of the 4 animations frames (out of 7) are displayed. The first 4 frames are displayed only in the top half, and the remaining 3 animations frames are simply not displayed.
Here is a comparison picture (left is ZSNES / right is BSNES)
My sprites are stored starting at 0x4000 in VRAM. At first I thought there could be some memory alignment issues between the two sprite sizes, so I've tried to store 16x16 sprites data in 0x4000 and the 32x32 ones in 0x6000, the result is the same.
However, I then tried to "invert" the order of which I loaded my sprite in VRAM (i use two 16x16 spritesheets and one 32x32 spritesheet). Instead of loading the two 16x16 spritesheets then the 32x32 one, I loaded one 16x16 sprite sheet (the player), the 32x32 one (explosion) and the other 16x16 one (enemies). By doing this, it still works on ZSNES and hardware, but the enemies, stored in VRAM after the 32x32 explosions, are no longer displayed in SNES9X and BSNES / Higan.
To summarize, it appears that, BSNES / Higan and SNES9X have trouble to display my 32x32 sprites and everything stored after them in VRAM, for a reason i can't explain.
What puzzles me my the most is that my program is working on actual hardware but glitching on BSNES / Higan, which I thought impossible due to the high level of emulation accuracy.
Do you have any idea of what can be the cause of this issue?
And a lead to a possible fix?
Thanks a lot for your help!
A few months ago, I've started to make my first (tiny) SNES homebrew, the "newbie way": I'm using PVSNESlib and C coding. Thanks to all the docs and the many questions answered here, I've been able to come over a lot of my dev issues, but there is one that I couldn't find any answer for:
- My game use both 16x16 sprites (SMALL), for the player and ennemies, and 32x32 sprits (LARGE) , for the explosions.
- When an enemy (or the player) is hit, I hide his (16x16) sprite and I display a larger explosion Sprite over it (32x32). The OAM for explosion sprite is lower (#5-15) than player and enemies (#20-50)
- On an actual SNES it runs fine, as intended (unmodified PAL 50hz + SD2SNES).
- On ZNES and No$SNS it runs fines too, like on the SNES hardware
- On BSNES / Higan and on SNES9X, the 32x32 sprites are displayed only partially: only the top half of the 4 animations frames (out of 7) are displayed. The first 4 frames are displayed only in the top half, and the remaining 3 animations frames are simply not displayed.
Here is a comparison picture (left is ZSNES / right is BSNES)
My sprites are stored starting at 0x4000 in VRAM. At first I thought there could be some memory alignment issues between the two sprite sizes, so I've tried to store 16x16 sprites data in 0x4000 and the 32x32 ones in 0x6000, the result is the same.
However, I then tried to "invert" the order of which I loaded my sprite in VRAM (i use two 16x16 spritesheets and one 32x32 spritesheet). Instead of loading the two 16x16 spritesheets then the 32x32 one, I loaded one 16x16 sprite sheet (the player), the 32x32 one (explosion) and the other 16x16 one (enemies). By doing this, it still works on ZSNES and hardware, but the enemies, stored in VRAM after the 32x32 explosions, are no longer displayed in SNES9X and BSNES / Higan.
To summarize, it appears that, BSNES / Higan and SNES9X have trouble to display my 32x32 sprites and everything stored after them in VRAM, for a reason i can't explain.
What puzzles me my the most is that my program is working on actual hardware but glitching on BSNES / Higan, which I thought impossible due to the high level of emulation accuracy.
Do you have any idea of what can be the cause of this issue?
And a lead to a possible fix?
Thanks a lot for your help!