--- previous/src/dialog.c 2018/04/24 19:25:10 1.1 +++ previous/src/dialog.c 2018/04/24 19:27:29 1.1.1.3 @@ -15,7 +15,7 @@ const char Dialog_fileid[] = "Hatari dia #include "log.h" #include "sdlgui.h" #include "screen.h" -#include "statusbar.h" +#include "file.h" /*-----------------------------------------------------------------------*/ @@ -47,8 +47,6 @@ bool Dialog_DoProperty(void) /* If a memory snapshot has been loaded, no further changes are required */ if (bLoadedSnapshot) { - /* changes from new memory snapshot may affect also info shown in statusbar */ - Statusbar_UpdateInfo(); Main_UnPauseEmulation(); return true; } @@ -56,7 +54,7 @@ bool Dialog_DoProperty(void) /* Check if reset is required and ask user if he really wants to continue then */ if (bOKDialog && !bForceReset && Change_DoNeedReset(¤t, &ConfigureParams) - && ConfigureParams.Log.nAlertDlgLogLevel >= LOG_WARN) { + && ConfigureParams.Log.nAlertDlgLogLevel > LOG_FATAL) { bOKDialog = DlgAlert_Query("The emulated system must be " "reset to apply these changes. " "Apply changes now and reset " @@ -71,9 +69,80 @@ bool Dialog_DoProperty(void) } Main_UnPauseEmulation(); - + if (bQuitProgram) Main_RequestQuit(); - + return bOKDialog; } + + +/* Function to check if all necessary files exist. If loading of a file fails, we bring up a dialog to let the + * user choose another file. This is repeated for each missing file. + */ + +void Dialog_CheckFiles(void) { + bool bOldMouseVisibility; + bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY); + SDL_ShowCursor(SDL_ENABLE); + + /* Check if ROM file exists. If it is missing present a dialog to select a new ROM file. */ + switch (ConfigureParams.System.nMachineType) { + case NEXT_CUBE030: + while (!File_Exists(ConfigureParams.Rom.szRom030FileName)) { + DlgMissing_Rom(); + if (bQuitProgram) { + Main_RequestQuit(); + if (bQuitProgram) + break; + } + } + break; + case NEXT_CUBE040: + case NEXT_STATION: + if (ConfigureParams.System.bTurbo) { + while (!File_Exists(ConfigureParams.Rom.szRomTurboFileName)) { + DlgMissing_Rom(); + if (bQuitProgram) { + Main_RequestQuit(); + if (bQuitProgram) + break; + } + } + } else { + while (!File_Exists(ConfigureParams.Rom.szRom040FileName)) { + DlgMissing_Rom(); + if (bQuitProgram) { + Main_RequestQuit(); + if (bQuitProgram) + break; + } + } + } + break; + + default: + break; + } + if (bQuitProgram) + return; + + /* Check if SCSI disk images exist. Present a dialog to select missing files. */ + int target; + for (target = 0; target < ESP_MAX_DEVS; target++) { + while (ConfigureParams.SCSI.target[target].bAttached && !File_Exists(ConfigureParams.SCSI.target[target].szImageName)) { + DlgMissing_SCSIdisk(target); + if (bQuitProgram) { + Main_RequestQuit(); + if (bQuitProgram) + break; + } + } + if (bQuitProgram) + break; + } + if (bQuitProgram) + return; + + SDL_ShowCursor(bOldMouseVisibility); +}