From 6a3d2491e32aa53c7dde623f3fabe84e134f7670 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Thu, 24 Oct 2024 01:27:22 +0200 Subject: [PATCH] tr1: log details for SDL OpenGL context fails --- src/libtrx/gfx/context.c | 7 ++++--- src/libtrx/log.c | 2 -- src/tr1/game/shell.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libtrx/gfx/context.c b/src/libtrx/gfx/context.c index 1176ac113..65b4b5935 100644 --- a/src/libtrx/gfx/context.c +++ b/src/libtrx/gfx/context.c @@ -128,12 +128,13 @@ void GFX_Context_Attach(void *window_handle) m_Context.context = SDL_GL_CreateContext(m_Context.window_handle); - if (!m_Context.context) { - Shell_ExitSystem("Can't create OpenGL context"); + if (m_Context.context == NULL) { + Shell_ExitSystemFmt("Can't create OpenGL context: %s", SDL_GetError()); } if (SDL_GL_MakeCurrent(m_Context.window_handle, m_Context.context)) { - Shell_ExitSystem("Can't activate OpenGL context"); + Shell_ExitSystemFmt( + "Can't activate OpenGL context: %s", SDL_GetError()); } LOG_INFO("OpenGL vendor string: %s", glGetString(GL_VENDOR)); diff --git a/src/libtrx/log.c b/src/libtrx/log.c index cc8d3443c..07e75492b 100644 --- a/src/libtrx/log.c +++ b/src/libtrx/log.c @@ -1,7 +1,5 @@ #include "log.h" -#include "memory.h" - #include #include diff --git a/src/tr1/game/shell.c b/src/tr1/game/shell.c index 11b2f7430..37bafd333 100644 --- a/src/tr1/game/shell.c +++ b/src/tr1/game/shell.c @@ -136,7 +136,7 @@ void Shell_Init(const char *gameflow_path) Screen_Init(); if (!GameFlow_LoadFromFile(gameflow_path)) { - Shell_ExitSystem("MAIN: unable to load script file"); + Shell_ExitSystemFmt("Unable to load gameflow file: %s", gameflow_path); return; } Savegame_Init();