If video backend initialization fails, have the emulator die gracefully instead of crashing the application. Also a little clean up of the passage of the video window handle to the backend and back.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7248 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2011-02-25 21:14:13 +00:00
parent eef715b1cf
commit 992f8be5b0
17 changed files with 53 additions and 96 deletions

View File

@ -60,11 +60,6 @@
namespace DX9
{
void*& VideoWindowHandle()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.hMainWindow;
}
unsigned int VideoBackend::PeekMessages()
{
MSG msg;
@ -138,7 +133,7 @@ void VideoBackend::ShowConfig(void* parent)
#endif
}
void VideoBackend::Initialize()
bool VideoBackend::Initialize(void *&window_handle)
{
InitBackendInfo();
@ -149,20 +144,22 @@ void VideoBackend::Initialize()
UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue); // DX9 projection hack could be disabled by commenting out this line
UpdateActiveConfig();
VideoWindowHandle() = (void*)EmuWindow::Create((HWND)VideoWindowHandle(), GetModuleHandle(0), _T("Loading - Please wait."));
if (VideoWindowHandle() == NULL)
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Loading - Please wait."));
if (window_handle == NULL)
{
ERROR_LOG(VIDEO, "An error has occurred while trying to create the window.");
return;
return false;
}
else if (FAILED(DX9::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_ICONERROR|MB_OK);
return;
return false;
}
OSD::AddMessage("Dolphin Direct3D9 Video Backend.", 5000);
s_BackendInitialized = true;
return true;
}
void VideoBackend::Video_Prepare()