mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-25 01:00:01 +00:00
Offer to toggle graphics backends on any failure.
So, even if Direct3D 9 fails.
This commit is contained in:
parent
358462a7f4
commit
0039eab878
@ -3,11 +3,13 @@
|
||||
#include "base/timeutil.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "base/mutex.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "util/text/utf8.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "../Globals.h"
|
||||
#include "Windows/EmuThread.h"
|
||||
#include "Windows/W32Util/Misc.h"
|
||||
#include "Windows/WndMainWindow.h"
|
||||
#include "Windows/resource.h"
|
||||
#include "Core/Reporting.h"
|
||||
@ -126,12 +128,38 @@ unsigned int WINAPI TheThread(void *)
|
||||
|
||||
std::string error_string;
|
||||
if (!host->InitGraphics(&error_string)) {
|
||||
I18NCategory *err = GetI18NCategory("Error");
|
||||
Reporting::ReportMessage("Graphics init error: %s", error_string.c_str());
|
||||
std::string full_error = StringFromFormat( "Failed initializing OpenGL. Try upgrading your graphics drivers.\n\nError message:\n\n%s", error_string.c_str());
|
||||
MessageBox(0, ConvertUTF8ToWString(full_error).c_str(), L"OpenGL Error", MB_OK | MB_ICONERROR);
|
||||
|
||||
const char *defaultErrorOpenGL = "Failed initializing graphics. Try upgrading your graphics drivers.\n\nWould you like to try switching to DirectX 9?\n\nError message:";
|
||||
const char *defaultErrorDirect3D9 = "Failed initializing graphics. Try upgrading your graphics drivers.\n\nWould you like to try switching to OpenGL?\n\nError message:";
|
||||
const char *genericError;
|
||||
int nextBackend = GPU_BACKEND_DIRECT3D9;
|
||||
switch (g_Config.iGPUBackend) {
|
||||
case GPU_BACKEND_DIRECT3D9:
|
||||
nextBackend = GPU_BACKEND_OPENGL;
|
||||
genericError = err->T("GenericDirect3D9Error", defaultErrorDirect3D9);
|
||||
break;
|
||||
case GPU_BACKEND_OPENGL:
|
||||
default:
|
||||
nextBackend = GPU_BACKEND_DIRECT3D9;
|
||||
genericError = err->T("GenericOpenGLError", defaultErrorOpenGL);
|
||||
break;
|
||||
}
|
||||
std::string full_error = StringFromFormat("%s\n\n%s", genericError, error_string.c_str());
|
||||
std::wstring title = ConvertUTF8ToWString(err->T("GenericGraphicsError", "Graphics Error"));
|
||||
bool yes = IDYES == MessageBox(0, ConvertUTF8ToWString(full_error).c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);
|
||||
ERROR_LOG(BOOT, full_error.c_str());
|
||||
|
||||
// No safe way out without OpenGL.
|
||||
if (yes) {
|
||||
// Change the config to the alternative and restart.
|
||||
g_Config.iGPUBackend = nextBackend;
|
||||
g_Config.Save();
|
||||
|
||||
W32Util::ExitAndRestart();
|
||||
}
|
||||
|
||||
// No safe way out without graphics.
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ bool GL_Init(HWND window, std::string *error_message) {
|
||||
}
|
||||
|
||||
// Avoid further error messages. Let's just bail, it's safe, and we can't continue.
|
||||
ExitProcess(0);
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
if (GLEW_OK != glewInit()) {
|
||||
|
Loading…
Reference in New Issue
Block a user