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