Dolphin, the GameCube and Wii emulator - Forums

Full Version: [fix] Fragile (and maybe others), source included
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
hi Smile
here is a piece of code that should check for all the screen, and is faster than the previous code (stops checking after finding a pixel that is not black), but it seems to bug, if you could correct it :p

// [ fix for Fragile by kamui_kun ...
bool Renderer::IsBlack()
{
char pixels [3];
int x, y;

for(x = 0; x < (int) OpenGL_GetBackbufferHeight(); x++)
{
for(y = 0; y < (int) OpenGL_GetBackbufferWidth(); y++)
{
glReadPixels(x, y, 1, 1, GL_RED, GL_BYTE, &pixels[0]);
glReadPixels(x, y, 1, 1, GL_GREEN, GL_BYTE, &pixels[1]);
glReadPixels(x, y, 1, 1, GL_BLUE, GL_BYTE, &pixels[2]);
if((pixels[0] != 0) || (pixels[1] != 0) || (pixels[2] != 0)) return false;
}
}
return true;
}

void Renderer::SwapBuffers()
{
// [ fix for Fragile by kamui_kun ...
bool pass = false;

if(Renderer::IsBlack()) pass = true;

// ...]

...

if (!pass) OpenGL_SwapBuffers();

...
I'll look into it Tongue
If I may ask, what is the difference between all these codes? I'm saying that because I haven't noticed any real speed difference in any of these (the ones that work properly that is).
Woot got it to work perfectly.(Well almost)
There should now be no flickering.
Thank you very much for you're work Orbb.

Update to the latest svn for the updated version.
EDIT:
I just need people to test this with as much games as they can and tell me if any games are broken with the hack on.
no problem Smile
I've just checked your SVN update, and it seems to have a problem in this line :

glReadPixels(500, 300, 1, 1, color[c], GL_BYTE, &pixels[i]);

this check only for the pixel (500, 300)

it should be : glReadPixels(x, y, 1, 1, color[c], GL_BYTE, &pixels[i]);

for checking all the pixels in the screen ...
there is also a problem here :

for (int i = 0; i < 2;i++)
{
for (int c = 0; c < 2 ;c++)
{
glReadPixels(500, 300, 1, 1, color[c], GL_BYTE, &pixels[i]);
if(pixels[i] != 0)
return false;
else
return true;
}
}

it should be something like this :

for (int i = 0; i < 2;i++)
{
glReadPixels(x, y, 1, 1, color[i], GL_BYTE, &pixels[i]);
if(pixels[i] != 0)
return false;
else
return true;
}
glReadPixels(x, y, 1, 1, color[c], GL_BYTE, &pixels[i]);

The x and y causes the screen to stay black.
I can fix up the second one tho...

I think the problem is with the x and y thing is that nothing is being returned....
well this is maybe caused by OpenGL_GetBackbufferHeight() and OpenGL_GetBackbufferWidth()

I assumed that these two fonctions returns the current screen width and height, but its could be wrong...
or its perhaps caused by the fact that there maybe some pixels that are always in the buffer, like fps counter ect., and this code will display the frame because its not pure black...
Hey, I tried this option (r3276) and it made Virtua Quest GC won't start the game.
When it should be loading to the new game and continue screen, it hangs instead (there is a black screen before went to new game and continue screen).
Then I remove the check on the remove flicker and the game runs well.

So, I think this should made as an option. Cool
Well, I've tried some games here. Brawl seems to work ok, but the game which had flickering (Megaman 9) doesn't flicker, but it became a lot slower than before. Going to test more soon...
Ok cool thanks for checking.
orbb I'm pretty sure those are the right functions as well.
I have no idea what's wrong with it.
Pages: 1 2 3 4 5