示例#1
0
////////////////////////////////////////////////////////////
/// Load & apply some settings
////////////////////////////////////////////////////////////
void MainClient::_loadGameSettings(void)
{
	CSimpleIniA ini;
	if(	ini.LoadFile("settings.ini") < 0 ){
		throw "Could not open the settings file!";
	}

	//Input .ini file settings
	info.debug			= ini.GetBoolValue("Settings", "debug");
	info.mapfile 		= ini.GetValue("Settings", "map");
	info.demoFile		= ini.GetValue("Settings", "demo");
	info.demoPlay		= ini.GetBoolValue("Settings", "play");
	info.demoRecord		= ini.GetBoolValue("Settings", "record");
	info.texturefile	= ini.GetValue("Settings", "textures");

	info.fullscreen 	= ini.GetBoolValue("Window", "fullscreen");
	info.window_width	= ini.GetLongValue("Window", "width");
	info.window_height	= ini.GetLongValue("Window", "height");
	info.cursorfile 	= ini.GetValue("Window", "cursor");

	info.fpslimit 		= ini.GetLongValue("Graphics", "fpslimit");
	info.frameskip 		= ini.GetLongValue("Graphics", "frameskip");

	/* Load the weapon list */
	CSimpleIniA weaponlist;
	weaponlist.LoadFile("assets/weaponlist.ini");

	CSimpleIniA::TNamesDepend keys;
	weaponlist.GetAllKeys("Weapons", keys);

	//Build Weapon definitions
	CSimpleIniA::TNamesDepend::const_iterator i;
	for(i = keys.begin(); i != keys.end(); ++i){
		//corresponds to the weapon select menu
		WeaponList.push_back(weaponlist.GetValue("Weapons", i->pItem));

		{
			//Push back a weapon info
			object::Weapon::Info winfo;
			std::string	path = WeaponList.back() + "/weapon.ini";

			object::Weapon::Info::Load(path.c_str(), &winfo);

			WeaponInfo.push_back(winfo);
		}
	}

} //void MainClient::_loadGameSettings(void)
示例#2
0
void parseIniFile(const string& filepath) throw(TCLAP::ArgException)
{
    CSimpleIniA inireader;
    inireader.SetUnicode();
    inireader.LoadFile(filepath.c_str());
    if(inireader.IsEmpty())
        throw(TCLAP::ArgException("Ini-File not found!", "-i"));

    _RESULT_DIRECTORY_NAME_ =       inireader.GetValue("detection", "result_directory_name", DEFAULT_RESULT_DIRECTORY_NAME);
    _WRITE_PROBABILITY_MAPS_ =      inireader.GetBoolValue("detection", "write_probability_maps", DEFAULT_WRITE_PROBABILITY_MAPS);
    _FILENAME_RESULT_SUFFIX_ =      inireader.GetValue("detection", "filename_result_suffix", DEFAULT_FILENAME_RESULT_SUFFIX);
    _PROB_MAP_RESULT_SUFFIX_ =      inireader.GetValue("detection", "prob_map_result_suffix", DEFAULT_PROB_MAP_RESULT_SUFFIX);
    _MAX_BOUNDINGBOX_OVERLAP_ =     inireader.GetDoubleValue("detection", "max_boundingbox_overlap", DEFAULT_MAX_BOUNDINGBOX_OVERLAP);

#ifndef PERFORM_EVALUATION
    _DETECTION_DEFAULT_THRESHOLD_ = inireader.GetValue("detection", "detection_default_threshold", DEFAULT_DETECTION_DEFAULT_THRESHOLD);
    _DETECTION_LABEL_THRESHOLDS_ =  inireader.GetValue("detection", "detection_label_thresholds", DEFAULT_DETECTION_LABEL_THRESHOLDS);
    _DETECTION_LABELS_ =            inireader.GetValue("detection", "detection_labels", DEFAULT_DETECTION_LABELS);
#else
    _DETECTION_DEFAULT_THRESHOLD_ = "0.15";
    _DETECTION_LABEL_THRESHOLDS_ = "";
    _DETECTION_LABELS_ = "";
#endif
    _LABEL_DELIMITER_ =      inireader.GetValue("training", "label_delimiter", DEFAULT_LABEL_DELIMITER);
    _MAX_BOOTSTRAP_STAGES_ = inireader.GetLongValue("training", "max_bootstrap_stages", DEFAULT_MAX_BOOTSTRAP_STAGES);

    _PATCH_WINDOW_SIZE_ = inireader.GetLongValue("common", "patch_window_size", DEFAULT_PATCH_SIZE);
    _IMG_FILE_EXTENTIONS_ = inireader.GetValue("common", "file_extentions", DEFAULT_IMG_FILE_EXTENTIONS);
    _BACKGROUND_LABEL_ = inireader.GetLongValue("common", "background_label", DEAFULT_BACKGROUND_LABEL);

//    cout << "Ini-file: " << endl;
//    DEBUG_COUT_VAR(_RESULT_DIRECTORY_NAME_);
//    DEBUG_COUT_VAR(_WRITE_PROBABILITY_MAPS_);
//    DEBUG_COUT_VAR(_FILENAME_RESULT_SUFFIX_);
//    DEBUG_COUT_VAR(_PROB_MAP_RESULT_SUFFIX_);
//    DEBUG_COUT_VAR(_MAX_BOUNDINGBOX_OVERLAP_);
//    DEBUG_COUT_VAR(_DETECTION_DEFAULT_THRESHOLD_);
//    DEBUG_COUT_VAR(_DETECTION_LABEL_THRESHOLDS_);
//    DEBUG_COUT_VAR(_DETECTION_LABELS_);
//    DEBUG_COUT_VAR(_LABEL_DELIMITER_);
//    DEBUG_COUT_VAR(_MAX_BOOTSTRAP_STAGES_);
//    DEBUG_COUT_VAR(_PATCH_WINDOW_SIZE_);
//    DEBUG_COUT_VAR(_IMG_FILE_EXTENTIONS_);
//    DEBUG_COUT_VAR(_BACKGROUND_LABEL_);
//    exit(-1);


}
示例#3
0
void OneTweakConfig::ReadConfig()
{
	_MESSAGE(__FUNCTION__);

	inifilename = FullPathFromPath("OneTweak.ini");

	CSimpleIniA ini;
	ini.LoadFile(inifilename.c_str());

	version = ini.GetLongValue("Version", "Config");
	if (version != CONFIG_VERSION)
	{
		SaveConfig(&ini);
	}

	borderless.enabled = ini.GetBoolValue("Global", "BorderlessWindow");
	double_cursor_fix.enabled = ini.GetBoolValue("Global", "DoubleCursorFix");

	priority.enabled = ini.GetBoolValue("Global", "Priority");

	if (priority.enabled)
	{
		DWORD id_fg = ini.GetLongValue("Priority", "Foreground");
		DWORD id_bg = ini.GetLongValue("Priority", "Background");

		priority.high = PriorityIdToClass(id_fg);
		priority.low = PriorityIdToClass(id_bg);
	}

	if (borderless.enabled)
	{
		borderless.active = ini.GetBoolValue("BorderlessWindow", "Active");

		borderless.flags = ini.GetLongValue("BorderlessWindow", "StyleFlags");
		borderless.flagsEx = ini.GetLongValue("BorderlessWindow", "StyleFlagsEx");

		borderless.posX = ini.GetLongValue("BorderlessWindow", "WindowPosX");
		borderless.posY = ini.GetLongValue("BorderlessWindow", "WindowPosY");

		borderless.WindowWidth = ini.GetLongValue("BorderlessWindow", "WindowWidth");
		borderless.WindowHeight = ini.GetLongValue("BorderlessWindow", "WindowHeight");

		borderless.RenderWidth = ini.GetLongValue("BorderlessWindow", "RenderWidth");
		borderless.RenderHeight = ini.GetLongValue("BorderlessWindow", "RenderHeight");
	}

	directinput.nonexclusive = ini.GetBoolValue("DirectInput", "NonExclusive");

	OnReadConfig(&ini);
}
	void load(const char* filename) {
		CSimpleIniA ini;
		ini.SetUnicode();
		ini.LoadFile(filename);

		_mouseSensitivity = static_cast<float>(ini.GetDoubleValue("Controls", "Mouse Sensitivity", 0.5f));
		_displayWidth = ini.GetLongValue("Graphics", "Width", 640);
		_displayHeight = ini.GetLongValue("Graphics", "Height", 480);
		_fullscreen = ini.GetBoolValue("Graphics", "Fullscreen");
		_borderless = ini.GetBoolValue("Graphics", "Borderless");
		_fieldOfView = static_cast<float>(ini.GetDoubleValue("Graphics", "Field of View", 45.f));
		_showConsole = ini.GetBoolValue("Debug", "Show Console");
		_logging = ini.GetBoolValue("Debug", "Logging");
		_showMouseCursor = ini.GetBoolValue("Debug", "Show Mouse Cursor");
		_centerMouseCursor = ini.GetBoolValue("Debug", "Center Mouse Cursor", true);
		_showFPS = ini.GetBoolValue("Debug", "Show FPS", true);
		_showCursorCoordinates = ini.GetBoolValue("Debug", "Show Cursor Coords", true);
		_debugContext = ini.GetBoolValue("Debug", "Debug Context", false);
		*_startingScene = ini.GetValue("Debug", "Starting Scene", "default");
	}
