Skip to content

Commit f3d4a3a

Browse files
committed
pulled and resolved conlicts
2 parents 20414f1 + e37c0fa commit f3d4a3a

File tree

3 files changed

+22
-31
lines changed

3 files changed

+22
-31
lines changed

platform/common/emu.c

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,38 +1417,30 @@ void emu_cmn_forced_frame(int no_scale, int do_emu)
14171417
/* Quick save and turn off the console */
14181418
void quick_save_and_poweroff()
14191419
{
1420-
/* Vars */
1421-
char shell_cmd[1024];
1422-
FILE *fp;
1423-
1424-
/* Send command to kill any previously scheduled shutdown */
1425-
sprintf(shell_cmd, "pkill %s", SHELL_CMD_SCHEDULE_POWERDOWN);
1426-
fp = popen(shell_cmd, "r");
1427-
if (fp == NULL) {
1428-
printf("Failed to run command %s\n", shell_cmd);
1420+
printf("Save Instant Play file\n");
1421+
1422+
/* Send command to cancel any previously scheduled powerdown */
1423+
if (popen(SHELL_CMD_CANCEL_SCHED_POWERDOWN, "r") == NULL)
1424+
{
1425+
/* Countdown is still ticking, so better do nothing
1426+
than start writing and get interrupted!
1427+
*/
1428+
printf("Failed to cancel scheduled shutdown\n");
1429+
exit(0);
14291430
}
14301431

14311432
/* Save */
14321433
emu_save_load_game_from_file(0, quick_save_file);
14331434

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

1443-
/* Clean Poweroff */
1444-
sprintf(shell_cmd, "%s", SHELL_CMD_POWERDOWN);
1445-
fp = popen(shell_cmd, "r");
1446-
if (fp == NULL) {
1447-
printf("Failed to run command %s\n", shell_cmd);
1448-
}
1439+
/* Should not be reached */
1440+
printf("Failed to perform Instant Play save and shutdown\n");
14491441

14501442
/* Exit Emulator */
1451-
engineState = PGS_Quit;
1443+
exit(0);
14521444
}
14531445

14541446

platform/common/menu_pico.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,11 +1019,9 @@ void run_menu_loop()
10191019
if(menu_confirmation){
10201020
MENU_DEBUG_PRINTF("Powerdown - confirmed\n");
10211021
/// ----- Shell cmd ----
1022-
sprintf(shell_cmd, "%s", SHELL_CMD_POWERDOWN);
1023-
fp = popen(shell_cmd, "r");
1024-
if (fp == NULL) {
1025-
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
1026-
}
1022+
execlp(SHELL_CMD_SHUTDOWN_FUNKEY, SHELL_CMD_SHUTDOWN_FUNKEY, NULL);
1023+
MENU_ERROR_PRINTF("Failed to run command %s\n", SHELL_CMD_SHUTDOWN_FUNKEY);
1024+
exit(0);
10271025
}
10281026
else{
10291027
MENU_DEBUG_PRINTF("Powerdown - asking confirmation\n");

platform/common/menu_pico.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ typedef enum {RESUME_OPTIONS} ENUM_RESUME_OPTIONS;
5050
#define SHELL_CMD_VOLUME_SET "volume_set"
5151
#define SHELL_CMD_BRIGHTNESS_GET "brightness_get"
5252
#define SHELL_CMD_BRIGHTNESS_SET "brightness_set"
53-
#define SHELL_CMD_POWERDOWN "shutdown_funkey"
54-
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
5553
#define SHELL_CMD_NOTIF "notif_set"
5654
#define SHELL_CMD_WRITE_QUICK_LOAD_CMD "write_args_quick_load_file"
5755
#define SHELL_CMD_TURN_AMPLI_ON "start_audio_amp 1"
5856
#define SHELL_CMD_TURN_AMPLI_OFF "start_audio_amp 0"
57+
#define SHELL_CMD_CANCEL_SCHED_POWERDOWN "cancel_sched_powerdown"
58+
#define SHELL_CMD_INSTANT_PLAY "instant_play"
59+
#define SHELL_CMD_SHUTDOWN_FUNKEY "shutdown_funkey"
5960

6061
#define MAXPATHLEN 512
6162

0 commit comments

Comments
 (0)