Beispiel #1
0
  void write_controls(const SfxOptions& options) {
    DisableEvents de(*this);

    set_list_pos(module_ctrl_id, ArcAPI::sfx().find_by_name(options.name));

    set_check(replace_icon_ctrl_id, options.replace_icon);
    set_text(icon_path_ctrl_id, options.icon_path);

    set_check(replace_version_ctrl_id, options.replace_version);
    set_text(ver_info_product_name_ctrl_id, options.ver_info.product_name);
    set_text(ver_info_version_ctrl_id, options.ver_info.version);
    set_text(ver_info_company_name_ctrl_id, options.ver_info.company_name);
    set_text(ver_info_file_description_ctrl_id, options.ver_info.file_description);
    set_text(ver_info_comments_ctrl_id, options.ver_info.comments);
    set_text(ver_info_legal_copyright_ctrl_id, options.ver_info.legal_copyright);

    set_check(append_install_config_ctrl_id, options.append_install_config);
    set_text(install_config_title_ctrl_id, options.install_config.title);
    set_text(install_config_begin_prompt_ctrl_id, options.install_config.begin_prompt);
    TriState value;
    if (options.install_config.progress == L"yes")
      value = triTrue;
    else if (options.install_config.progress == L"no")
      value = triFalse;
    else
      value = triUndef;
    set_check3(install_config_progress_ctrl_id, value);
    set_text(install_config_run_program_ctrl_id, options.install_config.run_program);
    set_text(install_config_directory_ctrl_id, options.install_config.directory);
    set_text(install_config_execute_file_ctrl_id, options.install_config.execute_file);
    set_text(install_config_execute_parameters_ctrl_id, options.install_config.execute_parameters);
  }
