Open reefbarman opened 6 years ago
Hi,
Thank you for your feedback. It is greatly appreciated! As you probably have guessed, I was not aware of this glitching effect and will look into it :).
Regards, Washi
Did you ever get a chance to look into this?
Hello,
First of all, sorry for no update in such a long time. I had other business to attend.
I recall having a look at it briefly and found a few bugs on my way regarding the evaluation of a couple of instructions (see last commits). Fixing these resulted in that some of the screens of the Aladin game you were talking about are somewhat readable but still definitely not correct yet. Colours seem to be off and flickering.
After debugging some more, with the help of the BGB debugger, I found that it might be a timing related issue. As you might know, GPU registers that define the colours of tiles can be changed while the screen is refreshing. Games often use wait loops that wait for a particular value in the LY register (current scan line Y offset) to change the colours for a particular scan line. It seems that especially the game Aladin makes a lot of use of this with their splash and menu screens.
My hypothesis is that one or more GPU registers are not correctly synced up with the actual refreshing of the screen, and/or that some other timing or clock cycle counter is wrong, which would result in the colours not being updated at the correct times. This would explain the long bars and the flickering as can be seen in the picture below. Notice how the tiles seem to be correct (especially in the first screenshot), but colours are off.
I am not sure how to debug further yet though. Fixing timing issues has always been such a needle in a haystack if that makes sense.
Feel free to give suggestions if you have any :).
I may be taking this up as a challenge but I can't promise anything will be done. I have had a look at the current rendering code and can see quite a few isues: The main issue is that the whole scan line is rendered at once compared to the real CGB which draws in parallel with the CPU at a rate of 1 pixel per clock cycle, this means that any effects that change the PPU registers mid-scanline won't have any effect. Sprites are also not correctly prioritised and blended so that might have an impact. This will be quite a big change which might have a performance impact as graphical calculations will have to be done every instruction instead of in bulk.
Hi,
I have embarked on the same crazy endeavor as your self, and am trying to implement a GB/GBC emulator. I have chosen C# as my language of choice as well which led me to your emulator when I was looking for resources to help me try and sort out some rendering bugs I have when rendering GBC games.
For example when try to run Aladdin within your emulator most of the splash screens, menus don't render correctly and the in-game sections while mostly working display graphic glitches.
Are you aware of these issues and have an idea of what the problem may be?
Anyway I would love to sync up with you a discuss solutions if you are interested.
I am a member (tristancartledge) on the gbdev discord server https://discord.gg/6nShAM
Thanks