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
This commit is contained in:
parent
d70bb07580
commit
82ccf1d34c
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -197,6 +197,7 @@ class CFrame : public wxFrame
|
|||
bool m_bNoDocking;
|
||||
bool m_bModalDialogOpen;
|
||||
bool m_bControlsCreated;
|
||||
wxMessageDialog *m_StopDlg;
|
||||
|
||||
char **drives;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
@ -367,6 +340,34 @@ void ToggleFullscreen(HWND hParent)
|
|||
ShowCursor(FALSE);
|
||||
g_Config.bFullscreen = true;
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue