summaryrefslogtreecommitdiff
path: root/Source
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
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')
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp1
-rw-r--r--Source/Core/DolphinWX/Src/Frame.cpp4
-rw-r--r--Source/Core/DolphinWX/Src/Frame.h1
-rw-r--r--Source/Core/DolphinWX/Src/FrameTools.cpp11
-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
9 files changed, 75 insertions, 72 deletions
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index 0c35829390..ad35ea99e7 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -135,6 +135,7 @@ void CConfigMain::UpdateGUI()
// Disable the Core stuff on GeneralPage
AlwaysHLE_BS2->Disable();
m_RadioJIT->Disable();
+ m_RadioJITIL->Disable();
m_RadioInt->Disable();
CPUThread->Disable();
DSPThread->Disable();
diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp
index 31d5327c37..8227dff367 100644
--- a/Source/Core/DolphinWX/Src/Frame.cpp
+++ b/Source/Core/DolphinWX/Src/Frame.cpp
@@ -179,7 +179,7 @@ CPanel::CPanel(
if (dlg->ShowModal() == wxID_YES)
GetUsbPointer()->AccessWiiMote(lParam | 0x100)->Activate(true);
- delete dlg;
+ dlg->Destroy();
}
return 0;
}
@@ -323,7 +323,7 @@ CFrame::CFrame(wxFrame* parent,
, bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false)
, HaveLeds(false), HaveSpeakers(false)
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
- , m_bControlsCreated(false), bNoWiimoteMsg(false)
+ , m_bControlsCreated(false), bNoWiimoteMsg(false), m_StopDlg(NULL)
#if wxUSE_TIMER
, m_timer(this)
#endif
diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h
index 011b64a329..9d7bf90aa5 100644
--- a/Source/Core/DolphinWX/Src/Frame.h
+++ b/Source/Core/DolphinWX/Src/Frame.h
@@ -197,6 +197,7 @@ class CFrame : public wxFrame
bool m_bNoDocking;
bool m_bModalDialogOpen;
bool m_bControlsCreated;
+ wxMessageDialog *m_StopDlg;
char **drives;
diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp
index f6d7b8b31d..0130269c12 100644
--- a/Source/Core/DolphinWX/Src/FrameTools.cpp
+++ b/Source/Core/DolphinWX/Src/FrameTools.cpp
@@ -698,15 +698,20 @@ void CFrame::DoStop()
// Ask for confirmation in case the user accidentally clicked Stop / Escape
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{
- wxMessageDialog *dlg = new wxMessageDialog(
+ // Supress duplicate dialog boxes
+ if (m_StopDlg)
+ return;
+
+ m_StopDlg = new wxMessageDialog(
this,
wxT("Do you want to stop the current emulation?"),
wxT("Please confirm..."),
wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION,
wxDefaultPosition);
- int Ret = dlg->ShowModal();
- delete dlg;
+ int Ret = m_StopDlg->ShowModal();
+ m_StopDlg->Destroy();
+ m_StopDlg = NULL;
if (Ret == wxID_NO)
return;
}
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;
}