Example #1
0
/* Finds agup.cfg and add its contents to Allegro's current config. If agup.cfg
 * is found inside a datafile, the datafile is returned (and loaded if
 * necessary).
 */
static DATAFILE *
set_theme_config (char const *path, DATAFILE *datafile)
{
	DATAFILE *dat = NULL;

	if (path) {
		char *ext = get_extension (path);
		char str[1024 * 6];

		if (!strcmp (ext, "dat")) {
			dat = load_datafile (path);
			if (!dat)
				dat = datafile;
		}
		else if (!strcmp (ext, "cfg"))
			set_config_file (path);
		else {
			replace_extension (str, path, "dat", 1024 * 6);
			dat = load_datafile (str);
			if (!dat) {
				replace_extension (str, path, "cfg", 1024 * 6);
				set_config_file (str);
			}
		}
	}
	else
		dat = datafile;

	if (dat) {
		override_config_data (dat->dat, dat->size);
	}

	return dat;
}
Example #2
0
bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_property) {

	String name = p_name;

	if (name.begins_with("entry/")) {
		String key = name.substr(6, name.length() - 6);

		config_file->set_value("entry", key, p_property);

		set_config_file(config_file);

		return true;
	}

	if (name.begins_with("dependency/")) {
		String key = name.substr(11, name.length() - 11);

		config_file->set_value("dependencies", key, p_property);

		set_config_file(config_file);

		return true;
	}

	return false;
}
Example #3
0
/* init_config:
 *  Sets up the configuration routines ready for use, also loading the
 *  default config file if the loaddata flag is set and no other config
 *  file is in memory.
 */
static void init_config(int loaddata)
{
#if 0
   char buf[4][1025];
   char *s;
   int i;

   if (!config_installed) {
/*      _add_exit_func(config_cleanup);*/
      config_installed = TRUE;
   }

   if ((loaddata) && (!config[0])) {
      /* look for allegro.cfg in the same directory as the program */
      strcpy(buf[0], __crt0_argv[0]);
      strlwr(buf[0]);
      *get_filename(buf[0]) = 0;
      put_backslash(buf[0]);
      strcat(buf[0], "allegro.cfg");

      /* if that fails, try sound.cfg */
      strcpy(buf[1], __crt0_argv[0]);
      strlwr(buf[1]);
      *get_filename(buf[1]) = 0;
      put_backslash(buf[1]);
      strcat(buf[1], "sound.cfg");

      /* no luck? try the ALLEGRO enviroment variable... */
      s = getenv("ALLEGRO");
      if (s) {
	 strcpy(buf[2], s);
	 strlwr(buf[2]);
	 put_backslash(buf[2]);
	 strcat(buf[2], "allegro.cfg");

	 strcpy(buf[3], s);
	 strlwr(buf[3]);
	 put_backslash(buf[3]);
	 strcat(buf[3], "sound.cfg");
      }
      else {
	 strcpy(buf[2], buf[0]);
	 strcpy(buf[3], buf[1]);
      }
      /* see which of these files actually exist */
      for (i=0; i<4; i++) {
	 if (access (buf[i], R_OK)) {
	    set_config_file(buf[i]);
	    break;
	 }
      }

      if (i >= 4)
	 set_config_file(buf[0]);
   }
#endif   
}
Example #4
0
static char *_get_lang_name_from_file(const char *file_name, char *lang_code)
{
   char *line;
   char buf1[256], buf2[256];

   ASSERT(file_name);
   ASSERT(*file_name);
   ASSERT(lang_code);

   lang_code[0] = file_name[0];
   lang_code[1] = file_name[1];
   lang_code[2] = 0;

   get_executable_name(buf1, sizeof(buf1));
   replace_filename(buf2, buf1, file_name, sizeof(buf2));

   push_config_state();
   set_config_file(buf2);

   line = m_strdup(get_config_string(0, "language_name", ""));
   
   pop_config_state();

   if (*line)
      return line;

   free(line);
   return 0;
}
void LoadSavegame()
{


    set_config_file("Resources/Save.cfg");

    get_config_int("Savegame","FireH",FireH);
    get_config_int("Savegame","ThunderH",ThunderH);
    get_config_int("Savegame","WindH",WindH);
    get_config_int("Savegame","FreezeH",FreezeH);
    get_config_int("Savegame","FireB",FireB);
    get_config_int("Savegame","ThunderB",ThunderB);
    get_config_int("Savegame","WindB",WindB);
    get_config_int("Savegame","FreezeB",FreezeB);
    get_config_int("Savegame","FireS",FireS);
    get_config_int("Savegame","ThunderS",ThunderS);
    get_config_int("Savegame","WindS",WindS);
    get_config_int("Savegame","FreezeS",FreezeS);
    get_config_int("Savegame","FireM",FireM);
    get_config_int("Savegame","ThunderM",ThunderM);
    get_config_int("Savegame","WindM",WindM);
    get_config_int("Savegame","FreezeM",FreezeM);
    get_config_int("Savegame","FireW",FireW);
    get_config_int("Savegame","ThunderW",ThunderW);
    get_config_int("Savegame","WindW",WindW);
    get_config_int("Savegame","FreezeW",FreezeW);
}
Example #6
0
Configuration::Configuration() {
	Logfile::log("+Configuration at 0x%x\n", this);
	
	// Load in the config data
	set_config_file("lander.ini");

	showFPS = get_config_int("window","fps",0);
	fullscreen = get_config_int("window", "fullscreen", FALSE);

	sfx = get_config_int("audio","sfx",TRUE);
	music = get_config_int("audio","music",TRUE);

	musicVol = get_config_float("audio","musicvol",1.0f);
	soundVol = get_config_float("audio","soundvol",1.0f);
	
	Logfile::log("Configuration read:\n",0);
	Logfile::log(	"\tshowFPS: %d\n"
			"\tsfx: %d\n"
			"\tmusic: %d\n"
			"\tfullscreen: %d\n",
			showFPS, sfx, music, fullscreen);
	
	
	// This is lame, I know, but it gets the job done of turning
	// sound and music either on or off as specified in the file
	toggleSFX(); toggleSFX();
	toggleMusic(); toggleMusic();
}
Example #7
0
/* handle the save command */
int saver()
{
   char buf[FILENAME_LENGTH];

   strcpy(buf, config_file);

   if (file_select_ex("Save Keyboard Config", buf, "CFG", sizeof(buf), 0, 0)) {
      if ((stricmp(config_file, buf) != 0) && (exists(buf))) {
	 if (alert("Overwrite existing file?", NULL, NULL, "Yes", "Cancel", 'y', 27) != 1)
	    return D_REDRAW;
      }

      strlwr(buf);
      strcpy(config_file, buf);

      push_config_state();
      set_config_file(buf);

      set_config_string(NULL, "keyboard_name", keyboard_name);

      set_config_int("key_escape", "accent1", _key_accent1);
      set_config_int("key_escape", "accent2", _key_accent2);
      set_config_int("key_escape", "accent3", _key_accent3);
      set_config_int("key_escape", "accent4", _key_accent4);
      set_config_int("key_escape", "accent1_flag", _key_accent1_flag);
      set_config_int("key_escape", "accent2_flag", _key_accent2_flag);
      set_config_int("key_escape", "accent3_flag", _key_accent3_flag);
      set_config_int("key_escape", "accent4_flag", _key_accent4_flag);

      save_table(_key_ascii_table,               orig_key_ascii_table,               "key_ascii");
      save_table(_key_capslock_table,            orig_key_capslock_table,            "key_capslock");
      save_table(_key_shift_table,               orig_key_shift_table,               "key_shift");
      save_table(_key_control_table,             orig_key_control_table,             "key_control");

      if (split_altgr) {
         save_table(_key_altgr_lower_table,      orig_key_altgr_lower_table,         "key_altgr_lower");
         save_table(_key_altgr_upper_table,      orig_key_altgr_upper_table,         "key_altgr_upper");
      }
      else {
         save_table(_key_altgr_lower_table,      orig_key_altgr_lower_table,         "key_altgr");
      }

      save_table(_key_accent1_lower_table,       orig_key_accent1_lower_table,       "key_accent1_lower");
      save_table(_key_accent1_upper_table,       orig_key_accent1_upper_table,       "key_accent1_upper");
      save_table(_key_accent2_lower_table,       orig_key_accent2_lower_table,       "key_accent2_lower");
      save_table(_key_accent2_upper_table,       orig_key_accent2_upper_table,       "key_accent2_upper");
      save_table(_key_accent3_lower_table,       orig_key_accent3_lower_table,       "key_accent3_lower");
      save_table(_key_accent3_upper_table,       orig_key_accent3_upper_table,       "key_accent3_upper");
      save_table(_key_accent4_lower_table,       orig_key_accent4_lower_table,       "key_accent4_lower");
      save_table(_key_accent4_upper_table,       orig_key_accent4_upper_table,       "key_accent4_upper");

      pop_config_state();
   }

   return D_REDRAW;
}
Example #8
0
/* read_keyboard_config:
 *  Reads in the keyboard config tables.
 */
