Example #1
0
/*
* LoadResources: Load all resources into a newly allocated table.
*   Return True on success, False iff no resource files found.
*/
Bool LoadResources(void)
{
	Bool rsc_loaded, rsb_loaded;
	
	/* Initialize new table */
	t = table_create(TABLE_SIZE);
	
	ignore_duplicates = True;
	// Load combined rscs, then normal rscs
	rsb_loaded = LoadRscFilesSorted(rsb_spec);
	rsc_loaded = LoadRscFiles(rsc_spec);
	
	// Built-in resources for About box
	RscAddCallback("", ABOUT_RSC, "aarmor.bgf");
	RscAddCallback("", ABOUT_RSC1, "c1.bgf");
	RscAddCallback("", ABOUT_RSC2, "c2.bgf");
	RscAddCallback("", ABOUT_RSC3, "c3.bgf");
	RscAddCallback("", LAGBOXICON_RSC, "ilagbox.bgf");
	RscAddCallback("", LAGBOXNAME_RSC, "Latency");
	
	ignore_duplicates = False;
	
	if (!rsb_loaded && !rsc_loaded)
	{
		debug(("Couldn't load any resources!\n"));
		return False;
	}
	
	return True;
}
Example #2
0
int main(int argc, char **argv)
{
   int arg, len;
   char *output_filename;
   int output_file_found = 0;

   if (argc < 3)
      Usage();

   for (arg = 1; arg < argc; arg++)
   {
      len = strlen(argv[arg]);
      if (len == 0)
	 break;

      if (argv[arg][0] != '-')
	 break;

      if (len < 2)
      {
	 printf("Ignoring unknown option -\n");
	 continue;
      }

      switch(argv[arg][1])
      {
      case 'o':
	 arg++;
	 if (arg >= argc)
	 {
	    printf("Missing output filename\n");
	    break;
	 }
	 output_filename = argv[arg];
	 output_file_found = 1;
	 break;
      }
   }

   if (!output_file_found)
      Error("No output file specified");
   
   if (arg >= argc)
      Error("No input files specified");

   WrapInit();

   if (!LoadRscFiles(argc - arg, argv + arg))
      Error("Unable to load rsc files.");

   if (!SaveRscFile(output_filename))
      Error("Unable to save rsc file.");      

   WrapShutdown();
}