|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * Text-based user interface
5: * Sie haben es sich verdient!
6: *
7: * Copyright 1996 Tim Gunn, Bernd Schmidt
8: */
9:
10: #include "sysconfig.h"
11: #include "sysdeps.h"
12:
13: #include <stdio.h>
14: #include <ctype.h>
15:
16: #include "config.h"
17: #include "options.h"
1.1.1.10 root 18: #include "threaddep/thread.h"
1.1.1.2 root 19: #include "uae.h"
1.1.1.3 root 20: #include "gensound.h"
21: #include "joystick.h"
22: #include "keybuf.h"
1.1 root 23: #include "autoconf.h"
1.1.1.3 root 24: #include "xwin.h"
1.1 root 25: #include "tui.h"
26: #include "gui.h"
27: #include "memory.h"
28:
1.1.1.3 root 29: #define MAX_MENU_HEIGHT 15
30: #define OPTION_COLUMN 3
31: #define MENU_COL_OFFSET -2
1.1 root 32:
33: int mountok=0;
34:
1.1.1.4 root 35: void gui_led (int led, int on)
1.1 root 36: {
37: }
1.1.1.4 root 38: void gui_filename (int num, const char *name)
1.1 root 39: {
40: }
1.1.1.4 root 41: static void getline (char *p)
1.1 root 42: {
43: }
1.1.1.4 root 44: void gui_handle_events (void)
1.1 root 45: {
46: }
1.1.1.6 root 47: void gui_fps (int x)
48: {
49: }
1.1.1.3 root 50: static void save_settings (void)
1.1 root 51: {
1.1.1.3 root 52: FILE *f;
53: tui_backup_optionsfile ();
54: f = fopen (optionsfile, "w");
55: if (f == NULL) {
1.1.1.11! root 56: write_log ("Error saving options file!\n");
1.1.1.3 root 57: return;
58: }
1.1.1.6 root 59: save_options (f, &currprefs);
1.1.1.3 root 60: fclose (f);
1.1 root 61: }
62:
63: void gui_exit()
64: {
65: }
66:
1.1.1.2 root 67: static struct bstring mainmenu[] = {
1.1.1.3 root 68: { "UAE configuration", 0 },
1.1.1.2 root 69: { "_Disk settings", 'D' },
70: { "_Video settings", 'V' },
71: { "_Memory settings", 'M' },
1.1.1.5 root 72: { "_CPU settings", 'C' },
1.1.1.2 root 73: { "_Hard disk settings", 'H' },
74: { "_Sound settings", 'S' },
75: { "_Other settings", 'O' },
1.1.1.3 root 76: { "S_ave settings", 'A' },
1.1.1.2 root 77: { "_Run UAE", 'R' },
78: { NULL, -3 }
79: };
80:
1.1.1.3 root 81: static struct bstring mainmenu2[] = {
82: { "UAE configuration", 0 },
83: { "_Disk settings", 'D' },
84: /* { "_Video settings", 'V' },
85: { "_Memory settings", 'M' },
86: { "_Hard disk settings", 'H' },
87: { "_Sound settings", 'S' }, */
88: { "_Other settings", 'O' },
89: { "S_ave settings", 'A' },
90: { "R_eset UAE", 'E' },
91: { "_Quit UAE", 'Q' },
92: { "_Run UAE", 'R' },
93: { NULL, -3 }
1.1 root 94: };
95:
1.1.1.3 root 96: static struct bstring diskmenu[] = {
97: { "Floppy disk settings", 0 },
1.1.1.2 root 98: { "Change DF_0:", '0' },
99: { "Change DF_1:", '1' },
100: { "Change DF_2:", '2' },
101: { "Change DF_3:", '3' },
102: { NULL, -3 }
1.1 root 103: };
104:
1.1.1.3 root 105: static struct bstring videomenu[] = {
106: { "Video settings", 0 },
1.1.1.2 root 107: { "Change _width", 'W' },
108: { "Change _height", 'H' },
1.1.1.3 root 109: { "Change _color mode", 'C' },
110: { "Select predefined _mode", 'M' },
1.1.1.2 root 111: { "Toggle _low resolution", 'L' },
112: { "Change _X centering", 'X' },
1.1.1.3 root 113: { "Change _Y centering", 'Y' },
1.1.1.2 root 114: { "Toggle line _doubling", 'D' },
115: { "Toggle _aspect _correction", 'A' },
116: { "Change _framerate", 'F' },
1.1.1.5 root 117: { "_Graphics card memory", 'P'},
1.1.1.2 root 118: { NULL, -3 }
1.1 root 119: };
120:
1.1.1.3 root 121: static struct bstring memorymenu[] = {
122: { "Memory settings", 0 },
1.1.1.2 root 123: { "Change _fastmem size", 'F' },
124: { "Change _chipmem size", 'C' },
125: { "Change _slowmem size", 'S' },
1.1.1.3 root 126: { "Select ROM _image", 'I' },
1.1.1.2 root 127: { NULL, -3 }
1.1 root 128: };
129:
1.1.1.5 root 130: static struct bstring cpumenu[] = {
131: { "Change _CPU", 'C' },
132: { NULL, -3 }
133: };
134:
1.1.1.3 root 135: static struct bstring soundmenu[] = {
136: { "Sound settings", 0 },
137: { "Change _sound emulation accuracy", 'S' },
138: { "Change m_inimum sound buffer size", 'I' },
139: { "Change m_aximum sound buffer size", 'A' },
140: { "Change number of _bits", 'B' },
141: { "Change output _frequency", 'F' },
1.1.1.5 root 142: { "Change s_tereo", 'T' },
1.1.1.2 root 143: { NULL , -3 }
1.1 root 144: };
145:
1.1.1.3 root 146: static struct bstring miscmenu[] = {
147: { "Miscellaneous settings", 0 },
148: { "Toggle joystick port _0 emulation", '0' },
149: { "Toggle joystick port _1 emulation", '1' },
150: { "Set _CPU emulation speed", 'C' },
1.1.1.2 root 151: { NULL, -3 }
1.1 root 152: };
153:
1.1.1.2 root 154: static struct bstring hdmenu[] = {
1.1.1.3 root 155: /* { "Harddisk/CDROM emulation settings", 0 },*/
156: { "_Add a mounted volume", 'A' },
157: { "Add a mounted _volume r/o", 'V' },
158: { "Add a hard_file", 'F' },
159: { "_Delete a mounted volume", 'D' },
1.1.1.2 root 160: { NULL, -3 }
1.1 root 161: };
162:
1.1.1.4 root 163: static int makemenu (const char **menu, int x, int y)
1.1 root 164: {
165: const char **m = menu;
166: int maxlen = 0, count = 0;
167: int w;
1.1.1.3 root 168:
1.1 root 169: while (*m != NULL) {
1.1.1.4 root 170: int l = strlen (*m);
1.1 root 171: if (l > maxlen)
172: maxlen = l;
173: m++; count++;
174: }
1.1.1.4 root 175: w = tui_dlog (x, y, x + maxlen + 2, y + count + 1);
176: tui_drawbox (w);
177: tui_selwin (w);
1.1 root 178: y = 2;
179: while (*menu != NULL) {
1.1.1.4 root 180: tui_gotoxy (2, y++);
181: tui_puts (*menu++);
1.1 root 182: }
1.1.1.4 root 183: tui_selwin (0);
1.1 root 184: return w;
185: }
186:
187: static char tmpbuf[256];
188:
189: static char *trimfilename(char *s, size_t n)
190: {
191: size_t i;
192: if (n > 250)
193: n = 250;
1.1.1.4 root 194: if (strlen (s) == 0)
195: strcpy (tmpbuf, "none");
196: else if (strlen (s) < n)
197: strcpy (tmpbuf, s);
1.1 root 198: else {
199: tmpbuf[0] = '^';
1.1.1.4 root 200: strcpy (tmpbuf + 1, s + strlen (s) - n + 2);
1.1 root 201: }
202: for (i = strlen(tmpbuf); i < n; i++)
203: tmpbuf[i] = ' ';
204: tmpbuf[i] = 0;
205: return tmpbuf;
206: }
207:
1.1.1.4 root 208: static void print_configuration (void)
1.1 root 209: {
210: char tmp[256];
211: int y = 5;
1.1.1.2 root 212: int i;
1.1 root 213:
1.1.1.4 root 214: tui_clrwin (0);
1.1.1.3 root 215:
1.1.1.4 root 216: tui_drawbox (0);
217: tui_hline (2, 3, tui_cols () - 1);
218: sprintf (tmp, "UAE %d.%d.%d: The Un*x Amiga Emulator", UAEMAJOR, UAEMINOR, UAESUBREV);
219: tui_gotoxy ((tui_cols () - strlen(tmp))/2, 2); tui_puts (tmp);
1.1.1.2 root 220: strcpy(tmp, "Press RETURN/ENTER to run UAE, ESC to exit");
1.1.1.4 root 221: tui_gotoxy ((tui_cols () - strlen(tmp))/2, tui_lines ()); tui_puts (tmp);
1.1.1.2 root 222:
1.1.1.4 root 223: tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF0: %s", trimfilename (currprefs.df[0], tui_cols () - 20)); tui_puts (tmp);
224: tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF1: %s", trimfilename (currprefs.df[1], tui_cols () - 20)); tui_puts (tmp);
225: tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF2: %s", trimfilename (currprefs.df[2], tui_cols () - 20)); tui_puts (tmp);
226: tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF3: %s", trimfilename (currprefs.df[3], tui_cols () - 20)); tui_puts (tmp);
1.1 root 227: y++;
1.1.1.4 root 228: tui_gotoxy (OPTION_COLUMN, y++);
229: sprintf (tmp, "VIDEO: %d:%d%s %s", currprefs.gfx_width, currprefs.gfx_height,
1.1.1.3 root 230: currprefs.gfx_lores ? " (lores)" : "", colormodes[currprefs.color_mode]);
1.1.1.4 root 231: tui_puts (tmp);
1.1 root 232:
1.1.1.4 root 233: tui_gotoxy (OPTION_COLUMN+7, y++);
1.1.1.3 root 234: if (currprefs.gfx_linedbl)
1.1.1.4 root 235: tui_puts ("Doubling lines, ");
1.1.1.3 root 236: if (currprefs.gfx_correct_aspect)
1.1.1.4 root 237: tui_puts ("Aspect corrected");
1.1.1.3 root 238: else
1.1.1.4 root 239: tui_puts ("Not aspect corrected");
240: tui_gotoxy (OPTION_COLUMN+7, y++);
1.1.1.3 root 241: if (currprefs.gfx_xcenter)
1.1.1.2 root 242: tui_puts ("X centered");
1.1.1.3 root 243: if (currprefs.gfx_xcenter == 2)
1.1.1.2 root 244: tui_puts (" (clever)");
1.1.1.3 root 245: if (currprefs.gfx_ycenter && currprefs.gfx_xcenter)
1.1.1.2 root 246: tui_puts (", ");
1.1.1.3 root 247: if (currprefs.gfx_ycenter)
1.1.1.2 root 248: tui_puts ("Y centered ");
1.1.1.3 root 249: if (currprefs.gfx_ycenter == 2)
1.1.1.2 root 250: tui_puts (" (clever)");
1.1.1.4 root 251: tui_gotoxy (OPTION_COLUMN+7, y++);
252: tui_puts ("drawing every ");
1.1.1.7 root 253: switch (currprefs.gfx_framerate) {
1.1 root 254: case 1: break;
1.1.1.4 root 255: case 2: tui_puts ("2nd "); break;
256: case 3: tui_puts ("3rd "); break;
1.1.1.7 root 257: default: sprintf (tmp, "%dth ",currprefs.gfx_framerate); tui_puts (tmp); break;
1.1 root 258: }
1.1.1.4 root 259: tui_puts ("frame. ");
1.1.1.5 root 260:
261: tui_gotoxy (OPTION_COLUMN+7, y++);
262: if (currprefs.gfxmem_size) {
263: sprintf (tmp, "Picasso 96 %d MB", currprefs.gfxmem_size / 0x100000);
264: tui_puts(tmp);
265: } else
266: tui_puts ("Picasso 96 Off");
1.1 root 267: y++;
1.1.1.5 root 268:
269: tui_gotoxy (OPTION_COLUMN, y++);
270: tui_puts ("CPU: ");
271: switch (currprefs.cpu_level) {
272: case 0: tui_puts ("68000"); break;
273: case 1: tui_puts ("68010"); break;
274: case 2: tui_puts ("68020"); break;
275: case 3: tui_puts ("68020/68881"); break;
276: }
277: if (currprefs.address_space_24 && currprefs.cpu_level > 1)
278: tui_puts (" (24 bit addressing)");
279: if (currprefs.cpu_compatible)
280: tui_puts (" (slow but compatible)");
1.1.1.4 root 281: tui_gotoxy (OPTION_COLUMN, y++);
1.1.1.5 root 282: sprintf (tmp, "MEMORY: %4dK chip; %4dK fast; %4dK slow",
283: currprefs.chipmem_size/1024,
284: currprefs.fastmem_size/1024,
285: currprefs.bogomem_size/1024);
1.1.1.4 root 286: tui_puts (tmp);
287:
288: tui_gotoxy (OPTION_COLUMN, y++);
1.1.1.6 root 289: sprintf (tmp, "ROM IMAGE: %s", trimfilename (currprefs.romfile, tui_cols () - 50));
1.1.1.4 root 290: tui_puts (tmp);
291: tui_gotoxy (OPTION_COLUMN, y++);
1.1 root 292: if (!sound_available)
1.1.1.4 root 293: tui_puts ("SOUND: Not available");
1.1 root 294: else {
1.1.1.3 root 295: switch (currprefs.produce_sound) {
1.1.1.4 root 296: case 0: tui_puts ("SOUND: 0 (Off)"); break;
297: case 1: tui_puts ("SOUND: 1 (Off, but emulated)"); break;
298: case 2: tui_puts ("SOUND: 2 (On)"); break;
299: case 3: tui_puts ("SOUND: 3 (On, emulated perfectly)"); break;
1.1 root 300: }
1.1.1.4 root 301: tui_gotoxy (OPTION_COLUMN + 7, y++);
302: sprintf (tmp, "%d bits at %d Hz", currprefs.sound_bits, currprefs.sound_freq);
303: tui_puts (tmp);
304: tui_gotoxy (OPTION_COLUMN + 7, y++);
305: sprintf (tmp, "Minimum buffer size %d bytes, maximum %d bytes", currprefs.sound_minbsiz, currprefs.sound_maxbsiz);
306: tui_puts (tmp);
1.1 root 307: }
308:
1.1.1.4 root 309: tui_gotoxy (OPTION_COLUMN,y++);
1.1.1.3 root 310: tui_puts ("GAME PORT 1: "); tui_puts (gameport_state (0));
1.1.1.4 root 311: tui_gotoxy (OPTION_COLUMN,y++);
1.1.1.3 root 312: tui_puts ("GAME PORT 2: "); tui_puts (gameport_state (1));
1.1 root 313:
1.1.1.2 root 314: for (i = 0;; i++) {
315: char buf[256];
1.1.1.3 root 316:
1.1.1.4 root 317: tui_gotoxy (OPTION_COLUMN+1,y++);
1.1.1.5 root 318: if (sprintf_filesys_unit (currprefs.mountinfo, buf, i) == -1)
1.1.1.2 root 319: break;
1.1.1.4 root 320: tui_puts (buf);
1.1 root 321: }
322: }
323:
1.1.1.4 root 324: static void HDOptions (void)
1.1 root 325: {
326: char *buff;
327: char tmp[256];
1.1.1.3 root 328: char mountvol[256];
329: char mountdir[256];
1.1.1.2 root 330: int c = 0;
1.1 root 331:
332: for (;;){
1.1.1.3 root 333:
1.1 root 334: tui_selwin(0);
335: print_configuration();
1.1.1.2 root 336:
1.1.1.3 root 337: c = tui_menubrowse (hdmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
1.1.1.2 root 338: if (c == -1)
339: break;
1.1.1.4 root 340: else switch (c) {
1.1.1.2 root 341: case 0:
1.1.1.3 root 342: tui_wgets (mountvol, "Enter mounted volume name", 10);
343: if (strlen (mountvol) == 0)
1.1.1.2 root 344: break;
1.1.1.3 root 345: if (mountvol[strlen(mountvol)-1]==':')
1.1.1.2 root 346: mountvol[strlen(mountvol)-1] = 0;
1.1.1.3 root 347: tui_wgets (mountdir, "Enter mounted volume path", 78);
1.1.1.6 root 348: add_filesys_unit (currprefs.mountinfo, mountvol, mountdir, 0, 0, 0, 0, 0);
1.1 root 349: break;
1.1.1.9 root 350: case 1:
1.1.1.3 root 351: tui_wgets (mountvol, "Enter mounted volume name", 10);
352: if (strlen (mountvol) == 0)
1.1.1.2 root 353: break;
1.1.1.4 root 354: if (mountvol[strlen (mountvol)-1]==':')
1.1.1.3 root 355: mountvol[strlen (mountvol)-1] = 0;
356: tui_wgets (mountdir, "Enter mounted volume path", 78);
1.1.1.6 root 357: add_filesys_unit (currprefs.mountinfo, mountvol, mountdir, 1, 0, 0, 0, 0);
1.1.1.2 root 358: break;
1.1.1.9 root 359: case 2:
1.1.1.3 root 360: buff = tui_filereq("*", "", "Select the hardfile to be mounted");
361: if (buff == NULL)
362: break;
363: strcpy (mountvol, buff);
364: tui_wgets (mountdir, "Enter number of sectors per track", 4);
365: tui_wgets (mountdir + 10, "Enter number of heads", 4);
366: tui_wgets (mountdir + 20, "Enter number of reserved blocks", 3);
1.1.1.6 root 367: tui_wgets (mountdir + 30, "Enter block size", 4);
1.1.1.5 root 368: buff = add_filesys_unit (currprefs.mountinfo, 0, mountvol, 1,
1.1.1.3 root 369: atoi (mountdir), atoi (mountdir + 10),
1.1.1.6 root 370: atoi (mountdir + 20), atoi (mountdir + 30));
1.1.1.3 root 371: if (buff)
372: tui_errorbox (buff);
373: break;
1.1.1.9 root 374: case 3:
1.1.1.3 root 375: tui_wgets (mountvol, "Enter number of volume to be removed (0 for UAE0:, etc.)", 2);
1.1.1.5 root 376: if (kill_filesys_unit (currprefs.mountinfo, atoi (mountvol)) == -1)
1.1.1.4 root 377: tui_errorbox ("Volume does not exist");
1.1 root 378: break;
379: }
380: }
381: }
382:
1.1.1.4 root 383: static void DiskOptions (void)
1.1 root 384: {
1.1.1.3 root 385: char tmp[256];
1.1.1.2 root 386: int c = 0;
387:
1.1 root 388: for (;;) {
389: char *sel;
1.1.1.2 root 390:
1.1 root 391: tui_selwin(0);
392: print_configuration();
1.1.1.3 root 393:
1.1.1.4 root 394: c = tui_menubrowse (diskmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
1.1.1.2 root 395: if (c == -1)
1.1 root 396: break;
1.1.1.4 root 397: else switch (c) {
1.1.1.3 root 398: case 0:
399: case 1:
400: case 2:
401: case 3:
1.1.1.4 root 402: sprintf (tmp, "Select a diskfile for DF%d:", c);
1.1.1.3 root 403: sel = tui_filereq("*.adf", currprefs.df[c], tmp);
1.1 root 404: if (sel == NULL)
405: break;
1.1.1.5 root 406: strcpy (currprefs.df[c], sel);
1.1 root 407: break;
408: }
409: }
410: }
411:
1.1.1.4 root 412: static void VideoOptions (void)
1.1 root 413: {
414: char tmp[256];
1.1.1.2 root 415: int c = 0;
1.1 root 416:
1.1.1.3 root 417: for (c = 0; c < 10; c++)
418: if (videomenu[c].val == 'M') {
419: if (video_mode_menu == NULL)
420: videomenu[c].val = -4;
421: break;
422: }
423:
424: c = 0;
1.1 root 425: for (;;) {
426:
427: tui_selwin(0);
428: print_configuration();
1.1.1.3 root 429:
1.1.1.4 root 430: c = tui_menubrowse (videomenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
1.1.1.2 root 431: if (c == -1)
432: break;
1.1.1.4 root 433: else switch (c) {
1.1.1.2 root 434: case 0:
1.1.1.4 root 435: tui_wgets (tmp, "Enter new video mode width", 4);
1.1.1.2 root 436: if (atoi (tmp) < 320 || atoi (tmp) > 1600 /* maybe we'll implement SHires */)
1.1.1.4 root 437: tui_errorbox ("Insane value for video mode width");
1.1.1.2 root 438: else
1.1.1.3 root 439: currprefs.gfx_width = atoi (tmp);
1.1.1.2 root 440: break;
441: case 1:
1.1.1.4 root 442: tui_wgets (tmp, "Enter new video mode height", 4);
1.1.1.2 root 443: if (atoi (tmp) < 200 || atoi (tmp) > 800 /* whatever */)
1.1.1.4 root 444: tui_errorbox ("Insane value for video mode height");
1.1.1.2 root 445: else
1.1.1.3 root 446: currprefs.gfx_height = atoi (tmp);
1.1.1.2 root 447: break;
448: case 2:
1.1.1.3 root 449: currprefs.color_mode++;
450: if (currprefs.color_mode > MAX_COLOR_MODES)
451: currprefs.color_mode=0;
1.1 root 452: break;
1.1.1.2 root 453: case 3:
1.1.1.4 root 454: c = tui_menubrowse (video_mode_menu, 4, 6, 0, 15);
1.1.1.3 root 455: if (c != -1)
456: vidmode_menu_selected(c);
457: c = 3;
1.1.1.2 root 458: break;
459: case 4:
1.1.1.3 root 460: currprefs.gfx_lores = !currprefs.gfx_lores;
1.1.1.2 root 461: break;
462: case 5:
1.1.1.3 root 463: currprefs.gfx_xcenter = (currprefs.gfx_xcenter + 1) % 3;
1.1.1.2 root 464: break;
465: case 6:
1.1.1.3 root 466: currprefs.gfx_ycenter = (currprefs.gfx_ycenter + 1) % 3;
1.1.1.2 root 467: break;
468: case 7:
1.1.1.3 root 469: currprefs.gfx_linedbl = !currprefs.gfx_linedbl;
1.1 root 470: break;
1.1.1.2 root 471: case 8:
1.1.1.3 root 472: currprefs.gfx_correct_aspect = !currprefs.gfx_correct_aspect;
473: break;
474: case 9:
1.1.1.7 root 475: currprefs.gfx_framerate++;
476: if (currprefs.gfx_framerate > 9)
477: currprefs.gfx_framerate=1;
1.1 root 478: break;
1.1.1.5 root 479: case 10:
480: currprefs.gfxmem_size += 0x100000;
481: if (currprefs.gfxmem_size > 0x800000)
482: currprefs.gfxmem_size = 0;
483: break;
1.1 root 484: }
485: }
486: }
487:
1.1.1.4 root 488: static void MemoryOptions (void)
1.1 root 489: {
1.1.1.3 root 490: char *tmp;
1.1.1.2 root 491: int c = 0;
1.1 root 492: for (;;) {
493:
494: tui_selwin(0);
1.1.1.4 root 495: print_configuration ();
1.1 root 496:
1.1.1.4 root 497: c = tui_menubrowse (memorymenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
1.1.1.2 root 498: if (c == -1)
1.1 root 499: break;
1.1.1.4 root 500: else switch (c) {
1.1.1.2 root 501: case 0:
1.1.1.5 root 502: if (currprefs.fastmem_size == 0)
503: currprefs.fastmem_size = 0x200000;
504: else if (currprefs.fastmem_size == 0x800000)
505: currprefs.fastmem_size = 0;
1.1 root 506: else
1.1.1.5 root 507: currprefs.fastmem_size <<= 1;
1.1 root 508: break;
1.1.1.2 root 509: case 1:
1.1.1.5 root 510: if (currprefs.chipmem_size == 0x800000)
511: currprefs.chipmem_size = 0x80000;
1.1 root 512: else
1.1.1.5 root 513: currprefs.chipmem_size <<= 1;
514: if (currprefs.chipmem_size > 0x200000)
515: currprefs.fastmem_size = 0;
1.1.1.3 root 516: break;
1.1.1.2 root 517: case 2:
1.1.1.5 root 518: if (currprefs.bogomem_size == 0)
519: currprefs.bogomem_size = 0x40000;
520: else if (currprefs.bogomem_size == 0x100000)
521: currprefs.bogomem_size = 0;
1.1 root 522: else
1.1.1.5 root 523: currprefs.bogomem_size <<= 1;
1.1 root 524: break;
1.1.1.3 root 525: case 3:
1.1.1.6 root 526: tmp = tui_filereq ("*.rom", currprefs.romfile, "Select a ROM image");
1.1.1.3 root 527: if (tmp != NULL)
1.1.1.6 root 528: strcpy (currprefs.romfile, tmp);
1.1.1.5 root 529: break;
530: }
531: }
532: }
533:
534: static void CPUOptions (void)
535: {
536: char *tmp;
537: int c = 0;
538: for (;;) {
539: tui_selwin(0);
540: print_configuration ();
541:
542: c = tui_menubrowse (cpumenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
543: if (c == -1)
544: break;
545: else switch (c) {
546: case 0:
547: currprefs.cpu_level++;
548: if (currprefs.cpu_level > 3)
549: currprefs.cpu_level = 0;
550: /* Default to 32 bit addressing when switching from a 68000/68010 to a 32 bit CPU */
551: if (currprefs.cpu_level == 2)
552: currprefs.address_space_24 = 0;
553: if (currprefs.cpu_level != 0)
554: currprefs.cpu_compatible = 0;
1.1.1.3 root 555: break;
556: }
1.1 root 557: }
558: }
559:
1.1.1.4 root 560: static void SoundOptions (void)
1.1 root 561: {
1.1.1.3 root 562: char tmp[256];
1.1.1.2 root 563: int c = 0;
1.1 root 564: for (;;) {
565: tui_selwin(0);
1.1.1.4 root 566: print_configuration ();
567: c = tui_menubrowse (soundmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
1.1.1.2 root 568: if (c == -1)
1.1 root 569: break;
1.1.1.4 root 570: else switch (c) {
1.1.1.2 root 571: case 0:
1.1.1.3 root 572: currprefs.produce_sound++;
1.1.1.4 root 573: if (currprefs.produce_sound > 3)
1.1.1.3 root 574: currprefs.produce_sound = 0;
575: break;
576:
577: case 1:
1.1.1.4 root 578: tui_wgets (tmp, "Enter new minimum sound buffer size in bytes", 6);
1.1.1.3 root 579: if (atoi (tmp) < 128 || atoi (tmp) > 65536 || atoi (tmp) > currprefs.sound_maxbsiz)
1.1.1.4 root 580: tui_errorbox ("Insane value for minimum sound buffer size");
1.1.1.3 root 581: else
582: currprefs.sound_minbsiz = atoi (tmp);
583: break;
584:
585: case 2:
1.1.1.4 root 586: tui_wgets (tmp, "Enter new maximum sound buffer size in bytes", 6);
1.1.1.3 root 587: if (atoi (tmp) < 128 || atoi (tmp) > 65536 || atoi (tmp) < currprefs.sound_minbsiz)
1.1.1.4 root 588: tui_errorbox ("Insane value for maximum sound buffer size");
1.1.1.3 root 589: else
590: currprefs.sound_maxbsiz = atoi (tmp);
591: break;
592:
593: case 3:
1.1.1.4 root 594: tui_wgets (tmp, "Enter new number of bits", 3);
1.1.1.3 root 595: if (atoi (tmp)!= 8 && atoi (tmp) != 16)
1.1.1.4 root 596: tui_errorbox ("Unsupported number of bits");
1.1.1.3 root 597: else
598: currprefs.sound_bits = atoi (tmp);
599: break;
600:
601: case 4:
1.1.1.4 root 602: tui_wgets (tmp, "Enter new sound output frequency", 6);
1.1.1.3 root 603: if (atoi (tmp) < 11025 || atoi (tmp) > 44100)
1.1.1.4 root 604: tui_errorbox ("Unsupported frequency");
1.1.1.3 root 605: else
606: currprefs.sound_freq = atoi (tmp);
1.1 root 607: break;
1.1.1.5 root 608: case 5:
1.1.1.8 root 609: currprefs.stereo = (currprefs.stereo + 1) % 3;
1.1.1.5 root 610: break;
1.1.1.3 root 611: }
1.1 root 612: }
613: }
614:
1.1.1.4 root 615: static void OtherOptions (void)
1.1 root 616: {
1.1.1.3 root 617: char tmp[256];
1.1.1.2 root 618: int c = 0;
1.1 root 619:
620: for (;;) {
1.1.1.3 root 621: tui_selwin (0);
622: print_configuration ();
623: c = tui_menubrowse (miscmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
1.1.1.2 root 624: if (c == -1) {
1.1 root 625: break;
1.1.1.4 root 626: } else switch (c) {
1.1.1.2 root 627: case 0:
1.1.1.6 root 628: currprefs.jport0 = (currprefs.jport0 + 1) % 6;
629: if (currprefs.jport0 == currprefs.jport1)
630: currprefs.jport1 = (currprefs.jport1 + 5) % 6;
1.1.1.3 root 631: break;
1.1.1.2 root 632: case 1:
1.1.1.6 root 633: currprefs.jport1 = (currprefs.jport1 + 1) % 6;
634: if (currprefs.jport0 == currprefs.jport1)
635: currprefs.jport0 = (currprefs.jport0 + 5) % 6;
1.1.1.3 root 636: break;
637: case 2:
1.1.1.4 root 638: tui_wgets (tmp, "Enter new CPU emulation speed", 6);
1.1.1.3 root 639: if (atoi (tmp) < 1 || atoi (tmp) > 20)
1.1.1.4 root 640: tui_errorbox ("Unsupported CPU emulation speed");
1.1.1.3 root 641: else
642: currprefs.m68k_speed = atoi (tmp);
1.1 root 643: break;
644: }
645: }
646: }
647:
1.1.1.4 root 648: static int do_gui (int mode)
1.1 root 649: {
650: char cwd[1024];
1.1.1.2 root 651:
1.1.1.4 root 652: if (getcwd (cwd, 1024) == NULL)
1.1 root 653: return 0;
654:
1.1.1.4 root 655: tui_setup ();
1.1.1.3 root 656:
1.1 root 657: for (;;) {
658: int c;
1.1.1.3 root 659:
1.1.1.4 root 660: tui_selwin (0);
661: print_configuration ();
662: c = tui_menubrowse (mode == 0 ? mainmenu2 : mainmenu, MENU_COL_OFFSET, 4, 0, MAX_MENU_HEIGHT);
1.1.1.2 root 663: if (c == -1) {
1.1.1.4 root 664: tui_shutdown ();
1.1.1.2 root 665: return -2;
1.1.1.3 root 666: }
667: if (mode == 1) {
1.1.1.5 root 668: if (c == 8)
1.1.1.3 root 669: break;
670: switch (c) {
671: case 0: DiskOptions (); break;
672: case 1: VideoOptions (); break;
673: case 2: MemoryOptions (); break;
1.1.1.5 root 674: case 3: CPUOptions (); break;
675: case 4: HDOptions (); break;
676: case 5: SoundOptions (); break;
677: case 6: OtherOptions (); break;
678: case 7: save_settings (); break;
1.1.1.3 root 679: }
680: } else {
681: if (c == 5)
682: break;
683: switch (c) {
684: case 0: DiskOptions (); break;
685: case 1: OtherOptions (); break;
686: case 2: save_settings (); break;
687: case 3: uae_reset (); break;
688: case 4: uae_quit (); break;
689: }
1.1 root 690: }
691: }
1.1.1.4 root 692: tui_shutdown ();
1.1.1.3 root 693:
1.1 root 694: chdir (cwd);
695: return 0;
696: }
1.1.1.2 root 697:
1.1.1.4 root 698: int gui_init (void)
1.1.1.2 root 699: {
1.1.1.4 root 700: return do_gui (1);
1.1.1.2 root 701: }
702:
1.1.1.4 root 703: void gui_changesettings (void)
1.1.1.3 root 704: {
705: struct uae_prefs oldprefs;
706: oldprefs = currprefs;
707:
708: if (do_gui(0) == -2)
709: uae_quit ();
710: else {
711: changed_prefs = currprefs;
712: currprefs = oldprefs;
1.1.1.6 root 713: currprefs.jport0 = changed_prefs.jport0;
714: currprefs.jport1 = changed_prefs.jport1;
1.1.1.3 root 715: joystick_setting_changed ();
716: }
717: }
718:
1.1.1.4 root 719: int gui_update (void)
1.1.1.2 root 720: {
1.1.1.3 root 721: return 0;
1.1.1.2 root 722: }
1.1.1.11! root 723:
! 724: void gui_lock (void)
! 725: {
! 726: }
! 727:
! 728: void gui_unlock (void)
! 729: {
! 730: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.