static void read_keyboard_config(void)
{
   char filename[1024], tmp1[128], tmp2[128], *ext, *datafile;
   AL_CONST char* name;

   name = get_config_string(uconvert_ascii("system", tmp1), uconvert_ascii("keyboard", tmp2), _keyboard_layout);

   if ((!name) || (!ugetc(name)))
      return;

   ext = uconvert_ascii(".cfg", tmp1);
   datafile = uconvert_ascii("keyboard.dat", tmp2);

   if (find_allegro_resource(filename, name, ext, datafile, NULL, NULL, NULL, sizeof(filename)) != 0)
      return;

   push_config_state();
   set_config_file(filename);

   read_key_table(custom_key_ascii_table,          standard_key_ascii_table,     "key_ascii");
   read_key_table(custom_key_capslock_table,       standard_key_capslock_table,  "key_capslock");
   read_key_table(custom_key_shift_table,          standard_key_shift_table,     "key_shift");
   read_key_table(custom_key_control_table,        standard_key_control_table,   "key_control");

   /* preserve backward compatibility with former unique key_altgr table */
   read_key_table(custom_key_altgr_lower_table,    standard_key_empty_table,     "key_altgr");
   read_key_table(custom_key_altgr_upper_table,    standard_key_empty_table,     "key_altgr");

   read_key_table(custom_key_altgr_lower_table,    custom_key_altgr_lower_table, "key_altgr_lower");
   read_key_table(custom_key_altgr_upper_table,    custom_key_altgr_upper_table, "key_altgr_upper");

   read_key_table(custom_key_accent1_lower_table,  standard_key_empty_table,     "key_accent1_lower");
   read_key_table(custom_key_accent1_upper_table,  standard_key_empty_table,     "key_accent1_upper");
   read_key_table(custom_key_accent2_lower_table,  standard_key_empty_table,     "key_accent2_lower");
   read_key_table(custom_key_accent2_upper_table,  standard_key_empty_table,     "key_accent2_upper");
   read_key_table(custom_key_accent3_lower_table,  standard_key_empty_table,     "key_accent3_lower");
   read_key_table(custom_key_accent3_upper_table,  standard_key_empty_table,     "key_accent3_upper");
   read_key_table(custom_key_accent4_lower_table,  standard_key_empty_table,     "key_accent4_lower");
   read_key_table(custom_key_accent4_upper_table,  standard_key_empty_table,     "key_accent4_upper");

   _key_accent1 = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent1", tmp2), 0);
   _key_accent2 = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent2", tmp2), 0);
   _key_accent3 = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent3", tmp2), 0);
   _key_accent4 = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent4", tmp2), 0);

   _key_accent1_flag = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent1_flag", tmp2), 0);
   _key_accent2_flag = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent2_flag", tmp2), 0);
   _key_accent3_flag = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent3_flag", tmp2), 0);
   _key_accent4_flag = get_config_int(uconvert_ascii("key_escape", tmp1), uconvert_ascii("accent4_flag", tmp2), 0);

   pop_config_state();

   set_custom_keyboard();

   update_key_descriptions();
}
Example #9
0
CPlayer::CPlayer(int x,int y,char *key_bindings_file,int solid)
{	
	set_config_file(key_bindings_file);
	key_left = get_config_int(NULL,"LEFT",0);
	key_right = get_config_int(NULL,"RIGHT",0);
	key_fire  = get_config_int(NULL,"FIRE",0);
	
	this->x = x;
	this->y = y;
	set_config_file(DEFAULT_PLAYER_CONFIG_FILE);
	bonus_frequency = default_bonus_frequency = get_config_int(NULL,"bonus_rate",5);
	more_bonuses_modifier = get_config_int(NULL,"more_bonuses_modifier",1);
	more_bonuses_duration = get_config_int(NULL,"more_bonuses_duration",10);
	
	move_speed = default_move_speed = get_config_int(NULL,"pad_speed",100);
	speed_modifier = get_config_int(NULL,"player_speed_modifier",5);
	
	set_color_conversion(COLORCONV_TOTAL);
	model = load_bitmap("/home/valo/Projects/breakin/graphics/batata.bmp",NULL);
	width = model->w;
	height = model->h;
	
	score = 0;
	last_scored = -30;
	bonus_points = 0;
	
	solid_walls = solid;
	
	immortal_time = get_config_int(NULL,"immortal_time",10);
	
	penetrating = false;
	penetration_time = get_config_int(NULL,"penetration_duration",10);
	
	ball_speed = default_ball_speed = get_config_int(NULL,"ball_speed",5);
	ball_speed_modifier = get_config_int(NULL,"ball_speed_modifier",10);
	
	fast_hit_max_time = get_config_float(NULL,"fast_hit_max_time",0.5);
	
	status_font1 = alfont_load_font(STATUS_FONT1_FILENAME);
	status_font2 = alfont_load_font(STATUS_FONT2_FILENAME);
	alfont_set_font_size(status_font1,50);
	alfont_set_font_size(status_font2,20);
}
Example #10
0
KeyHandler::KeyHandler() {
	Logfile::log("+KeyHandler at 0x%x\n", this);

	set_config_file("lander.ini");
	kLeft = get_config_int("keys","left",KEY_RIGHT);
	kRight= get_config_int("keys","right",KEY_LEFT);
	kMax = get_config_int("keys","max",KEY_Q);
	kMed = get_config_int("keys","med",KEY_A); 
	kMin = get_config_int("keys","mid",KEY_Z);
	kAll = get_config_int("keys","all",KEY_W);
}
Example #11
0
int main(int argc, char **argv)
{
	bool fullScreen;
	int windowW, windowH;

	srand(time(0));
	allegro_init();

	install_keyboard();
	install_mouse();
	install_timer();
	install_joystick(JOY_TYPE_AUTODETECT);

	set_color_depth(32);

	CheckMIDIs();
	set_config_file("trog.cfg");

	CfgLoad();

	set_gfx_mode(cfgFull ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, std::atoi(cfgW), std::atoi(cfgH), 0, 0);
	install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, 0);

	set_window_title("The Revenge of Gregorius");
	set_display_switch_mode(SWITCH_BACKGROUND);
	set_display_switch_callback(SWITCH_OUT, &SwitchOut);
	
	LoadSoundVolumes("sounds.cfg");
	game.Init();

	bool notQuit = true;
	while(notQuit)
	{
		int ret = MainMenu();
		switch(ret)
		{
			case 0:
				game.zoomMode = cfgZoom;
				game.Start(-1);
				break;
			case 1:
				DoConfiguration();
				break;
			case 2:
				notQuit = false;
				break;
		}
	}
	return 0;
}
Example #12
0
KeyHandler::~KeyHandler()
{
	// Save key configuration
	set_config_file("lander.ini");
	set_config_int("keys","left",kLeft);
	set_config_int("keys","right",kRight);
	set_config_int("keys","max",kMax);
	set_config_int("keys","med",kMed); 
	set_config_int("keys","min",kMin);
	set_config_int("keys","all",kAll);

	flush_config_file();
	Logfile::log("-KeyHandler at 0x%x\n", this);
}
Example #13
0
void Init_INI(void)
{
    unsigned long cver, iniver;

    // initialize the system - create the ini file if necessary
    if (!exists(CONFIG_FILE))
    {
	set_config_file(CONFIG_FILE);
	set_config_int("System", "Version_Major", NEWINI_MAJOR);
	set_config_int("System", "Version_Minor", NEWINI_MINOR);
	set_config_string("System", "Info", CONFIG_INFO);
	set_config_string("System", "Author", CONFIG_AUTHOR);
	set_config_string("System", "ROMPath", DEFAULT_PATH);
	Save_INI();
    } else {
	set_config_file(CONFIG_FILE);
	Load_INI();
    }

    ini_version_major = get_config_int("System", 
				    "Version_Major", ini_version_major);
    ini_version_minor = get_config_int("System", 
				    "Version_Minor", ini_version_minor);

    cver = ((NEWINI_MAJOR)<<16) + NEWINI_MINOR;
    iniver = ((ini_version_major)<<16) + ini_version_minor;

    if (cver < iniver)
    {
	printf("ERROR: The \"%s\" file is newer than TURACO.\n"
	     "       There might be problems when running TURACO!\n"
	     "       Winging it!   Press any key to continue...\n",
	     CONFIG_FILE);
	(void)getch();
    }
}
Example #14
0
/* handle the save command */
static void save_key_map(void)
{
   int i;
   char *section, *option_format, option[80], tmp1[80], tmp2[80];

   set_config_file("xkeymap.cfg");
   section = uconvert_ascii("xkeymap", tmp1);
   option_format = uconvert_ascii("keycode%d", tmp2);

   for (i = 0; i < 256; i++) {
      if (keycode_to_scancode[i] > 0) {
	 uszprintf(option, sizeof(option), option_format, i);
	 set_config_int(section, option, keycode_to_scancode[i]);
      }
   }
}
Example #15
0
void load_options(void)
{
	{
		char ef[256], cf[256];

		get_executable_name(ef, 256);
		replace_filename(cf, ef, "studio.ini", 256);

		set_config_file(cf);
	}

	opt.gfx_w = get_config_int("options", "gfx_w", DEF_GFX_W);
	opt.gfx_h = get_config_int("options", "gfx_h", DEF_GFX_H);

	atexit(&save_options);
}
Example #16
0
/* save_joystick_data:
 *  After calibrating a joystick, this function can be used to save the
 *  information into the specified file, from where it can later be 
 *  restored by calling load_joystick_data().
 */
