示例#1
0
/* loadsave values:
 * 0 : Load Model
 * 1 : Save Model
 * 2 : Load Template
 * 3 : Load Icon
 * 4 : Load Layout
 */
void MODELPage_ShowLoadSave(int loadsave, void(*return_page)(int page))
{
    u8 num_models = 0;
    PAGE_RemoveAllObjects();
    PAGE_SetModal(1);
    mp->return_page = return_page;
    _show_buttons(loadsave);
    if (loadsave == LOAD_TEMPLATE) { //Template
        num_models = count_files("template", ".ini", NULL);
        mp->selected = 1;
    } else if (loadsave == LOAD_ICON) { //Icon
        mp->selected = 0;
        num_models = 1 + count_files("modelico", ".bmp", Model.icon[0] ? Model.icon+9 : NULL);
        const char *ico = mp->selected == 0 ? CONFIG_GetIcon(Model.type) : CONFIG_GetCurrentIcon();
        strlcpy(mp->iconstr, ico, sizeof(mp->iconstr));
        mp->selected++;
    } else if (loadsave == LOAD_LAYOUT) { //Layout
        mp->selected = 1;
        num_models = count_files("layout", ".ini", "default.ini");
        mp->file_state = num_models;
        num_models += model_count();
    } else {
        num_models = model_count();
        strlcpy(mp->iconstr, CONFIG_GetCurrentIcon(), sizeof(mp->iconstr));
        if (loadsave == SAVE_MODEL)
            mp->selected = 0;
        else
            mp->selected = CONFIG_GetCurrentModel();
    }
    _show_list(loadsave, num_models);
}
示例#2
0
文件: filter.c 项目: jollywho/nav
void filter_build(Filter *fil, const char *line)
{
  log_msg("FILTER", "build");
  if (fil->pat)
    regex_pat_delete(fil->pat);

  fil->pat = regex_pat_new(line);
  SWAP_ALLOC_PTR(fil->line, strdup(line));

  Model *m = fil->hndl->model;

  model_clear_filter(m);

  int max = model_count(m);
  int count = 0;
  for (int i = max; i > 0; i--) {
    char *str = model_str_line(m, i-1);
    if (!regex_match(fil->pat, str)) {
      model_filter_line(m, i-1);
      count++;
    }
  }
  buf_signal_filter(fil->hndl->buf, count);
}
示例#3
0
文件: pc.c 项目: richardg867/PCem-X
void loadconfig(char *fn)
{
    char s[512];
    char *p;

    if (!fn)
    {
        append_filename(config_file_default, pcempath, "pcem.cfg", 511);

        config_load(config_file_default);
    }
    else
        config_load(fn);

    GAMEBLASTER = config_get_int(NULL, "gameblaster", 0);
    GUS = config_get_int(NULL, "gus", 0);
    SSI2001 = config_get_int(NULL, "ssi2001", 0);
    voodoo_enabled = config_get_int(NULL, "voodoo", 0);

// #ifdef USE_NETWORKING
    //network
    ethif = config_get_int(NULL, "netinterface", 1);
    if (ethif >= inum)
        inum = ethif + 1;
    network_card_current = config_get_int(NULL, "netcard", NE2000);
// #endif

    model = config_get_int(NULL, "model", 14);

    if (model >= model_count())
        model = model_count() - 1;

    romset = model_getromset();
    cpu_manufacturer = config_get_int(NULL, "cpu_manufacturer", 0);
    cpu = config_get_int(NULL, "cpu", 0);
    cpu_use_dynarec = config_get_int(NULL, "cpu_use_dynarec", 0);

    gfxcard = config_get_int(NULL, "gfxcard", 0);
    video_speed = config_get_int(NULL, "video_speed", 3);
    sound_card_current = config_get_int(NULL, "sndcard", SB2);

    p = (char *)config_get_string(NULL, "disc_a", "");
    if (p) strcpy(discfns[0], p);
    else   strcpy(discfns[0], "");

    p = (char *)config_get_string(NULL, "disc_b", "");
    if (p) strcpy(discfns[1], p);
    else   strcpy(discfns[1], "");

    mem_size = config_get_int(NULL, "mem_size", 4);
    cdrom_drive = config_get_int(NULL, "cdrom_drive", 0);
    cdrom_enabled = config_get_int(NULL, "cdrom_enabled", 0);

    slowega = config_get_int(NULL, "slow_video", 1);
    cache = config_get_int(NULL, "cache", 3);
    cga_comp = config_get_int(NULL, "cga_composite", 0);

    vid_resize = config_get_int(NULL, "vid_resize", 0);
    vid_api = config_get_int(NULL, "vid_api", 0);
    video_fullscreen_scale = config_get_int(NULL, "video_fullscreen_scale", 0);
    video_fullscreen_first = config_get_int(NULL, "video_fullscreen_first", 1);

    hdc[0].spt = config_get_int(NULL, "hdc_sectors", 0);
    hdc[0].hpc = config_get_int(NULL, "hdc_heads", 0);
    hdc[0].tracks = config_get_int(NULL, "hdc_cylinders", 0);
    p = (char *)config_get_string(NULL, "hdc_fn", "");
    if (p) strcpy(ide_fn[0], p);
    else   strcpy(ide_fn[0], "");
    hdc[1].spt = config_get_int(NULL, "hdd_sectors", 0);
    hdc[1].hpc = config_get_int(NULL, "hdd_heads", 0);
    hdc[1].tracks = config_get_int(NULL, "hdd_cylinders", 0);
    p = (char *)config_get_string(NULL, "hdd_fn", "");
    if (p) strcpy(ide_fn[1], p);
    else   strcpy(ide_fn[1], "");
    hdc[2].spt = config_get_int(NULL, "hde_sectors", 0);
    hdc[2].hpc = config_get_int(NULL, "hde_heads", 0);
    hdc[2].tracks = config_get_int(NULL, "hde_cylinders", 0);
    p = (char *)config_get_string(NULL, "hde_fn", "");
    if (p) strcpy(ide_fn[2], p);
    else   strcpy(ide_fn[2], "");
    hdc[3].spt = config_get_int(NULL, "hdf_sectors", 0);
    hdc[3].hpc = config_get_int(NULL, "hdf_heads", 0);
    hdc[3].tracks = config_get_int(NULL, "hdf_cylinders", 0);
    p = (char *)config_get_string(NULL, "hdf_fn", "");
    if (p) strcpy(ide_fn[3], p);
    else   strcpy(ide_fn[3], "");

    p = (char *)config_get_string(NULL, "disc_a", "");
    if (p) strcpy(discfns[0], p);
    else   strcpy(discfns[0], "");
    configure_from_int(0, config_get_int(NULL, "drivetype_a", 8));

    p = (char *)config_get_string(NULL, "disc_b", "");
    if (p) strcpy(discfns[1], p);
    else   strcpy(discfns[1], "");
    configure_from_int(1, config_get_int(NULL, "drivetype_b", 8));

    force_43 = config_get_int(NULL, "force_43", 0);
    enable_overscan = config_get_int(NULL, "enable_overscan", 1);
    ps1xtide = config_get_int(NULL, "ps1xtide", 0);

    disable_xchg_dynarec = config_get_int(NULL, "disable_xchg_dynarec", 0);
    turbo = config_get_int(NULL, "turbo", 1);

    cga_color_burst = config_get_int(NULL, "cga_color_burst", 1);

    cga_brown = config_get_int(NULL, "cga_brown", 1);
}