From bccd8832ddbe0d7e5b7d6884aa8309f1e0b73196 Mon Sep 17 00:00:00 2001 From: kub Date: Fri, 11 Aug 2023 12:34:31 +0000 Subject: [PATCH] libretro, fix crash when exiting 32x --- platform/libretro/libretro.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index 2504cf90..6aae0a34 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -592,10 +592,9 @@ void emu_32x_startup(void) PicoDrawSetOutFormat(vout_format, 0); vout_16bit = 1; - if ((vm_current_start_line != -1) && - (vm_current_line_count != -1) && - (vm_current_start_col != -1) && - (vm_current_col_count != -1)) + if (vout_buf && + (vm_current_start_line != -1) && (vm_current_line_count != -1) && + (vm_current_start_col != -1) && (vm_current_col_count != -1)) emu_video_mode_change( vm_current_start_line, vm_current_line_count, vm_current_start_col, vm_current_col_count); @@ -2014,10 +2013,9 @@ static void update_variables(bool first_run) /* setup video if required */ if (vout_format != old_vout_format) { - if ((vm_current_start_line != -1) && - (vm_current_line_count != -1) && - (vm_current_start_col != -1) && - (vm_current_col_count != -1)) + if (vout_buf && + (vm_current_start_line != -1) && (vm_current_line_count != -1) && + (vm_current_start_col != -1) && (vm_current_col_count != -1)) emu_video_mode_change( vm_current_start_line, vm_current_line_count, vm_current_start_col, vm_current_col_count); @@ -2390,6 +2388,10 @@ void retro_deinit(void) { size_t i; + PicoExit(); + + disk_init(); + #ifdef _3DS linearFree(vout_buf); #elif defined(RENDER_GSKIT_PS2) @@ -2408,9 +2410,5 @@ void retro_deinit(void) free(vout_ghosting_buf); vout_ghosting_buf = NULL; - PicoExit(); - - disk_init(); - libretro_supports_bitmasks = false; } -- 2.39.5