From 240730417774174315c2f7c148393834eb3297eb Mon Sep 17 00:00:00 2001
From: Lothar Serra Mari <serra@scummvm.org>
Date: Thu, 19 Apr 2018 16:47:54 +0200
Subject: [PATCH] SDL2: Write battery file information before issueing
 RESET_COMMAND

Before performing the GB reset, we should perform a GB_save_battery.

Otherwise, resetting the emulation will kill ("kill" as in simply don't
write them into the .sav) all changes made to the battery save since
sameboy was started.
---
 SDL/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/SDL/main.c b/SDL/main.c
index bd14377d..cfdbf4a9 100755
--- a/SDL/main.c
+++ b/SDL/main.c
@@ -302,6 +302,7 @@ static bool handle_pending_command(void)
         }
             
         case GB_SDL_RESET_COMMAND:
+            GB_save_battery(&gb, battery_save_path_ptr);
             return true;
             
         case GB_SDL_NO_COMMAND: