Report git version with library_version
[picodrive.git] / platform / libretro / libretro.c
index 4636361..9588bc8 100644 (file)
@@ -1,6 +1,8 @@
 /*
  * libretro core glue for PicoDrive
  * (C) notaz, 2013
+ * (C) aliaspider, 2016
+ * (C) Daniel De Matteis, 2013
  *
  * This work is licensed under the terms of MAME license.
  * See COPYING file in the top-level directory.
@@ -537,7 +539,10 @@ void retro_get_system_info(struct retro_system_info *info)
 {
    memset(info, 0, sizeof(*info));
    info->library_name = "PicoDrive";
-   info->library_version = VERSION;
+#ifndef GIT_VERSION
+#define GIT_VERSION ""
+#endif
+   info->library_version = VERSION GIT_VERSION;
    info->valid_extensions = "bin|gen|smd|md|32x|cue|iso|sms";
    info->need_fullpath = true;
 }
@@ -877,6 +882,22 @@ static const char *find_bios(int *region, const char *cd_fname)
    return NULL;
 }
 
+static void sram_reset()
+{
+   SRam.data = NULL;
+   SRam.start = 0;
+   SRam.end = 0;
+   SRam.flags = '\0';
+   SRam.unused2 = '\0';
+   SRam.changed = '\0' ;
+   SRam.eeprom_type = '\0';
+   SRam.unused3 = '\0';
+   SRam.eeprom_bit_cl = '\0';
+   SRam.eeprom_bit_in = '\0';
+   SRam.eeprom_bit_out = '\0';
+   SRam.size = 0;
+}
+
 bool retro_load_game(const struct retro_game_info *info)
 {
    enum media_type_e media_type;
@@ -933,6 +954,8 @@ bool retro_load_game(const struct retro_game_info *info)
       { 0 },
    };
 
+   sram_reset();
+
    enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
    if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) {
       if (log_cb)