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

Log CoreVideo functions error code.

This commit is contained in:
Sergey Lipskiy 2019-11-03 22:59:36 +07:00
parent 5484972b37
commit a87f7c4022
4 changed files with 22 additions and 11 deletions

View File

@ -4820,23 +4820,25 @@ public:
{ {
} }
static std::shared_ptr<OpenGlCommand> get() static std::shared_ptr<OpenGlCommand> get(m64p_error& returnValue)
{ {
static int poolId = OpenGlCommandPool::get().getNextAvailablePool(); static int poolId = OpenGlCommandPool::get().getNextAvailablePool();
auto ptr = getFromPool<CoreVideoInitCommand>(poolId); auto ptr = getFromPool<CoreVideoInitCommand>(poolId);
ptr->set(); ptr->set(returnValue);
return ptr; return ptr;
} }
void commandToExecute() override void commandToExecute() override
{ {
::CoreVideo_Init(); *m_returnValue = ::CoreVideo_Init();
} }
private: private:
void set() void set(m64p_error& returnValue)
{ {
m_returnValue = &returnValue;
} }
m64p_error* m_returnValue;
}; };
class CoreVideoQuitCommand : public OpenGlCommand class CoreVideoQuitCommand : public OpenGlCommand

View File

@ -1327,12 +1327,14 @@ namespace opengl {
#ifdef MUPENPLUSAPI #ifdef MUPENPLUSAPI
void FunctionWrapper::CoreVideo_Init() m64p_error FunctionWrapper::CoreVideo_Init()
{ {
m64p_error returnValue;
if (m_threaded_wrapper) if (m_threaded_wrapper)
executeCommand(CoreVideoInitCommand::get()); executeCommand(CoreVideoInitCommand::get(returnValue));
else else
CoreVideoInitCommand::get()->performCommandSingleThreaded(); CoreVideoInitCommand::get(returnValue)->performCommandSingleThreaded();
return returnValue;
} }
void FunctionWrapper::CoreVideo_Quit() void FunctionWrapper::CoreVideo_Quit()

View File

@ -179,7 +179,7 @@ namespace opengl {
#ifdef MUPENPLUSAPI #ifdef MUPENPLUSAPI
//Vid_ext functions //Vid_ext functions
static void CoreVideo_Init(); static m64p_error CoreVideo_Init();
static void CoreVideo_Quit(); static void CoreVideo_Quit();
static m64p_error CoreVideo_SetVideoMode(int screenWidth, int screenHeight, int bitsPerPixel, m64p_video_mode mode, m64p_video_flags flags); static m64p_error CoreVideo_SetVideoMode(int screenWidth, int screenHeight, int bitsPerPixel, m64p_video_mode mode, m64p_video_flags flags);
static void CoreVideo_GL_SetAttribute(m64p_GLattr attribute, int value); static void CoreVideo_GL_SetAttribute(m64p_GLattr attribute, int value);

View File

@ -76,7 +76,13 @@ void DisplayWindowMupen64plus::_setAttributes()
bool DisplayWindowMupen64plus::_start() bool DisplayWindowMupen64plus::_start()
{ {
FunctionWrapper::setThreadedMode(config.video.threadedVideo); FunctionWrapper::setThreadedMode(config.video.threadedVideo);
FunctionWrapper::CoreVideo_Init(); auto returnValue = FunctionWrapper::CoreVideo_Init();
if (returnValue != M64ERR_SUCCESS) {
LOG(LOG_ERROR, "Error in CoreVideo_Init. Error code: %d", returnValue);
FunctionWrapper::CoreVideo_Quit();
return false;
}
_setAttributes(); _setAttributes();
m_bFullscreen = config.video.fullscreen > 0; m_bFullscreen = config.video.fullscreen > 0;
@ -87,9 +93,10 @@ bool DisplayWindowMupen64plus::_start()
printf("(II) Setting video mode %dx%d...\n", m_screenWidth, m_screenHeight); printf("(II) Setting video mode %dx%d...\n", m_screenWidth, m_screenHeight);
const m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING; const m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING;
if (FunctionWrapper::CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags) != M64ERR_SUCCESS) { returnValue = FunctionWrapper::CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags);
if (returnValue != M64ERR_SUCCESS) {
//printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight); //printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight);
LOG(LOG_ERROR, "Error setting videomode %dx%d", m_screenWidth, m_screenHeight); LOG(LOG_ERROR, "Error setting videomode %dx%d. Error code: %d", m_screenWidth, m_screenHeight, returnValue);
FunctionWrapper::CoreVideo_Quit(); FunctionWrapper::CoreVideo_Quit();
return false; return false;
} }