Explorar o código

corrected pclose in init_menu_system_values

Vincent-FK %!s(int64=3) %!d(string=hai) anos
pai
achega
484383a502
Modificáronse 3 ficheiros con 19 adicións e 12 borrados
  1. 1 1
      platform/common/emu.c
  2. 7 0
      platform/common/main.c
  3. 11 11
      platform/common/menu_pico.c

+ 1 - 1
platform/common/emu.c

@@ -210,7 +210,7 @@ static const char *find_bios(int *region, const char *cd_fname)
 	for (i = 0; i < count; i++)
 	{
 		emu_make_path(static_buff, files[i], sizeof(static_buff) - 4);
-		printf("static_buff: %s\n", static_buff);
+		//printf("bios name static_buff: %s\n", static_buff);
 		strcat(static_buff, ".bin");
 		f = fopen(static_buff, "rb");
 		if (f) break;

+ 7 - 0
platform/common/main.c

@@ -245,6 +245,13 @@ int main(int argc, char *argv[])
 
 	for (;;)
 	{
+		/** Debug */
+		/*static int prev_engine_state = -1;
+		if(prev_engine_state != engineState){
+			printf("current engine state: %d, prev = %d\n", engineState, prev_engine_state);
+			prev_engine_state = engineState;
+		}*/
+
 		switch (engineState)
 		{
 			case PGS_Menu:

+ 11 - 11
platform/common/menu_pico.c

@@ -443,8 +443,8 @@ void init_menu_system_values(){
         volume_percentage = 50; ///wrong value: setting default to 50
     }
     else{
-        pclose(fp);
         fgets(res, sizeof(res)-1, fp);
+        pclose(fp);
 
         /// Check if Volume is a number (at least the first char)
         if(res[0] < '0' || res[0] > '9'){
@@ -464,8 +464,8 @@ void init_menu_system_values(){
         brightness_percentage = 50; ///wrong value: setting default to 50
     }
     else{
-        pclose(fp);
         fgets(res, sizeof(res)-1, fp);
+        pclose(fp);
 
         /// Check if brightness is a number (at least the first char)
         if(res[0] < '0' || res[0] > '9'){
@@ -806,8 +806,8 @@ void run_menu_loop()
                             if (fp == NULL) {
                                 MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
                             } else {
-			        pclose(fp);
-			    }
+            			        pclose(fp);
+            			    }
 
                             /// ------ Refresh screen ------
                             screen_refresh = 1;
@@ -824,7 +824,7 @@ void run_menu_loop()
                             if (fp == NULL) {
                                 MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
                             } else {
-			        pclose(fp);
+			                     pclose(fp);
                             }
                         /// ------ Refresh screen ------
                             screen_refresh = 1;
@@ -882,7 +882,7 @@ void run_menu_loop()
                             if (fp == NULL) {
                                 MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
                             } else {
-			        pclose(fp);
+			                     pclose(fp);
                             }
                             /// ------ Refresh screen ------
                             screen_refresh = 1;
@@ -899,7 +899,7 @@ void run_menu_loop()
                             if (fp == NULL) {
                                 MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
                             } else {
-			        pclose(fp);
+			                     pclose(fp);
                             }
                             /// ------ Refresh screen ------
                             screen_refresh = 1;
@@ -966,8 +966,8 @@ void run_menu_loop()
                                 fp = popen(shell_cmd, "r");
                                 if (fp == NULL) {
                                     MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
-				} else {
-				    pclose(fp);
+                				} else {
+                				    pclose(fp);
                                 }
 
                                 stop_menu_loop = 1;
@@ -1013,8 +1013,8 @@ void run_menu_loop()
                                 fp = popen(shell_cmd, "r");
                                 if (fp == NULL) {
                                     MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
-				} else {
-				    pclose(fp);
+                				} else {
+                				    pclose(fp);
                                 }
 
                                 /*snprintf(hud_msg, sizeof(hud_msg), ret == 0 ? "LOADED" : "FAIL!");