int save_joystick_data(char *filename)
{
   if (filename) {
      push_config_state();
      set_config_file(filename);
   }

   set_config_id("joystick", "joytype", joy_type);

   if ((joystick_driver) && (joystick_driver->save_data))
      joystick_driver->save_data();

   if (filename)
      pop_config_state();

   return 0;
}
Example #17
0
Configuration::~Configuration() {
	// Save game information
	set_config_file("lander.ini");

	// todo: get the window's coordinates
	set_config_int("window","posx",-1);
	set_config_int("window","posy",-1);
	set_config_int("window","fullscreen",fullscreen);

	set_config_int("audio","sfx",sfx);
	set_config_int("audio","music",music);
	flush_config_file();
	
	Logfile::log("Window and Audio config settings saved.\n");
	
	Logfile::log("-Configuration at 0x%x\n", this);
}
Example #18
0
int main(int argc, unsigned char **argv)
{
  /* Variables located at IR.config */
  int Resol_X, Resol_Y, count;
  char **screen;
  
  if (allegro_init() != 0)   /* you should always do this at the start of Allegro programs */
    return 1;
  
  set_config_file("config/Coco.config");  /* Read configuration file */
  
  install_keyboard();   /* set up the keyboard handler */
  install_timer();	/* set up the timer handler */
  
  set_color_depth(32);  
  /* Get screen resolution from Coco.config */
  screen = get_config_argv("content", "SCREEN_SIZE", &count);
  Resol_X = atoi(screen[0]);  Resol_Y = atoi(screen[1]);
  if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, Resol_X, Resol_Y, 0, 0) != 0)   /* for X */
    {
      if (set_gfx_mode(GFX_SAFE, Resol_X, Resol_Y, 0, 0) != 0)        /* for console */
	{
	  set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
	  allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
	  return 1;
	}
    }
  
  /* Check if all images exists before trying to blit'em */
  /* Add some protection */
  
  set_palette(desktop_palette);   /* set the color palette */
  
  /* Read desired sampling time in IR.config */
  Delay= (get_config_float("content", "Delay", 0));  
  
  iSP= (get_config_float("content", "iSP", 0));  
  SP= iSP*3.68;
  
  /* Go to Register the user and run the program after having hardware initialized */

  Register();
  return 0;  
}
Example #19
0
void Level::loadCore(int level)
{
	set_config_file("core.ini");

	char section[256];
	sprintf(section,"level%02d",level);

	zoom2x = get_config_int(section,"zoom2x",-1);
	zoom2y = get_config_int(section,"zoom2y",-1);
	zoom5x = get_config_int(section,"zoom5x",-1);
	zoom5y = get_config_int(section,"zoom5y",-1);
	zoom10x = get_config_int(section,"zoom10x",-1);
	zoom10y = get_config_int(section,"zoom10y",-1);

	pad2x1 = get_config_int(section,"pad2x1",-1);
	pad2x2 = get_config_int(section,"pad2x2",-1);
	pad2y = get_config_int(section,"pad2y",-1);

	pad5x1 = get_config_int(section,"pad5x1",-1);
	pad5x2 = get_config_int(section,"pad5x2",-1);
	pad5y = get_config_int(section,"pad5y",-1);

	pad10x1 = get_config_int(section,"pad10x1",-1);
	pad10x2 = get_config_int(section,"pad10x2",-1);
	pad10y = get_config_int(section,"pad10y",-1);

	label2x = get_config_int(section,"label2x",-1);
	label2y = get_config_int(section,"label2y",-1);

	label5x = get_config_int(section,"label5x",-1);
	label5y = get_config_int(section,"label5y",-1);

	label10x = get_config_int(section,"label10x",-1);
	label10y = get_config_int(section,"label10y",-1);

	brandx = get_config_int(section,"brandx",-1);
	brandy = get_config_int(section,"brandy",-1);

	const char *tmp = get_config_string(section,"name","name not specified");
	sprintf(name,tmp);

	levelNumber = level;
}
Example #20
0
/* load_joystick_data:
 *  Restores a set of joystick calibration data previously saved by
 *  save_joystick_data().
 */
