From f6ea61b41fc09af9b34bb28c9a685f1c4a6432f5 Mon Sep 17 00:00:00 2001 From: radius Date: Sat, 30 Jun 2018 18:06:41 -0500 Subject: [PATCH] cleanups --- libretro/libretro.cpp | 61 ++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index ff25321f..c8e616d8 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -732,26 +732,6 @@ static bool8 is_SufamiTurbo_Cart (const uint8 *data, uint32 size) return (FALSE); } -void retro_load_init_reset() -{ - struct retro_memory_map map={ memorydesc+MAX_MAPS-memorydesc_c, memorydesc_c }; - if (rom_loaded) environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &map); - - int pixel_format = RGB555; - if(environ_cb) { - pixel_format = RGB565; - enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; - if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) - pixel_format = RGB555; - } - S9xGraphicsDeinit(); - S9xSetRenderPixelFormat(pixel_format); - S9xGraphicsInit(); - - update_geometry(); - audio_interp_max = 32768; -} - bool retro_load_game(const struct retro_game_info *game) { init_descriptors(); @@ -788,7 +768,8 @@ bool retro_load_game(const struct retro_game_info *game) } int pixel_format = RGB555; - if(environ_cb) { + if(environ_cb) + { pixel_format = RGB565; enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) @@ -798,20 +779,19 @@ bool retro_load_game(const struct retro_game_info *game) S9xSetRenderPixelFormat(pixel_format); S9xGraphicsInit(); + struct retro_memory_map map={ memorydesc+MAX_MAPS-memorydesc_c, memorydesc_c }; + if (rom_loaded) + { + environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &map); + update_geometry(); + } + if (!rom_loaded && log_cb) log_cb(RETRO_LOG_ERROR, "[libretro]: Rom loading failed...\n"); - struct retro_memory_map map={ memorydesc+MAX_MAPS-memorydesc_c, memorydesc_c }; - if (rom_loaded) environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &map); - - update_geometry(); - return rom_loaded; } -void retro_unload_game(void) -{} - bool retro_load_game_special(unsigned game_type, const struct retro_game_info *info, size_t num_info) { uint8_t *romptr[3]; @@ -897,11 +877,32 @@ bool retro_load_game_special(unsigned game_type, const struct retro_game_info *i break; } - if (rom_loaded) retro_load_init_reset(); + if (rom_loaded) + { + int pixel_format = RGB555; + if(environ_cb) + { + pixel_format = RGB565; + enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; + if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) + pixel_format = RGB555; + } + S9xGraphicsDeinit(); + S9xSetRenderPixelFormat(pixel_format); + S9xGraphicsInit(); + + struct retro_memory_map map={ memorydesc+MAX_MAPS-memorydesc_c, memorydesc_c }; + environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &map); + update_geometry(); + audio_interp_max = 32768; + } return rom_loaded; } +void retro_unload_game(void) +{} + static void map_buttons(); static void check_system_specs(void)