Skip to content

Commit

Permalink
fixed merge confilcts
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent-FK committed Jan 15, 2021
2 parents 420139c + 2d5e38d commit f56f1a0
Showing 3 changed files with 20 additions and 31 deletions.
41 changes: 15 additions & 26 deletions menu/main.cpp
Original file line number Diff line number Diff line change
@@ -591,16 +591,16 @@ void S9xLoadSRAM (void)
/* Quick save and turn off the console */
void quick_save_and_poweroff()
{
/* Vars */
char shell_cmd[200+SAL_MAX_PATH];
FILE *fp;

/* Send command to kill any previously scheduled shutdown */
sprintf(shell_cmd, "pkill %s", SHELL_CMD_SCHEDULE_POWERDOWN);
fp = popen(shell_cmd, "r");
if (fp == NULL)
printf("Save Instant Play file\n");

/* Send command to cancel any previously scheduled powerdown */
if (popen(SHELL_CMD_CANCEL_SCHED_POWERDOWN, "r") == NULL)
{
printf("Failed to run command %s\n", shell_cmd);
/* Countdown is still ticking, so better do nothing
than start writing and get interrupted!
*/
printf("Failed to cancel scheduled shutdown\n");
exit(0);
}

/* Save */
@@ -610,26 +610,15 @@ void quick_save_and_poweroff()
return;
}

/* Write quick load file */
sprintf(shell_cmd, "%s SDL_NOMOUSE=1 \"%s\" -loadStateFile \"%s\" \"%s\"",
SHELL_CMD_WRITE_QUICK_LOAD_CMD, prog_name, quick_save_file, mRomName);
printf("Cmd write quick load file:\n %s\n", shell_cmd);
fp = popen(shell_cmd, "r");
if (fp == NULL)
{
printf("Failed to run command %s\n", shell_cmd);
}
/* Perform Instant Play save and shutdown */
execlp(SHELL_CMD_INSTANT_PLAY, SHELL_CMD_INSTANT_PLAY,
prog_name, "-loadStateFile", quick_save_file, mRomName, NULL);

/* Clean Poweroff */
sprintf(shell_cmd, "%s", SHELL_CMD_POWERDOWN);
fp = popen(shell_cmd, "r");
if (fp == NULL)
{
printf("Failed to run command %s\n", shell_cmd);
}
/* Should not be reached */
printf("Failed to perform Instant Play save and shutdown\n");

/* Exit Emulator */
mExit = 1;
exit(0);
}

static u32 LastAudioRate = 0;
8 changes: 3 additions & 5 deletions menu/menu.cpp
Original file line number Diff line number Diff line change
@@ -956,11 +956,9 @@ void run_menu_loop()
if(menu_confirmation){
MENU_DEBUG_PRINTF("Powerdown - confirmed\n");
/// ----- Shell cmd ----
sprintf(shell_cmd, "%s", SHELL_CMD_POWERDOWN);
fp = popen(shell_cmd, "r");
if (fp == NULL) {
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
}
execlp(SHELL_CMD_SHUTDOWN_FUNKEY, SHELL_CMD_SHUTDOWN_FUNKEY, NULL);
MENU_ERROR_PRINTF("Failed to run command %s\n", SHELL_CMD_SHUTDOWN_FUNKEY);
exit(0);
}
else{
MENU_DEBUG_PRINTF("Powerdown - asking confirmation\n");
2 changes: 2 additions & 0 deletions menu/menu.h
Original file line number Diff line number Diff line change
@@ -191,6 +191,8 @@ typedef enum {RESUME_OPTIONS} ENUM_RESUME_OPTIONS;
#define SHELL_CMD_POWERDOWN "shutdown_funkey"
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
#define SHELL_CMD_NOTIF "notif_set"
#define SHELL_CMD_CANCEL_SCHED_POWERDOWN "cancel_sched_powerdown"
#define SHELL_CMD_INSTANT_PLAY "instant_play"
#define SHELL_CMD_WRITE_QUICK_LOAD_CMD "write_args_quick_load_file"
#define SHELL_CMD_TURN_AMPLI_ON "start_audio_amp 1"
#define SHELL_CMD_TURN_AMPLI_OFF "start_audio_amp 0"

0 comments on commit f56f1a0

Please sign in to comment.