General cleanup to 3D Vision hack, fits in more with the Dolphin coding style now. Also, fixed the crash that would occur when using a mouse button with 3D Vision enabled.

Not sure how to fix Dolphins hotkeys when 3D Vision is enabled (I do know a way, but it's messy and I don't want 3D Vision messing with Dolphin's cleanliness).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6362 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Matt Callaghan 2010-11-08 22:17:51 +00:00
parent 4782a8fc5a
commit 15d74b7461
10 changed files with 16 additions and 124 deletions

View file

@ -90,6 +90,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1); // NOTE - this is x in (1 << x)
iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, "");
iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false);
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false);
@ -203,6 +204,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader);
iniFile.Set("Enhancements", "Enable3dVision", b3DVision);
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable);

View file

@ -111,6 +111,7 @@ struct VideoConfig
bool bAnaglyphStereo;
int iAnaglyphStereoSeparation;
int iAnaglyphFocalAngle;
bool b3DVision;
// Hacks
bool bEFBAccessEnable;

View file

@ -710,14 +710,6 @@
RelativePath=".\Src\Render.cpp"
>
</File>
<File
RelativePath=".\Src\Render3dVision.cpp"
>
</File>
<File
RelativePath=".\Src\Render3dVision.h"
>
</File>
<File
RelativePath=".\Src\TextureCache.cpp"
>

View file

@ -20,7 +20,6 @@
#include "Render.h"
#include "XFStructs.h"
#include "StringUtil.h"
#include "Render3dVision.h"
// D3DX
HINSTANCE hD3DXDll = NULL;
@ -140,7 +139,7 @@ void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
yres = pp->BackBufferHeight = client.bottom - client.top;
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
pp->PresentationInterval = g_Config.bVSync ? D3DPRESENT_INTERVAL_DEFAULT : D3DPRESENT_INTERVAL_IMMEDIATE;
pp->Windowed = !Render3dVision::isEnable3dVision();
pp->Windowed = !g_Config.b3DVision;
}
void Enumerate()

View file

