this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

libretro: Update the libretro state values (#2590)

* libretro: Update the libretro state values

* libretro: Disable module loading on libretro

authored by

Rob Loach and committed by
GitHub
b255c613 1c8eb84c

+26 -13
+3
cmake/libretro.cmake
··· 59 59 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib 60 60 ) 61 61 62 + target_compile_definitions(tic80_libretro PRIVATE 63 + __LIBRETRO__=TRUE 64 + ) 62 65 target_link_libraries(tic80_libretro tic80core) 63 66 set_target_properties(tic80_libretro PROPERTIES PREFIX "") 64 67 endif()
+6
include/tic80_config.h
··· 52 52 # define TIC_MODULE_EXT ".so" 53 53 #endif 54 54 55 + #if defined(__LIBRETRO__) 56 + #ifdef TIC_MODULE_EXT 57 + #undef TIC_MODULE_EXT 58 + #endif 59 + #endif 60 + 55 61 #if defined(TIC_RUNTIME_STATIC) 56 62 # define TIC_EXPORT 57 63 #else
+17 -13
src/system/libretro/tic80_libretro.c
··· 79 79 tic80* tic; 80 80 retro_usec_t frameTime; 81 81 }; 82 - static struct tic80_state* state; 82 + static struct tic80_state* state = NULL; 83 83 84 84 /** 85 85 * TIC-80 callback; Request counter. ··· 106 106 */ 107 107 void tic80_libretro_exit() 108 108 { 109 - if (state != NULL) { 110 - state->quit = true; 109 + if (state == NULL) { 110 + return; 111 111 } 112 + 113 + state->quit = true; 112 114 } 113 115 114 116 /** ··· 169 171 */ 170 172 RETRO_API void retro_init(void) 171 173 { 172 - // Ensure the state is ready. 174 + // Do not re-initialize. 173 175 if (state != NULL) { 174 - retro_deinit(); 176 + return; 175 177 } 176 178 177 179 // Initialize the base state. ··· 313 315 retro_unload_game(); 314 316 315 317 // Free up the state. 316 - if (state != NULL) { 317 - free(state); 318 - state = NULL; 318 + if (state == NULL) { 319 + return; 319 320 } 321 + 322 + free(state); 323 + state = NULL; 320 324 } 321 325 322 326 /** ··· 1111 1115 */ 1112 1116 RETRO_API void retro_unload_game(void) 1113 1117 { 1114 - if (state != NULL) { 1115 - if (state->tic != NULL) { 1116 - tic80_delete(state->tic); 1117 - state->tic = NULL; 1118 - } 1118 + if (state == NULL || state->tic == NULL) { 1119 + return; 1119 1120 } 1121 + 1122 + tic80_delete(state->tic); 1123 + state->tic = NULL; 1120 1124 } 1121 1125 1122 1126 /**