• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › General Discussion v
« Previous 1 ... 364 365 366 367 368 Next »

[fix] Fragile (and maybe others), source included
View New Posts | View Today's Posts

Pages (5): 1 2 3 4 5 Next »
Thread Rating:
  • 3 Vote(s) - 2.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
[fix] Fragile (and maybe others), source included
05-21-2009, 09:18 PM (This post was last modified: 05-21-2009, 09:23 PM by orbb.)
#1
orbb Offline
Junior Member
**
Posts: 15
Threads: 3
Joined: May 2009
Lightbulb 
Hi Smile

I played this morning with the sources of dolphin, and I managed to fix the screen flickering problem in Fragile :p

The basic idea is that I check before each frame is displayed if the frame is black, and I dont display it in this case.

the source included is really basic, it checks only for 5 pixels, it should check for the full screen normally, so some screen wont be displayed... anyway, this is just a fix suggestion, so the devs should try to implement this hack and optimise it Smile

This fix seems to slow the emulation a little, and may break other games...

Ok, here's how to implement it :

- Edit the file source\Plugins\Plugin_VideoOGL\Src\render.cpp

- find the line : OpenGL_SwapBuffers();

- replace it with this piece of code :

// [ fix for Fragile by kamui_kun ...
BYTE pixels [15] ;

glReadPixels(300, 200, 1, 1, GL_RED, GL_BYTE, &pixels[0]);
glReadPixels(300, 400, 1, 1, GL_RED, GL_BYTE, &pixels[1]);
glReadPixels(700, 200, 1, 1, GL_RED, GL_BYTE, &pixels[2]);
glReadPixels(700, 400, 1, 1, GL_RED, GL_BYTE, &pixels[3]);
glReadPixels(500, 300, 1, 1, GL_RED, GL_BYTE, &pixels[4]);
glReadPixels(300, 200, 1, 1, GL_GREEN, GL_BYTE, &pixels[5]);
glReadPixels(300, 400, 1, 1, GL_GREEN, GL_BYTE, &pixels[6]);
glReadPixels(700, 200, 1, 1, GL_GREEN, GL_BYTE, &pixels[7]);
glReadPixels(700, 400, 1, 1, GL_GREEN, GL_BYTE, &pixels[8]);
glReadPixels(500, 300, 1, 1, GL_GREEN, GL_BYTE, &pixels[9]);
glReadPixels(300, 200, 1, 1, GL_BLUE, GL_BYTE, &pixels[10]);
glReadPixels(300, 400, 1, 1, GL_BLUE, GL_BYTE, &pixels[11]);
glReadPixels(700, 200, 1, 1, GL_BLUE, GL_BYTE, &pixels[12]);
glReadPixels(700, 400, 1, 1, GL_BLUE, GL_BYTE, &pixels[13]);
glReadPixels(500, 300, 1, 1, GL_BLUE, GL_BYTE, &pixels[14]);

if((pixels[0] != 0) || (pixels[1] != 0) || (pixels[2] != 0) || (pixels[3] != 0) || (pixels[4] != 0)
|| (pixels[5] != 0) || (pixels[6] != 0) || (pixels[7] != 0) || (pixels[8] != 0) || (pixels[9] != 0)
|| (pixels[10] != 0) || (pixels[11] != 0) || (pixels[12] != 0) || (pixels[13] != 0) || (pixels[14] != 0)
) OpenGL_SwapBuffers();
// ... ]

- compile, and play Smile
Find
Reply
05-22-2009, 12:41 AM (This post was last modified: 05-22-2009, 12:42 AM by student1.)
#2
student1 Offline
Junior Member
**
Posts: 30
Threads: 3
Joined: May 2009
(05-21-2009, 09:18 PM)orbb Wrote: Hi Smile

I played this morning with the sources of dolphin, and I managed to fix the screen flickering problem in Fragile :p

The basic idea is that I check before each frame is displayed if the frame is black, and I dont display it in this case.

the source included is really basic, it checks only for 5 pixels, it should check for the full screen normally, so some screen wont be displayed... anyway, this is just a fix suggestion, so the devs should try to implement this hack and optimise it Smile

This fix seems to slow the emulation a little, and may break other games...

Ok, here's how to implement it :

- Edit the file source\Plugins\Plugin_VideoOGL\Src\render.cpp

- find the line : OpenGL_SwapBuffers();

- replace it with this piece of code :

// [ fix for Fragile by kamui_kun ...
BYTE pixels [15] ;

