|
|
1.1 root 1: /*
2: Hatari - dialog.c
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
6:
7: Code to handle our options dialog.
8: */
9: const char Dialog_fileid[] = "Hatari dialog.c : " __DATE__ " " __TIME__;
10:
11: #include "main.h"
12: #include "configuration.h"
13: #include "change.h"
14: #include "dialog.h"
15: #include "log.h"
16: #include "sdlgui.h"
17: #include "screen.h"
1.1.1.3 ! root 18: #include "file.h"
1.1 root 19:
20:
21: /*-----------------------------------------------------------------------*/
22: /**
23: * Open Property sheet Options dialog.
24: *
25: * We keep all our configuration details in a structure called
26: * 'ConfigureParams'. When we open our dialog we make a backup
27: * of this structure. When the user finally clicks on 'OK',
28: * we can compare and makes the necessary changes.
29: *
30: * Return true if user chooses OK, or false if cancel!
31: */
32: bool Dialog_DoProperty(void)
33: {
34: bool bOKDialog; /* Did user 'OK' dialog? */
35: bool bForceReset;
36: bool bLoadedSnapshot;
37: CNF_PARAMS current;
38:
39: Main_PauseEmulation(true);
40: bForceReset = false;
41:
42: /* Copy details (this is so can restore if 'Cancel' dialog) */
43: current = ConfigureParams;
44: ConfigureParams.Screen.bFullScreen = bInFullScreen;
45: bOKDialog = Dialog_MainDlg(&bForceReset, &bLoadedSnapshot);
46:
47: /* If a memory snapshot has been loaded, no further changes are required */
48: if (bLoadedSnapshot)
49: {
50: Main_UnPauseEmulation();
51: return true;
52: }
53:
54: /* Check if reset is required and ask user if he really wants to continue then */
55: if (bOKDialog && !bForceReset
56: && Change_DoNeedReset(¤t, &ConfigureParams)
1.1.1.2 root 57: && ConfigureParams.Log.nAlertDlgLogLevel > LOG_FATAL) {
1.1 root 58: bOKDialog = DlgAlert_Query("The emulated system must be "
59: "reset to apply these changes. "
60: "Apply changes now and reset "
61: "the emulator?");
62: }
63:
64: /* Copy details to configuration */
65: if (bOKDialog) {
66: Change_CopyChangedParamsToConfiguration(¤t, &ConfigureParams, bForceReset);
67: } else {
68: ConfigureParams = current;
69: }
70:
71: Main_UnPauseEmulation();
1.1.1.3 ! root 72:
1.1 root 73: if (bQuitProgram)
74: Main_RequestQuit();
1.1.1.3 ! root 75:
1.1 root 76: return bOKDialog;
77: }
1.1.1.3 ! root 78:
! 79:
! 80: /* Function to check if all necessary files exist. If loading of a file fails, we bring up a dialog to let the
! 81: * user choose another file. This is repeated for each missing file.
! 82: */
! 83:
! 84: void Dialog_CheckFiles(void) {
! 85: bool bOldMouseVisibility;
! 86: bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
! 87: SDL_ShowCursor(SDL_ENABLE);
! 88:
! 89: /* Check if ROM file exists. If it is missing present a dialog to select a new ROM file. */
! 90: switch (ConfigureParams.System.nMachineType) {
! 91: case NEXT_CUBE030:
! 92: while (!File_Exists(ConfigureParams.Rom.szRom030FileName)) {
! 93: DlgMissing_Rom();
! 94: if (bQuitProgram) {
! 95: Main_RequestQuit();
! 96: if (bQuitProgram)
! 97: break;
! 98: }
! 99: }
! 100: break;
! 101: case NEXT_CUBE040:
! 102: case NEXT_STATION:
! 103: if (ConfigureParams.System.bTurbo) {
! 104: while (!File_Exists(ConfigureParams.Rom.szRomTurboFileName)) {
! 105: DlgMissing_Rom();
! 106: if (bQuitProgram) {
! 107: Main_RequestQuit();
! 108: if (bQuitProgram)
! 109: break;
! 110: }
! 111: }
! 112: } else {
! 113: while (!File_Exists(ConfigureParams.Rom.szRom040FileName)) {
! 114: DlgMissing_Rom();
! 115: if (bQuitProgram) {
! 116: Main_RequestQuit();
! 117: if (bQuitProgram)
! 118: break;
! 119: }
! 120: }
! 121: }
! 122: break;
! 123:
! 124: default:
! 125: break;
! 126: }
! 127: if (bQuitProgram)
! 128: return;
! 129:
! 130: /* Check if SCSI disk images exist. Present a dialog to select missing files. */
! 131: int target;
! 132: for (target = 0; target < ESP_MAX_DEVS; target++) {
! 133: while (ConfigureParams.SCSI.target[target].bAttached && !File_Exists(ConfigureParams.SCSI.target[target].szImageName)) {
! 134: DlgMissing_SCSIdisk(target);
! 135: if (bQuitProgram) {
! 136: Main_RequestQuit();
! 137: if (bQuitProgram)
! 138: break;
! 139: }
! 140: }
! 141: if (bQuitProgram)
! 142: break;
! 143: }
! 144: if (bQuitProgram)
! 145: return;
! 146:
! 147: SDL_ShowCursor(bOldMouseVisibility);
! 148: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.