1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +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 "FrameBuffer.h"
void DisplayWindow::start()
bool DisplayWindow::start()
{
_start(); // TODO: process initialization error
if (!_start())
return false;
graphics::ObjectHandle::defaultFramebuffer = _getDefaultFramebuffer();
gfxContext.init();
m_drawer._initData();
m_buffersSwapCount = 0;
return true;
}
void DisplayWindow::stop()
@ -113,7 +116,8 @@ bool DisplayWindow::resizeWindow()
return false;
m_drawer._destroyData();
if (!_resizeWindow())
_start();
if(!_start())
return false;
updateScale();
m_drawer._initData();
m_bResizeWindow = false;

View File

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

View File

@ -75,8 +75,6 @@ void DisplayWindowMupen64plus::_setAttributes()
bool DisplayWindowMupen64plus::_start()
{
FunctionWrapper::setThreadedMode(config.video.threadedVideo);
#ifdef EGL
// 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
@ -92,6 +90,7 @@ bool DisplayWindowMupen64plus::_start()
}
#endif
FunctionWrapper::setThreadedMode(config.video.threadedVideo);
FunctionWrapper::CoreVideo_Init();
_setAttributes();

View File

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

View File

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

View File

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