summaryrefslogtreecommitdiff
path: root/Source/Plugins
diff options
context:
space:
mode:
authorayuanx <ayuanx@gmail.com>2010-01-20 07:47:41 +0000
committerayuanx <ayuanx@gmail.com>2010-01-20 07:47:41 +0000
commit82ccf1d34c76b2bd67f07eaae826d2501ed0bf72 (patch)
tree3da929c7bb2c1c912666b1a4ec530fd5d1ba7017 /Source/Plugins
parentd70bb07580cb168963f37046f396faa38c0093ae (diff)
Fixes Issue 2070
Fixes Issue 1886 Fixes Issue 1519 Fixes wxWindow Destroy Issue Quits DX9 full screen when a message box pops up git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4898 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins')
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp4
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp97
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h2
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/Render.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/main.cpp25
5 files changed, 63 insertions, 67 deletions
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp
index 7dbd3a56b2..70fedd3c40 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp
@@ -136,9 +136,6 @@ void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
yres = pp->BackBufferHeight = FSResY;
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
pp->Windowed = FALSE;
- //if(g_Config.bHideCursor)
- //if(!g_Config.RenderToMainframe)
- ShowCursor(FALSE);
}
else
{
@@ -149,7 +146,6 @@ void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
pp->PresentationInterval = g_Config.bVSync ? D3DPRESENT_INTERVAL_DEFAULT : D3DPRESENT_INTERVAL_IMMEDIATE;
pp->Windowed = TRUE;
- ShowCursor(TRUE);
}
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp
index 403fba2ebf..6ee8adba02 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp
@@ -145,11 +145,19 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
case WM_USER:
if (wParam == WM_USER_STOP)
+ {
SetCursor((lParam) ? hCursor : hCursorBlank);
+ }
else if (wParam == TOGGLE_FULLSCREEN)
+ {
ToggleFullscreen(hWnd);
+ }
else if (wParam == WIIMOTE_DISCONNECT)
+ {
+ if (g_Config.bFullscreen)
+ ToggleFullscreen(hWnd);
PostMessage(m_hMain, WM_USER, wParam, lParam);
+ }
break;
case WM_SYSCOMMAND:
@@ -204,7 +212,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
m_hMain = parent;
m_hParent = NULL;
- DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
+ DWORD style = WS_OVERLAPPEDWINDOW;
RECT rc = {0, 0, width, height};
AdjustWindowRect(&rc, style, false);
@@ -239,38 +247,31 @@ HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title)
// 2. Make DX9 in fullscreen can be overlapped by other dialogs
HWND Ret;
int width=640, height=480;
- sscanf( g_Config.bFullscreen ? g_Config.cFSResolution : g_Config.cInternalRes, "%dx%d", &width, &height );
-// SetSize(width, height);
+ sscanf(g_Config.cInternalRes, "%dx%d", &width, &height );
+
Ret = OpenWindow(hParent, hInstance, width, height, title);
if (Ret)
{
- DWORD dwStyle = 0; // Window Style
- DWORD dwExStyle = 0; // Window Extended Style
RECT rc = {0, 0, width, height};
RECT rcdesktop;
GetWindowRect(GetDesktopWindow(), &rcdesktop);
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
- if (g_Config.bFullscreen && !g_Config.RenderToMainframe)
+ if (g_Config.bFullscreen)
{
- // Hide the cursor
- ShowCursor(FALSE);
+ ToggleFullscreen(Ret, true);
+ }
+ else if (!g_Config.RenderToMainframe)
+ {
+ SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
+ Show();
}
else
{
- dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
- dwStyle = WS_OVERLAPPEDWINDOW;
+ Show();
}
-
-// AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
-
- if (g_Config.bFullscreen)
- // We put the window at the upper left corner of the screen, so x = y = 0
- SetWindowPos(EmuWindow::GetWnd(), NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
- else if (!g_Config.RenderToMainframe)
- SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
}
return Ret;
}
@@ -300,7 +301,7 @@ void SetSize(int width, int height)
MoveWindow(m_hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
}
-void ToggleFullscreen(HWND hParent)
+void ToggleFullscreen(HWND hParent, bool bForceFull)
{
if (m_hParent == NULL)
{
@@ -312,35 +313,7 @@ void ToggleFullscreen(HWND hParent)
RECT rcdesktop;
int w_fs = 640, h_fs = 480;
- if (g_Config.bFullscreen)
- {
- if (strlen(g_Config.cInternalRes) > 1)
- sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
-
- //Get out of fullscreen
- g_Config.bFullscreen = false;
-
- // FullScreen - > Desktop
- ChangeDisplaySettings(NULL, 0);
-
- // Re-Enable the cursor
- ShowCursor(TRUE);
-
- RECT rc = {0, 0, w_fs, h_fs};
- GetWindowRect(GetDesktopWindow(), &rcdesktop);
-
- // SetWindowPos to the center of the screen
- int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
- int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
- SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
-
- // Set new window style FS -> Windowed
- SetWindowLong(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW);
-
- // Eventually show the window!
- EmuWindow::Show();
- }
- else
+ if (!g_Config.bFullscreen || bForceFull)
{
if (strlen(g_Config.cFSResolution) > 1)
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
@@ -370,6 +343,34 @@ void ToggleFullscreen(HWND hParent)
// Eventually show the window!
EmuWindow::Show();
}
+ else
+ {
+ if (strlen(g_Config.cInternalRes) > 1)
+ sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
+
+ //Get out of fullscreen
+ g_Config.bFullscreen = false;
+
+ // FullScreen - > Desktop
+ ChangeDisplaySettings(NULL, 0);
+
+ // Re-Enable the cursor
+ ShowCursor(TRUE);
+
+ RECT rc = {0, 0, w_fs, h_fs};
+ GetWindowRect(GetDesktopWindow(), &rcdesktop);
+
+ // SetWindowPos to the center of the screen
+ int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
+ int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
+ SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
+
+ // Set new window style FS -> Windowed
+ SetWindowLong(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW);
+
+ // Eventually show the window!
+ EmuWindow::Show();
+ }
}
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h
index 4becb60ad8..557a9a3466 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h
+++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h
@@ -12,7 +12,7 @@ HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
void Show();
void Close();
void SetSize(int displayWidth, int displayHeight);
-void ToggleFullscreen(HWND hParent);
+void ToggleFullscreen(HWND hParent, bool bForceFull = false);
bool IsSizing();
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
index 88a1f1de8a..60401cbecd 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
@@ -259,7 +259,7 @@ bool Renderer::Init()
if (fullScreenRes == D3D::GetAdapter(g_ActiveConfig.iAdapter).resolutions.size())
fullScreenRes = 0;
- D3D::Create(g_ActiveConfig.iAdapter, EmuWindow::GetWnd(), g_ActiveConfig.bFullscreen,
+ D3D::Create(g_ActiveConfig.iAdapter, EmuWindow::GetWnd(), false,
fullScreenRes, backbuffer_ms_mode, false);
s_backbuffer_width = D3D::GetBackBufferWidth();
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
index a76267e735..e20f408287 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
@@ -227,37 +227,36 @@ void DllConfig(HWND _hParent)
void Initialize(void *init)
{
- SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
frameCount = 0;
+ SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
g_VideoInitialize = *_pVideoInitialize;
+ InitXFBConvTables();
g_Config.Load(FULL_CONFIG_DIR "gfx_dx9.ini");
g_Config.GameIniLoad(globals->game_ini);
UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line
-
- // create the window
- /*if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL) // ignore parent for this plugin
- g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Loading - Please wait."));
- else*/
- g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Loading - Please wait."));
+ UpdateActiveConfig();
+
+ g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Loading - Please wait."));
if (g_VideoInitialize.pWindowHandle == NULL)
{
ERROR_LOG(VIDEO, "An error has occurred while trying to create the window.");
return;
}
- EmuWindow::Show();
- g_VideoInitialize.pPeekMessages = Callback_PeekMessages;
- g_VideoInitialize.pUpdateFPSDisplay = UpdateFPSDisplay;
- if (FAILED(D3D::Init()))
+ else if (FAILED(D3D::Init()))
{
MessageBox(GetActiveWindow(), _T("Unable to initialize Direct3D. Please make sure that you have the latest version of DirectX 9.0c correctly installed."), _T("Fatal Error"), MB_OK);
return;
}
- InitXFBConvTables();
- OSD::AddMessage("Dolphin Direct3D9 Video Plugin.", 5000);
+
+ g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
+ g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
+
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
+
+ OSD::AddMessage("Dolphin Direct3D9 Video Plugin.", 5000);
s_initialized = true;
}