int load_joystick_data(char *filename)
{
   int ret, c;

   joy_loading = TRUE;

   if (_joystick_installed)
      remove_joystick();

   if (filename) {
      push_config_state();
      set_config_file(filename);
   }

   joy_type = get_config_id("joystick", "joytype", -1);

   if (joy_type < 0) {
      joy_type = JOY_TYPE_NONE;
      ret = -1;
   }
   else {
      ret = install_joystick(joy_type);

      if (ret == 0) {
	 if (joystick_driver->load_data)
	    ret = joystick_driver->load_data();
      }
   }

   if (filename)
      pop_config_state();

   if (ret == 0) {
      for (c=0; c<num_joysticks; c++)
	 update_calib(c);

      poll_joystick();
   }

   joy_loading = FALSE;

   return ret;
}
Example #21
0
// saves the current palette
void SavePalette(int NumCols, int PalIndex, int CurrentPal, int IniFilePalNum)
{
   char * Buffer;
   char NumBuf[10];
   int j;

   // This buffer will hold number like the following:
   // 4 255 255 255  255 255 255
   // Note the 10 allows for the first number, space and a bit of overhead
   // the 13 allows for "255 255 255  ".
   // This is dynamically allocated as we don't know how much space is required
   // until we know the number of colours
   Buffer = malloc(10 + (NumCols * 13));
   if (Buffer == NULL)
   {
      alert("Error", "Failed to save palette!", NULL,  "&Okay", NULL, 'O', 0);
      return;
   }
   sprintf(Buffer, "%d ", NumCols);

   for (j = 0; j < NumCols; j ++)
   {
      int Offset = NumCols * CurrentPal;

      sprintf(NumBuf, "%d ", ColPalettes[PalIndex][j + Offset].r);
      strcat(Buffer, NumBuf);
      sprintf(NumBuf, "%d ", ColPalettes[PalIndex][j + Offset].g);
      strcat(Buffer, NumBuf);
      sprintf(NumBuf, "%d  ", ColPalettes[PalIndex][j + Offset].b);
      strcat(Buffer, NumBuf);
   }

   // now write out the buffer
   sprintf(NumBuf, "Palette%d", IniFilePalNum);

   push_config_state();
   set_config_file(INI_Driver_Path);
   set_config_string("Palette", NumBuf, Buffer);
   pop_config_state();

   free (Buffer);
}
Example #22
0
File: lcd.c Project: cravo/damp
void lcd_init(void)
{
   set_config_file(damp_ini_file);

   /* Load the driver */

   lcd_load_driver(get_config_string("[lcd]","driver","NONE"));

   /* Call the driver's init function */

   lcd_external_function("lcd_driver_init");

   /* Read LCD variables from the ini file */

   lcd_scroll_speed = get_config_int("[lcd]","scroll_speed",4);
   lcd_display_width = get_config_int("[lcd]","display_width",16);
   lcd_display_lines = get_config_int("[lcd]","display_lines",2);
   lcd_require_update = FALSE;

   /* Set up the scroller */

   lcd_scroll_pos = 0;
   sprintf(lcd_scroll_text,"%*c\n",lcd_display_width,' ');

   LOCK_FUNCTION(lcd_scroll);
   LOCK_VARIABLE(lcd_scroll_pos);
   LOCK_VARIABLE(lcd_require_update);
   install_int_ex(lcd_scroll,BPS_TO_TIMER(lcd_scroll_speed));

   /* Display driver details */

   printf("======================================================================\n");
   printf("DAMP LCD Driver\n");
   printf("======================================================================\n");
   printf("Driver name        : %s\n",lcd_driver_name);
   printf("Driver version     : %.2f\n",lcd_driver_version);
   printf("Author name        : %s\n",lcd_driver_author);
   printf("Author email       : %s\n",lcd_driver_author_email);
   printf("Driver description : %s\n",lcd_driver_description);
   printf("\n\n");

}
Example #23
0
void keyswitch(int keyswitch_lang)
{
	push_config_state();
	set_config_file(F("$(home)/ufo2000.ini"));

	switch (keyswitch_lang) {
		case 0: {
			const char *current_keyboard = get_config_string("system", "keyboard", "us");
			const char *primary_keyboard = get_config_string("system", "primary_keyboard", "us");
			const char *secondary_keyboard = get_config_string("system", "secondary_keyboard", "ru");
			if (strcmp(current_keyboard, primary_keyboard) == 0)
				set_config_string("system", "keyboard", secondary_keyboard);
			else
				set_config_string("system", "keyboard", primary_keyboard);
			break;
		}
		case KEY_E: 
			set_config_string("system", "keyboard", "us"); 
			break;
		case KEY_R: 
			set_config_string("system", "keyboard", "ru"); 
			break;
		case KEY_B: 
			set_config_string("system", "keyboard", "by"); 
			break;
		case KEY_P: 
			set_config_string("system", "keyboard", "pl"); 
			break;
		case KEY_D: 
			set_config_string("system", "keyboard", "de"); 
			break;
		default: 
			pop_config_state(); 
			return;
	}
	
	clear_keybuf();
	remove_keyboard();
	install_keyboard();
	pop_config_state();
}
int change_resolution(int fullscreen, int ResIndex)
{
    int screen_mode;
    if(!IsInstalled)
    {
        return install(fullscreen,800,480,32); //Security mesure
    }

    KillTextures();
    allegro_gl_set(AGL_COLOR_DEPTH, Resolutions->mode[ResIndex].bpp);
    if(fullscreen)
        screen_mode=GFX_OPENGL_FULLSCREEN;
    else
        screen_mode=GFX_OPENGL_WINDOWED;

    if (set_gfx_mode(screen_mode, Resolutions->mode[ResIndex].width,Resolutions->mode[ResIndex].height, 0, 0))
    {
        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
        allegro_message("Unable to set graphic mode\n%s\n", allegro_error);
        return 1;
    }

    SetOpenGL2D();
    RefreshGLTextures();
    AspectRatio=(float)SCREEN_W/(float)SCREEN_H;
    Fullscreen=fullscreen;
    Width=Resolutions->mode[ResIndex].width;
    Height=Resolutions->mode[ResIndex].height;
    depth=Resolutions->mode[ResIndex].bpp;
    ResolutionIndex=ResIndex;
    set_config_file("Resources/Setting.cfg");
    set_config_int("graphics","Fullscreen",Fullscreen);
    set_config_int("graphics","Width",Width);
    set_config_int("graphics","Height",Height);
    set_config_int("graphics","depth",depth);
    set_config_int("graphics","ResolutionIndex",ResIndex);
    flush_config_file();
    LoadSavegame();
    return 0;
}
Example #25
0
config_handler::config_handler( string fpath, string fname = "" )
{
  string mn = "config_handler:"; 
  cout<<mn<<" Constructor started for file \""<<fname<<"\"."<<endl;

  debug = true;
  init();


  if( fpath == "" ) fpath = utils::get_home_dir();
  if( fname == "" ) utils::get_base( fpath );
  if( fname == "" ) fname = "cirainbow.conf";

  // make sure default or custom config file is found
  // User coice, home directory "cirainbow.conf", local directory "sound_settings.conf"
  if( utils::is_file_readable( utils::pathify(fpath) + fname ) == false ) {

    cout<<cn<<mn<<" Initial config file not accesable at: \""<<utils::pathify(fpath)+fname<<"\"."<<endl;
    fpath = utils::get_base_dir();
    fname = "sound_settings.conf";
  }

  //cout<<cn<<mn<<" Config file here: \""<<utils::pathify(fpath)+fname<<"\"."<<endl; //TEST
  //exit( 0 ); //TEST


  set_config_file_path( fpath );
  set_config_file_name( fname );

  string configFile = get_config_file_path() + get_config_file_name();
  set_config_file( configFile );

  cout<<cn<<mn<<" Config file here: \""<<get_config_file()<<"\"."<<endl;


  read_config( configFile );


  cout<<cn<<mn<<" Constructor finished for file \""<<fname<<"\"."<<endl;
}
Example #26
0
void Preferences::serializeDocPref(const app::Document* doc, app::DocumentPreferences* docPref, bool save)
{
  bool specific_file = false;

  if (doc) {
    if (!doc->isAssociatedToFile())
      return;

    push_config_state();
    set_config_file(docConfigFileName(doc).c_str());
    specific_file = true;
  }

  if (save)
    docPref->save();
  else
    docPref->load();

  if (specific_file) {
    flush_config_file();
    pop_config_state();
  }
}
Example #27
0
int main(void)
{

/*
The following code is for use if your system is set up to prevent an application writing to its own directory.
Normally this will prevent highscores and key configurations being saved, but the following code puts the
initfile in a better place. This may be a default on some systems (eg Unixes and possibly Windows Vista)
and can be set on some other systems.

The only problem with this is that you'll have to manually type or copy the various other options (windowed,
vsync, joystick buttons etc) into the initfile in this new location (or just copy the initfile across, or
just rely on the default values and let the game make a new initfile).

Thanks to Thomas Harte for this code! I had no idea it was necessary (it isn't on my Windows XP computer, and
I haven't tested it).

*/




int allint =  allegro_init();
   if (allint == -1)
   {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Failed to initialise Allegro! This isn't going to work, sorry.");
      exit(1);
   }

//#define UNIX_OSX_VISTA_ETC

#ifdef UNIX_OSX_VISTA_ETC

   {

//     char *HPath = getenv("HOME");

// use this if for some reason you're running Windows Vista:
        char *HPath = getenv("APPDATA");

	 char ConfigPath[2048];

	 sprintf(ConfigPath, "%s/.Hspider", HPath);
	 set_config_file(ConfigPath);

   }
#else
   set_config_file("init.txt");
#endif

   install_keyboard();
   install_timer();

   three_finger_flag = 0;
   key_led_flag = 0;

 init_at_startup();

// now we've initialised, let's play the game!
// game_loop();
 startup_menu();

 return 0;

}
void inicia_allegro() {
	int profundidade, res;
	allegro_init();
	install_timer();
	install_keyboard();
	clear_keybuf();
	install_mouse();

	set_uformat(U_ASCII); // Habilita acentuação em ALGUMAS FONTES
	/*profundidade = desktop_color_depth();
	if (profundidade == 0) profundidade = 32;
	   set_color_depth(profundidade);*/

	//roda configuracao de um arquivo
	set_config_file("config.txt");

	profundidade = get_config_int("Inicializacao", "colordepth",32);
	int v = GetVersion() & 65535;
    float versao = (v%256) + (v/256)/10.;
    /*if (versao<=5.1) //5.1 = XP, 6.0 = Vista, 6.1 Win7
        profundidade=16;
    else
        profundidade=32;*/

	set_color_depth(profundidade); //padrao é 32 bits, no XP é 16

	volume=get_config_int("Inicializacao", "volume", 128); //usa as config de volume do arquivo
	exibirFPS=get_config_int("Inicializacao", "exibirFps", 0);

	#define GFX_BWINDOWSCREEN_ACCEL AL_ID('B','W','S','A')
	#define GFX_BWINDOWSCREEN        AL_ID('B','W','S',' ')
    AL_VAR(GFX_DRIVER, gfx_beos_bwindowscreen_accel);
    AL_VAR(GFX_DRIVER, gfx_beos_bwindowscreen);

	vSync = get_config_int("Inicializacao", "vsync",0);
	resolucaoX = get_config_int("Inicializacao", "resolucaox",800);
	resolucaoY = get_config_int("Inicializacao", "resolucaoy",600);
    //Fullscreen
    //res = set_gfx_mode(GFX_AUTODETECT_FULLSCREEN & GFX_BWINDOWSCREEN_ACCEL, resolucaoX, resolucaoY, 0, 0);
    //Janela
	res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, resolucaoX, resolucaoY, 0, 0);
	if (res != 0) {
		allegro_message(allegro_error);
		exit(-1);
	}
	if(install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL))
    {
        allegro_message("Sound Error: %s", allegro_error);
    }

	//inicializa o metodo de atualizacao
	initialize_screen_updating(get_config_int("Inicializacao", "updatemethod", UPDATE_TRIPLE_BUFFER));

    set_window_title("Snake Criado por Arthur Assuncao"); //nome da Janela

    set_display_switch_mode(SWITCH_BACKGROUND); //roda o allegro em segundo plano

    //Botao fechar
    LOCK_FUNCTION(BotaoFechar);
    set_close_button_callback(BotaoFechar);

	//Contador de frames
	// Faz o lock das variaveis usadas pela funcao de timer e da propria funcao
    LOCK_VARIABLE(fps);
    LOCK_VARIABLE(contFrames);
    LOCK_FUNCTION(funcFPS);
	//chama a funcao funcFPS
	install_int_ex(funcFPS,BPS_TO_TIMER(MAXFPS)); //Frames por segundo, 60FPS
	//chama a funcao funcTempo
	LOCK_VARIABLE(contTempo);
    LOCK_FUNCTION(funcTempo);
	install_int(funcTempo, 1000); //Timer "ticks" a cada mil milisegundos, ou seja, 1 segundo

	/* adicione outras iniciacoes aqui */
}
Example #29
0
int main(int argc, const char *const *argv) /* I'm const-crazy! */
{
	DUH *duh;          /* Encapsulates the music file. */
	AL_DUH_PLAYER *dp; /* Holds the current playback state. */

	/* Initialise Allegro */
	if (allegro_init())
		return EXIT_FAILURE;

	/* Check that we have one argument (plus the executable name). */
	if (argc != 2)
		usage(argv[0]);

	/* Tell Allegro where to find configuration data. This means you can
	 * put any settings for Allegro in dumb.ini. See Allegro's
	 * documentation for more information.
	 */
	set_config_file("dumb.ini");

	/* Initialise Allegro's keyboard input. */
	if (install_keyboard()) {
		allegro_message("Failed to initialise keyboard driver!\n");
		return EXIT_FAILURE;
	}

	/* This function call is appropriate for a program that will play one
	 * sample or one audio stream at a time. If you have sound effects
	 * too, you may want to increase the parameter. See Allegro's
	 * documentation for details on what the parameter means. Note that
	 * newer versions of Allegro act as if set_volume_per_voice() was
	 * called with parameter 1 initially, while older versions behave as
	 * if -1 was passed, so you should call the function if you want
	 * consistent behaviour.
	 */
	set_volume_per_voice(0);

	/* Initialise Allegro's sound output system. */
	if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL)) {
		allegro_message("Failed to initialise sound driver!\n%s\n", allegro_error);
		return EXIT_FAILURE;
	}

	/* dumb_exit() is a function defined by DUMB. This operation arranges
	 * for dumb_exit() to be called last thing before the program exits.
	 * dumb_exit() does a bit of cleaning up for you. atexit() is
	 * declared in stdlib.h.
	 */
	atexit(&dumb_exit);

	/* DUMB defines its own wrappers for file input. There is a struct
	 * called DUMBFILE that holds function pointers for the various file
	 * operations needed by DUMB. You can decide whether to use stdio
	 * FILE objects, Allegro's PACKFILEs or something else entirely. No
	 * wrapper is installed initially, so you must call this or
	 * dumb_register_stdfiles() or set up your own before trying to load
	 * modules by file name. (If you are using another method, such as
	 * loading an Allegro datafile with modules embedded in it, then DUMB
	 * never opens a file by file name so this doesn't apply.)
	 */
	dumb_register_packfiles();

	/* Load the module file into a DUH object. Quick and dirty: try the
	 * loader for each format until one succeeds. Note that 15-sample
	 * mods have no identifying features, so dumb_load_mod() may succeed
	 * on files that aren't mods at all. We therefore try that one last.
	 */
	duh = dumb_load_it(argv[1]);
	if (!duh) {
		duh = dumb_load_xm(argv[1]);
		if (!duh) {
			duh = dumb_load_s3m(argv[1]);
			if (!duh) {
				duh = dumb_load_mod(argv[1]);
				if (!duh) {
					allegro_message("Failed to load %s!\n", argv[1]);
					return EXIT_FAILURE;
				}
			}
		}
	}

	/* Read the quality values from the config file we told Allegro to
	 * use. You may want to hardcode these or provide a more elaborate
	 * interface via which the user can control them.
	 */
	dumb_resampling_quality = get_config_int("sound", "dumb_resampling_quality", 4);
	dumb_it_max_to_mix = get_config_int("sound", "dumb_it_max_to_mix", 128);

	/* If we're not in DOS, show a window and register our close hook
	 * function.
	 */
