Removed the Projection Hacks since the Original Projection was correct, I never ment to commit those projection changes anyway ;p

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1063 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2008-11-04 01:38:20 +00:00
parent 5507cc7b95
commit 712a391cb8
5 changed files with 52 additions and 104 deletions

View File

@ -71,15 +71,13 @@ void Config::Load()
iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0);
iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0);
iniFile.Get("Settings", "DisableCulling", &bDisableCulling, 0);
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
iniFile.Get("Enhancements", "ForceMaxAniso", &bForceMaxAniso, 0);
iniFile.Get("Enhancements", "StretchToFit", &bStretchToFit, false);
iniFile.Get("Enhancements", "KeepAR", &bKeepAR, false);
iniFile.Get("Hacks", "InvertDepth", &bInvertDepth, 0);
iniFile.Get("Hacks", "ProjectionHax1", &bProjectionHax1, 0);
iniFile.Get("Hacks", "ProjectionHax2", &bProjectionHax2, 0);
iniFile.Get("Hacks", "EFBToTextureDisable", &bEBFToTextureDisable, 0);
}
@ -90,7 +88,7 @@ void Config::Save()
iniFile.Set("Hardware", "WindowedRes", iWindowedRes);
iniFile.Set("Hardware", "FullscreenRes", iFSResolution);
iniFile.Set("Hardware", "Fullscreen", bFullscreen);
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
iniFile.Set("Settings", "ShowFPS", bShowFPS);
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
@ -114,8 +112,6 @@ void Config::Save()
iniFile.Set("Enhancements", "KeepAR", bKeepAR);
iniFile.Set("Hacks", "InvertDepth", bInvertDepth);
iniFile.Set("Hacks", "ProjectionHax1", bProjectionHax1);
iniFile.Set("Hacks", "ProjectionHax2", bProjectionHax2);
iniFile.Set("Hacks", "EFBToTextureDisable", bEBFToTextureDisable);
iniFile.Save("gfx_opengl.ini");

View File