示例#5
0
int main( int argc, const char** argv )
{
  signal(SIGSEGV, segfault_handler);   // install our segfault handler
  daemon_active = true;

  bool noDaemon = false;
  bool clockOn = false;
  std::string logFile;
  
  std::string configDir;

  TCLAP::CmdLine cmd("OpenAlpr Daemon", ' ', Alpr::getVersion());

  TCLAP::ValueArg<std::string> configDirArg("","config","Path to the openalpr config directory that contains alprd.conf and openalpr.conf. (Default: /etc/openalpr/)",false, "/etc/openalpr/" ,"config_file");
  TCLAP::ValueArg<std::string> logFileArg("l","log","Log file to write to.  Default=" + DEFAULT_LOG_FILE_PATH,false, DEFAULT_LOG_FILE_PATH ,"topN");

  TCLAP::SwitchArg daemonOffSwitch("f","foreground","Set this flag for debugging.  Disables forking the process as a daemon and runs in the foreground.  Default=off", cmd, false);
  TCLAP::SwitchArg clockSwitch("","clock","Display timing information to log.  Default=off", cmd, false);

  try
  {
    
    cmd.add( configDirArg );
    cmd.add( logFileArg );

    
    if (cmd.parse( argc, argv ) == false)
    {
      // Error occurred while parsing.  Exit now.
      return 1;
    }

    // Make sure configDir ends in a slash
    configDir = configDirArg.getValue();
    if (hasEnding(configDir, "/") == false)
      configDir = configDir + "/";
    
    logFile = logFileArg.getValue();
    noDaemon = daemonOffSwitch.getValue();
    clockOn = clockSwitch.getValue();
  }
  catch (TCLAP::ArgException &e)    // catch any exceptions
  {
    std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
    return 1;
  }
  
  std::string openAlprConfigFile = configDir + OPENALPR_CONFIG_FILE_NAME;
  std::string daemonConfigFile = configDir + ALPRD_CONFIG_FILE_NAME;
  
  // Validate that the configuration files exist
  if (fileExists(openAlprConfigFile.c_str()) == false)
  {
    std::cerr << "error, openalpr.conf file does not exist at: " << openAlprConfigFile << std::endl;
    return 1;
  }
  if (fileExists(daemonConfigFile.c_str()) == false)
  {
    std::cerr << "error, alprd.conf file does not exist at: " << daemonConfigFile << std::endl;
    return 1;
  }
  
  log4cplus::BasicConfigurator config;
  config.configure();
    
  if (noDaemon == false)
  {
    // Fork off into a separate daemon
    daemon(0, 0);
    
    
    log4cplus::SharedAppenderPtr myAppender(new log4cplus::RollingFileAppender(logFile));
    myAppender->setName("alprd_appender");
    // Redirect std out to log file
    logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("alprd"));
    logger.addAppender(myAppender);
    
    
    LOG4CPLUS_INFO(logger, "Running OpenALPR daemon in daemon mode.");
  }
  else
  {
    //log4cplus::SharedAppenderPtr myAppender(new log4cplus::ConsoleAppender());
    //myAppender->setName("alprd_appender");
    // Redirect std out to log file
    logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("alprd"));
    //logger.addAppender(myAppender);
    
    LOG4CPLUS_INFO(logger, "Running OpenALPR daemon in the foreground.");
  }
  
  CSimpleIniA ini;
  ini.SetMultiKey();
  
  ini.LoadFile(daemonConfigFile.c_str());
  
  std::vector<std::string> stream_urls;
  
  
  CSimpleIniA::TNamesDepend values;
  ini.GetAllValues("daemon", "stream", values);

  // sort the values into the original load order
  values.sort(CSimpleIniA::Entry::LoadOrder());

  // output all of the items
  CSimpleIniA::TNamesDepend::const_iterator i;
  for (i = values.begin(); i != values.end(); ++i) { 
      stream_urls.push_back(i->pItem);
  }
  
  
  if (stream_urls.size() == 0)
  {
    LOG4CPLUS_FATAL(logger, "No video streams defined in the configuration.");
    return 1;
  }
  
  std::string country = ini.GetValue("daemon", "country", "us");
  int topn = ini.GetLongValue("daemon", "topn", 20);
  
  bool storePlates = ini.GetBoolValue("daemon", "store_plates", false);
  std::string imageFolder = ini.GetValue("daemon", "store_plates_location", "/tmp/");
  bool uploadData = ini.GetBoolValue("daemon", "upload_data", false);
  std::string upload_url = ini.GetValue("daemon", "upload_address", "");
  std::string company_id = ini.GetValue("daemon", "company_id", "");
  std::string site_id = ini.GetValue("daemon", "site_id", "");
  
  LOG4CPLUS_INFO(logger, "Using: " << daemonConfigFile << " for daemon configuration");
  LOG4CPLUS_INFO(logger, "Using: " << imageFolder << " for storing valid plate images");
  
  pid_t pid;
  
  for (int i = 0; i < stream_urls.size(); i++)
  {
    pid = fork();
    if (pid == (pid_t) 0)
    {
      // This is the child process, kick off the capture data and upload threads
      CaptureThreadData* tdata = new CaptureThreadData();
      tdata->stream_url = stream_urls[i];
      tdata->camera_id = i + 1;
      tdata->config_file = openAlprConfigFile;
      tdata->output_images = storePlates;
      tdata->output_image_folder = imageFolder;
      tdata->country_code = country;
      tdata->company_id = company_id;
      tdata->site_id = site_id;
      tdata->top_n = topn;
      tdata->clock_on = clockOn;
      
      tthread::thread* thread_recognize = new tthread::thread(streamRecognitionThread, (void*) tdata);
      
      if (uploadData)
      {
	// Kick off the data upload thread
	UploadThreadData* udata = new UploadThreadData();
	udata->upload_url = upload_url;
	tthread::thread* thread_upload = new tthread::thread(dataUploadThread, (void*) udata );
      }
      
      break;
    }

    // Parent process will continue and spawn more children
  }



  while (daemon_active)
  {
    usleep(30000);
  }

}
示例#6
0
int main(int ArgumentCount, char* Arguments[])
{
	M2Lib::CM2 M2;

	char iniFileName[1024];
	strcpy(iniFileName, Arguments[0]);
	char* lastSlash = strrchr(iniFileName, '\\');
	if (NULL == lastSlash)
	{
		lastSlash = strrchr(iniFileName, '/');
	}
	if (NULL != lastSlash)
	{
		lastSlash[1] = 0;
	}
	strcat(iniFileName, "M2Mod.ini");

	const char* szInputM2 = 0;
	const char* szOutputM2I = 0;
	const char* szInputM2I = 0;
	const char* szOutputM2 = 0;
	const char* szSubmeshPositionalTolerance = 0;
	const char* szSubmeshAngularTolerance = 0;
	const char* szBodyPositionalTolerance = 0;
	const char* szBodyAngularTolerance = 0;
	const char* szClothingPositionalTolerance = 0;
	const char* szClothingAngularTolerance = 0;
	const char* szIgnoreMaterials = 0;
	const char* szIgnoreBones = 0;
	const char* szIgnoreAttachments = 0;
	const char* szIgnoreCameras = 0;
	const char* szMirrorCamera = 0;
	const char* szScale = 0;
	const char* szShowVersion = 0;
	g_Verbose = 0;
	Float32 SubmeshPositionalTolerance = 0.0005f;
	Float32 SubmeshAngularTolerance = 60.0f;
	Float32 BodyPositionalTolerance = 0.0005f;
	Float32 BodyAngularTolerance = 90.0f;
	Float32 ClothingPositionalTolerance = 0.0005f;
	Float32 ClothingAngularTolerance = 45.0f;
	bool IgnoreMaterials = false;
	bool IgnoreBones = false;
	bool IgnoreAttachments = false;
	bool IgnoreCameras = false;
	bool MirrorCamera = false;
	Float32 Scale = 1.0f;
	bool ShowVersion = false;

	CSimpleIniA Ini;
	bool Pause = true;
	if ( ArgumentCount <= 1 )
	{
		// take inputs from INI
		//std::cout << "loading INI" << std::endl;
		if ( Ini.LoadFile( iniFileName ) != SI_OK )
		{
			std::cout << "Error: Could not load M2Mod.ini. Make sure M2Mod.ini is in same directory as M2Mod.exe." << std::endl;
			system("pause");
			return 0;
		}
		szInputM2 = Ini.GetValue( "input", "InputM2" );
		szOutputM2I = Ini.GetValue( "input", "OutputM2I" );
		szInputM2I = Ini.GetValue( "input", "InputM2I" );
		szOutputM2 = Ini.GetValue( "input", "OutputM2" );
		szSubmeshPositionalTolerance = Ini.GetValue( "options", "SubmeshPositionalTolerance" );
		szSubmeshAngularTolerance = Ini.GetValue( "options", "SubmeshAngularTolerance" );
		szBodyPositionalTolerance = Ini.GetValue( "options", "BodyPositionalTolerance" );
		szBodyAngularTolerance = Ini.GetValue( "options", "BodyAngularTolerance" );
		szClothingPositionalTolerance = Ini.GetValue( "options", "ClothingPositionalTolerance" );
		szClothingAngularTolerance = Ini.GetValue( "options", "ClothingAngularTolerance" );
		szIgnoreMaterials = Ini.GetValue( "options", "IgnoreMaterials" );
		szIgnoreBones = Ini.GetValue( "options", "IgnoreBones" );
		szIgnoreAttachments = Ini.GetValue( "options", "IgnoreAttachments" );
		szMirrorCamera = Ini.GetValue( "options", "MirrorCamera" );
		szScale = Ini.GetValue( "options", "Scale" );
		szShowVersion = Ini.GetValue( "debug", "ShowVersion" );
		g_Verbose = Ini.GetLongValue( "debug", "Verbose" );
	}
	else
	{
		// take inputs from command line
		//std::cout << "loading CMD" << std::endl;
		Pause = false;
		for ( SInt32 i = 1; i < ArgumentCount; i++ )
		{
			if ( strcmp( Arguments[i], "/InputM2" ) == 0 )
			{
				i++;
				szInputM2 = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/OutputM2I" ) == 0 )
			{
				i++;
				szOutputM2I = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/InputM2I" ) == 0 )
			{
				i++;
				szInputM2I = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/OutputM2" ) == 0 )
			{
				i++;
				szOutputM2 = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/SubmeshPositionalTolerance" ) == 0 )
			{
				i++;
				szSubmeshPositionalTolerance = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/SubmeshAngularTolerance" ) == 0 )
			{
				i++;
				szSubmeshAngularTolerance = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/BodyPositionalTolerance" ) == 0 )
			{
				i++;
				szBodyPositionalTolerance = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/BodyAngularTolerance" ) == 0 )
			{
				i++;
				szBodyAngularTolerance = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/ClothingPositionalTolerance" ) == 0 )
			{
				i++;
				szClothingPositionalTolerance = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/ClothingAngularTolerance" ) == 0 )
			{
				i++;
				szClothingAngularTolerance = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/IgnoreMaterials" ) == 0 )
			{
				szIgnoreMaterials = "1";
			}
			else if ( strcmp( Arguments[i], "/IgnoreBones" ) == 0 )
			{
				szIgnoreBones = "1";
			}
			else if ( strcmp( Arguments[i], "/IgnoreAttachments" ) == 0 )
			{
				szIgnoreBones = "1";
			}
			else if ( strcmp( Arguments[i], "/IgnoreCameras" ) == 0 )
			{
				szIgnoreBones = "1";
			}
			else if ( strcmp( Arguments[i], "/MirrorCamera" ) == 0 )
			{
				szMirrorCamera = "1";
			}
			else if ( strcmp( Arguments[i], "/Scale" ) == 0 )
			{
				i++;
				szScale = Arguments[i];
			}
			else if ( strcmp( Arguments[i], "/ShowVersion" ) == 0 )
			{
				szShowVersion = "1";
			}
			else if ( strcmp( Arguments[i], "/Verbose" ) == 0 )
			{
				i++;
				g_Verbose = atoi( Arguments[i] );
			}
		}
	}

	if ( szShowVersion )
	{
		if ( szShowVersion[0] == '0' )
		{
			ShowVersion = false;
		}
		else
		{
			ShowVersion = true;
		}
	}
	if ( ShowVersion )
	{
		std::cout << "M2Mod version: " << M2MOD_VERSION << std::endl;
	}

	if ( szIgnoreMaterials )
	{
		if ( szIgnoreMaterials[0] == '0' )
		{
			IgnoreMaterials = false;
		}
		else
		{
			IgnoreMaterials = true;
		}
	}

	if ( szIgnoreBones )
	{
		if ( szIgnoreBones[0] == '0' )
		{
			IgnoreBones = false;
		}
		else
		{
			IgnoreBones = true;
		}
	}

	if ( szIgnoreAttachments )
	{
		if ( szIgnoreAttachments[0] == '0' )
		{
			IgnoreAttachments = false;
		}
		else
		{
			IgnoreAttachments = true;
		}
	}

	if ( szIgnoreCameras )
	{
		if ( szIgnoreCameras[0] == '0' )
		{
			IgnoreCameras = false;
		}
		else
		{
			IgnoreCameras = true;
		}
	}

	if ( szMirrorCamera )
	{
		if ( szMirrorCamera[0] == '0' )
		{
			MirrorCamera = false;
		}
		else
		{
			MirrorCamera = true;
		}
	}

	if ( szSubmeshPositionalTolerance )
	{
		SubmeshPositionalTolerance = (Float32)atof( szSubmeshPositionalTolerance );
	}
	if ( szSubmeshAngularTolerance )
	{
		SubmeshAngularTolerance = (Float32)atof( szSubmeshAngularTolerance );
	}
	if ( szBodyPositionalTolerance )
	{
		BodyPositionalTolerance = (Float32)atof( szBodyPositionalTolerance );
	}
	if ( szBodyAngularTolerance )
	{
		BodyAngularTolerance = (Float32)atof( szBodyAngularTolerance );
	}
	if ( szClothingPositionalTolerance )
	{
		ClothingPositionalTolerance = (Float32)atof( szClothingPositionalTolerance );
	}
	if ( szClothingAngularTolerance )
	{
		ClothingAngularTolerance = (Float32)atof( szClothingAngularTolerance );
	}

	if ( SubmeshPositionalTolerance < 0.0f )
	{
		SubmeshPositionalTolerance = 0.0f;
	}
	else if ( SubmeshPositionalTolerance > MaxPositionalTolerance )
	{
		SubmeshPositionalTolerance = MaxPositionalTolerance;
	}

	if ( SubmeshAngularTolerance < 0.0f )
	{
		SubmeshAngularTolerance = 0.0f;
	}
	else if ( SubmeshAngularTolerance > MaxAngularTolerance )
	{
		SubmeshAngularTolerance = MaxAngularTolerance;
	}

	if ( BodyPositionalTolerance < 0.0f )
	{
		BodyPositionalTolerance = 0.0f;
	}
	else if ( BodyPositionalTolerance > MaxPositionalTolerance )
	{
		BodyPositionalTolerance = MaxPositionalTolerance;
	}

	if ( BodyAngularTolerance < 0.0f )
	{
		BodyAngularTolerance = 0.0f;
	}
	else if ( BodyAngularTolerance > MaxAngularTolerance )
	{
		BodyAngularTolerance = MaxAngularTolerance;
	}

	if ( ClothingPositionalTolerance < 0.0f )
	{
		ClothingPositionalTolerance = 0.0f;
	}
	else if ( ClothingPositionalTolerance > MaxPositionalTolerance )
	{
		ClothingPositionalTolerance = MaxPositionalTolerance;
	}

	if ( ClothingAngularTolerance < 0.0f )
	{
		ClothingAngularTolerance = 0.0f;
	}
	else if ( ClothingAngularTolerance > MaxAngularTolerance )
	{
		ClothingAngularTolerance = MaxAngularTolerance;
	}

	SubmeshAngularTolerance *= DegreesToRadians;
	BodyAngularTolerance *= DegreesToRadians;
	ClothingAngularTolerance *= DegreesToRadians;

	if ( szInputM2 )
	{
		std::cout << "Loading M2:    " << szInputM2 << std::endl;
		if ( M2Lib::EError Error = M2.Load( const_cast<Char8*>(szInputM2) ) )
		{
			std::cout << M2Lib::GetErrorText( Error ) << std::endl;
			system("pause");
			return -1;
		}
	}
	else
	{
		std::cout << "Error: No input M2 specified" << std::endl;
		system("pause");
		return -1;
	}

	if ( szOutputM2I )
	{
		std::cout << "Exporting M2I: " << szOutputM2I << std::endl;
		if ( M2Lib::EError Error = M2.ExportM2Intermediate( const_cast<Char8*>(szOutputM2I) ) )
		{
			std::cout << M2Lib::GetErrorText( Error ) << std::endl;
			system("pause");
			return -1;
		}
	}

	if ( szInputM2I )
	{
		std::cout << "Importing M2I: " << szInputM2I << std::endl;
		if ( M2Lib::EError Error = M2.ImportM2Intermediate( const_cast<Char8*>(szInputM2I), IgnoreMaterials, IgnoreBones, IgnoreAttachments, IgnoreCameras, SubmeshPositionalTolerance, SubmeshAngularTolerance, BodyPositionalTolerance, BodyAngularTolerance, ClothingPositionalTolerance, ClothingAngularTolerance ) )
		{
			std::cout << M2Lib::GetErrorText( Error ) << std::endl;
			system("pause");
			return -1;
		}
	}

	if ( szMirrorCamera )
	{
		M2.MirrorCamera();
	}

	if ( szScale )
	{
		Float32 Scale = (Float32)atof( szScale );
		if ( Scale != 1.0f )
		{
			if ( Scale < 0.8f )
			{
				Scale = 0.8f;
			}
			else if ( Scale > 1.2f )
			{
				Scale = 1.2f;
			}
			M2.Scale( Scale );
		}
	}

	if ( szOutputM2 )
	{
		std::cout << "Saving M2:     " << szOutputM2 << std::endl;
		if ( M2Lib::EError Error = M2.Save( const_cast<Char8*>(szOutputM2) ) )
		{
			std::cout << M2Lib::GetErrorText( Error ) << std::endl;
			system("pause");
			return -1;
		}
	}

	std::cout << "Operations Complete" << std::endl;

	if ( Pause )
	{
		system("pause");
	}

	return 0;
}
示例#7
0
bool SettingsManager::loadSettings()
{
	CSimpleIniA ini;
	ini.SetUnicode();
	ini.LoadFile("CONFIG.ini");

	if(ini.IsEmpty())
		{return false;}

	m_settings = new SettingsObject();

	m_settings->FRAME_TITLE = ini.GetValue("FRAME", "TITLE", "");
	m_settings->FRAME_FULLSCREEN = ini.GetBoolValue("FRAME", "FULLSCREEN", false);
	m_settings->FRAME_RESOLUTION_FULLSCREEN_X = ini.GetLongValue("FRAME", "RESOLUTION_FULLSCREEN_X", 0);
	m_settings->FRAME_RESOLUTION_FULLSCREEN_Y = ini.GetLongValue("FRAME", "RESOLUTION_FULLSCREEN_Y", 0);
	m_settings->FRAME_RESOLUTION_WINDOWED_X = ini.GetLongValue("FRAME", "RESOLUTION_WINDOWED_X", 0);
	m_settings->FRAME_RESOLUTION_WINDOWED_Y = ini.GetLongValue("FRAME", "RESOLUTION_WINDOWED_Y", 0);
	m_settings->FRAME_VIEW_X = ini.GetLongValue("FRAME", "VIEW_X", 0);
	m_settings->FRAME_VIEW_Y = ini.GetLongValue("FRAME", "VIEW_Y", 0);

	m_settings->WORLD_GRAVITY = (float)ini.GetDoubleValue("WORLD", "GRAVITY", 0);

	m_settings->PLAYER_SPEED_SIDE = (float)ini.GetDoubleValue("PLAYER", "SPEED_SIDE", 0);
	m_settings->PLAYER_SPEED_SIDE_HALTING = (float)ini.GetDoubleValue("PLAYER", "SPEED_SIDE_HALTING", 0);
	m_settings->PLAYER_SPEED_JUMP = (float)ini.GetDoubleValue("PLAYER", "SPEED_JUMP", 0);
	m_settings->PLAYER_SPEED_DOWN = (float)ini.GetDoubleValue("PLAYER", "SPEED_DOWN", 0);
	m_settings->PLAYER_HEALTH = (float)ini.GetDoubleValue("PLAYER", "HEALTH", 0);
	m_settings->PLAYER_SWORD_SWING_TIME = (float)ini.GetDoubleValue("PLAYER", "SWORD_SWING_TIME", 0);
	m_settings->PLAYER_HIT_TIME_LIMIT_MELEE = (float)ini.GetDoubleValue("PLAYER", "HIT_TIME_LIMIT_MELEE", 0);
	m_settings->PLAYER_KNOCKBACK_SPEED_X_INIT = (float)ini.GetDoubleValue("PLAYER", "KNOCKBACK_SPEED_X_INIT", 0);
	m_settings->PLAYER_KNOCKBACK_SPEED_X_DECREASE = (float)ini.GetDoubleValue("PLAYER", "KNOCKBACK_SPEED_X_DECREASE", 0);
	m_settings->PLAYER_KNOCKBACK_SPEED_Y = (float)ini.GetDoubleValue("PLAYER", "KNOCKBACK_SPEED_Y", 0);

	m_settings->DAMAGE_ENEMY_PLACEHOLDER_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_PLACEHOLDER_TO_PLAYER", 0);
	m_settings->DAMAGE_ENEMY_TROLL_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_TROLL_TO_PLAYER", 0);
	m_settings->DAMAGE_PLAYER_TO_ENEMY_PLACEHOLDER = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_PLACEHOLDER", 0);
	m_settings->DAMAGE_PLAYER_TO_ENEMY_TROLL = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_TROLL", 0);
	m_settings->DAMAGE_ENEMY_PROJECTILE_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_PROJECTILE_TO_PLAYER", 0);
	m_settings->DAMAGE_PLAYER_TO_ENEMY_SHOOTER = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_SHOOTER", 0);
	m_settings->DAMAGE_ENEMY_BASE_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_BASE_TO_PLAYER", 0);
	m_settings->DAMAGE_PLAYER_TO_ENEMY_GOBLIN = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_TROLL", 0);

	m_settings->ENEMY_TROLL_HEALTH = (float)ini.GetDoubleValue("ENEMY_TROLL", "HEALTH", 0);
	m_settings->ENEMY_TROLL_HIT_TIME_LIMIT_MELEE = (float)ini.GetDoubleValue("ENEMY_TROLL", "HIT_TIME_LIMIT_MELEE", 0);
	m_settings->ENEMY_TROLL_SPEED_SIDE = (float)ini.GetDoubleValue("ENEMY_TROLL", "SPEED_SIDE", 0);
	m_settings->ENEMY_TROLL_HITBOX_SIZE_X = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_SIZE_X", 0);
	m_settings->ENEMY_TROLL_HITBOX_SIZE_Y = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_SIZE_Y", 0);
	m_settings->ENEMY_TROLL_HITBOX_LOCAL_POSITION_X = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_LOCAL_POSITION_X", 0);
	m_settings->ENEMY_TROLL_HITBOX_LOCAL_POSITION_Y = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_LOCAL_POSITION_Y", 0);
	m_settings->ENEMY_TROLL_AI_CHANGE_LIMIT_TIME = (float)ini.GetDoubleValue("ENEMY_TROLL", "AI_CHANGE_LIMIT_TIME", 0);
	m_settings->ENEMY_TROLL_AI_WALKING_BACKWARDS_DISTANCE_LIMIT = (float)ini.GetDoubleValue("ENEMY_TROLL", "AI_WALKING_BACKWARDS_DISTANCE_LIMIT", 0);
	m_settings->ENEMY_TROLL_ATTACK_STAGE_1_TIME = (float)ini.GetDoubleValue("ENEMY_TROLL", "ATTACK_STAGE_1_TIME", 0);
	m_settings->ENEMY_TROLL_ATTACK_STAGE_2_TIME = (float)ini.GetDoubleValue("ENEMY_TROLL", "ATTACK_STAGE_2_TIME", 0);

	m_settings->ENEMY_GOBLIN_HEALTH = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "HEALTH", 0);
	m_settings->ENEMY_GOBLIN_SPEED_SIDE = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "SPEED_SIDE", 0);
	m_settings->ENEMY_GOBLIN_BOMB_SPAWN_TIME = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "BOMB_SPAWN_TIME", 0);
	m_settings->ENEMY_GOBLIN_BOMB_AOE_DURATION = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "BOMB_AOE_DURATION", 0);
	m_settings->ENEMY_GOBLIN_BOMB_BLAST_AREA_SIZE = (float)ini.GetDoubleValue ("ENEMY_GOBLIN", "BOMB_BLAST_AREA_SIZE", 0);

	m_settings->ENEMY_SHOOTER_SHOOT_TIME = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "SHOOT_TIME", 0);
	m_settings->ENEMY_SHOOTER_PROJECTILE_PARTICLE_SPAWN_TIME = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "PROJECTILE_PARTICLE_SPAWN_TIME", 0);
	m_settings->ENEMY_SHOOTER_PROJETILE_SPEED = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "PROJETILE_SPEED", 0);
	m_settings->ENEMY_SHOOTER_PROJECTILE_LIFE_TIME = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "PROJECTILE_LIFE_TIME", 0);

	m_settings->ENEMY_BASE_HEALTH = (float)ini.GetDoubleValue("ENEMY_BASE", "HEALTH", 0);
	m_settings->ENEMY_BASE_SPEED_BASE = (float)ini.GetDoubleValue("ENEMY_BASE", "SPEED_BASE", 0);
	m_settings->ENEMY_BASE_SPEED_MIN_MULTIPLIER = (float)ini.GetDoubleValue("ENEMY_BASE", "SPEED_MIN_MULTIPLIER", 0);
	m_settings->ENEMY_BASE_SPEED_MAX_MULTIPLIER = (float)ini.GetDoubleValue("ENEMY_BASE", "SPEED_MAX_MULTIPLIER", 0);

	m_settings->PARTICLES_MAX_INIT_SPEED = (float)ini.GetDoubleValue("PARTICLES", "MAX_INIT_SPEED", 0);

	m_settings->SCORE_KILL_TROLL = ini.GetLongValue("SCORE", "KILL_TROLL", 0);
	m_settings->SCORE_KILL_GOBLIN = ini.GetLongValue("SCORE", "KILL_GOBLIN", 0);
	m_settings->SCORE_KILL_SHOOTER = ini.GetLongValue("SCORE", "KILL_SHOOTER", 0);
	m_settings->SCORE_KILL_BASE = ini.GetLongValue("SCORE", "KILL_BASE", 0);
	m_settings->SCORE_TIME_LIMIT = (float)ini.GetDoubleValue("SCORE", "TIME_LIMIT", 0);

	m_settings->HIGHSCORE_NAME = ini.GetValue("HIGHSCORE", "NAME", "");
	m_settings->HIGHSCORE2_NAME = ini.GetValue("HIGHSCORE2", "NAME", "");
	m_settings->HIGHSCORE3_NAME = ini.GetValue("HIGHSCORE3", "NAME", "");
	m_settings->HIGHSCORE_SCORE = ini.GetLongValue("HIGHSCORE", "SCORE", 0);
	m_settings->HIGHSCORE2_SCORE = ini.GetLongValue("HIGHSCORE2", "SCORE", 0);
	m_settings->HIGHSCORE3_SCORE = ini.GetLongValue("HIGHSCORE3", "SCORE", 0);

	return true;
}
void ScriptSettings::Read(ScriptControls* scriptControl) {
#pragma warning(push)
#pragma warning(disable: 4244) // Make everything doubles later...
	CSimpleIniA ini;
	ini.SetUnicode();
	ini.LoadFile(SETTINGSFILE);

	ini.GetBoolValue("OPTIONS", "Enable", true);
	// [OPTIONS]
	EnableManual        = ini.GetBoolValue("OPTIONS", "Enable", true);
	ShiftMode           = ini.GetLongValue("OPTIONS", "ShiftMode", 0);
	SimpleBike          = ini.GetBoolValue("OPTIONS", "SimpleBike", false);
	EngDamage           = ini.GetBoolValue("OPTIONS", "EngineDamage", false);
	EngStall            = ini.GetBoolValue("OPTIONS", "EngineStalling", false);
	EngBrake            = ini.GetBoolValue("OPTIONS", "EngineBraking", false);
	ClutchCatching      = ini.GetBoolValue("OPTIONS", "ClutchCatching", false);
	ClutchShifting      = ini.GetBoolValue("OPTIONS", "ClutchShifting", false);
	ClutchShiftingS     = ini.GetBoolValue("OPTIONS", "ClutchShiftingS", false);
	DefaultNeutral      = ini.GetBoolValue("OPTIONS", "DefaultNeutral", true);
	
	ClutchCatchpoint    = ini.GetDoubleValue("OPTIONS", "ClutchCatchpoint", 15.0) / 100.0f;
	StallingThreshold   = ini.GetDoubleValue("OPTIONS", "StallingThreshold", 75.0) / 100.0f;
	RPMDamage           = ini.GetDoubleValue("OPTIONS", "RPMDamage", 15.0) / 100.0f;
	MisshiftDamage      = ini.GetDoubleValue("OPTIONS", "MisshiftDamage", 10.0);

	AutoLookBack        = ini.GetBoolValue("OPTIONS", "AutoLookBack", false);
	AutoGear1           = ini.GetBoolValue("OPTIONS", "AutoGear1", false);
	HillBrakeWorkaround = ini.GetBoolValue("OPTIONS", "HillBrakeWorkaround", false);
	
	UITips              = ini.GetBoolValue("OPTIONS", "UITips", true);
	UITips_OnlyNeutral  = ini.GetBoolValue("OPTIONS", "UITips_OnlyNeutral", false);
	UITips_X            = ini.GetDoubleValue("OPTIONS", "UITips_X", 95.0) / 100.0f;
	UITips_Y            = ini.GetDoubleValue("OPTIONS", "UITips_Y", 95.0) / 100.0f;
	UITips_Size         = ini.GetDoubleValue("OPTIONS", "UITips_Size", 15.0) / 100.0f;
	UITips_TopGearC_R   = ini.GetLongValue("OPTIONS", "UITips_TopGearC_R", 255);
	UITips_TopGearC_G   = ini.GetLongValue("OPTIONS", "UITips_TopGearC_G", 255);
	UITips_TopGearC_B   = ini.GetLongValue("OPTIONS", "UITips_TopGearC_B", 255);

	CrossScript         = ini.GetBoolValue("OPTIONS", "CrossScript", false);

	// [CONTROLLER]
	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Toggle)]  = ini.GetValue("CONTROLLER", "Toggle", "DpadRight");
	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::ToggleH)] = ini.GetValue("CONTROLLER", "ToggleShift", "B");
	scriptControl->CToggleTime = ini.GetLongValue("CONTROLLER", "ToggleTime", 500);

	int tval = ini.GetLongValue("CONTROLLER", "TriggerValue", 75);
	if (tval > 100 || tval < 0) {
		tval = 75;
	}
	scriptControl->SetXboxTrigger(tval);

	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::ShiftUp)]   = ini.GetValue("CONTROLLER", "ShiftUp", "A");
	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::ShiftDown)] = ini.GetValue("CONTROLLER", "ShiftDown", "X");
	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Clutch)]    = ini.GetValue("CONTROLLER", "Clutch", "LeftThumbDown");
	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Engine)]    = ini.GetValue("CONTROLLER", "Engine", "DpadDown");
	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Throttle)]  = ini.GetValue("CONTROLLER", "Throttle", "RightTrigger");
	scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Brake)]     = ini.GetValue("CONTROLLER", "Brake", "LeftTrigger");

	// [KEYBOARD]
	
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Toggle)]        = str2key(ini.GetValue("KEYBOARD", "Toggle", "VK_OEM_5"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::ToggleH)]       = str2key(ini.GetValue("KEYBOARD", "ToggleH", "VK_OEM_6"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::ShiftUp)]       = str2key(ini.GetValue("KEYBOARD", "ShiftUp", "SHIFT"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::ShiftDown)]     = str2key(ini.GetValue("KEYBOARD", "ShiftDown", "CTRL"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Clutch)]        = str2key(ini.GetValue("KEYBOARD", "Clutch", "X"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Engine)]        = str2key(ini.GetValue("KEYBOARD", "Engine", "C"));

	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Throttle)]      = str2key(ini.GetValue("KEYBOARD", "Throttle", "W"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Brake)]         = str2key(ini.GetValue("KEYBOARD", "Brake", "S"));

	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::HR)]            = str2key(ini.GetValue("KEYBOARD", "HR", "NUM0"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H1)]            = str2key(ini.GetValue("KEYBOARD", "H1", "NUM1"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H2)]            = str2key(ini.GetValue("KEYBOARD", "H2", "NUM2"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H3)]            = str2key(ini.GetValue("KEYBOARD", "H3", "NUM3"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H4)]            = str2key(ini.GetValue("KEYBOARD", "H4", "NUM4"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H5)]            = str2key(ini.GetValue("KEYBOARD", "H5", "NUM5"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H6)]            = str2key(ini.GetValue("KEYBOARD", "H6", "NUM6"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H7)]            = str2key(ini.GetValue("KEYBOARD", "H7", "NUM7"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H8)]            = str2key(ini.GetValue("KEYBOARD", "H8", "NUM8"));
	scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::HN)]            = str2key(ini.GetValue("KEYBOARD", "HN", "NUM9"));

	// [WHEELOPTIONS]
	WheelEnabled = ini.GetBoolValue("WHEELOPTIONS", "Enable", false);
	WheelWithoutManual = ini.GetBoolValue("WHEELOPTIONS", "WheelWithoutManual", true);

	FFEnable = ini.GetBoolValue("WHEELOPTIONS", "FFEnable", true);
	FFGlobalMult =	ini.GetDoubleValue("WHEELOPTIONS", "FFGlobalMult", 100.0) / 100.0f;
	DamperMax =		ini.GetLongValue("WHEELOPTIONS", "DamperMax", 50);
	DamperMin = ini.GetLongValue("WHEELOPTIONS", "DamperMin", 20);
	TargetSpeed = ini.GetLongValue("WHEELOPTIONS", "DamperTargetSpeed", 10);
	FFPhysics = ini.GetDoubleValue("WHEELOPTIONS", "PhysicsStrength", 100.0) / 100.0f;
	CenterStrength = ini.GetDoubleValue("WHEELOPTIONS", "CenterStrength", 100.0) / 100.0f;
	DetailStrength = ini.GetDoubleValue("WHEELOPTIONS", "DetailStrength", 100.0) / 1.0f;

	// [WHEELCONTROLS]
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::Toggle)]          =	ini.GetLongValue("WHEELCONTROLS", "Toggle", 17);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::ToggleH)]         =	ini.GetLongValue("WHEELCONTROLS", "ToggleH", 6);

	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::ShiftUp)]         =	ini.GetLongValue("WHEELCONTROLS", "ShiftUp", 4);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::ShiftDown)]       =	ini.GetLongValue("WHEELCONTROLS", "ShiftDown", 5);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::HR)]              =	ini.GetLongValue("WHEELCONTROLS", "HR", 14);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::H1)]              =	ini.GetLongValue("WHEELCONTROLS", "H1", 8 );
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::H2)]              =	ini.GetLongValue("WHEELCONTROLS", "H2", 9 );
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::H3)]              =	ini.GetLongValue("WHEELCONTROLS", "H3", 10);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::H4)]              =	ini.GetLongValue("WHEELCONTROLS", "H4", 11);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::H5)]              =	ini.GetLongValue("WHEELCONTROLS", "H5", 12);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::H6)]              =	ini.GetLongValue("WHEELCONTROLS", "H6", 13);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::Handbrake)]       =	ini.GetLongValue("WHEELCONTROLS", "Handbrake", 19);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::Engine)]          =	ini.GetLongValue("WHEELCONTROLS", "Engine", 21   );

	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::Horn)]            =	ini.GetLongValue("WHEELCONTROLS", "Horn", 20 );
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::Lights)]          =	ini.GetLongValue("WHEELCONTROLS", "Lights", 7);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::LookBack)]        =	ini.GetLongValue("WHEELCONTROLS", "LookBack", 22);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::Camera)]          =	ini.GetLongValue("WHEELCONTROLS", "Camera", 0);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::RadioPrev)]       =	ini.GetLongValue("WHEELCONTROLS", "RadioPrev", 1);
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::RadioNext)]       =	ini.GetLongValue("WHEELCONTROLS", "RadioNext", 2);

	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::IndicatorLeft)]   =	ini.GetLongValue("WHEELCONTROLS", "IndicatorLeft", 19  );
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::IndicatorRight)]  =	ini.GetLongValue("WHEELCONTROLS", "IndicatorRight", 21 );
	scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::IndicatorHazard)] =	ini.GetLongValue("WHEELCONTROLS", "IndicatorHazard", 15);

	// [WHEELAXIS]
	
	scriptControl->WheelAxes[static_cast<int>(ScriptControls::WheelAxisType::Throttle)] = ini.GetValue("WHEELAXIS", "Throttle", "lY");
	scriptControl->ThrottleMin = ini.GetLongValue("WHEELAXIS", "ThrottleMin", 0);
	scriptControl->ThrottleMax = ini.GetLongValue("WHEELAXIS", "ThrottleMax", 65535);
	
	
	scriptControl->WheelAxes[static_cast<int>(ScriptControls::WheelAxisType::Brake)] = ini.GetValue("WHEELAXIS", "Brake", "lRz");
	scriptControl->BrakeMin = ini.GetLongValue("WHEELAXIS", "BrakeMin", 0);
	scriptControl->BrakeMax = ini.GetLongValue("WHEELAXIS", "BrakeMax", 65535);

	
	scriptControl->WheelAxes[static_cast<int>(ScriptControls::WheelAxisType::Clutch)] = ini.GetValue("WHEELAXIS", "Clutch", "rglSlider1");
	scriptControl->ClutchMin = ini.GetLongValue("WHEELAXIS", "ClutchMin", 0);
	scriptControl->ClutchMax = ini.GetLongValue("WHEELAXIS", "ClutchMax", 65535);

	scriptControl->WheelAxes[static_cast<int>(ScriptControls::WheelAxisType::Steer)] = ini.GetValue("WHEELAXIS", "Steer", "lX");

	scriptControl->SteerLeft =  ini.GetLongValue("WHEELAXIS", "SteerLeft", 0);
	scriptControl->SteerRight = ini.GetLongValue("WHEELAXIS", "SteerRight", 65535);
	
	scriptControl->FFAxis = ini.GetValue("WHEELAXIS", "FFAxis", "X");

	scriptControl->ClutchDisable = ini.GetBoolValue("WHEELAXIS", "ClutchDisable", false);

	SteerAngleMax = ini.GetDoubleValue("WHEELAXIS", "SteerAngleMax", 900.0);
	SteerAngleCar = ini.GetDoubleValue("WHEELAXIS", "SteerAngleCar", 720.0);
	SteerAngleBike = ini.GetDoubleValue("WHEELAXIS", "SteerAngleBike", 180.0);

	// [WHEELKEYBOARD]
	for (int i = 0; i < MAX_RGBBUTTONS; i++) { // Ouch
		std::string entryString = ini.GetValue("WHEELKEYBOARD", std::to_string(i).c_str(), "NOPE");
		if (std::string(entryString).compare("NOPE") == 0) {
			scriptControl->WheelToKey[i] = -1;
		}
		else {
			scriptControl->WheelToKey[i] = str2key(entryString);
		}
	}

	// [DEBUG]
	Debug = ini.GetBoolValue("DEBUG", "Info", false);
	AltControls = ini.GetBoolValue("DEBUG", "AltControls", false);
	SteerAngleAlt = ini.GetDoubleValue("DEBUG", "AltAngle", 180.0);
	
	// .ini version check
	INIver = ini.GetValue("DEBUG", "INIver", "0.0");

#pragma warning(pop)
}