glReadPixels(300, 200, 1, 1, GL_RED, GL_BYTE, &pixels[0]);
glReadPixels(300, 400, 1, 1, GL_RED, GL_BYTE, &pixels[1]);
glReadPixels(700, 200, 1, 1, GL_RED, GL_BYTE, &pixels[2]);
glReadPixels(700, 400, 1, 1, GL_RED, GL_BYTE, &pixels[3]);
glReadPixels(500, 300, 1, 1, GL_RED, GL_BYTE, &pixels[4]);
glReadPixels(300, 200, 1, 1, GL_GREEN, GL_BYTE, &pixels[5]);
glReadPixels(300, 400, 1, 1, GL_GREEN, GL_BYTE, &pixels[6]);
glReadPixels(700, 200, 1, 1, GL_GREEN, GL_BYTE, &pixels[7]);
glReadPixels(700, 400, 1, 1, GL_GREEN, GL_BYTE, &pixels[8]);
glReadPixels(500, 300, 1, 1, GL_GREEN, GL_BYTE, &pixels[9]);
glReadPixels(300, 200, 1, 1, GL_BLUE, GL_BYTE, &pixels[10]);
glReadPixels(300, 400, 1, 1, GL_BLUE, GL_BYTE, &pixels[11]);
glReadPixels(700, 200, 1, 1, GL_BLUE, GL_BYTE, &pixels[12]);
glReadPixels(700, 400, 1, 1, GL_BLUE, GL_BYTE, &pixels[13]);
glReadPixels(500, 300, 1, 1, GL_BLUE, GL_BYTE, &pixels[14]);

if((pixels[0] != 0) || (pixels[1] != 0) || (pixels[2] != 0) || (pixels[3] != 0) || (pixels[4] != 0)
|| (pixels[5] != 0) || (pixels[6] != 0) || (pixels[7] != 0) || (pixels[8] != 0) || (pixels[9] != 0)
|| (pixels[10] != 0) || (pixels[11] != 0) || (pixels[12] != 0) || (pixels[13] != 0) || (pixels[14] != 0)
) OpenGL_SwapBuffers();
// ... ]

- compile, and play Smile


Nice thanks, this might actually also fix games like mega man 9 Smile! But i think it might be more used as a hack to fix the issue, like an extra option for flicker! Anyway great work Smile!
Find
Reply
05-22-2009, 12:47 AM
#3
orbb Offline
Junior Member
**
Posts: 15
Threads: 3
Joined: May 2009
no problem Smile and yes it could fix some other games, and break others :p
but it really needs to be optimised, by checking all the backbuffer pixels and not just five ...
anyway, it works fine with Fragile, and that was my goal Smile
Find
Reply
05-22-2009, 07:28 AM
#4
cmccmc
Unregistered
 
I think this could help digimon world 4's constant screen flickering. I'm gonna go check
Reply
05-22-2009, 07:43 AM
#5
death-droid Offline
Member
***
Posts: 180
Threads: 0
Joined: Apr 2009
I'll add this as one of the game hack...
Maybe....
Find
Reply
05-22-2009, 08:10 AM
#6
cmccmc
Unregistered
 
how about adding this as an option instead of a hack. You could call it something like remove flicker. Of course before you do that you should probably tweak it a bit
Reply
05-22-2009, 11:15 AM
#7
deathtotheweird Offline
Junior Member
**
Posts: 11
Threads: 1
Joined: Mar 2009
This works just fine as long as the game is in full screen mode. Very nice find. Game runs better than expected too. Around 40-60fps at times.
Find
Reply
05-22-2009, 02:30 PM
#8
hakunushi Offline
Nintendo Fanboy
***
Posts: 117
Threads: 16
Joined: Mar 2009
this should be added may fix mario party for nvidia users.
[Image: locke.jpg]

GA ep43 ds3l
C2Q 8400 3200 MHz
4gb DDR2 800 patriot
Geforce gtx 560 2gb
Sata II 1,5 TB
Windows 7 64

Dell
Core i7 3612qm 2.10 mhz
8gb ddr3 800 samsung
1tb sata2 hd
geforce gtx 630m
Find
Reply
05-22-2009, 03:58 PM (This post was last modified: 05-22-2009, 04:41 PM by death-droid.)
#9
death-droid Offline
Member
***
Posts: 180
Threads: 0
Joined: Apr 2009
Ok Just editing the hack then i might implement it into the OpenGL plugin(As an option)

EDIT:


Just a little clean up Tongue
Need someone to make sure this works...

Woop's just relized the GL_RED stuff XD
Ok just need to make a quick fix for that Tongue

EDIT2:

Ok can someone try this out pls

Code:
BYTE pixels [14] ;
int  color[3];
color[GL_RED,GL_GREEN,GL_BLUE];

    for (int i = 0;i<14;i++)
    {
        for (int ii = 0;ii<3;i++)
        {
            if (i == 0||5||10)
                glReadPixels(300, 200, 1, 1, color[ii], GL_BYTE, &pixels[i]);

            if (i == 1||6||11)
                glReadPixels(300, 400, 1, 1, color[ii], GL_BYTE, &pixels[i]);

            if (i == 2||7||12)
                glReadPixels(700, 200, 1, 1, color[ii], GL_BYTE, &pixels[i]);
            
            if (i == 3||8||13)
                glReadPixels(700, 400, 1, 1, color[ii], GL_BYTE, &pixels[i]);

            if (i == 4||9||14)
                glReadPixels(500, 300, 1, 1, color[ii], GL_BYTE, &pixels[i]);
        }

        if(pixels[i]!=0)
        {
            OpenGL_SwapBuffers();
        }
    }
Find
Reply
05-22-2009, 04:36 PM
#10
deathtotheweird Offline
Junior Member
**
Posts: 11
Threads: 1
Joined: Mar 2009
Getting undeclared identifier from pixels. I'm no programmer so I have no idea how to fix this, or what it means.
Find
Reply
« Next Oldest | Next Newest »
Pages (5): 1 2 3 4 5 Next »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode