@@ -44,38 +44,41 @@ rcvar_t emu_exports[] =
4444/* Quick save and turn off the console */
4545void quick_save_and_poweroff ()
4646{
47- /* Vars */
48- char shell_cmd [1024 ];
49- FILE * fp ;
50-
51- /* Send command to kill any previously scheduled shutdown */
52- sprintf (shell_cmd , "pkill %s" , SHELL_CMD_SCHEDULE_POWERDOWN );
53- fp = popen (shell_cmd , "r" );
54- if (fp == NULL ) {
55- printf ("Failed to run command %s\n" , shell_cmd );
56- }
57-
58- /* Save */
59- state_file_save (quick_save_file );
60-
61- /* Write quick load file */
62- sprintf (shell_cmd , "%s SDL_NOMOUSE=1 \"%s\" --loadStateFile \"%s\" \"%s\"" ,
63- SHELL_CMD_WRITE_QUICK_LOAD_CMD , prog_name , quick_save_file , mRomName );
64- printf ("Cmd write quick load file:\n %s\n" , shell_cmd );
65- fp = popen (shell_cmd , "r" );
66- if (fp == NULL ) {
67- printf ("Failed to run command %s\n" , shell_cmd );
68- }
69-
70- /* Clean Poweroff */
71- sprintf (shell_cmd , "%s" , SHELL_CMD_POWERDOWN );
72- fp = popen (shell_cmd , "r" );
73- if (fp == NULL ) {
74- printf ("Failed to run command %s\n" , shell_cmd );
75- }
76-
77- /* Exit Emulator */
78- exit (0 );
47+ /* Vars */
48+ char shell_cmd [1024 ];
49+ FILE * fp ;
50+
51+ /* Send command to kill any previously scheduled shutdown */
52+ sprintf (shell_cmd , "pkill %s" , SHELL_CMD_SCHEDULE_POWERDOWN );
53+ fp = popen (shell_cmd , "r" );
54+ if (fp == NULL )
55+ {
56+ printf ("Failed to run command %s\n" , shell_cmd );
57+ }
58+
59+ /* Save */
60+ state_file_save (quick_save_file );
61+
62+ /* Write quick load file */
63+ sprintf (shell_cmd , "%s SDL_NOMOUSE=1 \"%s\" --loadStateFile \"%s\" \"%s\"" ,
64+ SHELL_CMD_WRITE_QUICK_LOAD_CMD , prog_name , quick_save_file , mRomName );
65+ printf ("Cmd write quick load file:\n %s\n" , shell_cmd );
66+ fp = popen (shell_cmd , "r" );
67+ if (fp == NULL )
68+ {
69+ printf ("Failed to run command %s\n" , shell_cmd );
70+ }
71+
72+ /* Clean Poweroff */
73+ sprintf (shell_cmd , "%s" , SHELL_CMD_POWERDOWN );
74+ fp = popen (shell_cmd , "r" );
75+ if (fp == NULL )
76+ {
77+ printf ("Failed to run command %s\n" , shell_cmd );
78+ }
79+
80+ /* Exit Emulator */
81+ exit (0 );
7982}
8083
8184
@@ -127,42 +130,47 @@ void emu_run()
127130 lcd_begin ();
128131
129132 /* Load slot */
130- if (load_state_slot != -1 ){
131- printf ("LOADING FROM SLOT %d...\n" , load_state_slot + 1 );
132- state_load (load_state_slot );
133- printf ("LOADED FROM SLOT %d\n" , load_state_slot + 1 );
134- load_state_slot = -1 ;
135- }
136- /* Load file */
137- else if (load_state_file != NULL ){
138- printf ("LOADING FROM FILE %s...\n" , load_state_file );
139- state_file_load (load_state_file );
140- printf ("LOADED FROM SLOT %s\n" , load_state_file );
141- load_state_file = NULL ;
142- }
143- /* Load quick save file */
144- else if (access ( quick_save_file , F_OK ) != -1 ){
145- printf ("Found quick save file: %s\n" , quick_save_file );
146-
147- int resume = launch_resume_menu_loop ();
148- if (resume == RESUME_YES ){
149- printf ("Resume game from quick save file: %s\n" , quick_save_file );
150- state_file_load (quick_save_file );
133+ if (load_state_slot != -1 )
134+ {
135+ printf ("LOADING FROM SLOT %d...\n" , load_state_slot + 1 );
136+ state_load (load_state_slot );
137+ printf ("LOADED FROM SLOT %d\n" , load_state_slot + 1 );
138+ load_state_slot = -1 ;
151139 }
152- else {
153- printf ("Reset game\n" );
154-
155- /* Remove quicksave file if present */
156- if (remove (quick_save_file ) == 0 ){
157- printf ("Deleted successfully: %s\n" , quick_save_file );
158- }
159- else {
160- printf ("Unable to delete the file: %s\n" , quick_save_file );
161- }
140+ /* Load file */
141+ else if (load_state_file != NULL )
142+ {
143+ printf ("LOADING FROM FILE %s...\n" , load_state_file );
144+ state_file_load (load_state_file );
145+ printf ("LOADED FROM SLOT %s\n" , load_state_file );
146+ load_state_file = NULL ;
147+ }
148+ /* Load quick save file */
149+ else if (access ( quick_save_file , F_OK ) != -1 )
150+ {
151+ printf ("Found quick save file: %s\n" , quick_save_file );
152+
153+ int resume = launch_resume_menu_loop ();
154+ if (resume == RESUME_YES )
155+ {
156+ printf ("Resume game from quick save file: %s\n" , quick_save_file );
157+ state_file_load (quick_save_file );
158+ }
159+ else {
160+ printf ("Reset game\n" );
161+
162+ /* Remove quicksave file if present */
163+ if (remove (quick_save_file ) == 0 )
164+ {
165+ printf ("Deleted successfully: %s\n" , quick_save_file );
166+ }
167+ else {
168+ printf ("Unable to delete the file: %s\n" , quick_save_file );
169+ }
170+ }
162171 }
163- }
164172
165- /* Main emulation loop */
173+ /* Main emulation loop */
166174 for (;;)
167175 {
168176 cpu_emulate (2280 );
@@ -197,15 +205,3 @@ void emu_run()
197205 emu_step ();
198206 }
199207}
200-
201-
202-
203-
204-
205-
206-
207-
208-
209-
210-
211-
0 commit comments