Add's a little hack to try and reduce flicking in some games.

Can also break some games or cause them to have flickering so I made it so it can be turned on and off :P
Original fix by orbb then modified by LuisR14 and me.



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3274 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid 2009-05-23 02:47:11 +00:00
parent 8ee7cfa6c6
commit d6b86232e0
5 changed files with 48 additions and 6 deletions

View File

@ -81,6 +81,7 @@ void Config::Load()
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0);
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
iniFile.Get("Hacks", "RemoveFlicker", &bRemoveFlicker, 0);
}
void Config::GameIniLoad() {
@ -117,7 +118,6 @@ void Config::GameIniLoad() {
if (iniFile->Exists("Video", "Hack"))
iniFile->Get("Video", "Hack", &iPhackvalue, 0);
}
void Config::Save()
@ -167,6 +167,8 @@ void Config::Save()
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bEFBCopyDisableHotKey);
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
iniFile.Set("Hacks", "RemoveFlicker", bRemoveFlicker);
iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini");
}

View File

@ -100,6 +100,7 @@ struct Config
bool bPhackvalue1, bPhackvalue2;
float fhackvalue1, fhackvalue2;
bool bProjHack1;
bool bRemoveFlicker;
int iLog; // CONF_ bits
int iSaveTargetId;

View File

@ -62,7 +62,7 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHECKBOX(ID_DISABLETEXTURING, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_DISABLEFOG, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_EFBCOPYDISABLEHOTKEY, ConfigDialog::AdvancedSettingsChanged)
//EVT_CHECKBOX(ID_PROJECTIONHACK1,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_REMOVEFLICKER, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_HACK, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_SAFETEXTURECACHE,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_DSTALPHAPASS,ConfigDialog::AdvancedSettingsChanged)
@ -364,7 +364,7 @@ void ConfigDialog::CreateGUIControls()
// Hacks controls
m_SafeTextureCache = new wxCheckBox(m_PageAdvanced, ID_SAFETEXTURECACHE, wxT("Use Safe texture cache"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_RemoveFlicker = new wxCheckBox(m_PageAdvanced, ID_REMOVEFLICKER, wxT("Remove Flicker"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_PhackvalueCB = new wxChoice(m_PageAdvanced, ID_PHACKVALUE, wxDefaultPosition, wxDefaultSize, arrayStringFor_PhackvalueCB, 0, wxDefaultValidator);
m_PhackvalueCB->Append(wxT("None"));
m_PhackvalueCB->Append(wxT("Zelda Twilight Princess Bloom hack"));
@ -377,12 +377,15 @@ void ConfigDialog::CreateGUIControls()
// Default values
m_SafeTextureCache->SetValue(g_Config.bSafeTextureCache);
m_RemoveFlicker->SetValue(g_Config.bRemoveFlicker);
// Tool tips
m_SafeTextureCache->SetToolTip(wxT("This is useful to prevent Metroid Prime from crashing, but can cause problems in other games."
"\n[This option will apply immediately and does not require a restart. However it may not"
" be entirely safe to change it midgames.]"));
m_RemoveFlicker->SetToolTip(wxT("This is used to try and removing flickering in some games."));
m_DstAlphaPass->SetToolTip(wxT("This renders a second time to set alpha to a constant value,"
"\nDisabling it may speed up some games, but could also cause glitches."));
m_DisableFog->SetToolTip(wxT("This option should not require a restart."));
@ -390,6 +393,7 @@ void ConfigDialog::CreateGUIControls()
// Sizers
sHacks = new wxGridBagSizer(0, 0);
sHacks->Add(m_SafeTextureCache, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5);
sHacks->Add(m_RemoveFlicker,wxGBPosition(1, 1),wxGBSpan(1, 1), wxALL, 5);
sHacks->Add(m_PhackvalueCB, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
sbHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks"));
@ -596,6 +600,9 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
case ID_SAFETEXTURECACHE:
g_Config.bSafeTextureCache = m_SafeTextureCache->IsChecked();
break;
case ID_REMOVEFLICKER:
g_Config.bRemoveFlicker = m_RemoveFlicker->IsChecked();
break;
case ID_HACK:
g_Config.bHack = m_Hack->IsChecked();
break;

View File

@ -119,6 +119,7 @@ class ConfigDialog : public wxDialog
wxCheckBox *m_DumpTextures;
wxCheckBox *m_HiresTextures;
wxCheckBox *m_DumpEFBTarget;
wxCheckBox *m_RemoveFlicker;
wxCheckBox *m_DumpFrames;
wxCheckBox *m_FreeLook;
wxStaticBox * m_StaticBox_EFB;
@ -184,6 +185,7 @@ class ConfigDialog : public wxDialog
ID_DUMPFRAMES,
ID_FREELOOK,
ID_TEXTUREPATH,
ID_REMOVEFLICKER,
ID_CHECKBOX_DISABLECOPYEFB,
ID_EFBCOPYDISABLEHOTKEY,

View File

@ -1218,7 +1218,37 @@ void Renderer::SwapBuffers()
}
#endif
// Copy the rendered frame to the real window
// [ fix for Fragile by kamui_kun ...
// TODO get the fix to read the whole screen not just 5 pixels
if (g_Config.bRemoveFlicker)
{
BOOL pass = FALSE;
char pixels [15];
short color[] = {GL_RED, GL_GREEN, GL_BLUE};
for( int i = 0; i < 14; i)
{
for( int c = 0; c < 3; c++,i+=5)
{
glReadPixels(300, 200, 1, 1, color[c], GL_BYTE, &pixels[i]);
glReadPixels(300, 400, 1, 1, color[c], GL_BYTE, &pixels[i+1]);
glReadPixels(700, 200, 1, 1, color[c], GL_BYTE, &pixels[i+2]);
glReadPixels(700, 400, 1, 1, color[c], GL_BYTE, &pixels[i+3]);
glReadPixels(500, 300, 1, 1, color[c], GL_BYTE, &pixels[i+4]);
}
}
for( int p = 0; p < 14; p++ )
{
if( pixels[p] != 0 )
pass = TRUE;
}
if( pass )
OpenGL_SwapBuffers();
}
else
{
OpenGL_SwapBuffers();
}
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);