Revert 2521.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2524 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
0255f775da
commit
56becf28db
|
@ -69,7 +69,7 @@ void VertexShaderManager::Shutdown()
|
|||
// =======================================================================================
|
||||
// Syncs the shader constant buffers with xfmem
|
||||
// ----------------
|
||||
void VertexShaderManager::SetConstants()
|
||||
void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
|
||||
{
|
||||
//nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
|
||||
//nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
|
||||
|
@ -203,17 +203,30 @@ void VertexShaderManager::SetConstants()
|
|||
g_fProjectionMatrix[0] = xfregs.rawProjection[0];
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = xfregs.rawProjection[1];
|
||||
g_fProjectionMatrix[3] = 0.0f;
|
||||
g_fProjectionMatrix[3] = 0;
|
||||
|
||||
g_fProjectionMatrix[4] = 0.0f;
|
||||
g_fProjectionMatrix[5] = xfregs.rawProjection[2];
|
||||
g_fProjectionMatrix[6] = xfregs.rawProjection[3];
|
||||
g_fProjectionMatrix[7] = 0.0f;
|
||||
g_fProjectionMatrix[7] = 0;
|
||||
|
||||
g_fProjectionMatrix[8] = 0.0f;
|
||||
g_fProjectionMatrix[9] = 0.0f;
|
||||
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
|
||||
g_fProjectionMatrix[11] = xfregs.rawProjection[5];
|
||||
|
||||
//---------Projection[11]---------
|
||||
// No hacks
|
||||
if ((!proj_hax_1 && !proj_hax_2) || (proj_hax_1 && proj_hax_2))
|
||||
g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
|
||||
|
||||
// Before R945 Hack
|
||||
if (proj_hax_1 && !proj_hax_2)
|
||||
g_fProjectionMatrix[11] = -(1.0f - xfregs.rawProjection[5]);
|
||||
|
||||
// R844 Hack
|
||||
if (!proj_hax_1 && proj_hax_2)
|
||||
g_fProjectionMatrix[11] = xfregs.rawProjection[5];
|
||||
//--------------------------------
|
||||
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
|
@ -253,10 +266,24 @@ void VertexShaderManager::SetConstants()
|
|||
g_fProjectionMatrix[8] = 0.0f;
|
||||
g_fProjectionMatrix[9] = 0.0f;
|
||||
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
|
||||
g_fProjectionMatrix[11] = xfregs.rawProjection[5] + 0.1f;
|
||||
|
||||
//---------Projection[11]---------
|
||||
// No hacks
|
||||
if ((!proj_hax_1 && !proj_hax_2) || (proj_hax_1 && proj_hax_2))
|
||||
g_fProjectionMatrix[11] = -(-0.5f - xfregs.rawProjection[5]);
|
||||
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
// Before R945 Hack
|
||||
if (proj_hax_1 && !proj_hax_2)
|
||||
g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
|
||||
|
||||
// R844 Hack
|
||||
if (!proj_hax_1 && proj_hax_2)
|
||||
g_fProjectionMatrix[11] = -xfregs.rawProjection[5];
|
||||
|
||||
//--------------------------------
|
||||
|
||||
g_fProjectionMatrix[12] = 0;
|
||||
g_fProjectionMatrix[13] = 0;
|
||||
g_fProjectionMatrix[14] = 0.0f;
|
||||
g_fProjectionMatrix[15] = 1.0f;
|
||||
|
||||
|
@ -276,17 +303,15 @@ void VertexShaderManager::SetConstants()
|
|||
SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]);
|
||||
SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]);
|
||||
SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]);
|
||||
|
||||
SETSTAT_FT(stats.proj_0, xfregs.rawProjection[0]);
|
||||
SETSTAT_FT(stats.proj_1, xfregs.rawProjection[1]);
|
||||
SETSTAT_FT(stats.proj_2, xfregs.rawProjection[2]);
|
||||
SETSTAT_FT(stats.proj_3, xfregs.rawProjection[3]);
|
||||
SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]);
|
||||
SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]);
|
||||
SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]);
|
||||
}
|
||||
|
||||
|
||||
SETSTAT_FT(stats.proj_0, xfregs.rawProjection[0]);
|
||||
SETSTAT_FT(stats.proj_1, xfregs.rawProjection[1]);
|
||||
SETSTAT_FT(stats.proj_2, xfregs.rawProjection[2]);
|
||||
SETSTAT_FT(stats.proj_3, xfregs.rawProjection[3]);
|
||||
SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]);
|
||||
SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]);
|
||||
SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]);
|
||||
|
||||
PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]);
|
||||
SetVSConstant4fv(C_PROJECTION, &g_fProjectionMatrix[0]);
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
static void Shutdown();
|
||||
|
||||
// constant management
|
||||
static void SetConstants();
|
||||
static void SetConstants(bool proj_hax_1, bool proj_hax_2);
|
||||
|
||||
static void SetViewport(float* _Viewport);
|
||||
static void SetViewportChanged();
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "CPMemory.h"
|
||||
#include "NativeVertexWriter.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "PixelShaderManager.h"
|
||||
|
||||
// LoadXFReg 0x10
|
||||
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
|
||||
|
@ -155,7 +154,6 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
|
|||
case 0x101a:
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::SetViewport((float*)&pData[i]);
|
||||
PixelShaderManager::SetViewport((float*)&pData[i]);
|
||||
i += 6;
|
||||
break;
|
||||
|
||||
|
|
|
@ -183,12 +183,34 @@ void BPWritten(int addr, int changes, int newval)
|
|||
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
|
||||
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
|
||||
|
||||
/*
|
||||
Logic Operation Blend Modes
|
||||
--------------------
|
||||
0: GL_CLEAR
|
||||
1: GL_AND
|
||||
2: GL_AND_REVERSE
|
||||
3: GL_COPY [Super Smash. Bro. Melee, NES Zelda I, NES Zelda II]
|
||||
4: GL_AND_INVERTED
|
||||
5: GL_NOOP
|
||||
6: GL_XOR
|
||||
7: GL_OR [Zelda: TP]
|
||||
8: GL_NOR
|
||||
9: GL_EQUIV
|
||||
10: GL_INVERT
|
||||
11: GL_OR_REVERSE
|
||||
12: GL_COPY_INVERTED
|
||||
13: GL_OR_INVERTED
|
||||
14: GL_NAND
|
||||
15: GL_SET
|
||||
*/
|
||||
|
||||
// LogicOp Blending
|
||||
if (changes & 2) {
|
||||
SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode);
|
||||
if (bpmem.blendmode.logicopenable)
|
||||
{
|
||||
glEnable(GL_COLOR_LOGIC_OP);
|
||||
// PanicAlert("Logic Op Blend : %i", bpmem.blendmode.logicmode);
|
||||
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -81,6 +81,8 @@ void Config::Load()
|
|||
|
||||
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0);
|
||||
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
|
||||
iniFile.Get("Hacks", "ProjectionHax1", &bProjectionHax1, 0);
|
||||
iniFile.Get("Hacks", "ProjectionHax2", &bProjectionHax2, 0);
|
||||
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
|
||||
}
|
||||
|
||||
|
@ -121,6 +123,8 @@ void Config::Save()
|
|||
|
||||
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
|
||||
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bEFBCopyDisableHotKey);
|
||||
iniFile.Set("Hacks", "ProjectionHax1", bProjectionHax1);
|
||||
iniFile.Set("Hacks", "ProjectionHax2", bProjectionHax2);
|
||||
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
|
||||
|
||||
iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini");
|
||||
|
|
|
@ -73,6 +73,8 @@ struct Config
|
|||
// Hacks
|
||||
bool bEFBCopyDisable;
|
||||
bool bEFBCopyDisableHotKey;
|
||||
bool bProjectionHax1;
|
||||
bool bProjectionHax2;
|
||||
bool bCopyEFBToRAM;
|
||||
bool bSafeTextureCache;
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
|||
EVT_CHECKBOX(ID_DISABLELIGHTING, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISABLETEXTURING, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_EFBCOPYDISABLEHOTKEY, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PROJECTIONHACK1,ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PROJECTIONHACK2,ConfigDialog::AdvancedSettingsChanged)
|
||||
|
||||
EVT_CHECKBOX(ID_SAFETEXTURECACHE,ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_CHECKBOX_DISABLECOPYEFB, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_DIRPICKER_CHANGED(ID_TEXTUREPATH, ConfigDialog::TexturePathChange)
|
||||
|
@ -229,8 +232,6 @@ void ConfigDialog::CreateGUIControls()
|
|||
wxString tmp;
|
||||
tmp << g_Config.iMultisampleMode;
|
||||
m_AliasModeCB->SetValue(tmp);
|
||||
AAText->Hide();
|
||||
m_AliasModeCB->Hide();
|
||||
|
||||
// Usage: The wxGBPosition() must have a column and row
|
||||
sGeneral = new wxBoxSizer(wxVERTICAL);
|
||||
|
@ -261,8 +262,8 @@ void ConfigDialog::CreateGUIControls()
|
|||
sEnhancements->Add(m_ForceFiltering, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sEnhancements->Add(AnisoText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sEnhancements->Add(m_MaxAnisotropyCB, wxGBPosition(1, 1), wxGBSpan(1, 2), wxALL, 5);
|
||||
//sEnhancements->Add(AAText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
//sEnhancements->Add(m_AliasModeCB, wxGBPosition(2, 1), wxGBSpan(1, 2), wxALL, 5);
|
||||
sEnhancements->Add(AAText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sEnhancements->Add(m_AliasModeCB, wxGBPosition(2, 1), wxGBSpan(1, 2), wxALL, 5);
|
||||
sbEnhancements->Add(sEnhancements);
|
||||
sGeneral->Add(sbEnhancements, 0, wxEXPAND|wxALL, 5);
|
||||
m_PageGeneral->SetSizer(sGeneral);
|
||||
|
@ -278,9 +279,9 @@ void ConfigDialog::CreateGUIControls()
|
|||
m_BlendStats->SetValue(g_Config.bOverlayBlendStats);
|
||||
m_ProjStats = new wxCheckBox(m_PageAdvanced, ID_PROJSTATS, wxT("Overlay Projection Stats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ProjStats->SetValue(g_Config.bOverlayProjStats);
|
||||
//m_ShaderErrors = new wxCheckBox(m_PageAdvanced, ID_SHADERERRORS, wxT("Show shader compilation issues"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ShaderErrors = new wxCheckBox(m_PageAdvanced, ID_SHADERERRORS, wxT("Show shader compilation issues"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
//m_ShaderErrors->SetValue(g_Config.bShowShaderErrors);
|
||||
//m_ShaderErrors->Enable(false);
|
||||
m_ShaderErrors->Enable(false);
|
||||
m_TexFmtOverlay = new wxCheckBox(m_PageAdvanced, ID_TEXFMTOVERLAY, wxT("Overlay texture format"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_TexFmtOverlay->SetValue(g_Config.bTexFmtOverlayEnable);
|
||||
m_TexFmtCenter = new wxCheckBox(m_PageAdvanced, ID_TEXFMTCENTER, wxT("centered"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
@ -329,21 +330,31 @@ 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("Projection before R945"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ProjectionHax2 = new wxCheckBox(m_PageAdvanced, ID_PROJECTIONHACK2, wxT("Projection hack of R844"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Disabled or enabled
|
||||
m_SafeTextureCache->Enable(true);
|
||||
m_ProjectionHax1->Enable(true);
|
||||
m_ProjectionHax2->Enable(true);
|
||||
|
||||
// Default values
|
||||
m_SafeTextureCache->SetValue(g_Config.bSafeTextureCache);
|
||||
m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
|
||||
m_ProjectionHax2->SetValue(g_Config.bProjectionHax2);
|
||||
|
||||
// Tool tips
|
||||
m_SafeTextureCache->SetToolTip(wxT("This is useful to prevent Metroid Prime from crashing, but can cause problems in other games."
|
||||
" [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 may reveal otherwise invisible graphics"
|
||||
" in\ngames like Mario Galaxy or Ikaruga."));
|
||||
|
||||
// Sizers
|
||||
sHacks = new wxGridBagSizer(0, 0);
|
||||
sHacks->Add(m_SafeTextureCache, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sHacks->Add(m_ProjectionHax1, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sHacks->Add(m_ProjectionHax2, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sHacks->Add(m_SafeTextureCache, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
|
||||
sbHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks"));
|
||||
sbHacks->Add(sHacks, 0, wxEXPAND | (wxTOP), 0);
|
||||
|
@ -352,12 +363,12 @@ void ConfigDialog::CreateGUIControls()
|
|||
sAdvanced = new wxBoxSizer(wxVERTICAL);
|
||||
sInfo = new wxGridBagSizer(0, 0);
|
||||
sInfo->Add(m_ShowFPS, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
//sInfo->Add(m_ShaderErrors, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_Statistics, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_BlendStats, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_ProjStats, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_TexFmtOverlay, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sInfo->Add(m_TexFmtCenter, wxGBPosition(4, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
sInfo->Add(m_ShaderErrors, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_Statistics, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_BlendStats, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_ProjStats, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sInfo->Add(m_TexFmtOverlay, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sInfo->Add(m_TexFmtCenter, wxGBPosition(5, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
sbInfo->Add(sInfo);
|
||||
|
||||
wxBoxSizer *sRenderBoxRow1 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -508,9 +519,16 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
|
|||
g_Config.bEFBCopyDisableHotKey = m_EFBCopyDisableHotKey->IsChecked();
|
||||
break;
|
||||
// Hacks
|
||||
case ID_PROJECTIONHACK1:
|
||||
g_Config.bProjectionHax1 = m_ProjectionHax1->IsChecked();
|
||||
break;
|
||||
case ID_PROJECTIONHACK2:
|
||||
g_Config.bProjectionHax2 = m_ProjectionHax2->IsChecked();
|
||||
break;
|
||||
case ID_SAFETEXTURECACHE:
|
||||
g_Config.bSafeTextureCache = m_SafeTextureCache->IsChecked();
|
||||
break;
|
||||
|
||||
// External frame buffer
|
||||
case ID_RADIO_COPYEFBTORAM:
|
||||
TextureMngr::ClearRenderTargets();
|
||||
|
|
|
@ -107,6 +107,8 @@ class ConfigDialog : public wxDialog
|
|||
wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL;
|
||||
wxDirPickerCtrl *m_TexturePath;
|
||||
wxCheckBox *m_EFBCopyDisableHotKey;
|
||||
wxCheckBox *m_ProjectionHax1;
|
||||
wxCheckBox *m_ProjectionHax2;
|
||||
wxCheckBox *m_SafeTextureCache;
|
||||
// Screen size
|
||||
wxStaticText *m_TextScreenWidth, *m_TextScreenHeight, *m_TextScreenLeft, *m_TextScreenTop;
|
||||
|
@ -159,6 +161,8 @@ class ConfigDialog : public wxDialog
|
|||
|
||||
ID_CHECKBOX_DISABLECOPYEFB,
|
||||
ID_EFBCOPYDISABLEHOTKEY,
|
||||
ID_PROJECTIONHACK1,
|
||||
ID_PROJECTIONHACK2,
|
||||
ID_RADIO_COPYEFBTORAM,
|
||||
ID_RADIO_COPYEFBTOGL,
|
||||
};
|
||||
|
|
|
@ -259,7 +259,7 @@ void Flush()
|
|||
}
|
||||
|
||||
// set global constants
|
||||
VertexShaderManager::SetConstants();
|
||||
VertexShaderManager::SetConstants(g_Config.bProjectionHax1, g_Config.bProjectionHax2);
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
// finally bind
|
||||
|
|
Loading…
Reference in New Issue