maybe we should just make configurable linear trasnformation hack;)


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2949 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-04-10 10:25:53 +00:00
parent 65fa1cb729
commit e84ec7855a
7 changed files with 26 additions and 7 deletions

View File

@ -69,7 +69,7 @@ void VertexShaderManager::Shutdown()
// ======================================================================================= // =======================================================================================
// Syncs the shader constant buffers with xfmem // Syncs the shader constant buffers with xfmem
// ---------------- // ----------------
void VertexShaderManager::SetConstants(bool proj_hax_1) void VertexShaderManager::SetConstants(bool proj_hax_1,bool SMG_hack)
{ {
//nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256; //nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
//nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96; //nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
@ -213,6 +213,7 @@ void VertexShaderManager::SetConstants(bool proj_hax_1)
g_fProjectionMatrix[8] = 0.0f; g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f; g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4]; g_fProjectionMatrix[10] = xfregs.rawProjection[4];
g_fProjectionMatrix[11] = xfregs.rawProjection[5]; g_fProjectionMatrix[11] = xfregs.rawProjection[5];
g_fProjectionMatrix[12] = 0.0f; g_fProjectionMatrix[12] = 0.0f;
@ -253,7 +254,13 @@ void VertexShaderManager::SetConstants(bool proj_hax_1)
g_fProjectionMatrix[8] = 0.0f; g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f; g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4]; g_fProjectionMatrix[10] = xfregs.rawProjection[4];
g_fProjectionMatrix[11] = xfregs.rawProjection[5] + (proj_hax_1 ? 0.1f : 0.0f);
if (SMG_hack) {
g_fProjectionMatrix[11] = -(0.512505 + xfregs.rawProjection[5]) + (proj_hax_1 ? 0.1f : 0.0f);
}
else {
g_fProjectionMatrix[11] = xfregs.rawProjection[5] + (proj_hax_1 ? 0.1f : 0.0f);
}
g_fProjectionMatrix[12] = 0.0f; g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f; g_fProjectionMatrix[13] = 0.0f;

View File

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

View File

@ -80,6 +80,7 @@ void Config::Load()
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 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", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
iniFile.Get("Hacks", "SMGhack", &bSMGhack, true);
} }
void Config::GameIniLoad() { void Config::GameIniLoad() {

View File

@ -91,6 +91,7 @@ struct Config
bool bEFBCopyDisable; bool bEFBCopyDisable;
bool bEFBCopyDisableHotKey; bool bEFBCopyDisableHotKey;
bool bProjectionHax1; bool bProjectionHax1;
bool bSMGhack;
bool bCopyEFBToRAM; bool bCopyEFBToRAM;
bool bSafeTextureCache; bool bSafeTextureCache;

View File

@ -60,6 +60,7 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHECKBOX(ID_DISABLEFOG, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_DISABLEFOG, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_EFBCOPYDISABLEHOTKEY, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_EFBCOPYDISABLEHOTKEY, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_PROJECTIONHACK1,ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_PROJECTIONHACK1,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_SMGHACK, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_SAFETEXTURECACHE,ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_SAFETEXTURECACHE,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_DSTALPHAPASS,ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_DSTALPHAPASS,ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_CHECKBOX_DISABLECOPYEFB, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_CHECKBOX_DISABLECOPYEFB, ConfigDialog::AdvancedSettingsChanged)
@ -353,13 +354,17 @@ void ConfigDialog::CreateGUIControls()
// Hacks controls // Hacks controls
m_SafeTextureCache = new wxCheckBox(m_PageAdvanced, ID_SAFETEXTURECACHE, wxT("Use Safe texture cache"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); 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_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);
// Disabled or enabled // Disabled or enabled
m_SafeTextureCache->Enable(true); m_SafeTextureCache->Enable(true);
m_ProjectionHax1->Enable(true); m_ProjectionHax1->Enable(true);
m_SMGh->Enable(false);
// Default values // Default values
m_SafeTextureCache->SetValue(g_Config.bSafeTextureCache); m_SafeTextureCache->SetValue(g_Config.bSafeTextureCache);
m_ProjectionHax1->SetValue(g_Config.bProjectionHax1); m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
m_SMGh->SetValue(g_Config.bSMGhack);
// Tool tips // Tool tips
m_SafeTextureCache->SetToolTip(wxT("This is useful to prevent Metroid Prime from crashing, but can cause problems in other games." m_SafeTextureCache->SetToolTip(wxT("This is useful to prevent Metroid Prime from crashing, but can cause problems in other games."
@ -373,8 +378,9 @@ void ConfigDialog::CreateGUIControls()
// Sizers // Sizers
sHacks = new wxGridBagSizer(0, 0); sHacks = new wxGridBagSizer(0, 0);
sHacks->Add(m_ProjectionHax1, wxGBPosition(0, 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_SafeTextureCache, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
sHacks->Add(m_SMGh, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5);
sbHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks")); sbHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks"));
sbHacks->Add(sHacks, 0, wxEXPAND | (wxTOP), 0); sbHacks->Add(sHacks, 0, wxEXPAND | (wxTOP), 0);
@ -567,7 +573,9 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
case ID_SAFETEXTURECACHE: case ID_SAFETEXTURECACHE:
g_Config.bSafeTextureCache = m_SafeTextureCache->IsChecked(); g_Config.bSafeTextureCache = m_SafeTextureCache->IsChecked();
break; break;
case ID_SMGHACK:
g_Config.bSMGhack = m_SMGh->IsChecked();
break;
case ID_RADIO_COPYEFBTORAM: case ID_RADIO_COPYEFBTORAM:
TextureMngr::ClearRenderTargets(); TextureMngr::ClearRenderTargets();
g_Config.bCopyEFBToRAM = true; g_Config.bCopyEFBToRAM = true;

View File

@ -113,6 +113,7 @@ class ConfigDialog : public wxDialog
wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL; wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL;
wxCheckBox *m_EFBCopyDisableHotKey; wxCheckBox *m_EFBCopyDisableHotKey;
wxCheckBox *m_ProjectionHax1; wxCheckBox *m_ProjectionHax1;
wxCheckBox *m_SMGh;
wxCheckBox *m_SafeTextureCache; wxCheckBox *m_SafeTextureCache;
// Screen size // Screen size
wxStaticText *m_TextScreenWidth, *m_TextScreenHeight, *m_TextScreenLeft, *m_TextScreenTop; wxStaticText *m_TextScreenWidth, *m_TextScreenHeight, *m_TextScreenLeft, *m_TextScreenTop;
@ -161,6 +162,7 @@ class ConfigDialog : public wxDialog
ID_DISABLEFOG, ID_DISABLEFOG,
ID_STATICBOX_EFB, ID_STATICBOX_EFB,
ID_SAFETEXTURECACHE, ID_SAFETEXTURECACHE,
ID_SMGHACK,
ID_DUMPTEXTURES, ID_DUMPTEXTURES,
ID_DUMPEFBTARGET, ID_DUMPEFBTARGET,

View File

@ -278,7 +278,7 @@ void Flush()
Renderer::SetRenderMode(Renderer::RM_Normal); Renderer::SetRenderMode(Renderer::RM_Normal);
// set global constants // set global constants
VertexShaderManager::SetConstants(g_Config.bProjectionHax1); VertexShaderManager::SetConstants(g_Config.bProjectionHax1, g_Config.bSMGhack);
PixelShaderManager::SetConstants(); PixelShaderManager::SetConstants();
// finally bind // finally bind