Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pokemon - Flickering SGB colors #1054

Closed
dobyrch opened this issue Apr 20, 2018 · 0 comments
Closed

Pokemon - Flickering SGB colors #1054

dobyrch opened this issue Apr 20, 2018 · 0 comments

Comments

@dobyrch
Copy link
Contributor

dobyrch commented Apr 20, 2018

Version: 9630583
OS: Arch Linux x86_64

In every SGB enhanced Pokemon game, the colors briefly flicker when starting a battle or switching Pokemon. The issue is caused by the ATTR_BLK command that sets the palette for the new Pokemon—it sets the palette outside of the block to 0, so the other Pokemon uses the wrong palette for a few frames until the next ATTR_BLK sets the correct palette.

color_flicker

Although it seems to be a mistake in the games' code, this capture of Pokemon Gold doesn't exhibit the issue.

I've been using the patch below to work around the bug, but I haven't tested it enough with other games to be certain that it doesn't break something else. This simply ignores any attempt to apply pallete 0 outside of the box specified by ATTR_BLK.

diff --git a/src/gb/renderers/software.c b/src/gb/renderers/software.c
index 25ca1f95..06cdbb0d 100644
--- a/src/gb/renderers/software.c
+++ b/src/gb/renderers/software.c
@@ -124,7 +124,7 @@ static void _parseAttrBlock(struct GBVideoSoftwareRenderer* renderer, int start)
                                        _setAttribute(renderer->d.sgbAttributes, x, y, pIn);
                                }
                        } else if (y < y0 || y > y1 || x < x0 || x > x1) {
-                               if (block[0] & 4) {
+                               if (block[0] & 4 && pOut) {
                                        _setAttribute(renderer->d.sgbAttributes, x, y, pOut);
                                }
                        } else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant