예제 #1
0
파일: uirom.c 프로젝트: BigBoss21X/vice-emu
static void init_romset_dialog(HWND hwnd)
{
    int res_value, idc_active;
    const char *name;
    TCHAR *st_name;

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

    /* adjust the size of the elements in the main group */
    uilib_adjust_group_width(hwnd, romset_main_group);

    resources_get_int("RomsetSourceFile", &res_value);
    idc_active = IDC_ROMSET_SELECT_ARCHIVE + res_value;
    update_romset_dialog(hwnd, idc_active);

    resources_get_string("RomsetArchiveName", &name);
    st_name = system_mbstowcs_alloc(name);
    SetDlgItemText(hwnd, IDC_ROMSET_ARCHIVE_NAME, name != NULL ? st_name : TEXT(""));
    system_mbstowcs_free(st_name);

    resources_get_string("RomsetFileName", &name);
    st_name = system_mbstowcs_alloc(name);
    SetDlgItemText(hwnd, IDC_ROMSET_FILE_NAME, name != NULL ? st_name : TEXT(""));
    system_mbstowcs_free(st_name);
}
예제 #2
0
파일: uic128.c 프로젝트: martinpiper/VICE
static void init_functionrom_dialog(HWND hwnd)
{
    int res_value;
    const char *romfile;
    TCHAR *st_romfile;

    resources_get_int("InternalFunctionROM", &res_value);
    CheckDlgButton(hwnd, IDC_C128_FUNCTIONROM_INTERNAL, res_value
                   ? BST_CHECKED : BST_UNCHECKED);

    resources_get_string("InternalFunctionName", &romfile);
    st_romfile = system_mbstowcs_alloc(romfile);
    SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME,
                   st_romfile != NULL ? st_romfile : TEXT(""));
    system_mbstowcs_free(st_romfile);

    resources_get_int("ExternalFunctionROM", &res_value);
    CheckDlgButton(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL, res_value
                   ? BST_CHECKED : BST_UNCHECKED);
 
    resources_get_string("ExternalFunctionName", &romfile);
    st_romfile = system_mbstowcs_alloc(romfile);
    SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME,
                   st_romfile != NULL ? st_romfile : TEXT(""));
    system_mbstowcs_free(st_romfile);

    enable_functionrom_controls(hwnd);
}
예제 #3
0
파일: uirs232.c 프로젝트: AreaScout/vice
static void init_rs232_dialog(HWND hwnd)
{
    const char *device;
    TCHAR *st_device;
    int xpos;
    RECT rect;

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

    /* adjust the size of the elements in the left group */
    uilib_adjust_group_width(hwnd, left_group);

    /* get the max x of the left group */
    uilib_get_group_max_x(hwnd, left_group, &xpos);

    /* move the right group to the correct position */
    uilib_move_group(hwnd, right_group, xpos + 10);

    /* get the max x of the right group */
    uilib_get_group_max_x(hwnd, right_group, &xpos);

    /* set the width of the dialog to 'surround' all the elements */
    GetWindowRect(hwnd, &rect);
    MoveWindow(hwnd, rect.left, rect.top, xpos + 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_string("RsDevice1", &device);
    st_device = system_mbstowcs_alloc(device);
    SetDlgItemText(hwnd, IDC_RS232_DEVICE1, device != NULL ? st_device : TEXT(""));
    system_mbstowcs_free(st_device);

    resources_get_string("RsDevice2", &device);
    st_device = system_mbstowcs_alloc(device);
    SetDlgItemText(hwnd, IDC_RS232_DEVICE2, device != NULL ? st_device : TEXT(""));
    system_mbstowcs_free(st_device);

    resources_get_string("RsDevice3", &device);
    st_device = system_mbstowcs_alloc(device);
    SetDlgItemText(hwnd, IDC_RS232_DEVICE3, device != NULL ? st_device : TEXT(""));
    system_mbstowcs_free(st_device);

    resources_get_string("RsDevice4", &device);
    st_device = system_mbstowcs_alloc(device);
    SetDlgItemText(hwnd, IDC_RS232_DEVICE4, device != NULL ? st_device : TEXT(""));
    system_mbstowcs_free(st_device);
}
예제 #4
0
파일: menu_sound.c 프로젝트: AreaScout/vice
static UI_MENU_CALLBACK(start_recording_callback)
{
    char *parameter = (char *)param;

    if (activated) {
        resources_set_string("SoundRecordDeviceName", "");
        if (parameter != NULL) {
            char *name = NULL;

            name = sdl_ui_file_selection_dialog("Choose audio file to record to", FILEREQ_MODE_CHOOSE_FILE);
            if (name != NULL) {
                util_add_extension(&name, parameter);
                resources_set_string("SoundRecordDeviceArg", name);
                resources_set_string("SoundRecordDeviceName", parameter);
                lib_free(name);
            }
        }
    } else {
        if (parameter != NULL) {
            const char *w;

            resources_get_string("SoundRecordDeviceName", &w);
            if (!strcmp(w, parameter)) {
                return sdl_menu_text_tick;
            }
        }
    }
    return NULL;
}
예제 #5
0
const char *prepend_dir_to_path(const char *dir)
{
    const char *saved_path;
    char *new_path;

    resources_get_string("Directory", &saved_path);
    saved_path = lib_stralloc(saved_path);

    if (dir && *dir) {
        new_path = util_concat(dir,
                               ARCHDEP_FINDPATH_SEPARATOR_STRING,
                               saved_path,
                               NULL);
    } else {
        char *current_dir = ioutil_current_dir();
        new_path = util_concat(current_dir,
                               ARCHDEP_FINDPATH_SEPARATOR_STRING,
                               saved_path,
                               NULL);
        lib_free(current_dir);
    }

    resources_set_string("Directory", new_path);
    lib_free(new_path);

    return saved_path;
} 
예제 #6
0
파일: uilib.c 프로젝트: martinpiper/VICE
void uilib_select_string(const char *resname, const char *title,
                         const char *name)
{
    ui_button_t button;
    const char *value;
    char *new_value;
    int len;

    vsync_suspend_speed_eval();

    resources_get_string(resname, &value);

    if (value == NULL)
        value = "";

    len = strlen(value) * 2;
    if (len < 255)
        len = 255;

    new_value = lib_calloc(1, len + 1);
    strncpy(new_value, value, len);

    button = ui_input_string(title, name, new_value, len);

    if (button == UI_BUTTON_OK)
        resources_set_string(resname, new_value);

    lib_free(new_value);
}
예제 #7
0
static void init_plus256k_dialog(HWND hwnd)
{
    int res_value;
    const char *plus256kfile;
    TCHAR *st_plus256kfile;
    int xsize, ysize;

    uilib_localize_dialog(hwnd, plus256k_dialog);
    uilib_adjust_group_width(hwnd, plus256k_group1);
    uilib_get_group_extent(hwnd, plus256k_leftgroup, &xsize, &ysize);
    uilib_adjust_group_width(hwnd, plus256k_leftgroup);
    uilib_move_group(hwnd, plus256k_rightgroup, xsize + 30);

    resources_get_int("PLUS256K", &res_value);
    CheckDlgButton(hwnd, IDC_PLUS256K_ENABLE, 
        res_value ? BST_CHECKED : BST_UNCHECKED);
    
    resources_get_string("PLUS256Kfilename", &plus256kfile);
    st_plus256kfile = system_mbstowcs_alloc(plus256kfile);
    SetDlgItemText(hwnd, IDC_PLUS256K_FILE,
                   plus256kfile != NULL ? st_plus256kfile : TEXT(""));
    system_mbstowcs_free(st_plus256kfile);

    enable_plus256k_controls(hwnd);
}
예제 #8
0
파일: debug.c 프로젝트: bobsummerwill/VICE
static void debug_open_new_file(void)
{
    char *filename, *st;
    const char *directory;

    if (debug_file != NULL) {
        fclose(debug_file);
    }

    resources_get_string("EventSnapshotDir", &directory);

    st = lib_msprintf("debug%06d", debug_file_current);
    filename = util_concat(directory, st, FSDEV_EXT_SEP_STR, "log", NULL);
    lib_free(st);

    debug_file = fopen(filename, MODE_READ_TEXT);
    if (debug_file != NULL) {
        debug_buffer_size = fread(debug_buffer, sizeof(char), 
                                  DEBUG_HISTORY_MAXFILESIZE, debug_file);
        debug_buffer_ptr = 0;
        debug_file_current++;
    } else {
        debug_buffer_size = 0;
    }

    debug_file_line = 0;

    lib_free(filename);
}
예제 #9
0
파일: petui.c 프로젝트: AreaScout/vice
static void pet_select_keymap(ui_window_t w, int check, char *name, int sympos)
{
    char filename[0x20];
    const char *resname;
    int kindex;
    const char *wd;
    const char *maps[6] = {"x11_buks", "x11_bukp", "x11_bgrs", "x11_bgrp", "x11_bdes", "x11_bdep"};

    resources_get_int("KeymapIndex", &kindex);
    strcpy(filename, maps[kindex]);
    strcat(filename, name);
    kindex = (kindex & ~1) + sympos;
    resname = machine_keymap_res_name_list[kindex];

    if (name) {
        if (!check) {
            resources_set_string(resname, filename);
            ui_update_menus();
        } else {
            resources_get_string(resname, &wd);
            if (!strcmp(wd, filename)) {
                ui_menu_set_tick(w, 1);
            } else {
                ui_menu_set_tick(w, 0);
            }
        }
    }
}
예제 #10
0
파일: uirom.c 프로젝트: BigBoss21X/vice-emu
static void update_romset_archive(HWND hwnd)
{
    HWND temp_hwnd;
    int num, index, active;
    const char *conf;

    active = 0;
    num = romset_archive_get_number();

    resources_get_string("RomsetArchiveActive", &conf);

    temp_hwnd = GetDlgItem(hwnd, IDC_ROMSET_ARCHIVE_ACTIVE);
    SendMessage(temp_hwnd, CB_RESETCONTENT, 0, 0);
    for (index = 0; index < num; index++) {
        TCHAR *st_name;
        char *name;

        name = romset_archive_get_item(index);
        if (!strcmp(conf, name)) {
            active = index;
        }
        st_name = system_mbstowcs_alloc(name);
        SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st_name);
        system_mbstowcs_free(st_name);
    }
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active, 0);

    update_romset_list(hwnd);
}
예제 #11
0
static void ffmpeg_widget(GtkWidget *w, gpointer data)
{
    int i;
    const char *current_driver;

    g_return_if_fail(GTK_IS_COMBO_BOX(w));

    resources_get_string("FFMPEGFormat", &current_driver);

    i = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
    if (strcmp(buttons[i].driver, "FFMPEG") == 0) {
        GtkListStore *store;
        GtkTreeIter iter;
        int index, found;
        char *drv_name = NULL;

        store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(ffmpeg_omenu)));
        if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
            do {
                gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &drv_name, 1, &index, -1);
                found = !strcmp(drv_name, current_driver);
                lib_free(drv_name);
            } while (!found && gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
            if (found) {
                selected_driver = current_driver;
                gtk_combo_box_set_active(GTK_COMBO_BOX(ffmpeg_omenu), index);
            }
            gtk_widget_set_sensitive(ffmpg_opts, TRUE);
            return;
        }
    }
    gtk_widget_set_sensitive(ffmpg_opts, FALSE);
}
예제 #12
0
파일: iecrom.c 프로젝트: martinpiper/VICE
int iecrom_load_1541(void)
{
    const char *rom_name = NULL;
    int filesize;

    if (!drive_rom_load_ok)
        return 0;

    resources_get_string("DosName1541", &rom_name);

    filesize = sysfile_load(rom_name, drive_rom1541, DRIVE_ROM1541_SIZE,
                            DRIVE_ROM1541_SIZE_EXPANDED);
    if (filesize < 0) {
        log_error(iecrom_log,
                  "1541 ROM image not found.  "
                  "Hardware-level 1541 emulation is not available.");
        drive_rom1541_size = 0;
    } else {
        rom1541_loaded = 1;
        drive_rom1541_size = (unsigned int)filesize;
        iecrom_do_1541_checksum();
        iecrom_new_image_loaded(DRIVE_TYPE_1541);
        return 0;
    }
    return -1;
}
예제 #13
0
파일: uikeyboard.c 프로젝트: AreaScout/vice
static void init_mapping_dialog(HWND hwnd)
{
    int idc_index, i;
    int xpos;
    RECT rect;

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

    /* translate ok and cancel items */
    uilib_localize_dialog(hwnd, ok_cancel_trans);

    /* adjust the size of the elements in the buttons group */
    uilib_adjust_group_width(hwnd, mapping_buttons_group);

    /* adjust the size of the elements in the left group */
    uilib_adjust_group_width(hwnd, mapping_left_group);

    /* get the max x of the left group */
    uilib_get_group_max_x(hwnd, mapping_left_group, &xpos);

    /* move the middle group to the correct position */
    uilib_move_group(hwnd, mapping_middle_group, xpos + 10);

    /* get the max x of the middle group */
    uilib_get_group_max_x(hwnd, mapping_middle_group, &xpos);

    /* move the right group to the correct position */
    uilib_move_group(hwnd, mapping_right_group, xpos + 10);

    /* get the max x of the right group */
    uilib_get_group_max_x(hwnd, mapping_right_group, &xpos);

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

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

    /* recenter the ok and cancel buttons in the newly resized dialog window */
    uilib_center_buttons(hwnd, ok_cancel_move_group, 0);

    idc_index = mapping_index_get();

    CheckRadioButton(hwnd, mapping_entry[0].idc_select, mapping_entry[uikeyboard_mapping_num - 1].idc_select, idc_index);

    for (i = 0; i < uikeyboard_mapping_num; i++) {
        const char *fname;
        TCHAR *st_fname;

        resources_get_string(mapping_entry[i].res_filename, &fname);
        st_fname = system_mbstowcs_alloc(fname);
        SetDlgItemText(hwnd, mapping_entry[i].idc_filename, fname != NULL ? st_fname : TEXT(""));
        system_mbstowcs_free(st_fname);
    }

    enable_mapping_controls(hwnd, idc_index);
}
예제 #14
0
파일: uiprinter.c 프로젝트: AreaScout/vice
static TUI_MENU_CALLBACK(text_output_file_callback)
{
    const char *s;

    resources_get_string((char *)param, &s);

    return s;
}
예제 #15
0
파일: stardos.c 프로젝트: martinpiper/VICE
void stardos_remove_kernal(void)
{
    const char *rom_name = NULL;

    c64rom_cartkernal_active=0;
    resources_get_string("KernalName", &rom_name);
    c64rom_load_kernal(rom_name, NULL);
}
예제 #16
0
파일: uiprinter.c 프로젝트: AreaScout/vice
static TUI_MENU_CALLBACK(printer_driver_submenu_callback)
{
    const char *s;

    resources_get_string((char *)param, &s);

    return s;
}
예제 #17
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);
}
예제 #18
0
static void init_sound_record_dialog(HWND hwnd)
{
    HWND temp_hwnd;
    const char *sound_record_file;
    TCHAR *st_sound_record_file;
    int xpos;
    RECT rect;

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

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

    /* get the max x of the sound record format element */
    uilib_get_element_max_x(hwnd, IDC_SOUND_RECORD_FORMAT_LABEL, &xpos);

    /* move the sound record format indicator element to the correct position */
    uilib_move_element(hwnd, IDC_SOUND_RECORD_FORMAT, xpos + 10);

    /* get the max x of the sound record file element */
    uilib_get_element_max_x(hwnd, IDC_SOUND_RECORD_FILE_LABEL, &xpos);

    /* move the browse button to the correct position */
    uilib_move_element(hwnd, IDC_SOUND_RECORD_BROWSE, xpos + 10);

    /* get the max x of the right group */
    uilib_get_group_max_x(hwnd, sound_record_right_group, &xpos);

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

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

    temp_hwnd = GetDlgItem(hwnd, IDC_SOUND_RECORD_FORMAT);
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"AIFF");
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"IFF");
#ifdef USE_LAMEMP3
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"MP3");
#endif
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"VOC");
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"WAV");
#ifdef USE_LAMEMP3
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)4, 0);
#else
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)3, 0);
#endif

    resources_get_string("SoundRecordDeviceArg", &sound_record_file);
    st_sound_record_file = system_mbstowcs_alloc(sound_record_file);
    SetDlgItemText(hwnd, IDC_SOUND_RECORD_FILE, sound_record_file != NULL ? st_sound_record_file : TEXT(""));
    system_mbstowcs_free(st_sound_record_file);

    enable_sound_record_controls(hwnd);
}
예제 #19
0
static void netplay_update_status(void)
{
    gchar *text = NULL;
    const char *server_name;
    const char *server_bind_address;
    int port;
    char st[256];

    switch(network_get_mode()) {
        case NETWORK_IDLE:
            gtk_widget_set_sensitive(GTK_WIDGET(dcb), FALSE);
            gtk_widget_set_sensitive(GTK_WIDGET(ctrls), TRUE);
            text = _("Idle");
            break;
        case NETWORK_SERVER:
            gtk_widget_set_sensitive(GTK_WIDGET(dcb), TRUE);
            gtk_widget_set_sensitive(GTK_WIDGET(ctrls), FALSE);
            text = _("Server listening");
            break;
        case NETWORK_SERVER_CONNECTED:
            gtk_widget_set_sensitive(GTK_WIDGET(dcb), TRUE);
            gtk_widget_set_sensitive(GTK_WIDGET(ctrls), FALSE);
            text = _("Connected server");
            break;
        case NETWORK_CLIENT:
            gtk_widget_set_sensitive(GTK_WIDGET(dcb), TRUE);
            gtk_widget_set_sensitive(GTK_WIDGET(ctrls), FALSE);
            text = _("Connected client");
            break;
        default:
            break;
    }
    gtk_label_set_text(GTK_LABEL(current_mode), text);

    resources_get_int("NetworkServerPort", &port);
    resources_get_string("NetworkServerName", &server_name);
    resources_get_string("NetworkServerBindAddress", &server_bind_address);
    snprintf(st, 256, "%d", port);
    gtk_entry_set_text(GTK_ENTRY(np_port), st);
    gtk_entry_set_text(GTK_ENTRY(np_server), server_name);
    gtk_entry_set_text(GTK_ENTRY(np_server_bind), server_bind_address);
    log_message(np_log, "Status: %s, Server: %s, Port: %d; server bind address: %s", text, server_name, port, server_bind_address);
    netplay_update_control_gui();
}
예제 #20
0
int mem_load(void)
{

    const char *rom_name = NULL;

    if (plus4rom_log == LOG_ERR)
        plus4rom_log = log_open("PLUS4MEM");

    plus4_rom_loaded = 1;

    if (resources_get_string("KernalName", &rom_name) < 0)
        return -1;
    if (plus4rom_load_kernal(rom_name) < 0)
        return -1;

    if (resources_get_string("BasicName", &rom_name) < 0)
        return -1;
    if (plus4rom_load_basic(rom_name) < 0)
        return -1;

    if (resources_get_string("FunctionLowName", &rom_name) < 0)
        return -1;
    if (plus4cart_load_func_lo(rom_name) < 0)
        return -1;

    if (resources_get_string("FunctionHighName", &rom_name) < 0)
        return -1;
    if (plus4cart_load_func_hi(rom_name) < 0)
        return -1;

    if (resources_get_string("c1loName", &rom_name) < 0)
        return -1;
    if (plus4cart_load_c1lo(rom_name) < 0)
        return -1;

    if (resources_get_string("c1hiName", &rom_name) < 0)
        return -1;
    if (plus4cart_load_c1hi(rom_name) < 0)
        return -1;

    if (resources_get_string("c2loName", &rom_name) < 0)
        return -1;
    if (plus4cart_load_c2lo(rom_name) < 0)
        return -1;

    if (resources_get_string("c2hiName", &rom_name) < 0)
        return -1;
    if (plus4cart_load_c2hi(rom_name) < 0)
        return -1;

    return 0;
}
예제 #21
0
static void init_ramcart_dialog(HWND hwnd)
{
    HWND temp_hwnd;
    int res_value;
    const char *ramcartfile;
    TCHAR *st_ramcartfile;
    int res_value_loop;
    int active_value;
    int xsize, ysize;
    int xsize2;

    uilib_localize_dialog(hwnd, ramcart_dialog);
    uilib_get_group_extent(hwnd, ramcart_leftgroup1, &xsize, &ysize);
    uilib_adjust_group_width(hwnd, ramcart_maingroup);
    uilib_adjust_group_width(hwnd, ramcart_leftgroup1);
    uilib_move_and_adjust_group_width(hwnd, ramcart_rightgroup1, xsize + 30);
    uilib_get_group_extent(hwnd, ramcart_leftgroup2, &xsize2, &ysize);
    uilib_adjust_group_width(hwnd, ramcart_leftgroup2);
    uilib_move_group(hwnd, ramcart_rightgroup2, xsize2 + 30);

    resources_get_int("RAMCART", &res_value);
    CheckDlgButton(hwnd, IDC_RAMCART_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED);

    resources_get_int("RAMCARTImageWrite", &res_value);
    CheckDlgButton(hwnd, IDC_RAMCART_WRITE_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED);

    resources_get_int("RAMCART_RO", &res_value);
    CheckDlgButton(hwnd, IDC_RAMCART_RO, res_value ? BST_CHECKED : BST_UNCHECKED);
    
    temp_hwnd = GetDlgItem(hwnd, IDC_RAMCART_SIZE);
    for (res_value_loop = 0; ui_ramcart_size[res_value_loop] != 0; res_value_loop++) {
        TCHAR st[10];

        _itot(ui_ramcart_size[res_value_loop], st, 10);
        _tcscat(st, translate_text(IDS_SPACE_KB));
        SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st);
    }
    resources_get_int("RAMCARTsize", &res_value);
    active_value = 0;
    for (res_value_loop = 0; ui_ramcart_size[res_value_loop] != 0; res_value_loop++) {
        if (ui_ramcart_size[res_value_loop] == res_value) {
            active_value = res_value_loop;
        }
    }
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0);

    resources_get_string("RAMCARTfilename", &ramcartfile);
    st_ramcartfile = system_mbstowcs_alloc(ramcartfile);
    SetDlgItemText(hwnd, IDC_RAMCART_FILE, ramcartfile != NULL ? st_ramcartfile : TEXT(""));
    system_mbstowcs_free(st_ramcartfile);

    enable_ramcart_controls(hwnd);
}
예제 #22
0
static UI_CALLBACK(monitor_select_addr)
{
    const char *wd = NULL;
    int len = 40;

    resources_get_string("MonitorServerAddress", &wd);
    vsync_suspend_speed_eval();
    if (ui_input_string(_("VICE setting"), _("Select server address"), (char*)wd, len) == UI_BUTTON_OK) {
        resources_set_string("MonitorServerAddress", wd);
    }
    lib_free(wd);
}
예제 #23
0
/* Load memory image files. */
int mem_load(void)
{
    int i;
    const char *rom_name = NULL;

    if (cbm2rom_log == LOG_ERR)
        cbm2rom_log = log_open("CBM2MEM");

    rom_loaded = 1;

    if (resources_get_string("ChargenName", &rom_name) < 0)
        return -1;
    if (cbm2rom_load_chargen(rom_name) < 0)
        return -1;

    /* Init Disk/Cartridge ROM with 'unused address' values.  */
    for (i = 0x800; i < 0x8000; i++) {
        mem_rom[i] = 0xff;
    }

    if (resources_get_string("KernalName", &rom_name) < 0)
        return -1;
    if (cbm2rom_load_kernal(rom_name) < 0)
        return -1;

    if (resources_get_string("BasicName", &rom_name) < 0)
        return -1;
    if (cbm2rom_load_basic(rom_name) < 0)
        return -1;

    /* Load extension ROMs.  */
    if (resources_get_string("Cart1Name", &rom_name) < 0)
        return -1;
    if (cbm2rom_load_cart_1(rom_name) < 0)
        return -1;

    if (resources_get_string("Cart2Name", &rom_name) < 0)
        return -1;
    if (cbm2rom_load_cart_2(rom_name) < 0)
        return -1;

    if (resources_get_string("Cart4Name", &rom_name) < 0)
        return -1;
    if (cbm2rom_load_cart_4(rom_name) < 0)
        return -1;

    if (resources_get_string("Cart6Name", &rom_name) < 0)
        return -1;
    if (cbm2rom_load_cart_6(rom_name) < 0)
        return -1;

    /* FIXME: VIC-II config */

    return 0;
}
예제 #24
0
static UI_MENU_CALLBACK(custom_FFMPEGFormat_callback)
{
    if (activated) {
        resources_set_string("FFMPEGFormat", (char *)param);
        update_codec_menus((const char *)param);
    } else {
        const char *w;

        resources_get_string("FFMPEGFormat", &w);
        if (!strcmp(w, (char *)param)) {
            return sdl_menu_text_tick;
        }
    }
    return NULL;
}
예제 #25
0
static UI_MENU_CALLBACK(c64_cart_flush_callback)
{
    int i;
    int found = 0;
    int enabled = 1;
    const char *filename = "a";

    if (activated) {
        int cartid = vice_ptr_to_int(param);

        if (cartridge_flush_image(cartid) < 0) {

            /* find cartid in carts */
            for (i = 0; carts[i].cartid != 0 && !found; i++) {
                if (carts[i].cartid == cartid) {
                    found = 1;
                }
            }
            i--;

            /* check if cart was enabled */
            if (found) {
                if (carts[i].enable_res) {
                    resources_get_int(carts[i].enable_res, &enabled);
                }
            }

            /* check if cart has image */
            if (found) {
                if (carts[i].image_res) {
                    resources_get_string(carts[i].image_res, &filename);
                }
            }

            if (!enabled) {
                ui_error("Cartridge is not enabled.");
            } else if (!filename) {
                ui_error("No name defined for cart image.");
            } else if (!*filename) {
                ui_error("No name defined for cart image.");
            } else {
                ui_error("Cannot save cartridge image.");
            }
        }
    }
    return NULL;
}
예제 #26
0
파일: debug.c 프로젝트: bobsummerwill/VICE
static void debug_create_new_file(void)
{
    char *filename, *st;
    const char *directory;

    debug_close_file();

    resources_get_string("EventSnapshotDir", &directory);

    st = lib_msprintf("debug%06d", debug_file_current);
    filename = util_concat(directory, st, FSDEV_EXT_SEP_STR, "log", NULL);
    lib_free(st);

    debug_file = fopen(filename, MODE_WRITE_TEXT);

    lib_free(filename);
}
예제 #27
0
/** \brief  Create widget to control Printer[device]TextDevice resource
 *
 * \param[in]   device  device number
 *
 * \return  GtkGrid
 */
