--- uae/src/tui.c 2018/04/24 16:40:05 1.1.1.3 +++ uae/src/tui.c 2018/04/24 16:42:12 1.1.1.4 @@ -32,16 +32,16 @@ int mountok=0; -void gui_led(int led, int on) +void gui_led (int led, int on) { } -void gui_filename(int num, const char *name) +void gui_filename (int num, const char *name) { } -static void getline(char *p) +static void getline (char *p) { } -void gui_handle_events(void) +void gui_handle_events (void) { } @@ -51,7 +51,7 @@ static void save_settings (void) tui_backup_optionsfile (); f = fopen (optionsfile, "w"); if (f == NULL) { - fprintf(stderr, "Error saving options file!\n"); + fprintf (stderr, "Error saving options file!\n"); return; } save_options (f); @@ -151,27 +151,27 @@ static struct bstring hdmenu[] = { { NULL, -3 } }; -static int makemenu(const char **menu, int x, int y) +static int makemenu (const char **menu, int x, int y) { const char **m = menu; int maxlen = 0, count = 0; int w; while (*m != NULL) { - int l = strlen(*m); + int l = strlen (*m); if (l > maxlen) maxlen = l; m++; count++; } - w = tui_dlog(x, y, x + maxlen + 2, y + count + 1); - tui_drawbox(w); - tui_selwin(w); + w = tui_dlog (x, y, x + maxlen + 2, y + count + 1); + tui_drawbox (w); + tui_selwin (w); y = 2; while (*menu != NULL) { - tui_gotoxy(2, y++); - tui_puts(*menu++); + tui_gotoxy (2, y++); + tui_puts (*menu++); } - tui_selwin(0); + tui_selwin (0); return w; } @@ -182,13 +182,13 @@ static char *trimfilename(char *s, size_ size_t i; if (n > 250) n = 250; - if (strlen(s) == 0) - strcpy(tmpbuf, "none"); - else if (strlen(s) < n) - strcpy(tmpbuf, s); + if (strlen (s) == 0) + strcpy (tmpbuf, "none"); + else if (strlen (s) < n) + strcpy (tmpbuf, s); else { tmpbuf[0] = '^'; - strcpy(tmpbuf + 1, s + strlen(s) - n + 2); + strcpy (tmpbuf + 1, s + strlen (s) - n + 2); } for (i = strlen(tmpbuf); i < n; i++) tmpbuf[i] = ' '; @@ -196,39 +196,39 @@ static char *trimfilename(char *s, size_ return tmpbuf; } -static void print_configuration(void) +static void print_configuration (void) { char tmp[256]; int y = 5; int i; - tui_clrwin(0); + tui_clrwin (0); - tui_drawbox(0); - tui_hline(2, 3, tui_cols() - 1); - sprintf(tmp, "UAE %d.%d.%d: The Un*x Amiga Emulator", UAEMAJOR, UAEMINOR, UAEURSAMINOR); - tui_gotoxy((tui_cols() - strlen(tmp))/2, 2); tui_puts(tmp); + tui_drawbox (0); + tui_hline (2, 3, tui_cols () - 1); + sprintf (tmp, "UAE %d.%d.%d: The Un*x Amiga Emulator", UAEMAJOR, UAEMINOR, UAESUBREV); + tui_gotoxy ((tui_cols () - strlen(tmp))/2, 2); tui_puts (tmp); strcpy(tmp, "Press RETURN/ENTER to run UAE, ESC to exit"); - tui_gotoxy((tui_cols() - strlen(tmp))/2, tui_lines()); tui_puts(tmp); + tui_gotoxy ((tui_cols () - strlen(tmp))/2, tui_lines ()); tui_puts (tmp); - tui_gotoxy(OPTION_COLUMN, y++); sprintf(tmp, "Disk file DF0: %s", trimfilename(currprefs.df[0], tui_cols() - 20)); tui_puts(tmp); - tui_gotoxy(OPTION_COLUMN, y++); sprintf(tmp, "Disk file DF1: %s", trimfilename(currprefs.df[1], tui_cols() - 20)); tui_puts(tmp); - tui_gotoxy(OPTION_COLUMN, y++); sprintf(tmp, "Disk file DF2: %s", trimfilename(currprefs.df[2], tui_cols() - 20)); tui_puts(tmp); - tui_gotoxy(OPTION_COLUMN, y++); sprintf(tmp, "Disk file DF3: %s", trimfilename(currprefs.df[3], tui_cols() - 20)); tui_puts(tmp); + tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF0: %s", trimfilename (currprefs.df[0], tui_cols () - 20)); tui_puts (tmp); + tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF1: %s", trimfilename (currprefs.df[1], tui_cols () - 20)); tui_puts (tmp); + tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF2: %s", trimfilename (currprefs.df[2], tui_cols () - 20)); tui_puts (tmp); + tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF3: %s", trimfilename (currprefs.df[3], tui_cols () - 20)); tui_puts (tmp); y++; - tui_gotoxy(OPTION_COLUMN, y++); - sprintf(tmp, "VIDEO: %d:%d%s %s", currprefs.gfx_width, currprefs.gfx_height, + tui_gotoxy (OPTION_COLUMN, y++); + sprintf (tmp, "VIDEO: %d:%d%s %s", currprefs.gfx_width, currprefs.gfx_height, currprefs.gfx_lores ? " (lores)" : "", colormodes[currprefs.color_mode]); - tui_puts(tmp); + tui_puts (tmp); - tui_gotoxy(OPTION_COLUMN+7, y++); + tui_gotoxy (OPTION_COLUMN+7, y++); if (currprefs.gfx_linedbl) - tui_puts("Doubling lines, "); + tui_puts ("Doubling lines, "); if (currprefs.gfx_correct_aspect) - tui_puts("Aspect corrected"); + tui_puts ("Aspect corrected"); else - tui_puts("Not aspect corrected"); - tui_gotoxy(OPTION_COLUMN+7, y++); + tui_puts ("Not aspect corrected"); + tui_gotoxy (OPTION_COLUMN+7, y++); if (currprefs.gfx_xcenter) tui_puts ("X centered"); if (currprefs.gfx_xcenter == 2) @@ -239,61 +239,61 @@ static void print_configuration(void) tui_puts ("Y centered "); if (currprefs.gfx_ycenter == 2) tui_puts (" (clever)"); - tui_gotoxy(OPTION_COLUMN+7, y++); - tui_puts("drawing every "); - switch(currprefs.framerate) { + tui_gotoxy (OPTION_COLUMN+7, y++); + tui_puts ("drawing every "); + switch (currprefs.framerate) { case 1: break; - case 2: tui_puts("2nd "); break; - case 3: tui_puts("3rd "); break; - default: sprintf(tmp, "%dth ",currprefs.framerate); tui_puts(tmp); break; + case 2: tui_puts ("2nd "); break; + case 3: tui_puts ("3rd "); break; + default: sprintf (tmp, "%dth ",currprefs.framerate); tui_puts (tmp); break; } - tui_puts("frame. "); + tui_puts ("frame. "); y++; - tui_gotoxy(OPTION_COLUMN, y++); - sprintf(tmp, "MEMORY: %4dK chip; %4dK fast; %4dK slow",chipmem_size/1024,fastmem_size/1024,bogomem_size/1024); - tui_puts(tmp); - - tui_gotoxy(OPTION_COLUMN, y++); - sprintf(tmp, "ROM IMAGE: %s", trimfilename(romfile, tui_cols() - 50)); - tui_puts(tmp); - tui_gotoxy(OPTION_COLUMN, y++); + tui_gotoxy (OPTION_COLUMN, y++); + sprintf (tmp, "MEMORY: %4dK chip; %4dK fast; %4dK slow",chipmem_size/1024,fastmem_size/1024,bogomem_size/1024); + tui_puts (tmp); + + tui_gotoxy (OPTION_COLUMN, y++); + sprintf (tmp, "ROM IMAGE: %s", trimfilename(romfile, tui_cols () - 50)); + tui_puts (tmp); + tui_gotoxy (OPTION_COLUMN, y++); if (!sound_available) - tui_puts("SOUND: Not available"); + tui_puts ("SOUND: Not available"); else { switch (currprefs.produce_sound) { - case 0: tui_puts("SOUND: 0 (Off)"); break; - case 1: tui_puts("SOUND: 1 (Off, but emulated)"); break; - case 2: tui_puts("SOUND: 2 (On)"); break; - case 3: tui_puts("SOUND: 3 (On, emulated perfectly)"); break; + case 0: tui_puts ("SOUND: 0 (Off)"); break; + case 1: tui_puts ("SOUND: 1 (Off, but emulated)"); break; + case 2: tui_puts ("SOUND: 2 (On)"); break; + case 3: tui_puts ("SOUND: 3 (On, emulated perfectly)"); break; } - tui_gotoxy(OPTION_COLUMN + 7, y++); - sprintf(tmp, "%d bits at %d Hz", currprefs.sound_bits, currprefs.sound_freq); - tui_puts(tmp); - tui_gotoxy(OPTION_COLUMN + 7, y++); - sprintf(tmp, "Minimum buffer size %d bytes, maximum %d bytes", currprefs.sound_minbsiz, currprefs.sound_maxbsiz); - tui_puts(tmp); + tui_gotoxy (OPTION_COLUMN + 7, y++); + sprintf (tmp, "%d bits at %d Hz", currprefs.sound_bits, currprefs.sound_freq); + tui_puts (tmp); + tui_gotoxy (OPTION_COLUMN + 7, y++); + sprintf (tmp, "Minimum buffer size %d bytes, maximum %d bytes", currprefs.sound_minbsiz, currprefs.sound_maxbsiz); + tui_puts (tmp); } - tui_gotoxy(OPTION_COLUMN,y++); + tui_gotoxy (OPTION_COLUMN,y++); tui_puts ("GAME PORT 1: "); tui_puts (gameport_state (0)); - tui_gotoxy(OPTION_COLUMN,y++); + tui_gotoxy (OPTION_COLUMN,y++); tui_puts ("GAME PORT 2: "); tui_puts (gameport_state (1)); - tui_gotoxy(OPTION_COLUMN,y++); - sprintf(tmp, "HARDDISK: (%s)", currprefs.automount_uaedev ? "enabled" : "disabled"); - tui_puts(tmp); + tui_gotoxy (OPTION_COLUMN,y++); + sprintf (tmp, "HARDDISK: (%s)", currprefs.automount_uaedev ? "enabled" : "disabled"); + tui_puts (tmp); for (i = 0;; i++) { char buf[256]; - tui_gotoxy(OPTION_COLUMN+1,y++); + tui_gotoxy (OPTION_COLUMN+1,y++); if (sprintf_filesys_unit(buf, i) == -1) break; - tui_puts(buf); + tui_puts (buf); } } -static void HDOptions(void) +static void HDOptions (void) { char *buff; char tmp[256]; @@ -309,7 +309,7 @@ static void HDOptions(void) c = tui_menubrowse (hdmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); if (c == -1) break; - else switch(c) { + else switch (c) { case 0: currprefs.automount_uaedev = !currprefs.automount_uaedev; break; @@ -326,7 +326,7 @@ static void HDOptions(void) tui_wgets (mountvol, "Enter mounted volume name", 10); if (strlen (mountvol) == 0) break; - if(mountvol[strlen (mountvol)-1]==':') + if (mountvol[strlen (mountvol)-1]==':') mountvol[strlen (mountvol)-1] = 0; tui_wgets (mountdir, "Enter mounted volume path", 78); add_filesys_unit (mountvol, mountdir, 1, 0, 0, 0); @@ -348,13 +348,13 @@ static void HDOptions(void) case 4: tui_wgets (mountvol, "Enter number of volume to be removed (0 for UAE0:, etc.)", 2); if (kill_filesys_unit (atoi (mountvol)) == -1) - tui_errorbox("Volume does not exist"); + tui_errorbox ("Volume does not exist"); break; } } } -static void DiskOptions(void) +static void DiskOptions (void) { char tmp[256]; int c = 0; @@ -365,15 +365,15 @@ static void DiskOptions(void) tui_selwin(0); print_configuration(); - c = tui_menubrowse(diskmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); + c = tui_menubrowse (diskmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); if (c == -1) break; - else switch(c) { + else switch (c) { case 0: case 1: case 2: case 3: - sprintf(tmp, "Select a diskfile for DF%d:", c); + sprintf (tmp, "Select a diskfile for DF%d:", c); sel = tui_filereq("*.adf", currprefs.df[c], tmp); if (sel == NULL) break; @@ -383,7 +383,7 @@ static void DiskOptions(void) } } -static void VideoOptions(void) +static void VideoOptions (void) { char tmp[256]; int c = 0; @@ -401,21 +401,21 @@ static void VideoOptions(void) tui_selwin(0); print_configuration(); - c = tui_menubrowse(videomenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); + c = tui_menubrowse (videomenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); if (c == -1) break; - else switch(c) { + else switch (c) { case 0: - tui_wgets(tmp, "Enter new video mode width", 4); + tui_wgets (tmp, "Enter new video mode width", 4); if (atoi (tmp) < 320 || atoi (tmp) > 1600 /* maybe we'll implement SHires */) - tui_errorbox("Insane value for video mode width"); + tui_errorbox ("Insane value for video mode width"); else currprefs.gfx_width = atoi (tmp); break; case 1: - tui_wgets(tmp, "Enter new video mode height", 4); + tui_wgets (tmp, "Enter new video mode height", 4); if (atoi (tmp) < 200 || atoi (tmp) > 800 /* whatever */) - tui_errorbox("Insane value for video mode height"); + tui_errorbox ("Insane value for video mode height"); else currprefs.gfx_height = atoi (tmp); break; @@ -425,7 +425,7 @@ static void VideoOptions(void) currprefs.color_mode=0; break; case 3: - c = tui_menubrowse(video_mode_menu, 4, 6, 0, 15); + c = tui_menubrowse (video_mode_menu, 4, 6, 0, 15); if (c != -1) vidmode_menu_selected(c); c = 3; @@ -454,19 +454,19 @@ static void VideoOptions(void) } } -static void MemoryOptions(void) +static void MemoryOptions (void) { char *tmp; int c = 0; for (;;) { tui_selwin(0); - print_configuration(); + print_configuration (); - c = tui_menubrowse(memorymenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); + c = tui_menubrowse (memorymenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); if (c == -1) break; - else switch(c) { + else switch (c) { case 0: if (fastmem_size == 0) fastmem_size = 0x200000; @@ -500,51 +500,51 @@ static void MemoryOptions(void) } } -static void SoundOptions(void) +static void SoundOptions (void) { char tmp[256]; int c = 0; for (;;) { tui_selwin(0); - print_configuration(); - c = tui_menubrowse(soundmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); + print_configuration (); + c = tui_menubrowse (soundmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); if (c == -1) break; - else switch(c) { + else switch (c) { case 0: currprefs.produce_sound++; - if(currprefs.produce_sound > 3) + if (currprefs.produce_sound > 3) currprefs.produce_sound = 0; break; case 1: - tui_wgets(tmp, "Enter new minimum sound buffer size in bytes", 6); + tui_wgets (tmp, "Enter new minimum sound buffer size in bytes", 6); if (atoi (tmp) < 128 || atoi (tmp) > 65536 || atoi (tmp) > currprefs.sound_maxbsiz) - tui_errorbox("Insane value for minimum sound buffer size"); + tui_errorbox ("Insane value for minimum sound buffer size"); else currprefs.sound_minbsiz = atoi (tmp); break; case 2: - tui_wgets(tmp, "Enter new maximum sound buffer size in bytes", 6); + tui_wgets (tmp, "Enter new maximum sound buffer size in bytes", 6); if (atoi (tmp) < 128 || atoi (tmp) > 65536 || atoi (tmp) < currprefs.sound_minbsiz) - tui_errorbox("Insane value for maximum sound buffer size"); + tui_errorbox ("Insane value for maximum sound buffer size"); else currprefs.sound_maxbsiz = atoi (tmp); break; case 3: - tui_wgets(tmp, "Enter new number of bits", 3); + tui_wgets (tmp, "Enter new number of bits", 3); if (atoi (tmp)!= 8 && atoi (tmp) != 16) - tui_errorbox("Unsupported number of bits"); + tui_errorbox ("Unsupported number of bits"); else currprefs.sound_bits = atoi (tmp); break; case 4: - tui_wgets(tmp, "Enter new sound output frequency", 6); + tui_wgets (tmp, "Enter new sound output frequency", 6); if (atoi (tmp) < 11025 || atoi (tmp) > 44100) - tui_errorbox("Unsupported frequency"); + tui_errorbox ("Unsupported frequency"); else currprefs.sound_freq = atoi (tmp); break; @@ -552,7 +552,7 @@ static void SoundOptions(void) } } -static void OtherOptions(void) +static void OtherOptions (void) { char tmp[256]; int c = 0; @@ -563,7 +563,7 @@ static void OtherOptions(void) c = tui_menubrowse (miscmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT); if (c == -1) { break; - } else switch(c) { + } else switch (c) { case 0: currprefs.fake_joystick = (currprefs.fake_joystick & 0xFF00) + ((currprefs.fake_joystick & 255) + 1) % 6; if ((currprefs.fake_joystick & 255) == (currprefs.fake_joystick >> 8)) @@ -575,9 +575,9 @@ static void OtherOptions(void) currprefs.fake_joystick = (currprefs.fake_joystick & 0xFF00) + ((currprefs.fake_joystick & 255) - 1) % 6; break; case 2: - tui_wgets(tmp, "Enter new CPU emulation speed", 6); + tui_wgets (tmp, "Enter new CPU emulation speed", 6); if (atoi (tmp) < 1 || atoi (tmp) > 20) - tui_errorbox("Unsupported CPU emulation speed"); + tui_errorbox ("Unsupported CPU emulation speed"); else currprefs.m68k_speed = atoi (tmp); break; @@ -585,23 +585,23 @@ static void OtherOptions(void) } } -static int do_gui(int mode) +static int do_gui (int mode) { char cwd[1024]; - if (getcwd(cwd, 1024) == NULL) + if (getcwd (cwd, 1024) == NULL) return 0; - tui_setup(); + tui_setup (); for (;;) { int c; - tui_selwin(0); - print_configuration(); - c = tui_menubrowse(mode == 0 ? mainmenu2 : mainmenu, MENU_COL_OFFSET, 4, 0, MAX_MENU_HEIGHT); + tui_selwin (0); + print_configuration (); + c = tui_menubrowse (mode == 0 ? mainmenu2 : mainmenu, MENU_COL_OFFSET, 4, 0, MAX_MENU_HEIGHT); if (c == -1) { - tui_shutdown(); + tui_shutdown (); return -2; } if (mode == 1) { @@ -628,18 +628,18 @@ static int do_gui(int mode) } } } - tui_shutdown(); + tui_shutdown (); chdir (cwd); return 0; } -int gui_init(void) +int gui_init (void) { - return do_gui(1); + return do_gui (1); } -void gui_changesettings(void) +void gui_changesettings (void) { struct uae_prefs oldprefs; oldprefs = currprefs; @@ -654,7 +654,7 @@ void gui_changesettings(void) } } -int gui_update(void) +int gui_update (void) { return 0; }