1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Don't crash on failed initialization

This commit is contained in:
fzurita 2019-10-04 08:54:40 -04:00 committed by Sergey Lipskiy
parent 427004a703
commit 8cdf5a41d8
6 changed files with 16 additions and 11 deletions

View File

@ -8,15 +8,18 @@
#include "PluginAPI.h" #include "PluginAPI.h"
#include "FrameBuffer.h" #include "FrameBuffer.h"
void DisplayWindow::start() bool DisplayWindow::start()
{ {
_start(); // TODO: process initialization error if (!_start())
return false;
graphics::ObjectHandle::defaultFramebuffer = _getDefaultFramebuffer(); graphics::ObjectHandle::defaultFramebuffer = _getDefaultFramebuffer();
gfxContext.init(); gfxContext.init();
m_drawer._initData(); m_drawer._initData();
m_buffersSwapCount = 0; m_buffersSwapCount = 0;
return true;
} }
void DisplayWindow::stop() void DisplayWindow::stop()
@ -113,7 +116,8 @@ bool DisplayWindow::resizeWindow()
return false; return false;
m_drawer._destroyData(); m_drawer._destroyData();
if (!_resizeWindow()) if (!_resizeWindow())
_start(); if(!_start())
return false;
updateScale(); updateScale();
m_drawer._initData(); m_drawer._initData();
m_bResizeWindow = false; m_bResizeWindow = false;

View File

@ -7,7 +7,7 @@ class DisplayWindow
public: public:
virtual ~DisplayWindow() {} virtual ~DisplayWindow() {}
void start(); bool start();
void stop(); void stop();
void restart(); void restart();
void swapBuffers(); void swapBuffers();

View File

@ -75,8 +75,6 @@ void DisplayWindowMupen64plus::_setAttributes()
bool DisplayWindowMupen64plus::_start() bool DisplayWindowMupen64plus::_start()
{ {
FunctionWrapper::setThreadedMode(config.video.threadedVideo);
#ifdef EGL #ifdef EGL
// Normally this is initialized externally through VidExt, but if VidExt is not implemented, // Normally this is initialized externally through VidExt, but if VidExt is not implemented,
// do this here anyways. Calling eglInitialize has no negative effect according to the spec // do this here anyways. Calling eglInitialize has no negative effect according to the spec
@ -92,6 +90,7 @@ bool DisplayWindowMupen64plus::_start()
} }
#endif #endif
FunctionWrapper::setThreadedMode(config.video.threadedVideo);
FunctionWrapper::CoreVideo_Init(); FunctionWrapper::CoreVideo_Init();
_setAttributes(); _setAttributes();

View File

@ -12,8 +12,7 @@ EXPORT int CALL RomOpen(void)
else else
RDRAMSize = 0; RDRAMSize = 0;
api().RomOpen(); return api().RomOpen();
return 1;
} }
EXPORT m64p_error CALL PluginGetVersion( EXPORT m64p_error CALL PluginGetVersion(

View File

@ -36,7 +36,7 @@ public:
void ProcessDList(); void ProcessDList();
void ProcessRDPList(); void ProcessRDPList();
void RomClosed(); void RomClosed();
void RomOpen(); int RomOpen();
void ShowCFB(); void ShowCFB();
void UpdateScreen(); void UpdateScreen();
int InitiateGFX(const GFX_INFO & _gfxInfo); int InitiateGFX(const GFX_INFO & _gfxInfo);

View File

@ -194,7 +194,7 @@ void PluginAPI::RomClosed()
#endif #endif
} }
void PluginAPI::RomOpen() int PluginAPI::RomOpen()
{ {
LOG(LOG_APIFUNC, "RomOpen"); LOG(LOG_APIFUNC, "RomOpen");
#ifdef RSPTHREAD #ifdef RSPTHREAD
@ -207,9 +207,12 @@ void PluginAPI::RomOpen()
RSP_Init(); RSP_Init();
GBI.init(); GBI.init();
Config_LoadConfig(); Config_LoadConfig();
dwnd().start(); if (!dwnd().start())
return 0;
#endif #endif
m_bRomOpen = true; m_bRomOpen = true;
return 1;
} }
void PluginAPI::ShowCFB() void PluginAPI::ShowCFB()