diff --git a/VideoOutput.cpp b/VideoOutput.cpp index 20f0810..4109192 100644 --- a/VideoOutput.cpp +++ b/VideoOutput.cpp @@ -161,6 +161,7 @@ VideoOutput::VideoOutput() VBOVertexInfo = 0; VBOIndices = 0; ShaderProgramID = 0; + IsInitialized = false; // initialize vertex indices; they are organized // assuming each quad will be given as 4 vertices, @@ -391,6 +392,7 @@ void VideoOutput::InitRendering() ); LOG( "Finished initializing rendering" ); + IsInitialized = true; } // ----------------------------------------------------------------------------- @@ -451,6 +453,10 @@ void VideoOutput::ReleaseTexture( GLuint& OpenGLTextureID ) void VideoOutput::Destroy() { + // prevent calling GL functions with no context active + if( !IsInitialized ) + return; + LOG( "Destroying video context" ); // release all textures @@ -476,13 +482,10 @@ void VideoOutput::Destroy() // delete our shader program LOG( "Deleting shader program" ); + glDeleteProgram( ShaderProgramID ); + ShaderProgramID = 0; - // these checks should not be needed but Lakka seems to crash here - if( glIsProgram( ShaderProgramID ) && glDeleteProgram ) - { - glDeleteProgram( ShaderProgramID ); - ShaderProgramID = 0; - } + IsInitialized = false; } diff --git a/VideoOutput.hpp b/VideoOutput.hpp index 9483e5d..4ed3d90 100644 --- a/VideoOutput.hpp +++ b/VideoOutput.hpp @@ -51,6 +51,7 @@ class VideoOutput GLuint VBOVertexInfo; GLuint VBOIndices; GLuint ShaderProgramID; + bool IsInitialized; // rendering control for quad groups int QueuedQuads; diff --git a/libretro.cpp b/libretro.cpp index 7dbab41..1b2f7ab 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -216,7 +216,7 @@ void retro_get_system_info( struct retro_system_info *info ) { memset( info, 0, sizeof( *info ) ); info->library_name = "Vircon32"; - info->library_version = "2023.08.24"; + info->library_version = "2024.04.14"; info->need_fullpath = true; // games can be too large to hold in memory info->valid_extensions = "v32|V32"; // target system may be case sensitive }