@@ -591,16 +591,16 @@ void S9xLoadSRAM (void)
591591/* Quick save and turn off the console */
592592void quick_save_and_poweroff ()
593593{
594- /* Vars */
595- char shell_cmd[200 +SAL_MAX_PATH];
596- FILE *fp;
597-
598- /* Send command to kill any previously scheduled shutdown */
599- sprintf (shell_cmd, " pkill %s" , SHELL_CMD_SCHEDULE_POWERDOWN);
600- fp = popen (shell_cmd, " r" );
601- if (fp == NULL )
594+ printf (" Save Instant Play file\n " );
595+
596+ /* Send command to cancel any previously scheduled powerdown */
597+ if (popen (SHELL_CMD_CANCEL_SCHED_POWERDOWN, " r" ) == NULL )
602598 {
603- printf (" Failed to run command %s\n " , shell_cmd);
599+ /* Countdown is still ticking, so better do nothing
600+ than start writing and get interrupted!
601+ */
602+ printf (" Failed to cancel scheduled shutdown\n " );
603+ exit (0 );
604604 }
605605
606606 /* Save */
@@ -610,26 +610,15 @@ void quick_save_and_poweroff()
610610 return ;
611611 }
612612
613- /* Write quick load file */
614- sprintf (shell_cmd, " %s SDL_NOMOUSE=1 \" %s\" -loadStateFile \" %s\" \" %s\" " ,
615- SHELL_CMD_WRITE_QUICK_LOAD_CMD, prog_name, quick_save_file, mRomName );
616- printf (" Cmd write quick load file:\n %s\n " , shell_cmd);
617- fp = popen (shell_cmd, " r" );
618- if (fp == NULL )
619- {
620- printf (" Failed to run command %s\n " , shell_cmd);
621- }
613+ /* Perform Instant Play save and shutdown */
614+ execlp (SHELL_CMD_INSTANT_PLAY, SHELL_CMD_INSTANT_PLAY,
615+ prog_name, " -loadStateFile" , quick_save_file, mRomName , NULL );
622616
623- /* Clean Poweroff */
624- sprintf (shell_cmd, " %s" , SHELL_CMD_POWERDOWN);
625- fp = popen (shell_cmd, " r" );
626- if (fp == NULL )
627- {
628- printf (" Failed to run command %s\n " , shell_cmd);
629- }
617+ /* Should not be reached */
618+ printf (" Failed to perform Instant Play save and shutdown\n " );
630619
631620 /* Exit Emulator */
632- mExit = 1 ;
621+ exit ( 0 ) ;
633622}
634623
635624static u32 LastAudioRate = 0 ;
0 commit comments