Ticket #9006: main_error_dialog.patch

File main_error_dialog.patch, 1.9 KB (added by SF/danielt3, 16 years ago)

Error message patch.

  • base/main.cpp

     
    312312
    313313                        // Try to run the game
    314314                        Common::Error result = runGame(plugin, system, specialDebug);
    315 
     315                       
    316316                        // Did an error occur ?
    317317                        if (result != Common::kNoError) {
    318318                                // TODO: Show an informative error dialog if starting the selected game failed.
     319                                Common::String ErrorMsg("Game could not be started.\n");
     320                                switch(result){
     321                                        case (Common::kInvalidPathError):
     322                                                ErrorMsg += "Reason: Invalid path error.\n";
     323                                                break;
     324                                        case (Common::kNoGameDataFoundError):
     325                                                ErrorMsg += "Reason: Game data file not found.\n";
     326                                                break;
     327                                        case (Common::kUnsupportedGameidError):
     328                                                ErrorMsg += "Reason: Unsupported gameid.\n";
     329                                                break;
     330                                        case (Common::kReadPermissionDenied):
     331                                                ErrorMsg += "Reason: Read permission denied.\n";
     332                                                break;
     333                                        case (Common::kWritePermissionDenied):
     334                                                ErrorMsg += "Reason: Write permission denied.\n";
     335                                                break;
     336                                        case (Common::kPathDoesNotExist):
     337                                                ErrorMsg += "Reason: Path does not exist.\n";
     338                                                break;
     339                                        case (Common::kPathNotDirectory):
     340                                                ErrorMsg += "Reason: Path is not a directory.\n";
     341                                                break;
     342                                        case (Common::kPathNotFile):
     343                                                ErrorMsg += "Reason: Path is not a file.\n";
     344                                                break;
     345                                        case (Common::kCreatingFileFailed):
     346                                                ErrorMsg += "Reason: File creation failed.\n";
     347                                                break;
     348                                        case (Common::kReadingFailed):
     349                                                ErrorMsg += "Reason: Error reading file.\n";
     350                                                break;
     351                                        case (Common::kWritingFailed):
     352                                                ErrorMsg += "Reason: Error writing file.\n";
     353                                                break;
     354                                        case (Common::kUnknownError):
     355                                        default:                                       
     356                                                ErrorMsg += "Reason: Unknown.\n";
     357                                                break;
     358                                }
     359                                GUI::MessageDialog ErrDlg(ErrorMsg);
     360                                ErrDlg.runModal();
    319361                        }
    320362
    321363                        // Quit unless an error occurred, or Return to launcher was requested