void
Snes9xNetplayDialog::settings_to_dialog ()
{
    set_entry_text ("rom_image", config->netplay_last_rom);
    set_entry_text ("ip_entry", config->netplay_last_host);
    set_check ("sync_reset", config->netplay_sync_reset);
    set_check ("send_image", config->netplay_send_rom);
    set_spin ("port", config->netplay_last_port);
    set_spin ("default_port", config->netplay_default_port);
    set_spin ("frames_behind", config->netplay_max_frame_loss);
    set_check ("connect_radio", !config->netplay_is_server);
    set_check ("host_radio", config->netplay_is_server);

    update_state ();
}
Beispiel #3
0
struct da *
da_create(void)
{
  struct da *da;
  da = malloc(sizeof(struct da));
  da->size = 0;
  da->arr = NULL;
  set_base(da, 1, 1);
  set_check(da, 1, 1);
  return da;
}
Beispiel #4
0
static void
move_children(struct da *da, struct resolve_stat *rs,
	      int parent, int left)
{
  int i;
  int orig_base = get_base(da, parent);
  int move;
  move = parent + orig_base - left;
  /*printf("parent=%d, nr=%d, left=%d, orig_base=%d\n",
    parent, rs->nr, left, orig_base);*/
  set_base(da, parent, left - parent);
  /* put moved children */
  for (i = 0; i < rs->nr; i++) {
    int idx = left + rs->elm[i].c;
    set_check(da, idx, parent);
    set_base(da, idx, rs->elm[i].base + move);
  }
  /* trim grand children */
  for (i = 0; i < rs->nr; i++) {
    int orig_left, old_child;
    int j;
    /**/
    orig_left = parent + orig_base + rs->elm[i].base + rs->elm[i].c;
    old_child = parent + orig_base + rs->elm[i].c;
    /*printf("parent=%d, old_child=%d, %d\n", parent, old_child, move);*/
    for (j = 0; j < 256; j++) {
      int orig_check = get_check(da, orig_left + j);
      if (get_check(da, orig_left + j) == old_child &&
	  get_check(da, orig_check) == 0) {
	int new_check;
	new_check = get_check(da, orig_left +j) - move;
	/*printf("rewrite check[%d] %d to %d (%d)\n",
	       orig_left + j,
	       get_check(da, orig_left + j), new_check,
	       get_check(da, orig_check));*/
	set_check(da, orig_left + j, new_check);
      }
    }
  }
}
Beispiel #5
0
static int check_prog(void) {
        DIR *dir;
        struct dirent *entry;
        char *name;
        char *status_tail;
        int pid;
        struct stat sb;
        int n;
        char status[32];
        char buf[1023];
        char cmd[16], scmd[16];
	char str[1024];
	if((dir = opendir("/proc")) == NULL) return(1);
        for(;;) {
                if((entry = readdir(dir)) == NULL) {
                        closedir(dir);
                        return(0);
                }
                name = entry->d_name;
                if (!(*name >= '0' && *name <= '9')) continue;
                pid = atoi(name);
                status_tail = status + sprintf(status, "/proc/%d", pid);
                if(stat(status, &sb)) continue;
                strcpy(status_tail, "/stat");
                n = read_oneline(status, buf);
                if(n < 0) continue;
                sscanf(buf, "%*s (%15c)", cmd);
		splitc(scmd,cmd,')');
		sprintf(str,"%s ",scmd);
                strcpy(status_tail, "/cmdline");
		n = read_oneline(status, buf);
                if(n > 0) {
                        if(buf[n-1]=='\n')  buf[--n] = 0;
                        name = buf;
                        while(n) {
                                if(((unsigned char)*name) < ' ') *name = ' ';
                                name++;
                                n--;
                        }
                        *name = 0;
                        if(buf[0]) sprintf(str,"%s %s ",str, strdup(buf));
                }
		trim(str);
		if(strstr(str,"taskq-check")) {
			taskq=1;
			continue;
		} 
		set_check(str);
        }
        return(0);
}
Beispiel #6
0
void
Snes9xPreferences::load_ntsc_settings (void)
{
    set_slider ("ntsc_artifacts", config->ntsc_setup.artifacts);
    set_slider ("ntsc_bleed", config->ntsc_setup.bleed);
    set_slider ("ntsc_brightness", config->ntsc_setup.brightness);
    set_slider ("ntsc_contrast", config->ntsc_setup.contrast);
    set_slider ("ntsc_fringing", config->ntsc_setup.fringing);
    set_slider ("ntsc_gamma", config->ntsc_setup.gamma);
    set_slider ("ntsc_hue", config->ntsc_setup.hue);
    set_check  ("ntsc_merge_fields", config->ntsc_setup.merge_fields);
    set_slider ("ntsc_resolution", config->ntsc_setup.resolution);
    set_slider ("ntsc_saturation", config->ntsc_setup.saturation);
    set_slider ("ntsc_sharpness", config->ntsc_setup.sharpness);

    return;
}
Beispiel #7
0
static int
do_add(struct da *da, int idx, unsigned char c)
{
  int base = get_base(da, idx);
  int next = idx + base + c;
  int cur_check = get_check(da, next);
  int new_base;
  if (cur_check > 0) {
    printf("conflict(%d,%c)\n", idx, c);
    return resolve_conflict(da, idx, c);
  }
  set_check(da, next, idx);
  /**/
  new_base = 1;
  if (idx == 1) {
    new_base = 256 - next;
  }
  set_base(da, next, new_base);
  return next;
}
Beispiel #8
0
static void
collect_child(struct da *da, struct resolve_stat *rs,
	      int parent, unsigned char c)
{
  int i;
  int base = get_base(da, parent);
  rs->nr = 0;
  ensure_array(da, base + 256);
  for (i = 0; i < 256; i++) {
    int idx = parent + base + i;
    if (i == c) {
      push_child(rs, c, 1);
    } else if (get_check(da, idx) == parent) {
      /* escape */
      /*printf("idx=%d,base=%d, parent=%d,i=%d\n",
	idx, base, parent, i);*/
      push_child(rs, i, get_base(da, idx));
      /* clear */
      set_base(da, idx, 0);
      set_check(da, idx, 0);
    }
  }
}
Beispiel #9
0
void
Snes9xPreferences::move_settings_to_dialog (void)
{
    set_check ("full_screen_on_open",       config->full_screen_on_open);
    set_check ("show_frame_rate",           Settings.DisplayFrameRate);
    set_check ("change_display_resolution", config->change_display_resolution);
    set_check ("scale_to_fit",              config->scale_to_fit);
    set_check ("overscan",                  config->overscan);
    set_check ("multithreading",            config->multithreading);
    set_combo ("hires_effect",              config->hires_effect);
    set_check ("maintain_aspect_ratio",     config->maintain_aspect_ratio);
    set_combo ("aspect_ratio",              config->aspect_ratio);
    if (config->sram_directory[0] == '\0')
        set_entry_text ("sram_directory", SAME_GAME);
    else
        set_entry_text ("sram_directory", config->sram_directory);
    if (config->savestate_directory[0] == '\0')
        set_entry_text ("savestate_directory", SAME_GAME);
    else
        set_entry_text ("savestate_directory", config->savestate_directory);
    if (config->patch_directory[0] == '\0')
        set_entry_text ("patch_directory", SAME_GAME);
    else
        set_entry_text ("patch_directory", config->patch_directory);
    if (config->cheat_directory[0] == '\0')
        set_entry_text ("cheat_directory", SAME_GAME);
    else
        set_entry_text ("cheat_directory", config->cheat_directory);
    if (config->export_directory[0] == '\0')
        set_entry_text ("export_directory", SAME_GAME);
    else
        set_entry_text ("export_directory", config->export_directory);

    set_combo ("resolution_combo",          config->xrr_index);
    set_combo ("scale_method_combo",        config->scale_method);
    set_entry_value ("save_sram_after_sec", Settings.AutoSaveDelay);
    set_check ("block_invalid_vram_access", Settings.BlockInvalidVRAMAccessMaster);
    set_check ("upanddown",                 Settings.UpAndDown);
    set_combo ("default_esc_behavior",      config->default_esc_behavior);
    set_check ("prevent_screensaver",       config->prevent_screensaver);
    set_check ("force_inverted_byte_order", config->force_inverted_byte_order);
    set_check ("stereo_check",              Settings.Stereo);
    set_combo ("playback_combo",            7 - config->sound_playback_rate);
    set_combo ("hw_accel",                  combo_value (config->hw_accel));
    set_check ("pause_emulation_on_switch", config->pause_emulation_on_switch);
    set_spin  ("num_threads",               config->num_threads);
    set_check ("mute_sound_check",          config->mute_sound);
    set_check ("mute_sound_turbo_check",    config->mute_sound_turbo);
    set_spin  ("sound_buffer_size",         config->sound_buffer_size);
    set_slider ("sound_input_rate",         config->sound_input_rate);
    set_check ("sync_sound",                Settings.SoundSync);
    set_spin  ("rewind_buffer_size",        config->rewind_buffer_size);
    set_spin  ("rewind_granularity",        config->rewind_granularity);

    int num_sound_drivers = 0;
#ifdef USE_PORTAUDIO
    num_sound_drivers++;
#endif
#ifdef USE_OSS
    num_sound_drivers++;
#endif
#ifdef USE_JOYSTICK
    num_sound_drivers++;
#endif
#ifdef USE_ALSA
    num_sound_drivers++;
#endif
#ifdef USE_PULSEAUDIO
    num_sound_drivers++;
#endif

    if (config->sound_driver >= num_sound_drivers)
        config->sound_driver = 0;

    set_combo ("sound_driver",              config->sound_driver);

    if (config->scale_method == FILTER_NTSC)
    {
        gtk_widget_show (get_widget ("ntsc_frame"));
    }
    else
    {
        gtk_widget_hide (get_widget ("ntsc_frame"));
    }

    if (config->scale_method == FILTER_SCANLINES)
    {
        gtk_widget_show (get_widget ("scanline_filter_frame"));
    }
    else
    {
        gtk_widget_hide (get_widget ("scanline_filter_frame"));
    }

    load_ntsc_settings ();
    set_combo ("ntsc_scanline_intensity",   config->ntsc_scanline_intensity);
    set_combo ("scanline_filter_intensity", config->scanline_filter_intensity);

    set_combo ("frameskip_combo",
               Settings.SkipFrames == AUTO_FRAMERATE ?
                   0 : Settings.SkipFrames + 1);
    set_check ("bilinear_filter",           config->bilinear_filter);

#ifdef USE_OPENGL
    set_check ("sync_to_vblank",            config->sync_to_vblank);
    set_check ("sync_every_frame",          config->sync_every_frame);
    set_check ("use_pbos",                  config->use_pbos);
    set_combo ("pixel_format",              config->pbo_format);
    set_check ("npot_textures",             config->npot_textures);
    set_check ("use_shaders",               config->use_shaders);
    set_entry_text ("fragment_shader",      config->fragment_shader);
#endif

#ifdef USE_JOYSTICK
    set_spin ("joystick_threshold",         config->joystick_threshold);
#else
    gtk_widget_set_sensitive (get_widget ("joystick_box"), FALSE);
#endif

    /* Control bindings */
    memcpy (pad, config->pad, (sizeof (JoypadBinding)) * NUM_JOYPADS);
    memcpy (shortcut, config->shortcut, (sizeof (Binding)) * NUM_EMU_LINKS);
    bindings_to_dialog (0);

    set_combo ("joypad_to_swap_with", 0);

    return;
}
Beispiel #10
0
		filesys_inf()
