Delete the misnamed GlobalControl.cpp/h, move the (ugly) projection hack code that was there into VertexShaderManager where it belongs.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4644 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-12-05 13:56:23 +00:00
parent 973441d703
commit f0bba97070
9 changed files with 144 additions and 204 deletions

View File

@ -1,126 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "GlobalControl.h"
namespace
{
// Control Variables
static bool g_ProjHack0;
static ProjectionHack g_ProjHack1;
static ProjectionHack g_ProjHack2;
} // Namespace
void Projection_SetHack0(bool value)
{
g_ProjHack0 = value;
}
void Projection_SetHack1(ProjectionHack value)
{
g_ProjHack1 = value;
}
void Projection_SetHack2(ProjectionHack value)
{
g_ProjHack2 = value;
}
bool Projection_GetHack0()
{
return g_ProjHack0;
}
ProjectionHack Projection_GetHack1()
{
return g_ProjHack1;
}
ProjectionHack Projection_GetHack2()
{
return g_ProjHack2;
}
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;
break;
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));
}

View File

@ -1,64 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
/* -----------------------------------------------------------------------
Purpose: This is used to control parts of the video code such as hacks
----------------------------------------------------------------------- */
#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;
float value;
ProjectionHack()
{
}
ProjectionHack(bool new_enabled, float new_value)
{
enabled = new_enabled;
value = new_value;
}
};
/* -------------------
Projection Control
------------------- */
void Projection_SetHack0(bool value);
void Projection_SetHack1(ProjectionHack value);
void Projection_SetHack2(ProjectionHack value);
bool Projection_GetHack0();
ProjectionHack Projection_GetHack1();
ProjectionHack Projection_GetHack2();
void UpdateProjectionHack(int hackIdx);

View File

@ -4,7 +4,6 @@ Import('env')
files = [ files = [
'VideoConfig.cpp', 'VideoConfig.cpp',
'GlobalControl.cpp',
'BPMemory.cpp', 'BPMemory.cpp',
'CPMemory.cpp', 'CPMemory.cpp',
'XFMemory.cpp', 'XFMemory.cpp',

View File

@ -30,7 +30,6 @@
#include "CPMemory.h" #include "CPMemory.h"
#include "XFMemory.h" #include "XFMemory.h"
#include "VideoCommon.h" #include "VideoCommon.h"
#include "GlobalControl.h"
// Temporary ugly declaration. // Temporary ugly declaration.
namespace VertexManager namespace VertexManager
@ -56,6 +55,123 @@ static float s_fViewRotation[2];
void UpdateViewport(); void UpdateViewport();
// Projection Hacks
void Projection_SetHack0(bool value);
void Projection_SetHack1(ProjectionHack value);
void Projection_SetHack2(ProjectionHack value);
bool Projection_GetHack0();
ProjectionHack Projection_GetHack1();
ProjectionHack Projection_GetHack2();
namespace
{
// Control Variables
static bool g_ProjHack0;
static ProjectionHack g_ProjHack1;
static ProjectionHack g_ProjHack2;
} // Namespace
void Projection_SetHack0(bool value)
{
g_ProjHack0 = value;
}
void Projection_SetHack1(ProjectionHack value)
{
g_ProjHack1 = value;
}
void Projection_SetHack2(ProjectionHack value)
{
g_ProjHack2 = value;
}
bool Projection_GetHack0()
{
return g_ProjHack0;
}
ProjectionHack Projection_GetHack1()
{
return g_ProjHack1;
}
ProjectionHack Projection_GetHack2()
{
return g_ProjHack2;
}
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;
break;
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));
}
void VertexShaderManager::Init() void VertexShaderManager::Init()
{ {
Dirty(); Dirty();

View File

@ -20,6 +20,30 @@
#include "VertexShaderGen.h" #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_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;
float value;
ProjectionHack() { }
ProjectionHack(bool new_enabled, float new_value)
: enabled(new_enabled), value(new_value) {}
};
void UpdateProjectionHack(int hackIdx);
// The non-API dependent parts. // The non-API dependent parts.
class VertexShaderManager class VertexShaderManager
{ {

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="VideoCommon" Name="VideoCommon"
ProjectGUID="{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}" ProjectGUID="{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}"
RootNamespace="VideoCommon" RootNamespace="VideoCommon"
@ -734,14 +734,6 @@
RelativePath=".\Src\CommandProcessor.h" RelativePath=".\Src\CommandProcessor.h"
> >
</File> </File>
<File
RelativePath=".\Src\GlobalControl.cpp"
>
</File>
<File
RelativePath=".\Src\GlobalControl.h"
>
</File>
<File <File
RelativePath=".\Src\memcpy_amd.cpp" RelativePath=".\Src\memcpy_amd.cpp"
> >

View File

@ -23,7 +23,6 @@
#include "Atomic.h" #include "Atomic.h"
#include "Thread.h" #include "Thread.h"
#include "LogManager.h" #include "LogManager.h"
#include "GlobalControl.h"
#include "debugger/debugger.h" #include "debugger/debugger.h"
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX

View File

@ -28,7 +28,7 @@
#include "../TextureMngr.h" #include "../TextureMngr.h"
#include "VertexShaderManager.h" #include "VertexShaderManager.h"
#include "../PostProcessing.h" #include "../PostProcessing.h"
#include "GlobalControl.h" //#include "GlobalControl.h"
#include "Render.h" #include "Render.h"
#include "FileUtil.h" #include "FileUtil.h"

View File

@ -32,7 +32,7 @@
#include <mmsystem.h> #include <mmsystem.h>
#endif #endif
#include "GlobalControl.h" //#include "GlobalControl.h"
#include "CommonPaths.h" #include "CommonPaths.h"
#include "VideoConfig.h" #include "VideoConfig.h"
#include "Profiler.h" #include "Profiler.h"