Example #1
0
void
game_init (const char *name)
{
  if (true == initialized)
    {
      LOG_FATAL ("already initialized");
    }

  conf_init ();

  log_set_name (name);
  log_set_verbose (conf_get_verbose ());

  filepath_init (conf_get_root ());
  video_init (conf_get_ratio (), conf_get_center ());
  keyboard_init ();

  char * const music_root = xmalloc (PATH_MAX);
  xsnprintf (music_root, PATH_MAX, "%s%cmusic", conf_get_root (),
             FILEPATH_SEPARATOR);
  audio_init (music_root);
  free (music_root);

  if (false == conf_get_music ())
    {
      audio_music_mute ();
    }
  if (false == conf_get_sound ())
    {
      audio_sound_mute ();
    }

  mouse_init ();

  pit_isr_is_installed = false;

  if (conf_get_fast ())
    {
      game_set_fps_high ();
    }
  else
    {
      game_set_fps_low ();
    }

  exit_clear ();

  initialized = true;
}
Example #2
0
int
main( int argc, char **argv )
{
    ARGPARSE_ARGS pargs;
    int rc=0;
    STRLIST sl;
    STRLIST nrings=NULL;
    unsigned configlineno;

    log_set_name("gpgv");
    init_signals();
    i18n_init();
    opt.command_fd = -1; /* no command fd */
    opt.pgp2_workarounds = 1;
    opt.keyserver_options.options|=KEYSERVER_AUTO_KEY_RETRIEVE;
    opt.trust_model = TM_ALWAYS;
    opt.batch = 1;
    opt.weak_digests = NULL;

    opt.homedir = default_homedir ();

    tty_no_terminal(1);
    tty_batchmode(1);
    dotlock_disable ();

    set_native_charset (NULL); /* Try to auto set the character set */
    additional_weak_digest("MD5");

    pargs.argc = &argc;
    pargs.argv = &argv;
    pargs.flags=  1;  /* do not remove the args */
    while( optfile_parse( NULL, NULL, &configlineno, &pargs, opts) ) {
	switch( pargs.r_opt ) {
	  case oQuiet: opt.quiet = 1; break;
          case oVerbose: g10_opt_verbose++;
		  opt.verbose++; opt.list_sigs=1; break;
          case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
	  case oStatusFD: set_status_fd( pargs.r.ret_int ); break;
	  case oLoggerFD: log_set_logfile( NULL, pargs.r.ret_int ); break;
	  case oHomedir: opt.homedir = pargs.r.ret_str; break;
	  case oWeakDigest: additional_weak_digest(pargs.r.ret_str); break;
	  case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
	  default : pargs.err = 2; break;
	}
    }

    if( log_get_errorcount(0) )
	g10_exit(2);

    g10_opt_homedir = opt.homedir;

    if( opt.verbose > 1 )
	set_packet_list_mode(1);

    if( !nrings )  /* no keyring given: use default one */
        keydb_add_resource ("trustedkeys" EXTSEP_S "gpg", 8, 0);
    for(sl = nrings; sl; sl = sl->next )
        keydb_add_resource (sl->d, 8, 0 );

    FREE_STRLIST(nrings);

    if( (rc = verify_signatures( argc, argv ) ))
        log_error("verify signatures failed: %s\n", g10_errstr(rc) );

    /* cleanup */
    g10_exit(0);
    return 8; /*NEVER REACHED*/
}