Ejemplo n.º 1
0
static UI_CALLBACK(toggle_DelayLoopEmulation)
{
    int delayloopemulation;

    resources_get_int("PALEmulation", &delayloopemulation);

    if (!CHECK_MENUS) {
        resources_set_int("PALEmulation", !delayloopemulation);
        ui_update_menus();
    } else {
        ui_menu_set_tick(w, delayloopemulation);
    }
}
Ejemplo n.º 2
0
static void init_rambanks_dialog(HWND hwnd)
{
    int res_value;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, rambanks_dialog_trans);

    /* adjust the size of the elements in the datasette_sub_group */
    uilib_adjust_group_width(hwnd, rambanks_group);

    resources_get_int("C128FullBanks", &res_value);
    CheckDlgButton(hwnd, IDC_C128_FULL_BANKS, res_value ? BST_CHECKED : BST_UNCHECKED);
}
Ejemplo n.º 3
0
static TUI_MENU_CALLBACK(digimax_base_submenu_callback)
{
    int value;
    static char s[100];

    resources_get_int("DIGIMAXbase", &value);
    if (value == 0xdd00) {
        sprintf(s, "Userport");
    } else {
        sprintf(s, "$%X", value);
    }
    return s;
}
Ejemplo n.º 4
0
static void video_resources_update_ui(video_canvas_t *canvas)
{
	int pal_enabled = 0;
	int ui_doublescan_enabled;

	if (canvas->videoconfig->cap->palemulation_allowed)
		resources_get_int("PALEmulation", &pal_enabled);

	if (canvas->videoconfig->double_size_enabled != 0)
		ui_doublescan_enabled = 1;
	else
		ui_doublescan_enabled = 0;
}
Ejemplo n.º 5
0
/* unused ? */
static UI_CALLBACK(set_joystick_device)
{
    vsync_suspend_speed_eval();
    if (!CHECK_MENUS) {
        resources_set_int("JoyDevice1", vice_ptr_to_int(UI_MENU_CB_PARAM));
        ui_update_menus();
    } else {
        int tmp;

        resources_get_int("JoyDevice1", &tmp);
        ui_menu_set_tick(w, tmp == vice_ptr_to_int(UI_MENU_CB_PARAM));
    }
}
Ejemplo n.º 6
0
static TUI_MENU_CALLBACK(speed_submenu_callback)
{
    static char s[1024];
    int value;

    resources_get_int("Speed", &value);
    if (value) {
        sprintf(s, "%d%%", value);
        return s;
    } else {
        return "None";
    }
}
Ejemplo n.º 7
0
static const char *cbm2_get_keyboard_name(void)
{
    int idx;

    if (resources_get_int("KeymapIndex", &idx) != 0) {
        idx = 0;
    }
    if ((idx & 2) == 0) {
        return CBM2keyBusinessName;
    }

    return CBM2keyGraphicName;
}
Ejemplo n.º 8
0
/* return pixel aspect ratio for current video mode
 * based on http://codebase64.com/doku.php?id=base:pixel_aspect_ratio
 */
