Newer version OpenGL game hacks by val532.(Has a lot better way of handling specific game hacks)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3196 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid 2009-05-11 06:40:03 +00:00
parent 8d19e264b9
commit 7011b9c1e4
9 changed files with 102 additions and 41 deletions

View File

@ -77,7 +77,7 @@ void VertexShaderManager::Shutdown()
// =======================================================================================
// Syncs the shader constant buffers with xfmem
// ----------------
void VertexShaderManager::SetConstants(bool proj_hax_1,bool SMG_hack, bool freeLook)
void VertexShaderManager::SetConstants(bool proj_hax_1 ,bool Hack_hack1 ,float Hack_value1 ,bool Hack_hack2 ,float Hack_value2 ,bool freeLook)
{
//nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
//nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
@ -261,10 +261,10 @@ void VertexShaderManager::SetConstants(bool proj_hax_1,bool SMG_hack, bool freeL
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
g_fProjectionMatrix[10] = (Hack_hack1 ? -(Hack_value1 + xfregs.rawProjection[4]) : xfregs.rawProjection[4]);
g_fProjectionMatrix[11] = (Hack_hack2 ? -(Hack_value2 + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (proj_hax_1 ? 0.1f : 0.0f);
g_fProjectionMatrix[11] = (SMG_hack ? -(0.512505f + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (proj_hax_1 ? 0.1f : 0.0f);
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
g_fProjectionMatrix[14] = 0.0f;

View File

@ -28,7 +28,7 @@ public:
static void Shutdown();
// constant management
static void SetConstants(bool proj_hax_1, bool SMG_hack, bool freeLook);
static void SetConstants(bool proj_hax_1, bool Hack_hack1, float Hack_value1, bool Hack_hack2, float Hack_value2, bool freeLook);
static void SetViewport(float* _Viewport);
static void SetViewportChanged();

View File

@ -354,13 +354,11 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
{
const u16 updpar = Memory_Read_U16(updaddr + j);
const u16 upddata = Memory_Read_U16(updaddr + j + 2);
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : General Mail (%08x)", _uMail);
}
else
{
const u16 updpar = Memory_Read_U16(updaddr);
const u16 upddata = Memory_Read_U16(updaddr + 2);
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : General Mail (%08x)", _uMail);
}

View File

@ -235,7 +235,7 @@ void Flush()
if (numVertices)
{
// set global constants
VertexShaderManager::SetConstants(false, false, false);
VertexShaderManager::SetConstants(false, false, 0, false, 0, false);
PixelShaderManager::SetConstants();
PixelShaderCache::SetShader();

View File

@ -80,9 +80,9 @@ void Config::Load()
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0);
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
iniFile.Get("Hacks", "ProjectionHax1", &bProjectionHax1, 0);
//iniFile.Get("Hacks", "ProjectionHax1", &bProjectionHax1, 0);
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
iniFile.Get("Hacks", "SMGhack", &bSMGhack, false);
//iniFile.Get("Hacks", "Hack", &bHack, false);
}
void Config::GameIniLoad() {
@ -102,8 +102,8 @@ void Config::GameIniLoad() {
if (iniFile->Exists("Video", "EFBCopyDisableHotKey"))
iniFile->Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
if (iniFile->Exists("Video", "ProjectionHax1"))
iniFile->Get("Video", "ProjectionHax1", &bProjectionHax1, 0);
//if (iniFile->Exists("Video", "ProjectionHax1"))
// iniFile->Get("Video", "ProjectionHax1", &bProjectionHax1, 0);
if (iniFile->Exists("Video", "EFBToTextureEnable"))
iniFile->Get("Video", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
@ -111,8 +111,8 @@ void Config::GameIniLoad() {
if (iniFile->Exists("Video", "SafeTextureCache"))
iniFile->Get("Video", "SafeTextureCache", &bSafeTextureCache, false);
if (iniFile->Exists("Video", "SMGhack"))
iniFile->Get("Video", "SMGhack", &bSMGhack, false);
// if (iniFile->Exists("Video", "SMGhack"))
// iniFile->Get("Video", "SMGhack", &bSMGhack, false);
if (iniFile->Exists("Video", "MSAA"))
iniFile->Get("Video", "MSAA", &iMultisampleMode, 0);
@ -170,9 +170,9 @@ void Config::Save()
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bEFBCopyDisableHotKey);
iniFile.Set("Hacks", "ProjectionHax1", bProjectionHax1);
//iniFile.Set("Hacks", "ProjectionHax1", bProjectionHax1);
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
iniFile.Set("Hacks", "SMGhack", bSMGhack);
//iniFile.Set("Hacks", "SMGhack", bSMGhack);
iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini");
}

View File

@ -93,9 +93,12 @@ struct Config
bool bEFBCopyDisable;
bool bEFBCopyDisableHotKey;
bool bProjectionHax1;
bool bSMGhack;
bool bHack;
bool bCopyEFBToRAM;
bool bSafeTextureCache;
int iPhackvalue;
bool bPhackvalue1, bPhackvalue2;
float fhackvalue1, fhackvalue2;
int iLog; // CONF_ bits
int iSaveTargetId;

View File

@ -62,13 +62,14 @@ 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_SMGHACK, ConfigDialog::AdvancedSettingsChanged)
//EVT_CHECKBOX(ID_PROJECTIONHACK1,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_HACK, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_SAFETEXTURECACHE,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_DSTALPHAPASS,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_CHECKBOX_DISABLECOPYEFB, ConfigDialog::AdvancedSettingsChanged)
EVT_RADIOBUTTON(ID_RADIO_COPYEFBTORAM, ConfigDialog::AdvancedSettingsChanged)
EVT_RADIOBUTTON(ID_RADIO_COPYEFBTOGL, ConfigDialog::AdvancedSettingsChanged)
EVT_CHOICE(ID_PHACKVALUE, ConfigDialog::GeneralSettingsChanged)
END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
@ -361,29 +362,41 @@ void ConfigDialog::CreateGUIControls()
// Hacks controls
m_SafeTextureCache = new wxCheckBox(m_PageAdvanced, ID_SAFETEXTURECACHE, wxT("Use Safe texture cache"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_ProjectionHax1 = new wxCheckBox(m_PageAdvanced, ID_PROJECTIONHACK1, wxT("ZTP Bloom hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_SMGh = new wxCheckBox(m_PageAdvanced, ID_SMGHACK, wxT("Mario Galaxy Hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//m_ProjectionHax1 = new wxCheckBox(m_PageAdvanced, ID_PROJECTIONHACK1, wxT("ZTP Bloom hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//m_Hack = new wxCheckBox(m_PageAdvanced, ID_HACK, wxT("Mario Galaxy Hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_PhackvalueCB = new wxChoice(m_PageAdvanced, ID_PHACKVALUE, wxDefaultPosition, wxDefaultSize, arrayStringFor_PhackvalueCB, 0, wxDefaultValidator);
m_PhackvalueCB->Append(wxT("Zero"));
m_PhackvalueCB->Append(wxT("ZTP Bloom hack"));
m_PhackvalueCB->Append(wxT("SMG"));
m_PhackvalueCB->Append(wxT("MK"));
m_PhackvalueCB->Append(wxT("Sonic and Black"));
m_PhackvalueCB->Append(wxT("Bleach"));
m_PhackvalueCB->Append(wxT("FFCC-OE"));
m_PhackvalueCB->SetSelection(g_Config.iPhackvalue);
// Default values
m_SafeTextureCache->SetValue(g_Config.bSafeTextureCache);
m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
m_SMGh->SetValue(g_Config.bSMGhack);
//m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
//m_Hack->SetValue(g_Config.bHack);
// 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_ProjectionHax1->SetToolTip(wxT("This should get ZTP's Bloom to show"));
//m_ProjectionHax1->SetToolTip(wxT("This should get ZTP's Bloom to show"));
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."));
m_SMGh->SetToolTip(wxT("SMG hack for Super Mario Galaxy, Mario Kart Wii and other game probably it will be disable for other game and during SMG ending sequence or movies use the M key to turn this option on or off"));
//m_SMGh->SetToolTip(wxT("SMG hack for Super Mario Galaxy, Mario Kart Wii and other game probably it will be disable for other game and during SMG ending sequence or movies use the M key to turn this option on or off"));
// Sizers
sHacks = new wxGridBagSizer(0, 0);
sHacks->Add(m_ProjectionHax1, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
sHacks->Add(m_SafeTextureCache, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
sHacks->Add(m_SMGh, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5);
//sHacks->Add(m_ProjectionHax1, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
sHacks->Add(m_SafeTextureCache, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5);
//sHacks->Add(m_Hack, wxGBPosition(1, 0), 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"));
sbHacks->Add(sHacks, 0, wxEXPAND | (wxTOP), 0);
@ -509,6 +522,53 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case ID_MSAAMODECB:
g_Config.iMultisampleMode = m_MSAAModeCB->GetSelection();
break;
case ID_PHACKVALUE:
g_Config.iPhackvalue = m_PhackvalueCB->GetSelection();
if (g_Config.iPhackvalue >= 0)
{
if (g_Config.iPhackvalue == 0)
{
g_Config.bPhackvalue1 = 0;
g_Config.bPhackvalue2 = 0;
}
if (g_Config.iPhackvalue == 1)
{
g_Config.bProjectionHax1 = 1;
}
if (g_Config.iPhackvalue == 2)
{
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.00006f;
g_Config.bPhackvalue2 = 0;
}
if (g_Config.iPhackvalue == 3)
{
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.0006f;
g_Config.bPhackvalue2 = 0;
}
if (g_Config.iPhackvalue == 4)
{
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.00002f;
g_Config.bPhackvalue2 = 1;
g_Config.fhackvalue2 = 1.999980f;
}
if (g_Config.iPhackvalue == 5)
{
g_Config.bPhackvalue2 = 1;
g_Config.fhackvalue2 = 0.5f;
g_Config.bPhackvalue1 = 0;
}
if (g_Config.iPhackvalue == 6)
{
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.8f;
g_Config.bPhackvalue2 = 1;
g_Config.fhackvalue2 = 1.2f;
}
}
break;
}
UpdateGUI();
@ -551,8 +611,7 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
break;
case ID_DISABLEFOG:
g_Config.bDisableFog = m_DisableFog->IsChecked();
break;
break;
case ID_DSTALPHAPASS:
g_Config.bDstAlphaPass = m_DstAlphaPass->IsChecked();
break;
@ -580,14 +639,14 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
g_Config.bEFBCopyDisableHotKey = m_EFBCopyDisableHotKey->IsChecked();
break;
// Hacks
case ID_PROJECTIONHACK1:
/*case ID_PROJECTIONHACK1:
g_Config.bProjectionHax1 = m_ProjectionHax1->IsChecked();
break;
break;*/
case ID_SAFETEXTURECACHE:
g_Config.bSafeTextureCache = m_SafeTextureCache->IsChecked();
break;
case ID_SMGHACK:
g_Config.bSMGhack = m_SMGh->IsChecked();
case ID_HACK:
g_Config.bHack = m_Hack->IsChecked();
break;
case ID_RADIO_COPYEFBTORAM:
TextureMngr::ClearRenderTargets();

View File

@ -89,8 +89,8 @@ class ConfigDialog : public wxDialog
wxComboBox *m_WindowResolutionCB;
wxArrayString arrayStringFor_MaxAnisotropyCB;
wxChoice *m_MaxAnisotropyCB;
wxArrayString arrayStringFor_MSAAModeCB;
wxChoice *m_MSAAModeCB;
wxArrayString arrayStringFor_MSAAModeCB, arrayStringFor_PhackvalueCB;
wxChoice *m_MSAAModeCB, *m_PhackvalueCB;
wxCheckBox *m_ShowFPS;
wxCheckBox *m_ShaderErrors;
@ -114,8 +114,8 @@ class ConfigDialog : public wxDialog
wxCheckBox *m_CheckBox_DisableCopyEFB;
wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL;
wxCheckBox *m_EFBCopyDisableHotKey;
wxCheckBox *m_ProjectionHax1;
wxCheckBox *m_SMGh;
//wxCheckBox *m_ProjectionHax1;
wxCheckBox *m_Hack;
wxCheckBox *m_SafeTextureCache;
// Screen size
wxStaticText *m_TextScreenWidth, *m_TextScreenHeight, *m_TextScreenLeft, *m_TextScreenTop;
@ -165,7 +165,8 @@ class ConfigDialog : public wxDialog
ID_DISABLEFOG,
ID_STATICBOX_EFB,
ID_SAFETEXTURECACHE,
ID_SMGHACK,
ID_HACK,
ID_PHACKVALUE,
ID_DUMPTEXTURES,
ID_HIRESTEXTURES,
@ -176,7 +177,7 @@ class ConfigDialog : public wxDialog
ID_CHECKBOX_DISABLECOPYEFB,
ID_EFBCOPYDISABLEHOTKEY,
ID_PROJECTIONHACK1,
//ID_PROJECTIONHACK1,
ID_DSTALPHAPASS,
ID_RADIO_COPYEFBTORAM,
ID_RADIO_COPYEFBTOGL,

View File

@ -281,7 +281,7 @@ void Flush()
Renderer::SetRenderMode(Renderer::RM_Normal);
// set global constants
VertexShaderManager::SetConstants(g_Config.bProjectionHax1, g_Config.bSMGhack, g_Config.bFreeLook);
VertexShaderManager::SetConstants(g_Config.bProjectionHax1, g_Config.bPhackvalue1, g_Config.fhackvalue1, g_Config.bPhackvalue2, g_Config.fhackvalue2, g_Config.bFreeLook);
PixelShaderManager::SetConstants();
// finally bind