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