GtkWidget *printer_output_mode_widget_create(int device)
{
    GtkWidget *grid;
    GtkWidget *radio_text;
    GtkWidget *radio_gfx;
    GSList *group = NULL;
    char resource[256];
    const char *value;

    /* can't use the resource base widgets here, since for some reason this
     * resource is a string with two possible values: "text" and "graphics"
     */

    grid = uihelpers_create_grid_with_label("Output mode", 1);

    g_snprintf(resource, 256, "Printer%dOutput", device);
    resource_widget_set_resource_name(grid, resource);

    radio_text = gtk_radio_button_new_with_label(group, "Text");
    g_object_set(radio_text, "margin-left", 16, NULL);
    radio_gfx = gtk_radio_button_new_with_label(group, "Graphics");
    g_object_set(radio_gfx, "margin-left", 16, NULL);
    gtk_radio_button_join_group(GTK_RADIO_BUTTON(radio_gfx),
            GTK_RADIO_BUTTON(radio_text));

    resources_get_string(resource, &value);
    if (strcmp(value, "text") == 0) {
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_text), TRUE);
    } else {
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_gfx), TRUE);
    }

    gtk_grid_attach(GTK_GRID(grid), radio_text, 0, 1, 1, 1);
    gtk_grid_attach(GTK_GRID(grid), radio_gfx, 0, 2, 1, 1);

    g_signal_connect(radio_text, "toggled", G_CALLBACK(on_radio_toggled),
            (gpointer)"text");
    g_signal_connect(radio_gfx, "toggled", G_CALLBACK(on_radio_toggled),
            (gpointer)"graphics");

    g_signal_connect(grid, "destroy", G_CALLBACK(on_widget_destroy), NULL);

    gtk_widget_show_all(grid);
    return grid;
}
예제 #28
0
파일: uipetreu.c 프로젝트: martinpiper/VICE
static void init_petreu_dialog(HWND hwnd)
{
    HWND temp_hwnd;
    int res_value;
    const char *petreufile;
    TCHAR *st_petreufile;
    int res_value_loop;
    int active_value;
    int xsize, ysize;

    uilib_localize_dialog(hwnd, petreu_dialog);
    uilib_get_group_extent(hwnd, petreu_leftgroup, &xsize, &ysize);
    uilib_adjust_group_width(hwnd, petreu_leftgroup);
    uilib_move_group(hwnd, petreu_rightgroup, xsize + 30);

    resources_get_int("PETREU", &res_value);
    CheckDlgButton(hwnd, IDC_PETREU_ENABLE, 
                   res_value ? BST_CHECKED : BST_UNCHECKED);

    temp_hwnd = GetDlgItem(hwnd, IDC_PETREU_SIZE);
    for (res_value_loop = 0; res_value_loop < NUM_OF_PETREU_SIZE;
        res_value_loop++) {
        TCHAR st[10];
        _itot(ui_petreu_size[res_value_loop], st, 10);
        _tcscat(st, translate_text(IDS_SPACE_KB));
        SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st);
    }
    resources_get_int("PETREUsize", &res_value);
    active_value = 0;
    for (res_value_loop = 0; res_value_loop < NUM_OF_PETREU_SIZE;
        res_value_loop++) {
        if (ui_petreu_size[res_value_loop] == res_value)
            active_value = res_value_loop;
    }
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0);

    resources_get_string("PETREUfilename", &petreufile);
    st_petreufile = system_mbstowcs_alloc(petreufile);
    SetDlgItemText(hwnd, IDC_PETREU_FILE,
                   petreufile != NULL ? st_petreufile : TEXT(""));
    system_mbstowcs_free(st_petreufile);

    enable_petreu_controls(hwnd);
}
예제 #29
0
void sdl_menu_ffmpeg_init(void)
{
    int i;
    gfxoutputdrv_format_t *format;
    const char *w;

    ffmpeg_drv = gfxoutput_get_driver("FFMPEG");

    if (!ffmpeg_drv) {
#ifdef SDL_DEBUG
fprintf(stderr, "%s: no driver found\n", __func__);
#endif
        return;
    }

    format = ffmpeg_drv->formatlist;
    i = 0;

    do {
        format_menu[i].string = format->name;
        format_menu[i].type = MENU_ENTRY_RESOURCE_RADIO;
        format_menu[i].callback = custom_FFMPEGFormat_callback;
        format_menu[i].data = (ui_callback_data_t)(format->name);
#ifdef SDL_DEBUG
fprintf(stderr, "%s: format %i: %s\n", __func__, i, (format->name) ? format->name : "(NULL)");
#endif

        format++;
        i++;

        if (i == MAX_FORMATS) {
#ifdef SDL_DEBUG
fprintf(stderr, "%s: FIXME format %i > %i (MAX)\n", __func__, i, MAX_FORMATS);
#endif
            break;
        }
    } while (format->name);

    format_menu[i].string = NULL;

    resources_get_string("FFMPEGFormat", &w);
    update_codec_menus(w);
}
예제 #30
0
/** \brief  Handler for the "toggled" event of the radio buttons
 *
 * \param[in]   radio       radio button
 * \param[in]   user_data   new value for resource (`string`)
 */
static void on_radio_toggled(GtkWidget *radio, gpointer user_data)
{
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio))) {
        GtkWidget *parent;
        const char *new_val;
        const char *old_val;
        const char *resource;

        parent = gtk_widget_get_parent(radio);
        resource = resource_widget_get_resource_name(parent);
        resources_get_string(resource, &old_val);
        new_val = (const char *)user_data;

        if (strcmp(new_val, old_val) == 0) {
            debug_gtk3("setting %s to '%s'.", resource, new_val);
            resources_set_string(resource, new_val);
        }
    }
}