* Changed the Projection Hack option in game properties to "Custom Projection Hack"

- dislocating all sensible stuff related to "values per game/pattern" outside the sourcecode.
  - giving more control to end-users across the user-friendly interface.
  - deleting/cleaning some dead variables.
  - updating all gameconfig.ini data to reflect new PHack concept (pending upload).

* Updated Italian translation
  - Includes corrections, a better strings translating and suggestions directly by Google Code's people.

+ Minor old pending changes...

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6973 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
gnick79
2011-01-29 21:13:56 +00:00
parent 7f97ce79bb
commit 3078db08c7
13 changed files with 305 additions and 184 deletions

View File

@ -434,7 +434,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer,
case 3: // Z16
colmat[1] = colmat[5] = colmat[9] = colmat[12] = 1.0f;
cbufid = 13;
cbufid = 24;
break;
case 11: // Z16 (reverse order)

View File

@ -20,6 +20,7 @@
#include "MathUtil.h"
#include <cmath>
#include <sstream>
#include "Statistics.h"
@ -52,24 +53,77 @@ void UpdateViewport();
namespace
{
// Control Variables
static bool g_ProjHack0;
static ProjectionHack g_ProjHack1;
static ProjectionHack g_ProjHack2;
static ProjectionHack g_ProjHack3;
static bool g_ProjHack3;
} // Namespace
void UpdateProjectionHack(int iPhackvalue)
float PHackValue(std::string sValue)
{
bool bProjHack1 = 0, bPhackvalue1 = 0, bPhackvalue2 = 0, bPhackvalue3 = 0;
float fhackvalue1 = 0, fhackvalue2 = 0;
switch(iPhackvalue)
float f = 0;
bool fp = false;
const char *cStr = sValue.c_str();
char *c = new char[strlen(cStr)+1];
std::istringstream sTof("");
for (unsigned int i=0; i<=strlen(cStr); ++i)
{
case PROJECTION_HACK_NONE:
bProjHack1 = 0;
bPhackvalue1 = 0;
bPhackvalue2 = 0;
bPhackvalue3 = 0;
break;
if (i == 20)
{
c[i] = '\0';
break;
}
c[i] = (cStr[i] == ',') ? '.' : *(cStr+i);
if (c[i] == '.')
fp = true;
}
cStr = c;
sTof.str(cStr);
sTof >> f;
if (!fp) f /= 0xF4240;
delete [] c;
return f;
}
void UpdateProjectionHack(int iPhackvalue[], std::string sPhackvalue[])
{
float fhackvalue1 = 0, fhackvalue2 = 0;
float fhacksign1 = 1.0, fhacksign2 = 1.0;
bool bProjHack3 = false;
char *sTemp[2];
if (iPhackvalue[0] == 0)
goto hackDisabled;
NOTICE_LOG(VIDEO, "\t\t--- Ortographic Projection Hack ON ---");
fhacksign1 *= (iPhackvalue[1] == 1) ? -1.0f : fhacksign1;
sTemp[0] = (iPhackvalue[1] == 1) ? " * (-1)" : "";
fhacksign2 *= (iPhackvalue[2] == 1) ? -1.0f : fhacksign2;
sTemp[1] = (iPhackvalue[2] == 1) ? " * (-1)" : "";
fhackvalue1 = PHackValue(sPhackvalue[0]);
NOTICE_LOG(VIDEO, "- zNear Correction = (%f + zNear)%s", fhackvalue1, sTemp[0]);
fhackvalue2 = PHackValue(sPhackvalue[1]);
NOTICE_LOG(VIDEO, "- zFar Correction = (%f + zFar)%s", fhackvalue2, sTemp[1]);
sTemp[0] = "DISABLED";
bProjHack3 = (iPhackvalue[3] == 1) ? true : bProjHack3;
if (bProjHack3)
sTemp[0] = "ENABLED";
NOTICE_LOG(VIDEO, "- Extra Parameter: %s", sTemp[0]);
hackDisabled:
// Set the projections hacks
g_ProjHack1 = ProjectionHack(fhackvalue1,fhacksign1);
g_ProjHack2 = ProjectionHack(fhackvalue2,fhacksign2);
g_ProjHack3 = bProjHack3;
/*
case PROJECTION_HACK_ZELDA_TP_BLOOM_HACK:
bPhackvalue1 = 1;
bProjHack1 = 1;
@ -95,7 +149,7 @@ void UpdateProjectionHack(int iPhackvalue)
case PROJECTION_HACK_METROID_OTHER_M: //temp fix for black screens during cut scenes
bPhackvalue3 = 1;
break;
/* // Unused - kept for reference
// Unused - kept for reference
case PROJECTION_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME:
bPhackvalue1 = 1;
fhackvalue1 = 0.8f;
@ -124,13 +178,6 @@ void UpdateProjectionHack(int iPhackvalue)
bProjHack1 = 1;
break;
*/
}
// Set the projections hacks
g_ProjHack0 = bProjHack1;
g_ProjHack1 = ProjectionHack(bPhackvalue1 == 0 ? false : true, fhackvalue1);
g_ProjHack2 = ProjectionHack(bPhackvalue2 == 0 ? false : true, fhackvalue2);
g_ProjHack3 = ProjectionHack(bPhackvalue3,0);
}
void VertexShaderManager::Init()
@ -344,8 +391,8 @@ void VertexShaderManager::SetConstants()
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = (g_ProjHack1.enabled ? -(g_ProjHack1.value + xfregs.rawProjection[4]) : xfregs.rawProjection[4]);
g_fProjectionMatrix[11] = (g_ProjHack2.enabled ? -(g_ProjHack2.value + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (g_ProjHack0 ? 0.1f : 0.0f);
g_fProjectionMatrix[10] = (g_ProjHack1.value + xfregs.rawProjection[4]) * g_ProjHack1.sign;
g_fProjectionMatrix[11] = (g_ProjHack2.value + xfregs.rawProjection[5]) * g_ProjHack2.sign;
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
@ -358,7 +405,7 @@ void VertexShaderManager::SetConstants()
*/
g_fProjectionMatrix[14] = 0.0f;
g_fProjectionMatrix[15] = (g_ProjHack3.enabled && xfregs.rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled
g_fProjectionMatrix[15] = (g_ProjHack3 && xfregs.rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);

View File

@ -20,26 +20,16 @@
#include "VertexShaderGen.h"
enum
{
PROJECTION_HACK_NONE = 0,
PROJECTION_HACK_ZELDA_TP_BLOOM_HACK = 1,
PROJECTION_HACK_SONIC_AND_THE_BLACK_KNIGHT = 2,
PROJECTION_HACK_BLEACH_VERSUS_CRUSADE = 3,
PROJECTION_HACK_SKIES_OF_ARCADIA = 4,
PROJECTION_HACK_METROID_OTHER_M = 5,
};
struct ProjectionHack
{
bool enabled;
float sign;
float value;
ProjectionHack() { }
ProjectionHack(bool new_enabled, float new_value)
: enabled(new_enabled), value(new_value) {}
ProjectionHack(float new_sign, float new_value)
: sign(new_sign), value(new_value) {}
};
void UpdateProjectionHack(int hackIdx);
void UpdateProjectionHack(int iParams[], std::string sParams[]);
// The non-API dependent parts.
class VertexShaderManager

View File

@ -110,7 +110,6 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false);
iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, true);
iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
if (iAdapter == -1)
@ -159,7 +158,17 @@ void VideoConfig::GameIniLoad(const char *ini_file)
if (iniFile.Exists("Video", "UseRealXFB"))
iniFile.Get("Video", "UseRealXFB", &bUseRealXFB);
if (iniFile.Exists("Video", "ProjectionHack"))
iniFile.Get("Video", "ProjectionHack", &iPhackvalue);
iniFile.Get("Video", "ProjectionHack", &iPhackvalue[0], 0);
if (iniFile.Exists("Video", "PH_SZNear"))
iniFile.Get("Video", "PH_SZNear", &iPhackvalue[1], 0);
if (iniFile.Exists("Video", "PH_SZFar"))
iniFile.Get("Video", "PH_SZFar", &iPhackvalue[2], 0);
if (iniFile.Exists("Video", "PH_ExtraParam"))
iniFile.Get("Video", "PH_ExtraParam", &iPhackvalue[3], 0);
if (iniFile.Exists("Video", "PH_ZNear"))
iniFile.Get("Video", "PH_ZNear", &sPhackvalue[0], "");
if (iniFile.Exists("Video", "PH_ZFar"))
iniFile.Get("Video", "PH_ZFar", &sPhackvalue[1], "");
if (iniFile.Exists("Video", "UseNativeMips"))
iniFile.Get("Video", "UseNativeMips", &bUseNativeMips);
if (iniFile.Exists("Video", "ZTPSpeedupHack"))
@ -228,7 +237,6 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
iniFile.Set("Hardware", "Adapter", iAdapter);

View File

@ -121,15 +121,12 @@ struct VideoConfig
bool bEFBCopyCacheEnable;
bool bEFBEmulateFormatChanges;
bool bOSDHotKey;
bool bHack;
bool bCopyEFBToTexture;
bool bCopyEFBScaled;
bool bSafeTextureCache;
int iSafeTextureCache_ColorSamples;
int iPhackvalue;
bool bPhackvalue1, bPhackvalue2;
float fhackvalue1, fhackvalue2;
bool bProjHack1;
int iPhackvalue[4];
std::string sPhackvalue[2];
float fAspectRatioHackW, fAspectRatioHackH;
bool bZTPSpeedHack; // The Legend of Zelda: Twilight Princess
bool bEnablePixelLigting;