@@ -498,41 +498,41 @@ static int install(int mcport, int icon_variant)
498498 {
499499 return 3 ;
500500 }
501- sprintf (temp_path ,"mc%u:BOOT" , mcport );
501+ snprintf (temp_path , MAX_PATH , "mc%u:BOOT" , mcport );
502502 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
503- sprintf (temp_path ,"mc%u:LDR_FMCBD-1.966" , mcport );
503+ snprintf (temp_path , MAX_PATH , "mc%u:LDR_FMCBD-1.966" , mcport );
504504 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
505- sprintf (temp_path ,"mc%u:SYS_FMCBCFG" , mcport );
505+ snprintf (temp_path , MAX_PATH , "mc%u:SYS_FMCBCFG" , mcport );
506506 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
507- sprintf (temp_path ,"mc%u:SYS_FMCB-CFG" , mcport );
507+ snprintf (temp_path , MAX_PATH , "mc%u:SYS_FMCB-CFG" , mcport );
508508 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
509- sprintf (temp_path ,"mc%u:FORTUNA" , mcport );
509+ snprintf (temp_path , MAX_PATH , "mc%u:FORTUNA" , mcport );
510510 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
511- sprintf (temp_path ,"mc%u:OPENTUNA" , mcport ); // This one is repeated later, ensure it's intended.
511+ snprintf (temp_path , MAX_PATH , "mc%u:OPENTUNA" , mcport ); // This one is repeated later, ensure it's intended.
512512 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
513- sprintf (temp_path , "mc%u:SYS-CONF" , mcport );
513+ snprintf (temp_path , MAX_PATH , "mc%u:SYS-CONF" , mcport );
514514 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
515- sprintf (temp_path , "mc%u:FUNTUNA-FORK" , mcport );
515+ snprintf (temp_path , MAX_PATH , "mc%u:FUNTUNA-FORK" , mcport );
516516 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
517- sprintf (temp_path , "mc%u:BXEXEC-FUNTUNA" , mcport );
517+ snprintf (temp_path , MAX_PATH , "mc%u:BXEXEC-FUNTUNA" , mcport );
518518 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
519- sprintf (temp_path , "mc%u:FUNTUNA" , mcport );
519+ snprintf (temp_path , MAX_PATH , "mc%u:FUNTUNA" , mcport );
520520 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
521- sprintf (temp_path , "mc%u:BXEXEC-OPENTUNA" , mcport );
521+ snprintf (temp_path , MAX_PATH , "mc%u:BXEXEC-OPENTUNA" , mcport );
522522 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
523- sprintf (temp_path , "mc%u:FMCBD-1.953" , mcport );
523+ snprintf (temp_path , MAX_PATH , "mc%u:FMCBD-1.953" , mcport );
524524 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
525- sprintf (temp_path , "mc%u:FMCBD-1.966" , mcport ); // This one is repeated (LDR_FMCBD-1.966 vs FMCBD-1.966) - seems okay.
525+ snprintf (temp_path , MAX_PATH , "mc%u:FMCBD-1.966" , mcport ); // This one is repeated (LDR_FMCBD-1.966 vs FMCBD-1.966) - seems okay.
526526 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
527- sprintf (temp_path , "mc%u:OPENTUNA" , mcport ); // Repeated
527+ snprintf (temp_path , MAX_PATH , "mc%u:OPENTUNA" , mcport ); // Repeated
528528 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
529- sprintf (temp_path , "mc%u:OSDMENU" , mcport );
529+ snprintf (temp_path , MAX_PATH , "mc%u:OSDMENU" , mcport );
530530 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
531- sprintf (temp_path , "mc%u:POPSTARTER" , mcport );
531+ snprintf (temp_path , MAX_PATH , "mc%u:POPSTARTER" , mcport );
532532 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
533- sprintf (temp_path , "mc%u:POWEROFF" , mcport );
533+ snprintf (temp_path , MAX_PATH , "mc%u:POWEROFF" , mcport );
534534 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
535- sprintf (temp_path , "mc%u:PS1_DKWDRV" , mcport );
535+ snprintf (temp_path , MAX_PATH , "mc%u:PS1_DKWDRV" , mcport );
536536 if (DeleteFolder (temp_path ) != 0 ) { PRINTF ("Install: Failed to delete folder %s\n" , temp_path ); return 7 ; }
537537
538538 //If the files exists, we have an error:
@@ -1087,8 +1087,16 @@ void error_message(int iz)
10871087 // This means iz=5,7,8 currently won't show a specific message here beyond the generic 'error' BMP.
10881088 default :
10891089 // No specific message for this error code, generic error BMP is already shown.
1090+ // We will print the numerical code below.
10901091 break ;
10911092 }
1093+
1094+ // Display the numerical error code
1095+ char err_code_str [32 ];
1096+ sprintf (err_code_str , "Error Code: %d" , iz );
1097+ // Y chosen to be below the typical MensajeX bitmaps.
1098+ // X chosen to be roughly centered for "Error Code: XX" (approx 14 chars, 8px/char ~112px; (640-112)/2 = 264)
1099+ gs_font_print (264 , 390 , 1 , 0x00E0E0E0 , err_code_str );
10921100}
10931101
10941102// Waits for a specific controller key press (or any key if 'key' is -1).
0 commit comments