static float ted_get_pixel_aspect(void)
{
    int video;
    resources_get_int("MachineVideoStandard", &video);
    switch (video) {
        case MACHINE_SYNC_PAL:
            return 1.03743478f;
        case MACHINE_SYNC_NTSC:
            return 0.85760931f;
        default:
            return 1.0f;
    }
}
Ejemplo n.º 9
0
static void init_autostart_dialog(HWND hwnd)
{
    HWND temp_hwnd;
    int res_value;
    const char *autostartfile;
    TCHAR *st_autostartfile;
    int xsize, ysize;
    int xsize2;
    RECT rect;

    uilib_localize_dialog(hwnd, autostart_dialog);
    uilib_get_group_extent(hwnd, autostart_leftgroup1, &xsize, &ysize);
    uilib_adjust_group_width(hwnd, autostart_leftgroup1);
    uilib_move_and_adjust_group_width(hwnd, autostart_rightgroup1, xsize + 30);
    uilib_get_group_extent(hwnd, autostart_leftgroup2, &xsize2, &ysize);
    uilib_adjust_group_width(hwnd, autostart_leftgroup2);
    uilib_move_group(hwnd, autostart_rightgroup2, xsize2 + 30);

    /* get the max x of the rightgroup3 elements */
    uilib_get_group_max_x(hwnd, autostart_rightgroup3, &xsize);

    /* resize the text fill-in box */
    uilib_move_and_set_element_width(hwnd, IDC_AUTOSTART_DISK_IMAGE_FILE, 9, xsize - 9);

    /* set the width of the dialog to 'surround' all the elements */
    GetWindowRect(hwnd, &rect);
    MoveWindow(hwnd, rect.left, rect.top, xsize + 20, rect.bottom - rect.top, TRUE);

    /* recenter the buttons in the newly resized dialog window */
    uilib_center_buttons(hwnd, move_buttons_group, 0);

    resources_get_int("AutostartWarp", &res_value);
    CheckDlgButton(hwnd, IDC_AUTOSTART_WARP, res_value ? BST_CHECKED : BST_UNCHECKED);

    resources_get_int("AutostartRunWithColon", &res_value);
    CheckDlgButton(hwnd, IDC_AUTOSTART_USE_COLON_WITH_RUN, res_value ? BST_CHECKED : BST_UNCHECKED);
    
    resources_get_int("AutostartBasicLoad", &res_value);
    CheckDlgButton(hwnd, IDC_AUTOSTART_LOAD_TO_BASIC, res_value ? BST_CHECKED : BST_UNCHECKED);

    resources_get_int("AutostartDelayRandom", &res_value);
    CheckDlgButton(hwnd, IDC_AUTOSTART_RANDOM_DELAY, res_value ? BST_CHECKED : BST_UNCHECKED);

    resources_get_int("AutostartHandleTrueDriveEmulation", &res_value);
    CheckDlgButton(hwnd, IDC_AUTOSTART_HANDLE_TRUE_DRIVE_EMULATION, res_value ? BST_CHECKED : BST_UNCHECKED);

    temp_hwnd = GetDlgItem(hwnd, IDC_AUTOSTART_PRG_MODE);
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_VIRTUAL_FS));
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_INJECT));
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_DISK));
    resources_get_int("AutostartPrgMode", &res_value);
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);

    resources_get_string("AutostartPrgDiskImage", &autostartfile);
    st_autostartfile = system_mbstowcs_alloc(autostartfile);
    SetDlgItemText(hwnd, IDC_AUTOSTART_DISK_IMAGE_FILE, autostartfile != NULL ? st_autostartfile : TEXT(""));
    system_mbstowcs_free(st_autostartfile);
}
Ejemplo n.º 10
0
/* this is partially modeled after the radio_* callbacks */
static UI_CALLBACK(set_KeyboardType)
{
    int current_value, new_value = 2 * vice_ptr_to_int(UI_MENU_CB_PARAM);

    resources_get_int("KeymapIndex", &current_value);
    if (!CHECK_MENUS) {
        if ((current_value & ~1) != new_value) {
            resources_set_int("KeymapIndex", (current_value & 1) + new_value);
            ui_update_menus();
        }
    } else {
        ui_menu_set_tick(w, (current_value & ~1) == new_value);
    }
}
Ejemplo n.º 11
0
void c64ui_draw_resid_string(unsigned char *screen, int menu_x, int menu_y)
{
  int sidengine;

  resources_get_int("SidEngine", &sidengine);
  if(sidengine)
  {
    draw_ascii_string(screen, display_width, menu_x, menu_y, "ReSID", menu_fg, menu_bg);
  }
  else
  {
    draw_ascii_string(screen, display_width, menu_x, menu_y, "FastSID", menu_fg, menu_bg);
  }
}
Ejemplo n.º 12
0
static int set_border_mode(int val, void *param)
{
    int sync;

    if (resources_get_int("MachineVideoStandard", &sync) < 0) {
        sync = MACHINE_SYNC_PAL;
    }

    if (vicii_resources.border_mode != val) {
        vicii_resources.border_mode = val;
        machine_change_timing(sync ^ VICII_BORDER_MODE(vicii_resources.border_mode));
    }
    return 0;
}
Ejemplo n.º 13
0
void petui_set_menu_params(int index, menu_draw_t *menu_draw)
{
    static int old_keymap = -1;
    int cols, keymap;

    resources_get_int("VideoSize", &cols);

    menu_draw->max_text_x = cols ? cols : 40;
    menu_draw->extra_x = 32;
    menu_draw->extra_y = (cols == 40) ? 40 : 28;

    resources_get_int("KeymapIndex", &keymap);

    keymap &= 2;
    if (keymap != old_keymap) {
        if (keymap) {
            sdl_vkbd_set_vkbd(&vkbd_pet_gr);
        } else {
            sdl_vkbd_set_vkbd(&vkbd_pet_uk);
        }
        old_keymap = keymap;
    }
}
Ejemplo n.º 14
0
static void init_speed_dialog(HWND hwnd)
{
    int res_value;
    char *speedstr;
    TCHAR *st_speedstr;

    resources_get_int("Speed", &res_value);

    speedstr = lib_msprintf("%i", res_value);
    st_speedstr = system_mbstowcs_alloc(speedstr);
    SetDlgItemText(hwnd, IDC_CUSTOM_SPEED, st_speedstr);
    system_mbstowcs_free(st_speedstr);
    lib_free(speedstr);
}
Ejemplo n.º 15
0
static TUI_MENU_CALLBACK(refresh_rate_submenu_callback)
{
    int v;
    static char s[256];

    resources_get_int("RefreshRate", &v);

    if (v == 0) {
        return "Auto";
    } else {
        sprintf(s, "1/%d", v);
        return s;
    }
}
Ejemplo n.º 16
0
static TUI_MENU_CALLBACK(sid_engine_model_submenu_callback)
{
    char *s;
    int temp;
    int value;

    resources_get_int("SidModel", &temp);
    resources_get_int("SidEngine", &value);
    value <<= 8;
    value |= temp;
    switch (value) {
        case SID_FASTSID_6581:
            s = "6581 (Fast SID)";
            break;
        case SID_FASTSID_8580:
            s = "8580 (Fast SID)";
            break;
#ifdef HAVE_PARSID
        case SID_PARSID_PORT1:
            s = "ParSID in Port 1";
            break;
        case SID_PARSID_PORT2:
            s = "ParSID in Port 2";
            break;
        case SID_PARSID_PORT3:
            s = "ParSID in Port 3";
            break;
#endif
        case SID_CATWEASELMKIII:
            s = "Catweasel";
            break;
        case SID_HARDSID:
            s = "HardSID";
            break;
    }
    return s;
}
Ejemplo n.º 17
0
static UI_CALLBACK(set_custom_refresh_rate)
{
    static char input_string[32];
    char *msg_string;
    ui_button_t button;
    int i;
    int current_refresh_rate;

    resources_get_int("RefreshRate", &current_refresh_rate);

    if (!*input_string) {
        sprintf(input_string, "%d", current_refresh_rate);
    }

    if (CHECK_MENUS) {
        if (current_refresh_rate < 0 || current_refresh_rate > 10) {
            ui_menu_set_tick(w, 1);
        } else {
            ui_menu_set_tick(w, 0);
        }
    } else {
        int current_speed;

        vsync_suspend_speed_eval();
        msg_string = lib_stralloc(_("Enter refresh rate"));
        button = ui_input_string(_("Refresh rate"), msg_string, input_string, 32);
        lib_free(msg_string);
        if (button == UI_BUTTON_OK) {
            i = atoi(input_string);
            resources_get_int("Speed", &current_speed);
            if (!(current_speed <= 0 && i <= 0) && i >= 0 && current_refresh_rate != i) {
                resources_set_int("RefreshRate", i);
                ui_update_menus();
            }
        }
    }
}
Ejemplo n.º 18
0
static int mem_write_rom_snapshot_module(snapshot_t *s)
{
    snapshot_module_t *m;
    int trapfl;

    /* Main memory module.  */

    m = snapshot_module_create(s, snap_rom_module_name,
                               SNAP_ROM_MAJOR, SNAP_ROM_MINOR);
    if (m == NULL)
        return -1;

    /* disable traps before saving the ROM */
    resources_get_int("VirtualDevices", &trapfl);
    resources_set_int("VirtualDevices", 0);

    if (0
        || SMW_BA(m, c128memrom_kernal_rom,  C128_KERNAL_ROM_SIZE) < 0
        || SMW_BA(m, c128memrom_basic_rom, C128_BASIC_ROM_SIZE) < 0
        || SMW_BA(m, c128memrom_basic_rom + C128_BASIC_ROM_SIZE,
        C128_EDITOR_ROM_SIZE) < 0
        || SMW_BA(m, mem_chargen_rom, C128_CHARGEN_ROM_SIZE) < 0)
        goto fail;

    /* FIXME: save cartridge ROM (& RAM?) areas:
       first write out the configuration, i.e.
       - type of cartridge (banking scheme type)
       - state of cartridge (active/which bank, ...)
       then the ROM/RAM arrays:
       - cartridge ROM areas
       - cartridge RAM areas
    */

    /* enable traps again when necessary */
    resources_set_int("VirtualDevices", trapfl);

    if (snapshot_module_close(m) < 0)
        goto fail;

    return 0;

 fail:
    /* enable traps again when necessary */
    resources_set_int("VirtualDevices", trapfl);

    if (m != NULL)
        snapshot_module_close(m);
    return -1;
}
Ejemplo n.º 19
0
static void init_soundexpander_dialog(HWND hwnd)
{
    HWND temp_hwnd;
    int res_value;
    int xsize, ysize;

    uilib_localize_dialog(hwnd, soundexpander_dialog);

    if (machine_class == VICE_MACHINE_VIC20) {
        uilib_localize_dialog(hwnd, soundexpander_mascuerade_dialog);
    }

    uilib_get_group_extent(hwnd, soundexpander_leftgroup, &xsize, &ysize);
    uilib_adjust_group_width(hwnd, soundexpander_left_total_group);
    uilib_move_group(hwnd, soundexpander_rightgroup, xsize + 30);

    resources_get_int("SFXSoundExpander", &res_value);
    CheckDlgButton(hwnd, IDC_SFX_SOUNDEXPANDER_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED);
    
    if (machine_class == VICE_MACHINE_VIC20) {
        resources_get_int("SFXSoundExpanderIOSwap", &res_value);
        CheckDlgButton(hwnd, IDC_SFX_SOUNDEXPANDER_IO_SWAP, res_value ? BST_CHECKED : BST_UNCHECKED);
    }

    temp_hwnd = GetDlgItem(hwnd, IDC_SFX_SOUNDEXPANDER_TYPE);

    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"3526");
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"3812");
    resources_get_int("SFXSoundExpanderChip", &res_value);
    if (res_value == 3526) {
        SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)0, 0);
    } else {
        SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)1, 0);
    }
    enable_soundexpander_controls(hwnd);
}
Ejemplo n.º 20
0
void _ui_menu_toggle_helper(Widget w, ui_callback_data_t client_data, ui_callback_data_t call_data, const char *resource_name)
{
    int current_value;

    if (resources_get_int(resource_name, &current_value) < 0) {
        return;
    }

    if (!call_data) {
        resources_set_int(resource_name, !current_value);
        ui_update_menus();
    } else {
        ui_menu_set_tick(w, current_value);
    }
}
Ejemplo n.º 21
0
void _ui_menu_radio_helper(Widget w, ui_callback_data_t client_data, ui_callback_data_t call_data, const char *resource_name)
{
    int current_value;

    resources_get_int(resource_name, &current_value);

    if (!call_data) {
        if (current_value != vice_ptr_to_int(client_data)) {
            resources_set_int(resource_name, vice_ptr_to_int(client_data));
            ui_update_menus();
        }
    } else {
        ui_menu_set_tick(w, current_value == vice_ptr_to_int(client_data));
    }
}
Ejemplo n.º 22
0
void SwitchToWindowedMode(HWND hwnd)
{
    int alwaysontop;

    if (!ui_setup_finished)
        return;

    if (video_dx9_enabled()) {
        SwitchToWindowedModeDx9(hwnd);
    } else {
        SwitchToWindowedModeDDraw(hwnd);
    }
    resources_get_int("AlwaysOnTop", &alwaysontop);
    ui_set_alwaysontop(alwaysontop);
}
Ejemplo n.º 23
0
void video_resources_check_win32_newpal(void)
{
    int pal_enabled = 0;
    int pal_mode = 0;

    resources_get_int("PALEmulation", &pal_enabled);

    if (pal_enabled)
        resources_get_int("PALMode", &pal_mode);

    if (video_current_canvas==NULL)
      return;

    if (video_current_canvas->videoconfig==NULL)
      return;

    if (pal_enabled != 0 && pal_mode == 2 &&
        video_current_canvas->videoconfig->fullscreen_enabled == 0 &&
        video_current_canvas->videoconfig->doublescan != 0 &&
        video_current_canvas->videoconfig->double_size_enabled != 0)
    {
        ui_message("This combination has a performance problem\nplease switch to old PAL emulation");
    }
}
Ejemplo n.º 24
0
/* FIXME: handle gamma for CRT emulation (CGA and Monochrom video) too */
static float video_get_gamma(video_resources_t *video_resources)
{
    int video;
    float mgam, vgam;

    resources_get_int("MachineVideoStandard", &video);
    if ((video == MACHINE_SYNC_PAL) || (video == MACHINE_SYNC_PALN)) {
        vgam = 2.8f;
    } else {
        vgam = 2.2f;
    }

    mgam = ((float)(video_resources->color_gamma)) / 1000.0f;
    return mgam / vgam;
}
Ejemplo n.º 25
0
static void init_device_7_dialog(HWND hwnd)
{
    int res_value;

    /* translate the iec dialog item(s) */
    uilib_localize_dialog(hwnd, printer_iec_dialog_trans);

    if (iec_available_busses() & IEC_BUS_IEC) {
        resources_get_int("IECDevice7", &res_value);
        CheckDlgButton(hwnd, IDC_PRINTER_USEIECDEVICE, res_value ? BST_CHECKED : BST_UNCHECKED);
    } else {
        ShowWindow(GetDlgItem(hwnd, IDC_PRINTER_USEIECDEVICE), FALSE);
        CheckDlgButton(hwnd, IDC_PRINTER_USEIECDEVICE, BST_UNCHECKED);
    }
}
Ejemplo n.º 26
0
static TUI_MENU_CALLBACK(iosize_callback)
{
    int value;

    resources_get_int("IOSize", &value);

    switch (value) {
        case 0x800:
            return "2 KBytes";
        case 0x100:
            return "256 Bytes";
        default:
            return "Unknown";
    }
}
Ejemplo n.º 27
0
static UI_CALLBACK(color_set)
{
    if (!CHECK_MENUS) {
        ui_update_menus();
    } else {
        int val;

        resources_get_int("TEDExternalPalette", &val);

        if (val)
            ui_menu_set_sensitive(w, 1);
        else
            ui_menu_set_sensitive(w, 0);
    }
}
Ejemplo n.º 28
0
void _ui_menu_toggle_helper(GtkWidget *w,
                            ui_callback_data_t event_data,
                            const char *resource_name)
{
    int current_value;

    if (resources_get_int(resource_name, &current_value) < 0)
        return;

    if(!CHECK_MENUS) {
        resources_set_int(resource_name, !current_value);
	ui_update_menus();
    } else {
        ui_menu_set_tick(w, current_value);
    }
}
Ejemplo n.º 29
0
static void netplay_update_control_gui(void)
{
    int i;
    unsigned int control;

    resources_get_int("NetworkControl", (int *)&control);
    for (i = 0; i < NR_NPCONROLS; i++)
    {
        if (control & np_controls[i].s_mask) {
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(np_controls[i].s_cb), TRUE);
        }
        if (control & np_controls[i].c_mask) {
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(np_controls[i].c_cb), TRUE);
        }
    }
}
Ejemplo n.º 30
0
static TUI_MENU_CALLBACK(userport_type_callback)
{
    if (been_activated) {
        resources_set_int("UserportJoyType", (int)(param));
        ui_update_menus();
    } else {
        int value;

        resources_get_int("UserportJoyType", &value);
        if (value == ((int)param)) {
            *become_default = 1;
        }
    }

    return NULL;
}