diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 5f0b70f..e7d6434 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -78,7 +78,7 @@ int audio_2p_mode = 0; bool already_checked_options = false; bool libretro_supports_persistent_buffer = false; bool libretro_supports_bitmasks = false; -struct retro_system_av_info *my_av_info = (retro_system_av_info*)malloc(sizeof(*my_av_info)); +struct retro_system_av_info *my_av_info; void retro_get_system_info(struct retro_system_info *info) { @@ -128,12 +128,15 @@ void retro_init(void) environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level); + my_av_info = (retro_system_av_info*)malloc(sizeof(*my_av_info)); + if (environ_cb(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL)) libretro_supports_bitmasks = true; } void retro_deinit(void) { + free(my_av_info); libretro_supports_bitmasks = false; } @@ -405,7 +408,6 @@ void retro_unload_game(void) render[i] = NULL; } } - free(my_av_info); libretro_supports_persistent_buffer = false; }