bugfix, fd leak
[libpicofe.git] / gp2x / emu.c
index c16b658..f3b4c02 100644 (file)
@@ -272,6 +272,9 @@ int emu_ReloadRom(void)
                get_ext(romFileName, ext);\r
        }\r
 \r
+       if ((PicoMCD & 1) && Pico_mcd != NULL)\r
+               Stop_CD();\r
+\r
        // check for MegaCD image\r
        cd_state = emu_cd_check(&used_rom_name);\r
        if (cd_state > 0) {\r
@@ -837,9 +840,11 @@ static void RunEvents(unsigned int which)
 {\r
        if(which & 0x1800) { // save or load (but not both)\r
                int do_it = 1;\r
-               if (!(which & 0x1000) && (currentConfig.EmuOpt & 0x200) && emu_check_save_file(state_slot)) {\r
+               if ( emu_check_save_file(state_slot) &&\r
+                               (( (which & 0x1000) && (currentConfig.EmuOpt & 0x800)) ||   // load\r
+                                (!(which & 0x1000) && (currentConfig.EmuOpt & 0x200))) ) { // save\r
                        unsigned long keys;\r
-                       blit("", "OVERWRITE SAVE? (Y=yes, X=no)");\r
+                       blit("", (which & 0x1000) ? "LOAD STATE? (Y=yes, X=no)" : "OVERWRITE SAVE? (Y=yes, X=no)");\r
                        while( !((keys = gp2x_joystick_read(1)) & (GP2X_X|GP2X_Y)) )\r
                                usleep(50*1024);\r
                        if (keys & GP2X_X) do_it = 0;\r