diff --git a/Source/Core/VideoCommon/Src/GlobalControl.cpp b/Source/Core/VideoCommon/Src/GlobalControl.cpp index 00cd8710a0..2dbb13901b 100644 --- a/Source/Core/VideoCommon/Src/GlobalControl.cpp +++ b/Source/Core/VideoCommon/Src/GlobalControl.cpp @@ -77,3 +77,72 @@ bool Projection_GetWidescreen() { return g_Widescreen; } + + +void UpdateProjectionHack(int iPhackvalue) +{ + bool bProjHack1=0, bPhackvalue1=0, bPhackvalue2=0; + float fhackvalue1=0, fhackvalue2=0; + switch(iPhackvalue) + { + case PROJECTION_HACK_NONE: + bProjHack1 = 0; + bPhackvalue1 = 0; + bPhackvalue2 = 0; + break; + case PROJECTION_HACK_ZELDA_TP_BLOOM_HACK: + bPhackvalue1 = 1; + bProjHack1 = 1; + break; + case PROJECTION_HACK_SONIC_AND_THE_BLACK_KNIGHT: + bPhackvalue1 = 1; + fhackvalue1 = 0.00002f; + bPhackvalue2 = 1; + fhackvalue2 = 1.999980f; + break; + case PROJECTION_HACK_BLEACH_VERSUS_CRUSADE: + bPhackvalue2 = 1; + fhackvalue2 = 0.5f; + bPhackvalue1 = 0; + bProjHack1 = 0; + break; + case PROJECTION_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME: + bPhackvalue1 = 1; + fhackvalue1 = 0.8f; + bPhackvalue2 = 1; + fhackvalue2 = 1.2f; + bProjHack1 = 0; + break; + case PROJECTION_HACK_HARVESTMOON_MM: + bPhackvalue1 = 1; + fhackvalue1 = 0.0075f; + bPhackvalue2 = 0; + bProjHack1 = 0; + case PROJECTION_HACK_BATEN_KAITOS: + bPhackvalue1 = 1; + fhackvalue1 = 0.0026f; + bPhackvalue2 = 1; + fhackvalue2 = 1.9974f; + bProjHack1 = 1; + break; + case PROJECTION_HACK_BATEN_KAITOS_ORIGIN: + bPhackvalue1 = 1; + fhackvalue1 = 0.0012f; + bPhackvalue2 = 1; + fhackvalue2 = 1.9988f; + bProjHack1 = 1; + break; + case PROJECTION_HACK_SKIES_OF_ARCADIA: + bPhackvalue1 = 1; + fhackvalue1 = 0.04f; + bPhackvalue2 = 0; + bProjHack1 = 0; + break; + } + + // Set the projections hacks + Projection_SetHack0(bProjHack1); + Projection_SetHack1(ProjectionHack(bPhackvalue1 == 0 ? false : true, fhackvalue1)); + Projection_SetHack2(ProjectionHack(bPhackvalue2 == 0 ? false : true, fhackvalue2)); +} + diff --git a/Source/Core/VideoCommon/Src/GlobalControl.h b/Source/Core/VideoCommon/Src/GlobalControl.h index da6a7fc1d7..1019191d9e 100644 --- a/Source/Core/VideoCommon/Src/GlobalControl.h +++ b/Source/Core/VideoCommon/Src/GlobalControl.h @@ -21,6 +21,19 @@ #include "Common.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_FINAL_FANTASY_CC_ECHO_OF_TIME = 4, + PROJECTION_HACK_HARVESTMOON_MM = 5, + PROJECTION_HACK_BATEN_KAITOS = 6, + PROJECTION_HACK_BATEN_KAITOS_ORIGIN = 7, + PROJECTION_HACK_SKIES_OF_ARCADIA = 8 +}; + struct ProjectionHack { bool enabled; @@ -51,3 +64,5 @@ ProjectionHack Projection_GetHack1(); ProjectionHack Projection_GetHack2(); bool Projection_GetFreeLook(); bool Projection_GetWidescreen(); + +void UpdateProjectionHack(int hackIdx); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index a321c93b43..578d4ad0c4 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -23,6 +23,7 @@ #include "Atomic.h" #include "Thread.h" #include "LogManager.h" +#include "GlobalControl.h" #if defined(HAVE_WX) && HAVE_WX @@ -183,6 +184,7 @@ bool Init() { g_Config.Load(); g_Config.GameIniLoad(); + UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line if (initCount == 0) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index ece0727847..afbce8672f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -789,66 +789,67 @@ void GFXConfigDialogOGL::UpdateGUI() void Config::UpdateProjectionHack() { - switch(g_Config.iPhackvalue) - { - case OGL_HACK_NONE: - g_Config.bProjHack1 = 0; - g_Config.bPhackvalue1 = 0; - g_Config.bPhackvalue2 = 0; - break; - case OGL_HACK_ZELDA_TP_BLOOM_HACK: - g_Config.bPhackvalue1 = 1; - g_Config.bProjHack1 = 1; - break; - case OGL_HACK_SONIC_AND_THE_BLACK_KNIGHT: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.00002f; - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 1.999980f; - break; - case OGL_HACK_BLEACH_VERSUS_CRUSADE: - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 0.5f; - g_Config.bPhackvalue1 = 0; - g_Config.bProjHack1 = 0; - break; - case OGL_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.8f; - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 1.2f; - g_Config.bProjHack1 = 0; - break; - case OGL_HACK_HARVESTMOON_MM: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.0075f; - g_Config.bPhackvalue2 = 0; - g_Config.bProjHack1 = 0; - case OGL_HACK_BATEN_KAITOS: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.0026f; - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 1.9974f; - g_Config.bProjHack1 = 1; - break; - case OGL_HACK_BATEN_KAITOS_ORIGIN: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.0012f; - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 1.9988f; - g_Config.bProjHack1 = 1; - break; - case OGL_HACK_SKIES_OF_ARCADIA: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.04f; - g_Config.bPhackvalue2 = 0; - g_Config.bProjHack1 = 0; - break; - } + ::UpdateProjectionHack(g_Config.iPhackvalue); + //switch(g_Config.iPhackvalue) + //{ + //case OGL_HACK_NONE: + // g_Config.bProjHack1 = 0; + // g_Config.bPhackvalue1 = 0; + // g_Config.bPhackvalue2 = 0; + // break; + //case OGL_HACK_ZELDA_TP_BLOOM_HACK: + // g_Config.bPhackvalue1 = 1; + // g_Config.bProjHack1 = 1; + // break; + //case OGL_HACK_SONIC_AND_THE_BLACK_KNIGHT: + // g_Config.bPhackvalue1 = 1; + // g_Config.fhackvalue1 = 0.00002f; + // g_Config.bPhackvalue2 = 1; + // g_Config.fhackvalue2 = 1.999980f; + // break; + //case OGL_HACK_BLEACH_VERSUS_CRUSADE: + // g_Config.bPhackvalue2 = 1; + // g_Config.fhackvalue2 = 0.5f; + // g_Config.bPhackvalue1 = 0; + // g_Config.bProjHack1 = 0; + // break; + //case OGL_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME: + // g_Config.bPhackvalue1 = 1; + // g_Config.fhackvalue1 = 0.8f; + // g_Config.bPhackvalue2 = 1; + // g_Config.fhackvalue2 = 1.2f; + // g_Config.bProjHack1 = 0; + // break; + //case OGL_HACK_HARVESTMOON_MM: + // g_Config.bPhackvalue1 = 1; + // g_Config.fhackvalue1 = 0.0075f; + // g_Config.bPhackvalue2 = 0; + // g_Config.bProjHack1 = 0; + //case OGL_HACK_BATEN_KAITOS: + // g_Config.bPhackvalue1 = 1; + // g_Config.fhackvalue1 = 0.0026f; + // g_Config.bPhackvalue2 = 1; + // g_Config.fhackvalue2 = 1.9974f; + // g_Config.bProjHack1 = 1; + // break; + //case OGL_HACK_BATEN_KAITOS_ORIGIN: + // g_Config.bPhackvalue1 = 1; + // g_Config.fhackvalue1 = 0.0012f; + // g_Config.bPhackvalue2 = 1; + // g_Config.fhackvalue2 = 1.9988f; + // g_Config.bProjHack1 = 1; + // break; + //case OGL_HACK_SKIES_OF_ARCADIA: + // g_Config.bPhackvalue1 = 1; + // g_Config.fhackvalue1 = 0.04f; + // g_Config.bPhackvalue2 = 0; + // g_Config.bProjHack1 = 0; + // break; + //} - // Set the projections hacks - Projection_SetHack0(g_Config.bProjHack1); - Projection_SetHack1(ProjectionHack(g_Config.bPhackvalue1 == 0 ? false : true, g_Config.fhackvalue1)); - Projection_SetHack2(ProjectionHack(g_Config.bPhackvalue2 == 0 ? false : true, g_Config.fhackvalue2)); + //// Set the projections hacks + //Projection_SetHack0(g_Config.bProjHack1); + //Projection_SetHack1(ProjectionHack(g_Config.bPhackvalue1 == 0 ? false : true, g_Config.fhackvalue1)); + //Projection_SetHack2(ProjectionHack(g_Config.bPhackvalue2 == 0 ? false : true, g_Config.fhackvalue2)); }