Exemplo n.º 1
0
int c64dtvui_init(void)
{
    tui_menu_t ui_ioextensions_submenu;

    ui_create_main_menu(1, 1, 1, 2, 1, drivec64dtv_settings_submenu);

    tui_menu_add_separator(ui_special_submenu);

    uic64dtvmodel_init(ui_special_submenu);

    uic64dtv_init(ui_special_submenu);
    tui_menu_add_separator(ui_special_submenu);

    ui_ioextensions_submenu = tui_menu_create("I/O extensions", 1);
    tui_menu_add(ui_ioextensions_submenu, ioextenstions_menu_items);
    tui_menu_add_submenu(ui_special_submenu, "_I/O extensions...",
                         "Configure I/O extensions",
                         ui_ioextensions_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    tui_menu_add_separator(ui_video_submenu);

    uivideo_init(ui_video_submenu, VID_VICII, VID_NONE);

    tui_menu_add(ui_sound_submenu, siddtv_ui_menu_items);
    tui_menu_add(ui_rom_submenu, rom_menu_items);

    return 0;
}
Exemplo n.º 2
0
static void create_special_submenu(int has_serial_traps)
{
    create_speed_limit_submenu();

    tui_menu_add_item(ui_special_submenu, "Enable _Warp Mode:",
                      "Make the emulator run as fast as possible skipping lots of frames",
                      toggle_WarpMode_callback,
                      NULL, 3,
                      TUI_MENU_BEH_CONTINUE);

    tui_menu_add_separator(ui_special_submenu);
    uiperipherial_init(ui_special_submenu);
    uiprinter_init(ui_special_submenu);

    if (has_serial_traps)
        tui_menu_add_item(ui_special_submenu, "Enable virtual device _traps:",
                          "Enable virtual device traps for fast tape and drive emulation",
                          toggle_VirtualDevices_callback,
                          NULL, 4,
                          TUI_MENU_BEH_CONTINUE);

    tui_menu_add_item(ui_special_submenu, "_Change Working Directory...",
                      "Change the current working directory",
                      change_workdir_callback,
                      NULL, 0,
                      TUI_MENU_BEH_CONTINUE);

    tui_menu_add_separator(ui_special_submenu);
    tui_menu_add_item(ui_special_submenu,
                      "Use _Keyboard LEDs:",
                      "Use PC keyboard LEDs for the disk drive and Warp Mode",
                      toggle_UseLeds_callback,
                      NULL, 4,
                      TUI_MENU_BEH_CONTINUE);
    tui_menu_add_item(ui_special_submenu,
                      "Show Status_bar:",
                      "Statusbar to display Speed, Tape and Drive properties; toggle with ALT-F5",
                      toggle_ShowStatusbar_callback,
                      NULL, 10,
                      TUI_MENU_BEH_CONTINUE);
}
Exemplo n.º 3
0
int petui_init(void)
{
    tui_menu_t ui_ioextensions_submenu;

    ui_create_main_menu(1, 1, 0, 2, 1);

    tui_menu_add_separator(ui_video_submenu);

    uivideo_init(ui_video_submenu, VID_CRTC, VID_NONE);

    tui_menu_add_separator(ui_special_submenu);
    tui_menu_add(ui_special_submenu, special_menu_items);

    uipetmodel_init(ui_special_submenu);

    ui_ioextensions_submenu = tui_menu_create("I/O extensions", 1);
    tui_menu_add_submenu(ui_special_submenu, "_I/O extensions",
                         "Configure I/O extensions",
                         ui_ioextensions_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    tui_menu_add(ui_rom_submenu, rom_menu_items);

    uipetdww_init(ui_ioextensions_submenu);

    uipethre`_init(ui_ioextensions_submenu);

    uipetreu_init(ui_ioextensions_submenu);

    uisidcart_init(ui_ioextensions_submenu, "$8F00", "$E900", "PET");

    tui_menu_add_item(ui_ioextensions_submenu, "Enable Userport DAC",
                      "Enable Userport DAC",
                      toggle_UserportDAC_callback,
                      NULL, 3,
                      TUI_MENU_BEH_CONTINUE);

    return 0;
}
Exemplo n.º 4
0
int cbm5x0ui_init(void)
{
    ui_create_main_menu(0, 1, 0, 0, 1);

    tui_menu_add_separator(ui_video_submenu);
    tui_menu_add(ui_sound_submenu, sid_cbm2_ui_menu_items);

    uivideo_init(ui_video_submenu, VID_VICII, VID_NONE);

    uicbm5x0model_init(ui_special_submenu);
    uiciamodel_single_init(ui_special_submenu);

    tui_menu_add(ui_rom_submenu, rom_menu_items);

    return 0;
}
Exemplo n.º 5
0
static void create_speed_limit_submenu(void)
{
    int i;
    int speed[4] = { 100, 50, 20, 10 };
    char *s1, *s2;
    static tui_menu_t speed_submenu;

    ui_special_submenu = tui_menu_create("Other Settings", 1);

    speed_submenu = tui_menu_create("Speed Limit", 1);
    for (i = 0; i < 4; i++) {
        if (speed[i] == 100) {
            s1 = lib_msprintf("Limit speed to the one of the real %s", machine_name);
        } else {
            s1 = lib_msprintf("Limit speed to %d%% of the real %s", speed[i], machine_name);
        }
        s2 = lib_msprintf("_%d%%", speed[i]);
        tui_menu_add_item(speed_submenu, s2,
                          s1,
                          speed_callback,
                          (void *)speed[i], 5,
                          TUI_MENU_BEH_CLOSE);
        lib_free(s1);
        lib_free(s2);
    }
    tui_menu_add_item(speed_submenu, "_No Limit",
                      "Run the emulator as fast as possible",
                      speed_callback,
                      (void *)0, 5,
                      TUI_MENU_BEH_CLOSE);
    tui_menu_add_separator(speed_submenu);
    tui_menu_add_item(speed_submenu, "_Custom...",
                      "Specify a custom relative speed value",
                       speed_callback,
                       (void *)-1, 5,
                       TUI_MENU_BEH_CLOSE);

    tui_menu_add_submenu(ui_special_submenu, "_Speed Limit:",
                         "Specify a custom speed limit",
                         speed_submenu, speed_submenu_callback,
                         NULL, 5);
}
Exemplo n.º 6
0
int c64ui_init(void)
{
    tui_menu_t ui_ioextensions_submenu;

    ui_create_main_menu(1, 1, 1, 2, 1);

    tui_menu_add_separator(ui_special_submenu);

    ui_ioextensions_submenu = tui_menu_create("I/O extensions", 1);
    tui_menu_add(ui_ioextensions_submenu, ioextenstions_menu_items);

    if (machine_class == VICE_MACHINE_C64SC) {
        uic64model_init(ui_special_submenu);
    }

    tui_menu_add_submenu(ui_special_submenu, "_I/O extensions...",
                         "Configure I/O extensions",
                         ui_ioextensions_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    uic64cart_init(NULL);
    tui_menu_add_separator(ui_video_submenu);

    uivideo_init(ui_video_submenu, VID_VICII, VID_NONE);

    tui_menu_add(ui_sound_submenu, sid_c64_ui_menu_items);
    tui_menu_add(ui_rom_submenu, rom_menu_items);

    uiburstmod_init(ui_ioextensions_submenu);

    uilightpen_init(ui_ioextensions_submenu);

    uireu_init(ui_ioextensions_submenu);

    uigeoram_c64_init(ui_ioextensions_submenu);

    uiramcart_init(ui_ioextensions_submenu);

    uiide64_init(ui_ioextensions_submenu);

    uidqbb_init(ui_ioextensions_submenu);

    uiisepic_init(ui_ioextensions_submenu);

    uiexpert_init(ui_ioextensions_submenu);

    uiplus60k_init(ui_ioextensions_submenu);

    uiplus256k_init(ui_ioextensions_submenu);

    uic64_256k_init(ui_ioextensions_submenu);

    uimmc64_init(ui_ioextensions_submenu);

    uimmcreplay_init(ui_ioextensions_submenu);

    uidigimax_c64_init(ui_ioextensions_submenu);

    uids12c887rtc_c64_init(ui_ioextensions_submenu);

    uimagicvoice_init(ui_ioextensions_submenu);

#ifdef HAVE_TFE
    uitfe_c64_init(ui_ioextensions_submenu);
#endif

    uieasyflash_init(ui_ioextensions_submenu);

    uisoundexpander_c64_init(ui_ioextensions_submenu);

    tui_menu_add_item(ui_ioextensions_submenu, "Enable SFX Sound Sampler",
                      "Enable SFX Sound Sampler",
                      toggle_SFXSoundSampler_callback,
                      NULL, 3,
                      TUI_MENU_BEH_CONTINUE);

    tui_menu_add_item(ui_ioextensions_submenu, "Enable Userport RTC",
                      "Enable Userport RTC",
                      toggle_UserportRTC_callback,
                      NULL, 3,
                      TUI_MENU_BEH_CONTINUE);

    return 0;
}
Exemplo n.º 7
0
void uivideo_init(struct tui_menu *parent_submenu, int vid1, int vid2)
{
    tui_menu_t video_submenu1;
    tui_menu_t video_submenu2;
    tui_menu_t render_submenu;
    tui_menu_t crt_emulation_submenu;
    tui_menu_t colors_submenu;

    if (vid2 != VID_NONE) {
        video_submenu1 = tui_menu_create(video_item[vid1].settings_name, 1);
        video_submenu2 = tui_menu_create(video_item[vid2].settings_name, 1);
    } else {
        video_submenu1 = parent_submenu;
    }

    tui_menu_add_item(video_submenu1, "Video cache",
                      "Enable video cache",
                      toggle_cache_callback,
                      (void *)vid1, 3,
                      TUI_MENU_BEH_CONTINUE);

    tui_menu_add_item(video_submenu1, "Double size",
                      "Enable double size",
                      toggle_doublesize_callback,
                      (void *)vid1, 3,
                      TUI_MENU_BEH_CONTINUE);

    if (vid2 != VID_NONE) {
        tui_menu_add_item(video_submenu2, "Double size",
                          "Enable double size",
                          toggle_doublesize_callback,
                          (void *)vid2, 3,
                          TUI_MENU_BEH_CONTINUE);
    }

    tui_menu_add_item(video_submenu1, "Double scan",
                      "Enable double scan",
                      toggle_doublescan_callback,
                      (void *)vid1, 3,
                      TUI_MENU_BEH_CONTINUE);

    if (vid2 != VID_NONE) {
        tui_menu_add_item(video_submenu2, "Double scan",
                          "Enable double scan",
                          toggle_doublesize_callback,
                          (void *)vid2, 3,
                          TUI_MENU_BEH_CONTINUE);
    }

    tui_menu_add_separator(video_submenu1);

    if (vid2 != VID_NONE) {
        tui_menu_add_separator(video_submenu2);
    }

    if (video_item[vid1].chip_menu != NULL) {
        tui_menu_add(video_submenu1, video_item[vid1].chip_menu);
        if (machine_class != VICE_MACHINE_C64SC && video_item[vid1].has_video_standard == 1) {
            tui_menu_add(video_submenu1, video_standard_menu_items);
        }
        tui_menu_add_separator(video_submenu1);
    }

    if (vid2 != VID_NONE) {
        if (video_item[vid2].chip_menu != NULL) {
            tui_menu_add(video_submenu2, video_item[vid2].chip_menu);
            tui_menu_add_separator(video_submenu2);
        }
    }

    tui_menu_add_item(video_submenu1, "External palette",
                      "Use external palette file",
                      toggle_external_palette_callback,
                      (void *)video_item[vid1].ext_pal_res, 3,
                      TUI_MENU_BEH_CONTINUE);

    tui_menu_add_item(video_submenu1, "Choose external palette",
                      "Load a custom palette",
                      custom_palette_callback,
                      (void *)video_item[vid1].ext_pal_file_res, 0,
                      TUI_MENU_BEH_RESUME);

    if (vid2 != VID_NONE) {
        tui_menu_add_item(video_submenu2, "External palette",
                          "Use external palette file",
                          toggle_external_palette_callback,
                          (void *)video_item[vid2].ext_pal_res, 3,
                          TUI_MENU_BEH_CONTINUE);

        tui_menu_add_item(video_submenu2, "Choose external palette",
                          "Load a custom palette",
                          custom_palette_callback,
                          (void *)video_item[vid2].ext_pal_file_res, 0,
                          TUI_MENU_BEH_RESUME);
    }

    if (vid2 != VID_NONE) {
        tui_menu_add_submenu(parent_submenu, video_item[vid1].settings_name,
                         video_item[vid1].settings_title,
                         video_submenu1,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

        tui_menu_add_submenu(parent_submenu, video_item[vid2].settings_name,
                         video_item[vid2].settings_title,
                         video_submenu2,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);
    }

    render_submenu = tui_menu_create("Render filter", 1);

    tui_menu_add_item(render_submenu, "None",
                      "No render filter",
                      radio_renderfilter_callback,
                      (void *)((vid1 << 4) | 0), 3,
                      TUI_MENU_BEH_CONTINUE);

    tui_menu_add_item(render_submenu, "CRT emulation",
                      "CRT emulation",
                      radio_renderfilter_callback,
                      (void *)((vid1 << 4) | 1), 3,
                      TUI_MENU_BEH_CONTINUE);

    if (video_item[vid1].scale2x_res != NULL) {
        tui_menu_add_item(render_submenu, "Scale2x",
                          "CRT emulation",
                          radio_renderfilter_callback,
                          (void *)((vid1 << 4) | 2), 3,
                          TUI_MENU_BEH_CONTINUE);
    }

    tui_menu_add_submenu(parent_submenu, "Render filter",
                         "Render filter",
                         render_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    crt_emulation_submenu = tui_menu_create("CRT emulation", 1);
    tui_menu_add(crt_emulation_submenu, ui_crt_emulation_items);
    tui_menu_add_submenu(parent_submenu, "CRT emulation",
                         "CRT emulation",
                         crt_emulation_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    colors_submenu = tui_menu_create("Colors", 1);
    tui_menu_add(colors_submenu, ui_color_items);
    tui_menu_add_submenu(parent_submenu, "Colors",
                         "Colors",
                         colors_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);
}
Exemplo n.º 8
0
void ui_create_main_menu(int has_tape, int has_drive, int has_serial_traps, int number_joysticks, int has_datasette)
{
    /* Main menu. */
    ui_main_menu = tui_menu_create(NULL, 1);

    ui_attach_submenu = tui_menu_create("Attach Images", 1);
    tui_menu_add(ui_attach_submenu, ui_attach_menu_def);

    if (has_tape) {
        tui_menu_add_separator(ui_attach_submenu);
        tui_menu_add_item(ui_attach_submenu, "_Tape:",
                          "Attach tape image for cassette player (device #1)",
                          attach_tape_callback,
                          NULL, 30,
                          TUI_MENU_BEH_CONTINUE);
        tui_menu_add_item(ui_attach_submenu, "Autostart Ta_pe",
                          "Reset the emulator and run the first program on the tape image",
                          autostart_callback,
                          (void *)1, 0,
                          TUI_MENU_BEH_RESUME);
    }

    ui_detach_submenu = tui_menu_create("Detach Images", 1);
    tui_menu_add_item(ui_detach_submenu, "Drive #_8:",
                      "Remove disk from disk drive #8",
                      detach_disk_callback,
                      (void *)8, 30,
                      TUI_MENU_BEH_CONTINUE);
    tui_menu_add_item(ui_detach_submenu,"Drive #_9:",
                      "Remove disk from disk drive #9",
                      detach_disk_callback,
                      (void *)9, 30,
                      TUI_MENU_BEH_CONTINUE);
    tui_menu_add_item(ui_detach_submenu, "Drive #1_0:",
                      "Remove disk from disk drive #10",
                      detach_disk_callback,
                      (void *)10, 30,
                      TUI_MENU_BEH_CONTINUE);
    tui_menu_add_item(ui_detach_submenu, "Drive #1_1:",
                      "Remove disk from disk drive #11",
                      detach_disk_callback,
                      (void *)11, 30,
                      TUI_MENU_BEH_CONTINUE);

    if (has_tape) {
        tui_menu_add_separator(ui_detach_submenu);
        tui_menu_add_item(ui_detach_submenu, "_Tape:",
                          "Remove tape from cassette player (device #1)",
                          detach_tape_callback,
                          NULL, 30,
                          TUI_MENU_BEH_CONTINUE);
    }

    tui_menu_add_submenu(ui_main_menu, "_Attach Image...",
                         "Insert virtual disks, tapes or cartridges in the emulated machine",
                         ui_attach_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);
    tui_menu_add_submenu(ui_main_menu, "_Detach Image...",
                         "Remove virtual disks, tapes or cartridges from the emulated machine",
                         ui_detach_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    if (has_datasette) {
        ui_datasette_submenu = tui_menu_create("Datassette control", 1);
        tui_menu_add_item(ui_datasette_submenu, "S_top",
                          "Press the STOP key of the datassette",
                          datasette_callback,
                          (void *)DATASETTE_CONTROL_STOP, 0,
                          TUI_MENU_BEH_RESUME);
        tui_menu_add_item(ui_datasette_submenu, "_Start",
                          "Press the START key of the datassette",
                          datasette_callback,
                          (void *)DATASETTE_CONTROL_START, 0,
                          TUI_MENU_BEH_RESUME);
        tui_menu_add_item(ui_datasette_submenu, "_Forward",
                          "Press the FORWARD key of the datassette",
                          datasette_callback,
                          (void *)DATASETTE_CONTROL_FORWARD, 0,
                          TUI_MENU_BEH_RESUME);
        tui_menu_add_item(ui_datasette_submenu, "_Rewind",
                          "Press the REWIND key of the datassette",
                          datasette_callback,
                          (void *)DATASETTE_CONTROL_REWIND, 0,
                          TUI_MENU_BEH_RESUME);
        tui_menu_add_item(ui_datasette_submenu, "Re_cord",
                          "Press the RECORD key of the datassette",
                          datasette_callback,
                          (void *)DATASETTE_CONTROL_RECORD, 0,
                          TUI_MENU_BEH_RESUME);
        tui_menu_add_item(ui_datasette_submenu, "R_eset",
                          "Rewind the tape and stop the datasette",
                          datasette_callback,
                          (void *)DATASETTE_CONTROL_RESET, 0,
                          TUI_MENU_BEH_RESUME);
        tui_menu_add_item(ui_datasette_submenu, "Reset C_ounter",
                          "Set the datasette counter to '000'",
                          datasette_callback,
                          (void *)DATASETTE_CONTROL_RESET_COUNTER, 0,
                          TUI_MENU_BEH_RESUME);

        tui_menu_add_submenu(ui_main_menu, "Datassett_e Control...",
                             "Press some buttons on the emulated datassette",
                             ui_datasette_submenu,
                             NULL, 0,
                             TUI_MENU_BEH_CONTINUE);
    }

    tui_menu_add_separator(ui_main_menu);

    create_ui_video_submenu();
    tui_menu_add_submenu(ui_main_menu, "_Video Settings...",
                         "Screen parameters",
                         ui_video_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    if (has_drive) {
        uidrive_init(ui_main_menu);
    }

    if (has_datasette) {
        ui_datasette_settings_submenu = tui_menu_create("Datasette Settings", 1);
        tui_menu_add(ui_datasette_settings_submenu,datasette_settings_submenu);
        tui_menu_add_submenu(ui_main_menu, "Da_tasette Settings...",
                             "Datasette settings",
                             ui_datasette_settings_submenu,
                             NULL, 0,
                             TUI_MENU_BEH_CONTINUE);
    }

    uisound_init(ui_main_menu);

    uijoystick_init(ui_main_menu);

    ui_rom_submenu = tui_menu_create("Firmware ROM Settings", 1);
    tui_menu_add(ui_rom_submenu, rom_submenu);
    tui_menu_add_submenu(ui_main_menu, "Firm_ware ROM Settings...",
                         "Firmware ROMs the emulator is using",
                         ui_rom_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    create_special_submenu(has_serial_traps);

    tui_menu_add_submenu(ui_main_menu, "_Other Settings...",
                         "Extra emulation features",
                         ui_special_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    tui_menu_add_separator(ui_main_menu);

    ui_snapshot_submenu = tui_menu_create("Freeze Commands", 1);
    tui_menu_add(ui_snapshot_submenu, ui_snapshot_menu_def);

    tui_menu_add_submenu(ui_main_menu, "_Freeze Commands...",
                         "Commands for loading/saving the machine state",
                         ui_snapshot_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

#ifdef HAVE_NETWORK
    ui_netplay_submenu = tui_menu_create("Netplay Commands", 1);
    tui_menu_add(ui_netplay_submenu, ui_netplay_menu_def);

    tui_menu_add_submenu(ui_main_menu, "_Netplay Commands...",
                         "Commands for netplay between computers",
                         ui_netplay_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);
#endif

    tui_menu_add_separator(ui_main_menu);

    ui_settings_submenu = tui_menu_create("Configuration Commands", 1);

    tui_menu_add_item(ui_settings_submenu, "_Write Configuration",
                      "Save current settings as default for next session",
                      save_settings_callback,
                      NULL, 0,
                      TUI_MENU_BEH_CLOSE);
    tui_menu_add_item(ui_settings_submenu, "_Load Configuration",
                      "Load saved settings from previous session",
                      load_settings_callback,
                      NULL, 0,
                      TUI_MENU_BEH_CLOSE);
    tui_menu_add_item(ui_settings_submenu, "Restore _Factory Defaults",
                      "Set default settings",
                      restore_default_settings_callback,
                      NULL, 0,
                      TUI_MENU_BEH_CLOSE);

    tui_menu_add_submenu(ui_main_menu, "_Configuration Commands...",
                         "Commands to save, retrieve and restore settings",
                         ui_settings_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);

    tui_menu_add_separator(ui_main_menu);

    tui_menu_add_item(ui_main_menu, "_Monitor",
                      "Enter the built-in machine language monitor",
                      monitor_callback,
                      NULL, 0,
                      TUI_MENU_BEH_RESUME);

    ui_reset_submenu = tui_menu_create("Reset?", 1);
    tui_menu_add(ui_reset_submenu, reset_submenu);
    tui_menu_add_submenu(ui_main_menu, "_Reset ",
                         "Reset the machine",
                         ui_reset_submenu,
                         NULL, NULL, 0);

    ui_quit_submenu = tui_menu_create("Quit", 1);
    tui_menu_add(ui_quit_submenu, quit_submenu);
    tui_menu_add_submenu(ui_main_menu, "_Quit",
                         "Quit emulator",
                         ui_quit_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);
    tui_menu_add_separator(ui_main_menu);

    ui_info_submenu = tui_menu_create("Info", 1);
    tui_menu_add(ui_info_submenu, info_submenu);
    tui_menu_add_submenu(ui_main_menu, "VICE _Info...",
                         "VICE is Free Software distributed under the GNU General Public License!",
                         ui_info_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);
}
Exemplo n.º 9
0
/* This is a bit of a hack, but I prefer this way instead of writing 1,000
   menu entries...  */
static void create_ui_video_submenu(void)
{
    static tui_menu_t refresh_rate_submenu, vga_mode_submenu;
    int i;

    refresh_rate_submenu = tui_menu_create("Refresh", 1);

    for (i = 1; i <= 10; i++) {
        char *label, *desc;
        if (i != 10) {
            label = lib_msprintf("1/_%d", i);
        } else {
            label = lib_stralloc("1/1_0");
        }
        if (i == 1) {
            desc = lib_msprintf("Set refresh rate to 1/%d (update every frame)", i);
        } else {
            desc = lib_msprintf("Set refresh rate to 1/%d (update once every %d frames)", i, i);
        }
        tui_menu_add_item(refresh_rate_submenu, label,
                          desc,
                          radio_RefreshRate_callback,
                          (void *)i, 0,
                          TUI_MENU_BEH_CLOSE);
        lib_free(label);
        lib_free(desc);
    }

    tui_menu_add_separator(refresh_rate_submenu);
    tui_menu_add_item(refresh_rate_submenu, "_Automatic",
                      "Let the emulator select an appropriate refresh rate automagically",
                      radio_RefreshRate_callback,
                      NULL, 0,
                      TUI_MENU_BEH_CLOSE);

    vga_mode_submenu = tui_menu_create("VGA Resolution", 1);

    for (i = 0; i < NUM_VGA_MODES; i++) {
        char *s1, *s2;

        /* FIXME: hotkeys work only for less than 11 elements. */
        s1 = lib_msprintf("Mode %s%d: %s",(i<10?" _":""), i, vga_modes[i].description);
        s2 = lib_msprintf("Set VGA resolution to %s", vga_modes[i].description);
        tui_menu_add_item(vga_mode_submenu, s1,
                          s2,
                          radio_VGAMode_callback,
                          (void *)i, 0,
                          TUI_MENU_BEH_CLOSE);
        lib_free(s1);
        lib_free(s2);
    }

    ui_video_submenu = tui_menu_create("Video Settings", 1);

    tui_menu_add_submenu(ui_video_submenu, "_VGA Resolution:",
                         "Choose screen resolution for video emulation",
                         vga_mode_submenu,
                         resolution_submenu_callback,
                         NULL, 15);

    tui_menu_add_submenu(ui_video_submenu, "_Refresh Rate:",
                         "Choose frequency of screen refresh",
                         refresh_rate_submenu,
                         refresh_rate_submenu_callback,
                         NULL, 4);

#ifndef USE_MIDAS_SOUND
    tui_menu_add_item(ui_video_submenu, "_Triple Buffering:",
                      "Enable triple buffering for smoother animations (when available)",
                      toggle_TripleBuffering_callback,
                      NULL, 3,
                      TUI_MENU_BEH_CONTINUE);
#endif

    tui_menu_add_separator(ui_video_submenu);

    ui_screenshot_submenu = tui_menu_create("Screenshot Commands", 1);
    tui_menu_add(ui_screenshot_submenu, ui_screenshot_menu_def);

    tui_menu_add_submenu(ui_video_submenu, "_Screenshot Commands...",
                         "Commands for saving screenshots",
                         ui_screenshot_submenu,
                         NULL, 0,
                         TUI_MENU_BEH_CONTINUE);
}