@ -24,7 +24,7 @@
#define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16
struct Config
struct Config
{
Config();
void Load();
@ -48,22 +48,20 @@ struct Config
bool bOverlayStats;
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
// Render
bool bUseXFB;
bool bWireFrame;
bool bDisableLighting;
bool bDisableTexturing;
bool bDisableCulling;
// Utility
char texDumpPath[280];
bool bDumpTextures;
// Hacks
bool bInvertDepth;
bool bProjectionHax1;
bool bProjectionHax2;
bool bEBFToTextureDisable;
int iLog; // CONF_ bits

View File

@ -45,8 +45,6 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHECKBOX(ID_USEXFB,ConfigDialog::UseXFBChange)
EVT_CHECKBOX(ID_DUMPTEXTURES,ConfigDialog::DumpTexturesChange)
EVT_CHECKBOX(ID_INVERTDEPTH,ConfigDialog::InvertDepth)
EVT_CHECKBOX(ID_PROJECTIONHAX1,ConfigDialog::ProjectionHax1)
EVT_CHECKBOX(ID_PROJECTIONHAX2,ConfigDialog::ProjectionHax2)
EVT_CHECKBOX(ID_DISABLELIGHTING,ConfigDialog::DisableLighting)
EVT_CHECKBOX(ID_DISABLETEXTURING,ConfigDialog::DisableTexturing)
EVT_CHECKBOX(ID_EFBTOTEXTUREDISABLE,ConfigDialog::EFBToTextureDisable)
@ -63,10 +61,10 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
ConfigDialog::~ConfigDialog()
{
}
}
void ConfigDialog::CreateGUIControls()
{
{
//notebook
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
@ -87,11 +85,11 @@ void ConfigDialog::CreateGUIControls()
m_PageHacks = new wxPanel(m_Notebook, ID_PAGEHACKS, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_PageHacks, wxT("Hacks"));
//buttons
m_About = new wxButton(this, ID_GRAPHIC_ABOUT, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_OK = new wxButton(this, ID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//put notebook and buttons in sizers
wxBoxSizer* sButtons;
@ -100,12 +98,12 @@ void ConfigDialog::CreateGUIControls()
sButtons->Add(0, 0, 1, wxEXPAND, 5);
sButtons->Add(m_OK, 0, wxALL, 5);
sButtons->Add(m_Cancel, 0, wxALL, 5);
wxBoxSizer* sMain;
sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 5);
this->SetSizer(sMain);
this->Layout();
@ -153,7 +151,7 @@ void ConfigDialog::CreateGUIControls()
// Page 3 "Information"
m_ShowFPS = new wxCheckBox(m_PageInformation, ID_SHOWFPS, wxT("Overlay FPS"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_ShowFPS->SetValue(g_Config.bShowFPS);
m_Statistics = new wxCheckBox(m_PageInformation, ID_STATISTICS, wxT("Overlay some statistics"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Statistics->SetValue(g_Config.bOverlayStats);
@ -203,14 +201,6 @@ void ConfigDialog::CreateGUIControls()
m_EFBToTextureDisable->Enable(true);
m_EFBToTextureDisable->SetValue(g_Config.bEBFToTextureDisable);
m_ProjectionHax1 = new wxCheckBox(m_PageHacks, ID_PROJECTIONHAX1, wxT("Projection before R945"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_ProjectionHax1->Enable(true);
m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
m_ProjectionHax2 = new wxCheckBox(m_PageHacks, ID_PROJECTIONHAX2, wxT("Projection hack of R844"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_ProjectionHax2->Enable(true);
m_ProjectionHax2->SetValue(g_Config.bProjectionHax2);
//Put options in sizers within the notebook
wxGridBagSizer* sPage1;
sPage1 = new wxGridBagSizer(0, 0);
@ -277,8 +267,6 @@ void ConfigDialog::CreateGUIControls()
sPage6->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
sPage6->Add(m_InvertDepth, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sPage6->Add(m_EFBToTextureDisable, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sPage6->Add(m_ProjectionHax1, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sPage6->Add(m_ProjectionHax2, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
m_PageHacks->SetSizer(sPage6);
sPage6->Layout();
@ -406,7 +394,7 @@ void ConfigDialog::UseXFBChange(wxCommandEvent& event)
}
void ConfigDialog::DumpTexturesChange(wxCommandEvent& event)
{
{
m_TexturePath->Enable(m_DumpTextures->IsChecked());
g_Config.bDumpTextures = m_DumpTextures->IsChecked();
}
@ -417,7 +405,7 @@ void ConfigDialog::TexturePathChange(wxFileDirPickerEvent& event)
// the combobox, this event wil not be fired.
strcpy(g_Config.texDumpPath,event.GetPath().mb_str());
}
void ConfigDialog::DllAbout(wxCommandEvent& event)
void ConfigDialog::DllAbout(wxCommandEvent& event)
{
wxAboutDialogInfo info;
info.AddDeveloper(_T("zerofrog(@gmail.com)"));
@ -428,14 +416,6 @@ void ConfigDialog::InvertDepth(wxCommandEvent& event)
{
g_Config.bInvertDepth = m_InvertDepth->IsChecked();
}
void ConfigDialog::ProjectionHax1(wxCommandEvent& event)
{
g_Config.bProjectionHax1 = m_ProjectionHax1->IsChecked();
}
void ConfigDialog::ProjectionHax2(wxCommandEvent& event)
{
g_Config.bProjectionHax2 = m_ProjectionHax2->IsChecked();
}
void ConfigDialog::DisableLighting(wxCommandEvent &event)
{
@ -452,4 +432,4 @@ void ConfigDialog::EFBToTextureDisable(wxCommandEvent &event)
void ConfigDialog::DisableCulling(wxCommandEvent &event)
{
g_Config.bDisableCulling = m_DisableCulling->IsChecked();
}
}

View File

@ -40,14 +40,14 @@ class ConfigDialog : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("OpenGL Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE);
virtual ~ConfigDialog();
void OKClick(wxCommandEvent& event);
// General
void FullScreenCheck(wxCommandEvent& event);
void FullScreenCheck(wxCommandEvent& event);
void RenderMainCheck(wxCommandEvent& event);
void AddFSReso(char *reso);
void AddWindowReso(char *reso);
@ -60,7 +60,7 @@ class ConfigDialog : public wxDialog
void FSCB(wxCommandEvent& event);
void WMCB(wxCommandEvent& event);
void AACB(wxCommandEvent& event);
void ForceFilteringCheck(wxCommandEvent& event);
void ForceFilteringCheck(wxCommandEvent& event);
void ForceAnisotropyCheck(wxCommandEvent& event);
// Information
@ -82,10 +82,8 @@ class ConfigDialog : public wxDialog
// Hacks
void InvertDepth(wxCommandEvent& event);
void ProjectionHax1(wxCommandEvent& event);
void ProjectionHax2(wxCommandEvent& event);
void EFBToTextureDisable(wxCommandEvent& event);
private:
wxButton* m_About;
@ -107,7 +105,7 @@ class ConfigDialog : public wxDialog
wxComboBox *m_AliasModeCB;
wxComboBox *m_WindowResolutionCB;
wxComboBox *m_FullscreenCB;
wxCheckBox *m_RenderToMainWindow;
wxCheckBox *m_RenderToMainWindow;
wxCheckBox *m_Fullscreen;
wxCheckBox *m_DisableLighting;
wxCheckBox *m_DisableTexturing;
@ -123,7 +121,7 @@ class ConfigDialog : public wxDialog
wxPanel *m_PageUtility;
wxPanel *m_PageHacks;
wxNotebook *m_Notebook;
private:
enum
@ -170,7 +168,7 @@ class ConfigDialog : public wxDialog
////GUI Enum Control ID End
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
private:
void OnClose(wxCloseEvent& event);
void CreateGUIControls();

View File

@ -75,7 +75,7 @@ void VertexShaderMngr::Init()
bTexMatricesChanged[0] = bTexMatricesChanged[1] = false;
bPosNormalMatrixChanged = bProjectionChanged = bViewportChanged = false;
nMaterialsChanged = 0;
memset(&xfregs, 0, sizeof(xfregs));
memset(xfmem, 0, sizeof(xfmem));
@ -118,7 +118,7 @@ VERTEXSHADER* VertexShaderMngr::GetShader(u32 components)
static int counter = 0;
char szTemp[MAX_PATH];
sprintf(szTemp, "%s/vs_%04i.txt", g_Config.texDumpPath, counter++);
SaveData(szTemp, code);
}
#endif
@ -266,7 +266,7 @@ void VertexShaderMngr::SetConstants()
int istart = nLightsChanged[0] / 0x10;
int iend = (nLightsChanged[1] + 15) / 0x10;
const float* xfmemptr = (const float*)&xfmem[0x10*istart + XFMEM_LIGHTS];
for (int i = istart; i < iend; ++i) {
u32 color = *(const u32*)(xfmemptr + 3);
SetVSConstant4f(C_LIGHTS + 5*i,
@ -319,7 +319,7 @@ void VertexShaderMngr::SetConstants()
(float*)xfmem + MatrixIndexA.Tex0MtxIdx * 4, (float*)xfmem + MatrixIndexA.Tex1MtxIdx * 4,
(float*)xfmem + MatrixIndexA.Tex2MtxIdx * 4, (float*)xfmem + MatrixIndexA.Tex3MtxIdx * 4
};
for (int i = 0; i < 4; ++i) {
SetVSConstant4fv(C_TEXMATRICES+3*i, fptrs[i]);
SetVSConstant4fv(C_TEXMATRICES+3*i+1, fptrs[i]+4);
@ -332,7 +332,7 @@ void VertexShaderMngr::SetConstants()
float* fptrs[] = {(float*)xfmem + MatrixIndexB.Tex4MtxIdx * 4, (float*)xfmem + MatrixIndexB.Tex5MtxIdx * 4,
(float*)xfmem + MatrixIndexB.Tex6MtxIdx * 4, (float*)xfmem + MatrixIndexB.Tex7MtxIdx * 4 };
for (int i = 0; i < 4; ++i) {
SetVSConstant4fv(C_TEXMATRICES+3*i+12, fptrs[i]);
SetVSConstant4fv(C_TEXMATRICES+3*i+12+1, fptrs[i]+4);
@ -372,7 +372,7 @@ void VertexShaderMngr::SetConstants()
{
// Check if height or width is the limiting factor
if (ratio > 1) // then we are to wide and have to limit the width
{
{
wAdj = ratio;
hAdj = 1;
@ -441,29 +441,17 @@ void VertexShaderMngr::SetConstants()
g_fProjectionMatrix[1] = 0.0f;
g_fProjectionMatrix[2] = xfregs.rawProjection[1];
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;
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
if((!g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) || (g_Config.bProjectionHax1 && g_Config.bProjectionHax2)) {
// Working bloom in ZTP
g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]); // Yes, it's important that it's done this way.
// Working projection in PSO
// g_fProjectionMatrix[11] = -(1.0f - rawProjection[5]);
}
if(g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) // Before R945
g_fProjectionMatrix[11] = -(1.0f - xfregs.rawProjection[5]);
if(!g_Config.bProjectionHax1 && g_Config.bProjectionHax2) // R844
g_fProjectionMatrix[11] = xfregs.rawProjection[5];
g_fProjectionMatrix[11] = xfregs.rawProjection[5];
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
// donkopunchstania: GC GPU rounds differently?
@ -485,19 +473,7 @@ void VertexShaderMngr::SetConstants()
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
if((!g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) || (g_Config.bProjectionHax1 && g_Config.bProjectionHax2)) {
// Working bloom in ZTP
g_fProjectionMatrix[11] = -(-1.0f - xfregs.rawProjection[5]); // Yes, it's important that it's done this way.
// Working projection in PSO, working Super Monkey Ball
// g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
}
if(g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) // Before R945
g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
if(!g_Config.bProjectionHax1 && g_Config.bProjectionHax2) // R844
g_fProjectionMatrix[11] = -xfregs.rawProjection[5];
g_fProjectionMatrix[11] = -(-1.0f - xfregs.rawProjection[5]);
g_fProjectionMatrix[12] = 0;
g_fProjectionMatrix[13] = 0;
@ -546,7 +522,7 @@ void VertexShaderMngr::InvalidateXFRange(int start, int end)
if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end;
}
}
if (start < XFMEM_NORMALMATRICES_END && end > XFMEM_NORMALMATRICES) {
int _start = start < XFMEM_NORMALMATRICES ? 0 : start-XFMEM_NORMALMATRICES;
int _end = end < XFMEM_NORMALMATRICES_END ? end-XFMEM_NORMALMATRICES : XFMEM_NORMALMATRICES_END-XFMEM_NORMALMATRICES;
@ -642,18 +618,18 @@ float* VertexShaderMngr::GetPosNormalMat()
void VertexShaderMngr::GetVertexShaderId(VERTEXSHADERUID& vid, u32 components)
{
u32 zbufrender = (bpmem.ztex2.op == ZTEXTURE_ADD) || Renderer::GetZBufferTarget() != 0;
vid.values[0] = components |
vid.values[0] = components |
(xfregs.numTexGens << 23) |
(xfregs.nNumChans << 27) |
((u32)xfregs.bEnableDualTexTransform << 29) |
(zbufrender << 30);
for (int i = 0; i < 2; ++i) {
vid.values[1+i] = xfregs.colChans[i].color.enablelighting ?
(u32)xfregs.colChans[i].color.hex :
vid.values[1+i] = xfregs.colChans[i].color.enablelighting ?
(u32)xfregs.colChans[i].color.hex :
(u32)xfregs.colChans[i].color.matsource;
vid.values[1+i] |= (xfregs.colChans[i].alpha.enablelighting ?
(u32)xfregs.colChans[i].alpha.hex :
vid.values[1+i] |= (xfregs.colChans[i].alpha.enablelighting ?
(u32)xfregs.colChans[i].alpha.hex :
(u32)xfregs.colChans[i].alpha.matsource) << 15;
}
@ -687,7 +663,7 @@ void VertexShaderMngr::GetVertexShaderId(VERTEXSHADERUID& vid, u32 components)
// LoadXFReg 0x10
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
{
{
u32 address = baseAddress;
for (int i = 0; i < (int)transferSize; i++)
{
@ -706,7 +682,7 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
}
else if (address<0x2000)
{
u32 data = pData[i];
u32 data = pData[i];
switch (address)
{
case 0x1000: // error
@ -743,19 +719,19 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
VertexManager::Flush();
nMaterialsChanged |= 1;
xfregs.colChans[0].ambColor = data;
s_fMaterials[0] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[1] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[0] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[1] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[2] = ((data>>8)&0xFF)/255.0f;
s_fMaterials[3] = ((data)&0xFF)/255.0f;
}
break;
break;
case 0x100b: //GXSetChanAmbientcolor
if (xfregs.colChans[1].ambColor != data) {
VertexManager::Flush();
nMaterialsChanged |= 2;
xfregs.colChans[1].ambColor = data;
s_fMaterials[4] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[5] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[4] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[5] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[6] = ((data>>8)&0xFF)/255.0f;
s_fMaterials[7] = ((data)&0xFF)/255.0f;
}
@ -765,8 +741,8 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
VertexManager::Flush();
nMaterialsChanged |= 4;
xfregs.colChans[0].matColor = data;
s_fMaterials[8] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[9] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[8] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[9] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[10] = ((data>>8)&0xFF)/255.0f;
s_fMaterials[11] = ((data)&0xFF)/255.0f;
}
@ -776,8 +752,8 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
VertexManager::Flush();
nMaterialsChanged |= 8;
xfregs.colChans[1].matColor = data;
s_fMaterials[12] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[13] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[12] = ((data>>24)&0xFF)/255.0f;
s_fMaterials[13] = ((data>>16)&0xFF)/255.0f;
s_fMaterials[14] = ((data>>8)&0xFF)/255.0f;
s_fMaterials[15] = ((data)&0xFF)/255.0f;
}
@ -830,7 +806,7 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
VertexShaderMngr::SetTexMatrixChangedB(data); //?
break;
case 0x101a:
case 0x101a:
VertexManager::Flush();
VertexShaderMngr::SetViewport((float*)&pData[i]);
i += 6;
@ -838,10 +814,10 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
case 0x101c: // paper mario writes 16777216.0f, 1677721.75
break;
case 0x101f: // paper mario writes 16777216.0f, 5033165.0f
case 0x101f: // paper mario writes 16777216.0f, 5033165.0f
break;
case 0x1020:
case 0x1020:
VertexManager::Flush();
VertexShaderMngr::SetProjection((float*)&pData[i]);
i += 7;