Skip to content

Commit f56f1a0

Browse files
committed
fixed merge confilcts
2 parents 420139c + 2d5e38d commit f56f1a0

File tree

3 files changed

+20
-31
lines changed

3 files changed

+20
-31
lines changed

menu/main.cpp

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,16 @@ void S9xLoadSRAM (void)
591591
/* Quick save and turn off the console */
592592
void 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

635624
static u32 LastAudioRate = 0;

menu/menu.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -956,11 +956,9 @@ void run_menu_loop()
956956
if(menu_confirmation){
957957
MENU_DEBUG_PRINTF("Powerdown - confirmed\n");
958958
/// ----- Shell cmd ----
959-
sprintf(shell_cmd, "%s", SHELL_CMD_POWERDOWN);
960-
fp = popen(shell_cmd, "r");
961-
if (fp == NULL) {
962-
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
963-
}
959+
execlp(SHELL_CMD_SHUTDOWN_FUNKEY, SHELL_CMD_SHUTDOWN_FUNKEY, NULL);
960+
MENU_ERROR_PRINTF("Failed to run command %s\n", SHELL_CMD_SHUTDOWN_FUNKEY);
961+
exit(0);
964962
}
965963
else{
966964
MENU_DEBUG_PRINTF("Powerdown - asking confirmation\n");

menu/menu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ typedef enum {RESUME_OPTIONS} ENUM_RESUME_OPTIONS;
191191
#define SHELL_CMD_POWERDOWN "shutdown_funkey"
192192
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
193193
#define SHELL_CMD_NOTIF "notif_set"
194+
#define SHELL_CMD_CANCEL_SCHED_POWERDOWN "cancel_sched_powerdown"
195+
#define SHELL_CMD_INSTANT_PLAY "instant_play"
194196
#define SHELL_CMD_WRITE_QUICK_LOAD_CMD "write_args_quick_load_file"
195197
#define SHELL_CMD_TURN_AMPLI_ON "start_audio_amp 1"
196198
#define SHELL_CMD_TURN_AMPLI_OFF "start_audio_amp 0"

0 commit comments

Comments
 (0)