#	ifndef ALLEGRO_DOS
		{
			const char *fn = get_filename(argv[1]);
			gfx_half_width = strlen(fn);
			if (gfx_half_width < 22) gfx_half_width = 22;
			gfx_half_width = (gfx_half_width + 2) * 4;

			/* set_window_title() is not const-correct (yet). */
			set_window_title((char *)"DUMB Music Player");

			if (set_gfx_mode(GFX_DUMB_MODE, gfx_half_width*2, 80, 0, 0) == 0) {
				acquire_screen();
				textout_centre(screen, font, fn, gfx_half_width, 20, 14);
				textout_centre(screen, font, "Press any key to exit.", gfx_half_width, 52, 11);
				release_screen();
			} else
				gfx_half_width = 0;
		}

		/* Silly check to get around the fact that someone stupidly removed
		 * an old function from Allegro instead of deprecating it. The old
		 * function was put back a version later, but we may as well use the
		 * new one if it's there!
		 */
#		if ALLEGRO_VERSION*10000 + ALLEGRO_SUB_VERSION*100 + ALLEGRO_WIP_VERSION >= 40105
			set_close_button_callback(&closehook);
#		else
			set_window_close_hook(&closehook);
#		endif

#	endif

	/* We want to continue running if the user switches to another
	 * application.
	 */
	set_display_switch_mode(SWITCH_BACKGROUND);

	/* We have the music loaded, but it isn't playing yet. This starts it
	 * playing. We construct a second object, the AL_DUH_PLAYER, to
	 * represent the playing music. This means you can play the music
	 * twice at the same time should you want to!
	 *
	 * Specify the number of channels (2 for stereo), which 'signal' to
	 * play (always 0 for modules), the volume (1.0f for default), the
	 * buffer size (4096 generally works well) and the sampling frequency
	 * (ideally match the final output frequency Allegro is using). An
	 * Allegro audio stream will be started.
	 */
	dp = al_start_duh(duh, 2, 0, 1.0f,
		get_config_int("sound", "buffer_size", 4096),
		get_config_int("sound", "sound_freq", 44100));

	/* Register our callback functions so that they are called when the
	 * music loops or stops. See docs/howto.txt for more information.
	 * There is no threading issue: DUMB will only process playback
	 * in al_poll_duh(), which we call below.
	 */
	{
		DUH_SIGRENDERER *sr = al_duh_get_sigrenderer(dp);
		DUMB_IT_SIGRENDERER *itsr = duh_get_it_sigrenderer(sr);
		dumb_it_set_loop_callback(itsr, &loop_callback, NULL);
		dumb_it_set_xm_speed_zero_callback(itsr, &xm_speed_zero_callback, NULL);
	}

	/* Main loop. */
	for (;;) {
		/* Check for keys in the buffer. If we get one, discard it
		 * and exit the main loop.
		 */
		if (keypressed()) {
			readkey();
			break;
		}

		/* Poll the music. We exit the loop if al_poll_duh() has
		 * returned nonzero (music finished) or the window has been
		 * closed. al_poll_duh() might return nonzero if you have set
		 * up a callback that tells the music to stop.
		 */
		if (al_poll_duh(dp) || closed)
			break;

		/* Give other threads a look-in, or allow the processor to
		 * sleep for a bit. YIELD() is defined further up in this
		 * file.
		 */
		YIELD();
	}

	/* Remove the audio stream and deallocate the memory being used for
	 * the playback state. We set dp to NULL to emphasise that the object
	 * has gone.
	 */
	al_stop_duh(dp);
	dp = NULL;

	/* Free the DUH object containing the actual music data. */
	unload_duh(duh);
	duh = NULL;

	/* All done! */
	return EXIT_SUCCESS;
}
Example #30
0
void init_config(void)
{

set_config_file("lacew.cfg");

 char miscstring [40];
 char wstring [40];
 char itstring [40];
 int i;

 options.sound_init = get_config_int("Options", "Sound_init", 1);
 options.sound_mode = get_config_int("Options", "Sound_mode", SOUNDMODE_STEREO);
 options.run_vsync = get_config_int("Options", "Run_vsync", 0);
 options.sound_volume = get_config_int("Options", "Sound_volume", 100);
 options.ambience_volume = get_config_int("Options", "Ambience_volume", 100);
 options.windowed = get_config_int("Options", "Windowed", 0);

 int p1_keys_default[NO_CMDS] = {KEY_8_PAD, KEY_4_PAD, KEY_6_PAD, KEY_0_PAD, KEY_ENTER_PAD, KEY_2_PAD, KEY_1_PAD, KEY_3_PAD, KEY_PLUS_PAD, KEY_SLASH_PAD};

 for (i = 0; i < NO_CMDS; i ++)
 {
  strcpy(wstring, "Player1Keys");
  strcpy(miscstring, "Key");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  player[0].keys [i] = get_config_int(wstring, miscstring, p1_keys_default[i]);
 }

 int p2_keys_default[NO_CMDS] = {KEY_W, KEY_A, KEY_D, KEY_Q, KEY_TAB, KEY_S, KEY_Z, KEY_X, KEY_E, KEY_1};

 for (i = 0; i < NO_CMDS; i ++)
 {
  strcpy(wstring, "Player2Keys");
  strcpy(miscstring, "Key");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  player[1].keys [i] = get_config_int(wstring, miscstring, p2_keys_default[i]);
 }

 struct score_list single_hs_default[NO_SCORES] = {{30000, SHIP_LACEWING, 11, "Jub-Jub"}, {20000, SHIP_HOOKWORM, 10, "Slurpy"}, {15000, SHIP_AETHER, 9, "Antlion"}, {12000, SHIP_CAPYBARA, 8, "Schnorkel"}, {10000, SHIP_LACEWING, 8, "Legit"}, {9000, SHIP_PORKUPINE, 7, "Asdfgh"}, {8000, SHIP_CAPYBARA, 6, "Nemelex"}, {7000, SHIP_TORTFEASOR, 6, "Hi there"}, {6000, SHIP_DESPOT, 6, "Hello"}, {5000, SHIP_HOOKWORM, 5, "Quirp"}, {4000, SHIP_LENTIL, 5, "Hi there"}, {3000, SHIP_LACEWING, 4, "Kikubaaqudgha"}, {2000, SHIP_PRONG, 3, "Qwerty"}, {1000, SHIP_LACEWING, 2, "Capt Pork"}, {700, SHIP_LACEWING, 1, "Capt Pork"}};

 for (i = 0; i < NO_SCORES; i ++)
 {
  strcpy(wstring, "Highscores_single");
  strcpy(miscstring, "Score");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  hs_single[i].score = get_config_int(wstring, miscstring, single_hs_default[i].score);
  strcpy(miscstring, "Level");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  hs_single[i].level = get_config_int(wstring, miscstring, single_hs_default[i].level);
  strcpy(miscstring, "Ship");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  hs_single[i].ship = get_config_int(wstring, miscstring, single_hs_default[i].ship);
  strcpy(miscstring, "Name");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  strcpy(hs_single[i].name, get_config_string(wstring, miscstring, single_hs_default[i].name));
 }

 struct score_list coop_hs_default[NO_SCORES] = {{27265, SHIP_LACEWING, 9, "CaptainP"}, {25920, SHIP_CAPYBARA, 10, "CaptainP"}, {10160, SHIP_AETHER, 5, "CaptainP"}, {8650, SHIP_AETHER, 6, "Captain Squid"}, {1735, SHIP_PRONG, 3, "CaptainP"}, {610, SHIP_DESPOT, 1, "CaptainP"}, {600, SHIP_CAPYBARA, 2, "CaptainP"}, {120, SHIP_DESPOT, 1, "CaptainP"}, {100, SHIP_LACEWING, 1, "CaptainP"}, {100, SHIP_LACEWING, 1, "CaptainP"}, {100, SHIP_LACEWING, 1, "CaptainP"}, {100, SHIP_LACEWING, 1, "CaptainP"}, {100, SHIP_LACEWING, 1, "CaptainP"}, {100, SHIP_LACEWING, 1, "CaptainP"}, {100, SHIP_LACEWING, 1, "Capt Pork"}};

 for (i = 0; i < NO_SCORES; i ++)
 {
  strcpy(wstring, "Highscores_Coop");
  strcpy(miscstring, "Score");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  hs_coop[i].score = get_config_int(wstring, miscstring, coop_hs_default[i].score);
  strcpy(miscstring, "Level");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  hs_coop[i].level = get_config_int(wstring, miscstring, coop_hs_default[i].level);
  strcpy(miscstring, "Ship");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  hs_coop[i].ship = get_config_int(wstring, miscstring, coop_hs_default[i].ship);
  strcpy(miscstring, "Name");
  strcpy(itstring, "");
  //strcat(miscstring, itoa(i, itstring, 10));
  sprintf(itstring, "%d", i);
  strcat(miscstring, itstring);
  strcpy(hs_coop[i].name, get_config_string(wstring, miscstring, coop_hs_default[i].name));
 }

}