@@ -591,41 +591,45 @@ 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 ) {
602- printf (" Failed to run command %s\n " , shell_cmd);
603- }
604-
605- /* Save */
606- if (!SaveStateFile ((s8 *)quick_save_file)){
607- printf (" Save failed" );
608- return ;
609- }
610-
611- /* Write quick load file */
612- sprintf (shell_cmd, " %s SDL_NOMOUSE=1 \" %s\" -loadStateFile \" %s\" \" %s\" " ,
613- SHELL_CMD_WRITE_QUICK_LOAD_CMD, prog_name, quick_save_file, mRomName );
614- printf (" Cmd write quick load file:\n %s\n " , shell_cmd);
615- fp = popen (shell_cmd, " r" );
616- if (fp == NULL ) {
617- printf (" Failed to run command %s\n " , shell_cmd);
618- }
619-
620- /* Clean Poweroff */
621- sprintf (shell_cmd, " %s" , SHELL_CMD_POWERDOWN);
622- fp = popen (shell_cmd, " r" );
623- if (fp == NULL ) {
624- printf (" Failed to run command %s\n " , shell_cmd);
625- }
626-
627- /* Exit Emulator */
628- mExit = 1 ;
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 )
602+ {
603+ printf (" Failed to run command %s\n " , shell_cmd);
604+ }
605+
606+ /* Save */
607+ if (!SaveStateFile ((s8 *)quick_save_file))
608+ {
609+ printf (" Save failed" );
610+ return ;
611+ }
612+
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+ }
622+
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+ }
630+
631+ /* Exit Emulator */
632+ mExit = 1 ;
629633}
630634
631635static u32 LastAudioRate = 0 ;
@@ -681,37 +685,41 @@ int Run(int sound)
681685 sal_AudioResume ();
682686
683687 /* Load slot */
684- if (load_state_slot != -1 ){
688+ if (load_state_slot != -1 )
689+ {
685690 printf (" LOADING FROM SLOT %d...\n " , load_state_slot+1 );
686691 LoadStateFile (mSaveState [load_state_slot].fullFilename );
687692 printf (" LOADED FROM SLOT %d\n " , load_state_slot+1 );
688693 load_state_slot = -1 ;
689694 }
690695 /* Load file */
691- else if (load_state_file != NULL ){
696+ else if (load_state_file != NULL )
697+ {
692698 printf (" LOADING FROM FILE %s...\n " , load_state_file);
693699 LoadStateFile (load_state_file);
694700 printf (" LOADED FROM SLOT %s\n " , load_state_file);
695701 load_state_file = NULL ;
696702 }
697703 /* Load quick save file */
698- else if (access ( quick_save_file, F_OK ) != -1 ){
704+ else if (access ( quick_save_file, F_OK ) != -1 )
705+ {
699706 printf (" Found quick save file: %s\n " , quick_save_file);
700707
701708 int resume = launch_resume_menu_loop ();
702- if (resume == RESUME_YES){
709+ if (resume == RESUME_YES)
710+ {
703711 printf (" Resume game from quick save file: %s\n " , quick_save_file);
704712 LoadStateFile (quick_save_file);
705713 }
706- else {
714+ else {
707715 printf (" Reset game\n " );
708716
709717 /* Remove quicksave file if present */
710718 if (remove (quick_save_file) == 0 ){
711- printf (" Deleted successfully: %s\n " , quick_save_file);
719+ printf (" Deleted successfully: %s\n " , quick_save_file);
712720 }
713- else {
714- printf (" Unable to delete the file: %s\n " , quick_save_file);
721+ else {
722+ printf (" Unable to delete the file: %s\n " , quick_save_file);
715723 }
716724 }
717725 }
@@ -727,14 +735,16 @@ int Run(int sound)
727735 so.err_counter = 0 ;
728736
729737 // / Menu
730- if (mEnterMenu && !mQuickSaveAndPoweroff ){
738+ if (mEnterMenu && !mQuickSaveAndPoweroff )
739+ {
731740 run_menu_loop ();
732741 mEnterMenu = 0 ;
733742 sal_force_no_menu_detection ();
734743 }
735744
736745 // Quick save and poweroff
737- if (mQuickSaveAndPoweroff ){
746+ if (mQuickSaveAndPoweroff )
747+ {
738748 quick_save_and_poweroff ();
739749 mQuickSaveAndPoweroff = 0 ;
740750 }
@@ -943,13 +953,13 @@ extern "C"
943953/* Handler for SIGUSR1, caused by closing the console */
944954void handle_sigusr1 (int sig)
945955{
946- // printf("Caught signal USR1 %d\n", sig);
956+ // printf("Caught signal USR1 %d\n", sig);
947957
948- /* Exit menu if it was launched */
949- stop_menu_loop = 1 ;
958+ /* Exit menu if it was launched */
959+ stop_menu_loop = 1 ;
950960
951- /* Signal to quick save and poweoff after next loop */
952- mQuickSaveAndPoweroff = 1 ;
961+ /* Signal to quick save and poweoff after next loop */
962+ mQuickSaveAndPoweroff = 1 ;
953963}
954964
955965void parse_cmd_line (int argc, char *argv[])
@@ -966,10 +976,16 @@ void parse_cmd_line(int argc, char *argv[])
966976 {
967977 if (strcasecmp (argv[x], " -loadStateSlot" ) == 0 )
968978 {
969- if (x+1 < argc) { ++x; load_state_slot = atoi (argv[x]); }
979+ if (x+1 < argc)
980+ {
981+ ++x; load_state_slot = atoi (argv[x]);
982+ }
970983 }
971984 else if (strcasecmp (argv[x], " -loadStateFile" ) == 0 ) {
972- if (x+1 < argc) { ++x; load_state_file = argv[x]; }
985+ if (x+1 < argc)
986+ {
987+ ++x; load_state_file = argv[x];
988+ }
973989 }
974990 else if (strcasecmp (argv[x], " -fps" ) == 0 ) {
975991
@@ -984,7 +1000,8 @@ void parse_cmd_line(int argc, char *argv[])
9841000 else {
9851001 mRomName = argv[x];
9861002 FILE *f = fopen (mRomName , " rb" );
987- if (f) {
1003+ if (f)
1004+ {
9881005
9891006 /* Save Rom path */
9901007 mRomPath = (char *)malloc (strlen (mRomName )+1 );
@@ -1006,15 +1023,16 @@ void parse_cmd_line(int argc, char *argv[])
10061023
10071024 fclose (f);
10081025 }
1009- else {
1026+ else {
10101027 printf (" Rom %s not found \n " , mRomName );
10111028 unrecognized = 1 ;
10121029 }
10131030 break ;
10141031 }
10151032 }
10161033
1017- if (unrecognized) {
1034+ if (unrecognized)
1035+ {
10181036 printf (" \n\n\n PocketSNES \n " );
10191037 printf (" usage: %s [options] [romfile]\n " , argv[0 ]);
10201038 printf (" options:\n "
@@ -1039,8 +1057,8 @@ int mainEntry(int argc, char* argv[])
10391057 parse_cmd_line (argc, argv);
10401058 }
10411059
1042- /* Set env var for no mouse */
1043- putenv (strdup (" SDL_NOMOUSE=1" ));
1060+ /* Set env var for no mouse */
1061+ putenv (strdup (" SDL_NOMOUSE=1" ));
10441062
10451063 /* Init Video */
10461064 sal_Init ();
@@ -1079,7 +1097,7 @@ int mainEntry(int argc, char* argv[])
10791097 printf (" Failed to load ROM %s\n " ,mRomName );
10801098 mRomName [0 ] = 0 ;
10811099 sal_Reset ();
1082- return 0 ;
1100+ return 0 ;
10831101 }
10841102 else
10851103 {
@@ -1128,9 +1146,3 @@ int mainEntry(int argc, char* argv[])
11281146}
11291147
11301148}
1131-
1132-
1133-
1134-
1135-
1136-
0 commit comments