Defying all expectations
After a good while of working on the OpenGL renderer, fixing its issues for a 0.8.1 release, attempting to add some features, I figured I'd look at some of the old game issues. melonDS has reached a point where almost every known game bug is a timing issue, but not all of them are.

In particular, this issue: graphical glitches in iCarly - Groovy Foodie.

When it was posted, I didn't look much into it, thinking that was my topnotch software renderer acting up, and hastily giving it the '3D accuracy' label to put it on the backburner.

So I thought, hey, let's see if this is any different with the OpenGL renderer?

Which is where this bug started defying my expectations. Software or OpenGL, it didn't matter, the graphics looked the same. But, when I tested the game under DeSmuME and NO$GBA, they both exhibited the same bug.

Which is where I knew that we were in for an interesting ride. Typically, emulation bugs in melonDS are either specific to melonDS, meaning it's a flaw in my implementation, or they're shared with NO$GBA but not DeSmuME, which means that is some hardware behavior that was discovered by the DeSmuME team but did not yet make it into GBAtek. But with a bug that happens in every of these emulators, we know that we're stepping in uncharted territory.

So, as usual, we start by investigating how the game renders its graphics. The issue has nothing to do with 3D graphics at all, as it's not using the 3D engine. In particular, the glitched intro logo on the top screen is made of sprites, but looking at NO$GBA's sprite viewer shows there's something fishy behind this.



We only have a handful of the 16x16 sprites that make up the logo. Where's the rest?

Some logging confirms my suspicion that the game is updating OAM midframe. This is probably the last game where I'd have expected to see this kind of trickery, but hey, why not.

For example, as far as the glitched part of the logo is concerned, the OAM for the sprites is updated during the HBlank period right before scanline 30. However, the new sprite data gives them a Y coordinate of 31. Hence the glitch.

At this point, one can easily speculate that the OAM data copied right before scanline 30 is meant to be used at scanlines 31 and up. But hey, we can't just go and implement something based on an assumption. So, a few hardware tests later, we can confirm that sprites are rendered one scanline in advance. After implementing this behavior, and a few checks to ensure we aren't breaking anything, tada:


Mrrowww says:
Jun 10th 2019
That's ... groovy~
Atom-Fire says:
Jun 10th 2019
(Reposted from a different part of the forum)
Heyo, Love this emulator!
I was wondering if there were any development plans of added the ability for the Emu to connect via wireless (instead of just Ethernet), I understand that this is a giant task but i'm really hoping it's something that's being looked into.

Any information about this would be great! Thanks.
Henke37 says:
Jun 10th 2019
Did they neglect to set the enable oam in hblank flag or are they really poking around while the engine is rendering?
Arisotura says:
Jun 10th 2019
Atom-Fire: you can try indirect mode, but it doesn't work that well atm. I'll probably just use slirp instead.

Henke37: they update OAM during the HBlank period, which is fine. not sure about the bit you mentioned tho, but, they don't use a lot of sprites, so it should be fine either way.
Zinx says:
Jun 11th 2019
I think you could use PicoTCP for emulation of indirect mode. It was also used in Reicast emulator.
Reggie04 says:
Jun 11th 2019
Hi,

First I want to thank you. Your work is awesome!

I'm having problems with some games that worked very well with version 0.7.4.

Games: Golden Sun Dark Dawn (crash after Nintendo logo); Pokemon Black/White 1/2 (crash after the opening video)

I've tried with software renderer but same issues on 0.8.0.

I'm already happy that Pokemon SoulSilver and Platinum work 100% so thank you very much for your work.

Best'
Nick says:
Jun 12th 2019
Wayforward, D3publisher? What the... anyway hooray for fixing shovelware \o/
Reggie04 says:
Jun 15th 2019
All the issues have been fixed by release 0.8.1

Thank you very much.
Reggie04 says:
Jun 15th 2019
All the issues have been fixed by release 0.8.1

Thank you very much.
Johy says:
Jun 21st 2019
Hello can you make Android build 0.8.1 will all feature from pc version
Post a comment
Name:
DO NOT FILL