@ -31,7 +31,6 @@
#include "VideoConfig.h"
#include "TextureCache.h"
#include "Render3dVision.h"
BEGIN_EVENT_TABLE(GFXConfigDialogDX,wxDialog)
@ -154,7 +153,7 @@ void GFXConfigDialogDX::InitializeGUIValues()
m_EnableXFB->SetValue(g_Config.bUseXFB);
m_EnableRealXFB->SetValue(g_Config.bUseRealXFB);
m_UseNativeMips->SetValue(g_Config.bUseNativeMips);
m_Enable3dVision->SetValue(Render3dVision::isEnable3dVision());
m_Enable3dVision->SetValue(g_Config.b3DVision);
m_DumpTextures->SetValue(g_Config.bDumpTextures);
m_DumpFrames->SetValue(g_Config.bDumpFrames);
@ -554,7 +553,7 @@ void GFXConfigDialogDX::AdvancedSettingsChanged(wxCommandEvent& event)
g_Config.bTexFmtOverlayCenter = m_TexfmtCenter->IsChecked();
break;
case ID_ENABLE_3DVISION:
Render3dVision::setEnable3dVision(m_Enable3dVision->IsChecked());
g_Config.b3DVision = m_Enable3dVision->IsChecked();
break;
}
UpdateGUI();
@ -564,7 +563,6 @@ void GFXConfigDialogDX::CloseWindow()
{
// Save the config to INI
g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
Render3dVision::saveConfig((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
EndModal(1);
}

View file

@ -22,7 +22,6 @@
#include "EmuWindow.h"
#include "D3DBase.h"
#include "Fifo.h"
#include "Render3dVision.h"
int OSDChoice = 0 , OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
@ -92,9 +91,16 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
s_sizing = false;
break;
/* Post thes mouse events to the main window, it's nessesary because in difference to the
/* Post the mouse events to the main window, it's nessesary because in difference to the
keyboard inputs these events only appear here, not in the parent window or any other WndProc()*/
case WM_LBUTTONDOWN:
if(g_Config.b3DVision)
{
// This basically throws away the left button down input when b3DVision is activated so WX
// can't get access to it, stopping focus pulling on mouse click.
// (Input plugins use a different system so it doesn't cause any weirdness)
break;
}
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
PostMessage(GetParentWnd(), iMsg, wParam, lParam);
@ -198,7 +204,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
m_hParent = parent;
m_hWnd = CreateWindow(m_szClassName, title, Render3dVision::isEnable3dVision() ? WS_EX_TOPMOST | WS_POPUP : WS_CHILD,
m_hWnd = CreateWindow(m_szClassName, title, g_ActiveConfig.b3DVision ? WS_EX_TOPMOST | WS_POPUP : WS_CHILD,
0, 0, width, height, m_hParent, NULL, hInstance, NULL);
return m_hWnd;

View file

@ -52,8 +52,6 @@
#include "debugger/debugger.h"
#include "Render3dVision.h"
static int s_fps = 0;
static bool WindowResized;
@ -1321,7 +1319,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
}
else
{
if(Render3dVision::isEnable3dVision())
if(g_ActiveConfig.b3DVision)
{
// This works, yet the version in the else doesn't. No idea why.
xScale = (float)s_backbuffer_width / (float)s_XFB_width;

View file

@ -1,49 +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 "Render3dVision.h"
#include "IniFile.h"
bool Render3dVision::enable3dVision = false;
bool Render3dVision::isEnable3dVision()
{
return enable3dVision;
}
void Render3dVision::setEnable3dVision(bool value)
{
enable3dVision = value;
}
void Render3dVision::loadConfig(const char* filename)
{
IniFile iniFile;
iniFile.Load(filename);
iniFile.Get("Settings", "Enable3dVision", &enable3dVision, false);
}
void Render3dVision::saveConfig(const char* filename)
{
IniFile iniFile;
iniFile.Load(filename);
iniFile.Set("Settings", "Enable3dVision", enable3dVision);
iniFile.Save(filename);
}

View file

@ -1,51 +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/
#ifndef _RENDER3DVISION_H
#define _RENDER3DVISION_H
#include "CommonTypes.h"
#include "VideoCommon.h"
//3d vision pipline functions and variables.
//This class provides services needed to run 3d vision.
//It could be replaced by putting the config settings in the
//VideoSettings class, but this way the dx9 plugin can stay portable
//with no reliance on Core being updated. This can be modified if
//these changes are added to the trunk.
class Render3dVision
{
private:
static bool enable3dVision;
public:
//Check to see if 3d vision compatable rendering should be used.
static bool isEnable3dVision();
//Set 3d vision enabled or disabled, used by the config dialog.
static void setEnable3dVision(bool value);
//Lod the specified config file and get enable3dVision out of it.
static void loadConfig(const char* filename);
//Save the enable3dVision variable to the specified config file.
static void saveConfig(const char* filename);
static void Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc);
};
#endif

View file

@ -53,7 +53,6 @@ GFXConfigDialogDX *m_ConfigFrame = NULL;
#include "XFBConvert.h"
#include "render.h"
#include "DLCache.h"
#include "Render3dVision.h"
HINSTANCE g_hInstance = NULL;
SVideoInitialize g_VideoInitialize;
@ -181,7 +180,6 @@ void DllConfig(void *_hParent)
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
g_Config.GameIniLoad(globals->game_ini);
UpdateActiveConfig();
Render3dVision::loadConfig((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
#if defined(HAVE_WX) && HAVE_WX
m_ConfigFrame = new GFXConfigDialogDX((wxWindow *)_hParent);
@ -206,8 +204,6 @@ void Initialize(void *init)
UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line
UpdateActiveConfig();
Render3dVision::loadConfig((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Loading - Please wait."));
if (g_VideoInitialize.pWindowHandle == NULL)
{