/*              Чтение информации о файловой системе
		в сответствующую структуру panels[]
		текущий каталог устанавливается в read_to_panel()
	panels[outpanel].total    * всего места на диске *
			.avail    * доступно для распределения не-super*
			.free     * свободно *
			.bs       * размер блока *
			.fragm    * fragment size *
			.itotal   * i-nodes всего *
			.iavail   * i-nodes доступно для распределения не-super *
			.ifree    * i-nodes свободно *
			.*fstype  * тип файловой системы *
			.*fsname  * имя файловой системы *
*****************************************************************************/

{
extern  int     outpanel;       /*обрабатываемая панель */
extern  struct  panel   panels[NPANELS];

#if defined( __svr4__ ) || defined( __SVR4 )
/*######################## SOLARIS 2.x & other SVR4 ########################*/

#include <sys/statvfs.h>
#define BUF2_SIZ (sizeof(buf.f_fstr)+1)

static  struct  statvfs buf;            /* буфер для statvfs() */
static  char    *name=".";            /* имя файла на файловой системе */
static  char    buf_fstr [BUF2_SIZ];    /*буфер для вывода buf.f_fstr*/
/*==========================================================================*/

if ( statvfs (name, &buf) != 0 ){
  panels[outpanel].total  = panels[outpanel].avail  =
  panels[outpanel].free   = panels[outpanel].bs     =
  panels[outpanel].fragm  = panels[outpanel].itotal =
  panels[outpanel].iavail = panels[outpanel].ifree  = 0L;

  panels[outpanel].fstype = panels[outpanel].fsname = "\0";
}

if(buf.f_frsize)
  {
    panels[outpanel].total = buf.f_frsize*(dev_data)buf.f_blocks;
    panels[outpanel].avail = buf.f_frsize*(dev_data)buf.f_bavail;
    panels[outpanel].free  = buf.f_frsize*(dev_data)buf.f_bfree;
  }else if(buf.f_bsize){
    panels[outpanel].total = buf.f_bsize*(dev_data)buf.f_blocks;
    panels[outpanel].avail = buf.f_bsize*(dev_data)buf.f_bavail;
    panels[outpanel].free  = buf.f_bsize*(dev_data)buf.f_bfree;
  }else{
    panels[outpanel].total = 1024*(dev_data)buf.f_blocks;
    panels[outpanel].avail = 1024*(dev_data)buf.f_bavail;
    panels[outpanel].free  = 1024*(dev_data)buf.f_bfree;
  }

panels[outpanel].bs     = buf.f_bsize;
panels[outpanel].fragm  = buf.f_frsize;
panels[outpanel].itotal = buf.f_files;
panels[outpanel].iavail = buf.f_favail;
panels[outpanel].ifree  = buf.f_ffree;
panels[outpanel].fstype = buf.f_basetype;

strncpy(buf_fstr , buf.f_fstr    , BUF2_SIZ-1 );
buf_fstr[BUF2_SIZ-1] = '\0';
panels[outpanel].fsname = buf_fstr;

#elif defined( LINUX )
/*########################### Linux ########################################*/
#include <sys/vfs.h>

	struct  statfs  buf;            /* буфер для statfs() */
	int     i;
static  char    *name=".";            /* имя файла на файловой системе */
struct  fstypes
	{
	char    *name;
	long    type;
	};
static  struct fstypes fstypes[]=
	{
	      {"EXT2_OLD_SUPER_MAGIC" , 0xEF51    },
	      {"EXT2_SUPER_MAGIC"     , 0xEF53    },
	      {"EXT_SUPER_MAGIC"      , 0x137D    },
	      {"ISOFS_SUPER_MAGIC"    , 0x9660    },
	      {"MINIX_SUPER_MAGIC"    , 0x137F    },/* orig. minix */
	      {"MINIX_SUPER_MAGIC2"   , 0x138F    },/* 30 char minix */
	      {"NEW_MINIX_SUPER_MAGIC", 0x2468    },/* minix V2 */
	      {"MSDOS_SUPER_MAGIC"    , 0x4d44    },
	      {"NFS_SUPER_MAGIC"      , 0x6969    },
	      {"PROC_SUPER_MAGIC"     , 0x9fa0    },
	      {"_XIAFS_SUPER_MAGIC"   , 0x012FD16D},
	      {NULL                   , 0         }
	};
/*==========================================================================*/

panels[outpanel].total  = panels[outpanel].avail  =
panels[outpanel].free   = panels[outpanel].bs     =
panels[outpanel].fragm  = panels[outpanel].itotal =
panels[outpanel].iavail = panels[outpanel].ifree  = -1L;
panels[outpanel].fstype = panels[outpanel].fsname = "\0";

if ( statfs (name, &buf) == 0 ) {
    if(buf.f_bsize > 0){
      if(buf.f_blocks>0) set_check(&panels[outpanel].total, (dev_data)buf.f_blocks,  (dev_data)buf.f_bsize);
      if(buf.f_bavail>0) set_check(&panels[outpanel].avail, (dev_data)buf.f_bavail, (dev_data)buf.f_bsize);
      if(buf.f_bfree>0)  set_check(&panels[outpanel].free , (dev_data)buf.f_bfree, (dev_data)buf.f_bsize);
    }

    panels[outpanel].bs     = buf.f_bsize;
    panels[outpanel].itotal = buf.f_files;
    panels[outpanel].ifree  = buf.f_ffree;

    for ( i=0; fstypes[i].name && fstypes[i].type!=buf.f_type; i++);
    if ( fstypes[i].name )
      {
	panels[outpanel].fstype = fstypes[i].name; /* нулевой указатель здесь не пройдет */
      }else{
	panels[outpanel].fstype = "Some Unknown!";
      }

}

#elif defined( FREEBSD )
/*########################### FreeBSD ########################################*/
#include <sys/param.h>
#include <sys/mount.h>

	struct  statfs  buf;            /* буфер для statfs() */
	int     i;
static  char    *name=".";            /* имя файла на файловой системе */
struct  fstypes
	{
	char    *name;
	long    type;
	};
static  struct fstypes fstypes[]=
	{
	      {"UFS"    , MOUNT_UFS   },
	      {"NFS"    , MOUNT_NFS   },
	      {"MFS"    , MOUNT_MFS   },
	      {"MSDOS"  , MOUNT_MSDOS },
	      {"LFS"    , MOUNT_LFS   },
	      {"LOFS"   , MOUNT_LOFS  },
	      {"FDESC"  , MOUNT_FDESC },
	      {"PORTAL" , MOUNT_PORTAL},
	      {"NULL"   , MOUNT_NULL  },
	      {"UMAP"   , MOUNT_UMAP  },
	      {"KERNFS" , MOUNT_KERNFS},
	      {"PROCFS" , MOUNT_PROCFS},
	      {"AFS"    , MOUNT_AFS   },
	      {"CD9660" , MOUNT_CD9660},
	      {"UNION"  , MOUNT_UNION },
	      {NULL     , 0           }
	};
/*==========================================================================*/

panels[outpanel].total  = panels[outpanel].avail  =
panels[outpanel].free   = panels[outpanel].bs     =
panels[outpanel].fragm  = panels[outpanel].itotal =
panels[outpanel].iavail = panels[outpanel].ifree  = -1L;
panels[outpanel].fstype = panels[outpanel].fsname = "\0";

if ( statfs (name, &buf) == 0 ) {
    if(buf.f_bsize > 0){
      if(buf.f_blocks>0) set_check(&panels[outpanel].total, (dev_data)buf.f_blocks,  (dev_data)buf.f_bsize);
      if(buf.f_bavail>0) set_check(&panels[outpanel].avail, (dev_data)buf.f_bavail, (dev_data)buf.f_bsize);
      if(buf.f_bfree>0)  set_check(&panels[outpanel].free , (dev_data)buf.f_bfree, (dev_data)buf.f_bsize);
    }

    panels[outpanel].bs     = buf.f_bsize;
    if(buf.f_files>0) panels[outpanel].itotal = buf.f_files;
    if(buf.f_ffree>0) panels[outpanel].ifree  = buf.f_ffree;

    for ( i=0; fstypes[i].name && fstypes[i].type!=buf.f_type; i++);
    if ( fstypes[i].name )
      {
	panels[outpanel].fstype = fstypes[i].name; /* нулевой указатель здесь не пройдет */
      }else{
	panels[outpanel].fstype = "Some Unknown!";
      }

}

#elif defined( SCO )

/*######################### SCO UNIX 3.2 & others ##########################*/
#include <sys/statfs.h>

/* это идиотизм, но SCO говорит, что buf.f_bsize==1024,
   и размер получается в 2 раза больше, чем надо!
 */
#define BLKSIZE 512

#define BUFNAME_SIZ (sizeof(buf.f_fname)+1)
#define BUFPACK_SIZ (sizeof(buf.f_fpack)+1)

	struct  statfs  buf;            /* буфер для statfs() */
static  char    *name=".";            /* имя файла на файловой системе */
static  char    buf_name[BUFNAME_SIZ];
static  char    buf_pack[BUFPACK_SIZ];
static  char    buf_fstype[10];         /* числовое значение типа файловой системы*/
/*==========================================================================*/

if ( statfs (name, &buf, sizeof(buf), 0) != 0 ){
  panels[outpanel].total  = panels[outpanel].avail  =
  panels[outpanel].free   = panels[outpanel].bs     =
  panels[outpanel].fragm  = panels[outpanel].itotal =
  panels[outpanel].iavail = panels[outpanel].ifree  = 0L;

  panels[outpanel].fstype = panels[outpanel].fsname = "\0";
}

strncpy(buf_name , buf.f_fname    , BUFNAME_SIZ-1 );
strncpy(buf_pack , buf.f_fpack    , BUFPACK_SIZ-1 );

buf_pack[BUFPACK_SIZ-1] = buf_name[BUFNAME_SIZ-1] = '\0';

if(buf.f_frsize)
  {
    set_check(&panels[outpanel].total, (dev_data)buf.f_frsize, (dev_data)buf.f_blocks);
    set_check(&panels[outpanel].avail, (dev_data)buf.f_frsize, (dev_data)buf.f_bfree);
    panels[outpanel].free  = -1; /* в структуре statfs отдельно нет, поэтому поставим ==free */
  }else{
    set_check(&panels[outpanel].total, (dev_data)BLKSIZE, (dev_data)buf.f_blocks);
    set_check(&panels[outpanel].avail, (dev_data)BLKSIZE, (dev_data)buf.f_bfree);
    panels[outpanel].free  = -1; /* в структуре statfs отдельно нет, поэтому поставим ==free */
  }

panels[outpanel].bs     = buf.f_bsize;
panels[outpanel].fragm  = buf.f_frsize;
panels[outpanel].itotal = buf.f_files;
panels[outpanel].iavail = /* в структуре statfs отдельно нет, поэтому поставим ==ifree */
panels[outpanel].ifree  = buf.f_ffree;

if(buf_name[0])
  {
    panels[outpanel].fsname = buf_name;
  }else{
    panels[outpanel].fsname = buf_pack;
  }

sprintf(buf_fstype, "%u", buf.f_fstyp);
panels[outpanel].fstype = buf_fstype;

#endif
}