mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 23:11:14 +01:00
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
|
// Disable the Core stuff on GeneralPage
|
||||||
AlwaysHLE_BS2->Disable();
|
AlwaysHLE_BS2->Disable();
|
||||||
m_RadioJIT->Disable();
|
m_RadioJIT->Disable();
|
||||||
|
m_RadioJITIL->Disable();
|
||||||
m_RadioInt->Disable();
|
m_RadioInt->Disable();
|
||||||
CPUThread->Disable();
|
CPUThread->Disable();
|
||||||
DSPThread->Disable();
|
DSPThread->Disable();
|
||||||
|
@ -179,7 +179,7 @@ CPanel::CPanel(
|
|||||||
if (dlg->ShowModal() == wxID_YES)
|
if (dlg->ShowModal() == wxID_YES)
|
||||||
GetUsbPointer()->AccessWiiMote(lParam | 0x100)->Activate(true);
|
GetUsbPointer()->AccessWiiMote(lParam | 0x100)->Activate(true);
|
||||||
|
|
||||||
delete dlg;
|
dlg->Destroy();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ CFrame::CFrame(wxFrame* parent,
|
|||||||
, bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false)
|
, bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false)
|
||||||
, HaveLeds(false), HaveSpeakers(false)
|
, HaveLeds(false), HaveSpeakers(false)
|
||||||
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
|
, 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
|
#if wxUSE_TIMER
|
||||||
, m_timer(this)
|
, m_timer(this)
|
||||||
#endif
|
#endif
|
||||||
|
@ -197,6 +197,7 @@ class CFrame : public wxFrame
|
|||||||
bool m_bNoDocking;
|
bool m_bNoDocking;
|
||||||
bool m_bModalDialogOpen;
|
bool m_bModalDialogOpen;
|
||||||
bool m_bControlsCreated;
|
bool m_bControlsCreated;
|
||||||
|
wxMessageDialog *m_StopDlg;
|
||||||
|
|
||||||
char **drives;
|
char **drives;
|
||||||
|
|
||||||
|
@ -698,15 +698,20 @@ void CFrame::DoStop()
|
|||||||
// Ask for confirmation in case the user accidentally clicked Stop / Escape
|
// Ask for confirmation in case the user accidentally clicked Stop / Escape
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
|
||||||
{
|
{
|
||||||
wxMessageDialog *dlg = new wxMessageDialog(
|
// Supress duplicate dialog boxes
|
||||||
|
if (m_StopDlg)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_StopDlg = new wxMessageDialog(
|
||||||
this,
|
this,
|
||||||
wxT("Do you want to stop the current emulation?"),
|
wxT("Do you want to stop the current emulation?"),
|
||||||
wxT("Please confirm..."),
|
wxT("Please confirm..."),
|
||||||
wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION,
|
wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION,
|
||||||
wxDefaultPosition);
|
wxDefaultPosition);
|
||||||
|
|
||||||
int Ret = dlg->ShowModal();
|
int Ret = m_StopDlg->ShowModal();
|
||||||
delete dlg;
|
m_StopDlg->Destroy();
|
||||||
|
m_StopDlg = NULL;
|
||||||
if (Ret == wxID_NO)
|
if (Ret == wxID_NO)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -136,9 +136,6 @@ void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
|
|||||||
yres = pp->BackBufferHeight = FSResY;
|
yres = pp->BackBufferHeight = FSResY;
|
||||||
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||||
pp->Windowed = FALSE;
|
pp->Windowed = FALSE;
|
||||||
//if(g_Config.bHideCursor)
|
|
||||||
//if(!g_Config.RenderToMainframe)
|
|
||||||
ShowCursor(FALSE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -149,7 +146,6 @@ void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
|
|||||||
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||||
pp->PresentationInterval = g_Config.bVSync ? D3DPRESENT_INTERVAL_DEFAULT : D3DPRESENT_INTERVAL_IMMEDIATE;
|
pp->PresentationInterval = g_Config.bVSync ? D3DPRESENT_INTERVAL_DEFAULT : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||||
pp->Windowed = TRUE;
|
pp->Windowed = TRUE;
|
||||||
ShowCursor(TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,11 +145,19 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||||||
|
|
||||||
case WM_USER:
|
case WM_USER:
|
||||||
if (wParam == WM_USER_STOP)
|
if (wParam == WM_USER_STOP)
|
||||||
|
{
|
||||||
SetCursor((lParam) ? hCursor : hCursorBlank);
|
SetCursor((lParam) ? hCursor : hCursorBlank);
|
||||||
|
}
|
||||||
else if (wParam == TOGGLE_FULLSCREEN)
|
else if (wParam == TOGGLE_FULLSCREEN)
|
||||||
|
{
|
||||||
ToggleFullscreen(hWnd);
|
ToggleFullscreen(hWnd);
|
||||||
|
}
|
||||||
else if (wParam == WIIMOTE_DISCONNECT)
|
else if (wParam == WIIMOTE_DISCONNECT)
|
||||||
|
{
|
||||||
|
if (g_Config.bFullscreen)
|
||||||
|
ToggleFullscreen(hWnd);
|
||||||
PostMessage(m_hMain, WM_USER, wParam, lParam);
|
PostMessage(m_hMain, WM_USER, wParam, lParam);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
@ -204,7 +212,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||||||
m_hMain = parent;
|
m_hMain = parent;
|
||||||
m_hParent = NULL;
|
m_hParent = NULL;
|
||||||
|
|
||||||
DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
|
DWORD style = WS_OVERLAPPEDWINDOW;
|
||||||
|
|
||||||
RECT rc = {0, 0, width, height};
|
RECT rc = {0, 0, width, height};
|
||||||
AdjustWindowRect(&rc, style, false);
|
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
|
// 2. Make DX9 in fullscreen can be overlapped by other dialogs
|
||||||
HWND Ret;
|
HWND Ret;
|
||||||
int width=640, height=480;
|
int width=640, height=480;
|
||||||
sscanf( g_Config.bFullscreen ? g_Config.cFSResolution : g_Config.cInternalRes, "%dx%d", &width, &height );
|
sscanf(g_Config.cInternalRes, "%dx%d", &width, &height );
|
||||||
// SetSize(width, height);
|
|
||||||
Ret = OpenWindow(hParent, hInstance, width, height, title);
|
Ret = OpenWindow(hParent, hInstance, width, height, title);
|
||||||
|
|
||||||
if (Ret)
|
if (Ret)
|
||||||
{
|
{
|
||||||
DWORD dwStyle = 0; // Window Style
|
|
||||||
DWORD dwExStyle = 0; // Window Extended Style
|
|
||||||
RECT rc = {0, 0, width, height};
|
RECT rc = {0, 0, width, height};
|
||||||
RECT rcdesktop;
|
RECT rcdesktop;
|
||||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/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
|
ToggleFullscreen(Ret, true);
|
||||||
ShowCursor(FALSE);
|
}
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
Show();
|
||||||
dwStyle = WS_OVERLAPPEDWINDOW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
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);
|
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)
|
if (m_hParent == NULL)
|
||||||
{
|
{
|
||||||
@ -312,35 +313,7 @@ void ToggleFullscreen(HWND hParent)
|
|||||||
|
|
||||||
RECT rcdesktop;
|
RECT rcdesktop;
|
||||||
int w_fs = 640, h_fs = 480;
|
int w_fs = 640, h_fs = 480;
|
||||||
if (g_Config.bFullscreen)
|
if (!g_Config.bFullscreen || bForceFull)
|
||||||
{
|
|
||||||
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 (strlen(g_Config.cFSResolution) > 1)
|
if (strlen(g_Config.cFSResolution) > 1)
|
||||||
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
|
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
|
||||||
@ -367,6 +340,34 @@ void ToggleFullscreen(HWND hParent)
|
|||||||
ShowCursor(FALSE);
|
ShowCursor(FALSE);
|
||||||
g_Config.bFullscreen = true;
|
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!
|
// Eventually show the window!
|
||||||
EmuWindow::Show();
|
EmuWindow::Show();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
|
|||||||
void Show();
|
void Show();
|
||||||
void Close();
|
void Close();
|
||||||
void SetSize(int displayWidth, int displayHeight);
|
void SetSize(int displayWidth, int displayHeight);
|
||||||
void ToggleFullscreen(HWND hParent);
|
void ToggleFullscreen(HWND hParent, bool bForceFull = false);
|
||||||
bool IsSizing();
|
bool IsSizing();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ bool Renderer::Init()
|
|||||||
if (fullScreenRes == D3D::GetAdapter(g_ActiveConfig.iAdapter).resolutions.size())
|
if (fullScreenRes == D3D::GetAdapter(g_ActiveConfig.iAdapter).resolutions.size())
|
||||||
fullScreenRes = 0;
|
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);
|
fullScreenRes, backbuffer_ms_mode, false);
|
||||||
|
|
||||||
s_backbuffer_width = D3D::GetBackBufferWidth();
|
s_backbuffer_width = D3D::GetBackBufferWidth();
|
||||||
|
@ -227,37 +227,36 @@ void DllConfig(HWND _hParent)
|
|||||||
|
|
||||||
void Initialize(void *init)
|
void Initialize(void *init)
|
||||||
{
|
{
|
||||||
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
|
|
||||||
frameCount = 0;
|
frameCount = 0;
|
||||||
|
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
|
||||||
g_VideoInitialize = *_pVideoInitialize;
|
g_VideoInitialize = *_pVideoInitialize;
|
||||||
|
InitXFBConvTables();
|
||||||
|
|
||||||
g_Config.Load(FULL_CONFIG_DIR "gfx_dx9.ini");
|
g_Config.Load(FULL_CONFIG_DIR "gfx_dx9.ini");
|
||||||
g_Config.GameIniLoad(globals->game_ini);
|
g_Config.GameIniLoad(globals->game_ini);
|
||||||
UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line
|
UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line
|
||||||
|
UpdateActiveConfig();
|
||||||
|
|
||||||
// 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."));
|
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Loading - Please wait."));
|
||||||
if (g_VideoInitialize.pWindowHandle == NULL)
|
if (g_VideoInitialize.pWindowHandle == NULL)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "An error has occurred while trying to create the window.");
|
ERROR_LOG(VIDEO, "An error has occurred while trying to create the window.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EmuWindow::Show();
|
else if (FAILED(D3D::Init()))
|
||||||
g_VideoInitialize.pPeekMessages = Callback_PeekMessages;
|
|
||||||
g_VideoInitialize.pUpdateFPSDisplay = UpdateFPSDisplay;
|
|
||||||
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);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
InitXFBConvTables();
|
|
||||||
OSD::AddMessage("Dolphin Direct3D9 Video Plugin.", 5000);
|
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||||
|
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
|
||||||
|
|
||||||
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
||||||
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
||||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||||
|
|
||||||
|
OSD::AddMessage("Dolphin Direct3D9 Video Plugin.", 5000);
|
||||||
s_initialized = true;
|
s_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user