コード例 #1
0
void ControlBlockConfiguration::initialize() {
    try {
        Json::Value root;
        Json::Reader reader;

        std::ifstream t("/etc/controlblockconfig.cfg");
        std::string config_doc((std::istreambuf_iterator<char>(t)),
                               std::istreambuf_iterator<char>());

        bool parsingSuccessful = reader.parse(config_doc, root);
        if (!parsingSuccessful) {
            std::cout << "[ControlBlock] Failed to parse configuration\n"
                      << reader.getFormattedErrorMessages();
            return;
        }

        std::string configvalue = root["input"]["gamepadtype"].asString();
        if (configvalue.compare("arcade") == 0) {
            gamepadType = GAMEPAD_ARCADE;
            std::cout << "[ControlBlock] Gamepadtype = ARCADE gamepads"
                      << std::endl;
        } else if (configvalue.compare("mame") == 0) {
            gamepadType = GAMEPAD_MAME;
            std::cout << "[ControlBlock] Gamepadtype = MAME Keyboard"
                      << std::endl;
        } else if (configvalue.compare("snes") == 0) {
            gamepadType = GAMEPAD_SNES;
            std::cout << "[ControlBlock] Gamepadtype = SNES gamepads"
                      << std::endl;
        } else {
            gamepadType = GAMEPAD_NONE;
            std::cout << "[ControlBlock] Gamepadtype = NONE" << std::endl;
        }

        bool configSingleGamepadBoolean = root["input"]["singlegamepad"].asBool();
        if (configSingleGamepadBoolean) {
            singleGamepad = SINGLE_GAMEPAD_ACTIVATED;
            std::cout << "[ControlBlock] Single gamepad mode ACTIVATED" << std::endl;
        } else {
            singleGamepad = SINGLE_GAMEPAD_DEACTIVATED;
            std::cout << "[ControlBlock] Single gamepad mode DEACTIVATED" << std::endl;
        }

        bool configPowerswitchBoolean = root["powerswitch"]["activated"].asBool();
        if (configPowerswitchBoolean) {
            doShutdown = SHUTDOWN_ACTIVATED;
            std::cout << "[ControlBlock] Shutdown is ACTIVATED" << std::endl;
        } else {
            doShutdown = SHUTDOWN_DEACTIVATED;
            std::cout << "[ControlBlock] Shutdown is DEACTIVATED" << std::endl;
        }

    } catch(int errno) {
        std::cout << "[ControlBlock] Error while initializing "
                     "ControlBlockConfiguration instance. Error number: "
                  << errno << std::endl;
    }
}
コード例 #2
0
ファイル: json_test.cpp プロジェクト: odarbelaeze/Gmr
int main(int argc, char const *argv[])
{
    Json::Value root;
    Json::Reader reader;

    std::ifstream config_doc ("descriptor_example.json");

    bool parsingSuccessful = reader.parse( config_doc, root, false );
    if ( !parsingSuccessful )
    {
        // report to the user the failure and their locations in the document.
        std::cout  << "Failed to parse configuration\n"
                   << reader.getFormattedErrorMessages();
    }
    else
    {
        std::cout << root.toStyledString () << std::endl;
    }

    std::cout << root["system"]["dimensions"]["width"].asInt() << std::endl;

    return 0;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: rogervictor/tws
int main(int argc, char *argv[])
{
// look for tws_app_server config file
  std::string config_file_name = tws::core::find_in_app_path("share/tws/config/tws_app_server.json");

  if(config_file_name.empty())
  {
    std::cerr << TE_TR("Could not find tws_app_server configuration file: 'tws_app_server.json'.");

    return EXIT_FAILURE;
  }

  try
  {
// read config file
    std::unique_ptr<rapidjson::Document> config_doc(tws::core::open_json_file(config_file_name));

    if(!config_doc->IsObject() || config_doc->IsNull())
      throw tws::parse_error() << tws::error_description(TE_TR("error in array entry name in metadata."));

// get log file information
    const rapidjson::Value& jlog_file = (*config_doc)["log_file"];

    std::string log_file = jlog_file.GetString();

// init logger
    TE_INIT_DEFAULT_LOGGER(log_file);

// init TerraLib and TWS frameworks
    TE_LOG_INFO(TE_TR("Starting TerraLib GeoWeb Services..."));

    TerraLib::getInstance().initialize();

    tws::core::init_terralib_web_services();
    
    LoadModules();

// start default htp server
    const rapidjson::Value& jhttp_server = (*config_doc)["http_server"];

    std::string http_server = jhttp_server.GetString();

    std::unique_ptr<tws::core::http_server> server = tws::core::http_server_builder::instance().build(http_server);

    server->start();

    UnloadModules();

    TerraLib::getInstance().finalize();

    TE_LOG_INFO(TE_TR("Finished TerraLib GeoWeb Services!"));
  }
  catch(const boost::exception& e)
  {
    if(const std::string* d = boost::get_error_info<tws::error_description>(e))
    {
      boost::format err_msg(TE_TR("the following error has occurred: %1%."));

      TE_LOG_ERROR((err_msg % *d).str());
    }
    else
    {
      TE_LOG_ERROR(TE_TR("an unknown error has occurred"));
    }

    return EXIT_FAILURE;
  }
  catch(const std::exception& e)
  {
    boost::format err_msg(TE_TR("the following error has occurred: %1%."));

    TE_LOG_ERROR((err_msg % e.what()).str());

    return EXIT_FAILURE;
  }
  catch(...)
  {
    TE_LOG_ERROR(TE_TR("an unknown error has occurred."));

    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}
コード例 #4
0
ファイル: main.cpp プロジェクト: qubitrot/resonance
void init(std::string file, System* system, Driver* driver, SampleSpace* sample_space)
{
    Json::Value  root;
    Json::Reader reader;

    std::ifstream config_doc(file, std::ifstream::binary);
    config_doc >> root;

    //============ PARSE SYSTEM =============
    std::cout << "Parsing System."; std::flush(std::cout);

    short particle_id_counter = 0;

    //Parse particles
    const Json::Value j_particles = root["particles"];
    for (uint n = 0; n<j_particles.size(); ++n) {
        uint count = j_particles[n].get("count",1).asInt();
        for (uint i=0; i<count; ++i) {
            ParticleType ptype = ParticleType::PT_None;
            if (j_particles[n].get("type","").asString() == "boson")
                ptype = ParticleType::PT_Boson;
            if (j_particles[n].get("type","").asString() == "fermion")
                ptype = ParticleType::PT_Fermion;

            Particle p(ptype);

            p.id           = particle_id_counter++;
            p.name         = j_particles[n].get("name","").asString();
            p.mass         = j_particles[n].get("mass",1).asDouble();
            p.identicality = j_particles[n].get("identicality",-10).asInt();
            if (p.identicality == -10) {
                std::cout << "Particle " << p.name << " has unspecified identicality";
                throw;
            }

            system->add_particle(p);
        }
    }

    std::cout << "."; std::flush(std::cout);

    //Parse trapping potential
    const Json::Value j_trap = root["trap"];
    Trap trap;

    if (j_trap.get("type","none").asString() == "harmonic") {
        trap.type = Trap::Type::Harmonic;
    } else {
        trap.type = Trap::Type::None;
    }

    trap.w = j_trap.get("w",1).asDouble();

    system->set_trapping_potential(trap);

    //Parse interaction potentials
    const Json::Value j_interactions = root["interactions"];
    for (uint k=0; k<j_interactions.size(); ++k) {
        std::string p1 = j_interactions[k]["pair"][0].asString();
        std::string p2 = j_interactions[k]["pair"][1].asString();
        std::string t  = j_interactions[k].get("type","none").asString();

        if (t == "gaussian") {
            Interaction V;
            V.type = Interaction::Type::Gaussian;
            V.v0   = j_interactions[k].get("V0",1).asDouble();
            V.r0sq = j_interactions[k].get("r0",1).asDouble();
            V.r0sq = V.r0sq * V.r0sq;
            system->set_interaction(p1,p2,V);
        }
        else if (t == "multigaussian") {
            Interaction V;
            V.type = Interaction::Type::MultiGaussian;

            const Json::Value j_multV0 = j_interactions[k]["V0"];
            const Json::Value j_multr0 = j_interactions[k]["r0"];

            assert (j_multV0.size() == j_multr0.size());

            for (uint l=0; l<j_multV0.size(); ++l) {
                V.mult_v0.push_back( j_multV0[l].asDouble() );
                V.mult_r0sq.push_back( j_multr0[l].asDouble()
                                     * j_multr0[l].asDouble() );
            }

            system->set_interaction(p1,p2,V);
        }
        else if (t == "powerlaw") {
            Interaction V;
            V.type = Interaction::Type::PowerLaw;
            V.v0   = j_interactions[k].get("V0",1).asDouble();
            V.pow = j_interactions[k].get("pow",1).asDouble();
            system->set_interaction(p1,p2,V);
        }
        else if (t == "multipower") {
            Interaction V;
            V.type = Interaction::Type::MultiPower;

            const Json::Value j_multV0  = j_interactions[k]["V0"];
            const Json::Value j_multpow = j_interactions[k]["pow"];

            assert (j_multV0.size() == j_multpow.size());

            for (uint l=0; l<j_multV0.size(); ++l) {
                V.mult_v0.push_back(  j_multV0[l].asDouble() );
                V.mult_pow.push_back( j_multpow[l].asDouble()
                                    * j_multpow[l].asDouble() );
            }

            system->set_interaction(p1,p2,V);
        }
    }

    std::cout << "."; std::flush(std::cout);

    system->init();

    std::cout << ".\n";

    //========== PARSE SAMPLE SPACE =======
    std::cout << "Parsing Sample Space.\n";

    const Json::Value space   = root["sampleSpace"];
    const Json::Value dists   = space["distributions"];
    const Json::Value strains = space["strains"];

    for (uint k=0; k<strains.size(); ++k) {
        uint freq = strains[k].get("frequency",10).asInt();

        CG_Strain cgs;
        auto particles = system->get_particles();

        const Json::Value pairs = strains[k]["pairs"];
        for (uint l=0; l<pairs.size(); ++l) {
            std::string p1 = pairs[l]["pair"][0].asString();
            std::string p2 = pairs[l]["pair"][1].asString();
            std::string d  = pairs[l].get("distribution","").asString();

            short id1 = -1;
            short id2 = -1;

            for (auto p : particles) {
                if (p.name == p1) id1 = p.id;
                if (p.name == p2) id2 = p.id;
            }

            if (id1 == -1) std::cout << "ERROR: No particle with name" << p1 << "\n";
            if (id2 == -1) std::cout << "ERROR: No particle with name" << p2 << "\n";

            for (uint i=0; i<dists.size(); ++i) {
                if (dists[i].get("name","none").asString() == d) {
                    if (dists[i].get("type","").asString() == "uniform") {
                        double min = dists[i].get("min",0).asDouble();
                        double max = dists[i].get("max",0).asDouble();

                        cgs.set_distribution(id1,id2,
                                             std::shared_ptr<SamplingDistribution>(
                                                 new SD_Uniform(min,max)));
                    }
                    else if (dists[i].get("type","").asString() == "gaussian") {
                        std::string name = dists[i].get("name","").asString();

                        double mean  = dists[i].get("mean",0).asDouble();
                        double std   = dists[i].get("std",0).asDouble();
                        double mstdf = dists[i].get("mstdf",0).asDouble();
                        double min   = dists[i].get("min",-1).asDouble();
                        double max   = dists[i].get("max",-1).asDouble();
                        double learn = dists[i].get("learn",0).asInt();
                        double hist  = dists[i].get("history",0).asInt();

                        bool has_min = false;
                        bool has_max = false;
                        if (min != -1) has_min = true;
                        if (max != -1) has_max = true;

                        cgs.set_distribution(id1,id2,
                                             std::shared_ptr<SamplingDistribution>(
                                                 new SD_Gaussian(name,mean,std,mstdf,has_min,
                                                                 min,has_max,max,learn,
                                                                 hist)));
                    }
                    else {
                        std::cout << "ERROR: distribution type invalid for "
                                  << dists[i].get("name","") << "\n";
                        throw;
                    }
                }
            }
        }

        sample_space->add_strain(cgs,freq);
    }

    //========== PARSE DRIVER =============
    std::cout << "Parsing Driver.\n";

    const Json::Value JDriver  = root["driver"];
    driver->target_state       = JDriver.get("targetState",0).asInt();
    //driver->targetEnergy     = JDriver.get("targetEnergy",1111).asDouble();
    driver->trial_size         = JDriver.get("trialSize",1).asInt();
    driver->threads            = JDriver.get("threads",1).asInt();
    driver->singularity_limit  = JDriver.get("singularityLimit",1e-10).asDouble();
    //driver->forceDiversity   = JDriver.get("forceDiversity",0).asInt();
}
コード例 #5
0
ファイル: main.cpp プロジェクト: qubitrot/resonance
int main(int argc, char* argv[])
{
#ifndef NDEBUG
    Profiler::setLogFile("out/preformance/report.html");
    Profiler::setLogFormat(new HTMLWriter);
    PROFILE();
#endif

    std::string out_dir     = "";
    std::string config_file = "";
    std::string config_name = "";

    if (argc < 2) {
        std::cout << "Nope.\n";
        return 1;
    } else {
        config_file = argv[1];
        if (argc > 2) {
            out_dir = argv[2];
        } else {
            time_t t = time(0);
            struct tm* now = localtime(&t);

            std::string date;
            date = std::to_string(now->tm_year+1900) + std::string("-")
                 + std::to_string(now->tm_mon+1)     + std::string("-")
                 + std::to_string(now->tm_mday)      + std::string("-")
                 + std::to_string(now->tm_hour);

            int lastdot   = config_file.find_last_of(".");
            int lastslash = config_file.find_last_of("/");

            config_name = config_file.substr(lastslash+1,lastdot-lastslash-1);
            out_dir     = "out/" + date + "_" + config_name;
        }
    }

    std::string mkdir = std::string("mkdir -p ") + out_dir;
    std::system(mkdir.c_str());
    std::system(("cp " + config_file + " " + out_dir
                 + "/" + config_name + ".json").c_str());

    System* system            = new System();
    SampleSpace* sample_space = new SampleSpace();
    Driver* driver            = new Driver(system,sample_space);

    init(config_file,system,driver,sample_space);

    Json::Value  root;
    Json::Reader reader;
    std::ifstream config_doc(config_file, std::ifstream::binary);
    config_doc >> root;
    const Json::Value config_queue = root["queue"];

    SolverCPU<real> solver(system);
    Basis           basis;
    Solution<real>  cache;

    for (uint i=0; i<config_queue.size(); ++i) {
        const Json::Value item = config_queue[i];
        std::string action = item[0].asString();

        if (action == "read") {
            std::string file = item[1].asString();
            uint num = item[2].asInt();
            basis    = driver->read_basis(file,num);
            cache    = solver.solve(basis);
        }
        else if (action == "generate") {
            uint num    = item[1].asInt();
            real target = item[2].asDouble();
            uint trials = item[3].asInt();
            if (target < 0) {
                driver->targeting_energy = true;
                driver->target_energy    = target;
            } else {
                driver->targeting_energy = false;
                driver->target_state     = target;
            }
            driver->trial_size = trials;

            uint rep = 1;
            if (item.size() >= 5 && item[4].asInt() >= 1)
                rep = item[4].asInt();

            for (uint j=0; j<rep; ++j) {
                auto cd  = driver->expand_basis(basis,cache,num);
                driver->write_basis(basis, out_dir + "/basis.json");
                driver->write_convergence(cd,out_dir + "/convergence.dat",true);
            }
        }
        else if (action == "sweep") {
            real start = item[1].asDouble();
            real end   = item[2].asDouble();
            uint steps = item[3].asInt();
            auto sd    = driver->sweep_basis(basis,start,end,steps);
            driver->write_sweep(sd,out_dir+"/sweep.dat",true);
        }
        else if (action == "pair_distribution") {
            Solution<real> sol = solver.solve(basis,1,0);
            uint i = item[1].asInt();
            uint j = item[2].asInt();
            uint t = item[3].asInt();
            real s = item[4].asDouble();
            uint b = item[5].asInt();
            real p = item[6].asDouble();
            auto pd = driver->pair_distribution(basis,sol,i,j,t,s,b,p);
            driver->write_pair_distribution(pd,out_dir+"/pair_distribution.dat",false);
        }
        else {
            std::cout << "Queue action not recognised.\n";
        }
    }

    /*real step_size = pi/6 / 50;
    for (real theta=0; theta<pi/6; theta += step_size) {
        SweepData sd = driver->sweep_basis(basis,theta,pi/6,1);
        driver->write_sweep(sd,out_dir+"/sweep.dat",true);
    }*/

    delete system;
    delete sample_space;
    delete driver;
}
コード例 #6
0
ファイル: settings.cpp プロジェクト: oSleepY/AimTux
void Settings::LoadConfig(std::string path)
{
	if (!std::ifstream(path).good())
	{
		Settings::LoadDefaultsOrSave(path);
		return;
	}

	Json::Value settings;
	std::ifstream config_doc(path, std::ifstream::binary);
	config_doc >> settings;

	GetVal(settings["UI"]["mainColor"], &Settings::UI::mainColor);
	GetVal(settings["UI"]["bodyColor"], &Settings::UI::bodyColor);
	GetVal(settings["UI"]["fontColor"], &Settings::UI::fontColor);
	GetVal(settings["UI"]["Fonts"]["ESP"]["family"], &Settings::UI::Fonts::ESP::family);
	GetVal(settings["UI"]["Fonts"]["ESP"]["size"], &Settings::UI::Fonts::ESP::size);
	GetVal(settings["UI"]["Fonts"]["ESP"]["flags"], &Settings::UI::Fonts::ESP::flags);

	Fonts::SetupFonts();

	Settings::Aimbot::weapons.clear();

	for (Json::ValueIterator itr = settings["Aimbot"]["weapons"].begin(); itr != settings["Aimbot"]["weapons"].end(); itr++)
	{
		std::string weaponDataKey = itr.key().asString();
		auto weaponSetting = settings["Aimbot"]["weapons"][weaponDataKey];

		// XXX Using exception handling to deal with this is stupid, but I don't care to find a better solution
		// XXX We can't use GetOrdinal() since the key type is a string...
		int weaponID;
		try
		{
			weaponID = std::stoi(weaponDataKey);
		}
		catch (std::invalid_argument) // Not a number
		{
			weaponID = Util::Items::GetItemIndex(weaponDataKey);
		}

		Settings::Aimbot::Weapon weapon;
		bool autoWallBones[] = { true, false, false, false, false, false };

		for (int bone = HITBOX_HEAD; bone <= HITBOX_ARMS; bone++)
			autoWallBones[bone] = weaponSetting["AutoWall"]["Bones"][bone].asBool();

		weapon = Settings::Aimbot::Weapon(
			weaponSetting["Enabled"].asBool(),
			weaponSetting["Silent"].asBool(),
			weaponSetting["Friendly"].asBool(),
			weaponSetting["TargetBone"].asInt(),
			Util::GetButtonCode(weaponSetting["AimKey"].asCString()),
			weaponSetting["AimKeyOnly"].asBool(),
			weaponSetting["Smooth"]["Enabled"].asBool(),
			weaponSetting["Smooth"]["Amount"].asFloat(),
			weaponSetting["Smooth"]["Type"].asInt(),
			weaponSetting["Smooth"]["Salting"]["Enabled"].asBool(),
			weaponSetting["Smooth"]["Salting"]["Multiplier"].asFloat(),
			weaponSetting["ErrorMargin"]["Enabled"].asBool(),
			weaponSetting["ErrorMargin"]["Value"].asFloat(),
			weaponSetting["AutoAim"]["Enabled"].asBool(),
			weaponSetting["AutoAim"]["FOV"].asFloat(),
			weaponSetting["AimStep"]["Enabled"].asBool(),
			weaponSetting["AimStep"]["Amount"].asFloat(),
			weaponSetting["RCS"]["Enabled"].asBool(),
			weaponSetting["RCS"]["AlwaysOn"].asBool(),
			weaponSetting["RCS"]["Amount"].asFloat(),
			weaponSetting["AutoPistol"]["Enabled"].asBool(),
			weaponSetting["AutoShoot"]["Enabled"].asBool(),
			weaponSetting["AutoScope"]["Enabled"].asBool(),
			weaponSetting["NoShoot"]["Enabled"].asBool(),
			weaponSetting["IgnoreJump"]["Enabled"].asBool(),
			weaponSetting["SmokeCheck"]["Enabled"].asBool(),
			weaponSetting["AutoWall"]["Enabled"].asBool(),
			weaponSetting["AutoWall"]["Value"].asFloat(),
			autoWallBones
		);

		Settings::Aimbot::weapons[weaponID] = weapon;
	}

	GetVal(settings["Resolver"]["resolve_all"], &Settings::Resolver::resolve_all);

	GetVal(settings["Triggerbot"]["enabled"], &Settings::Triggerbot::enabled);
	GetButtonCode(settings["Triggerbot"]["key"], &Settings::Triggerbot::key);
	GetVal(settings["Triggerbot"]["Filters"]["enemies"], &Settings::Triggerbot::Filters::enemies);
	GetVal(settings["Triggerbot"]["Filters"]["allies"], &Settings::Triggerbot::Filters::allies);
	GetVal(settings["Triggerbot"]["Filters"]["walls"], &Settings::Triggerbot::Filters::walls);
	GetVal(settings["Triggerbot"]["Filters"]["smoke_check"], &Settings::Triggerbot::Filters::smoke_check);
	GetVal(settings["Triggerbot"]["Filters"]["head"], &Settings::Triggerbot::Filters::head);
	GetVal(settings["Triggerbot"]["Filters"]["chest"], &Settings::Triggerbot::Filters::chest);
	GetVal(settings["Triggerbot"]["Filters"]["stomach"], &Settings::Triggerbot::Filters::stomach);
	GetVal(settings["Triggerbot"]["Filters"]["arms"], &Settings::Triggerbot::Filters::arms);
	GetVal(settings["Triggerbot"]["Filters"]["legs"], &Settings::Triggerbot::Filters::legs);
	GetVal(settings["Triggerbot"]["Delay"]["enabled"], &Settings::Triggerbot::Delay::enabled);
	GetVal(settings["Triggerbot"]["Delay"]["value"], &Settings::Triggerbot::Delay::value);

	GetVal(settings["AntiAim"]["Yaw"]["enabled"], &Settings::AntiAim::Yaw::enabled);
	GetVal(settings["AntiAim"]["Yaw"]["type"], &Settings::AntiAim::Yaw::type);
	GetVal(settings["AntiAim"]["Yaw"]["type_fake"], &Settings::AntiAim::Yaw::type_fake);
	GetVal(settings["AntiAim"]["Pitch"]["enabled"], &Settings::AntiAim::Pitch::enabled);
	GetVal(settings["AntiAim"]["Pitch"]["type"], &Settings::AntiAim::Pitch::type);
	GetVal(settings["AntiAim"]["HeadEdge"]["enabled"], &Settings::AntiAim::HeadEdge::enabled);
	GetVal(settings["AntiAim"]["HeadEdge"]["distance"], &Settings::AntiAim::HeadEdge::distance);
	GetVal(settings["AntiAim"]["AutoDisable"]["knife_held"], &Settings::AntiAim::AutoDisable::knife_held);
	GetVal(settings["AntiAim"]["AutoDisable"]["no_enemy"], &Settings::AntiAim::AutoDisable::no_enemy);

	GetVal(settings["ESP"]["enabled"], &Settings::ESP::enabled);
	GetVal(settings["ESP"]["enemy_color"], &Settings::ESP::enemy_color);
	GetVal(settings["ESP"]["enemy_visible_color"], &Settings::ESP::enemy_visible_color);
	GetVal(settings["ESP"]["ally_color"], &Settings::ESP::ally_color);
	GetVal(settings["ESP"]["ally_visible_color"], &Settings::ESP::ally_visible_color);
	GetVal(settings["ESP"]["t_color"], &Settings::ESP::t_color);
	GetVal(settings["ESP"]["t_visible_color"], &Settings::ESP::t_visible_color);
	GetVal(settings["ESP"]["ct_color"], &Settings::ESP::ct_color);
	GetVal(settings["ESP"]["ct_visible_color"], &Settings::ESP::ct_visible_color);
	GetVal(settings["ESP"]["bomb_color"], &Settings::ESP::bomb_color);
	GetVal(settings["ESP"]["bomb_defusing_color"], &Settings::ESP::bomb_defusing_color);
	GetVal(settings["ESP"]["hostage_color"], &Settings::ESP::hostage_color);
	GetVal(settings["ESP"]["defuser_color"], &Settings::ESP::defuser_color);
	GetVal(settings["ESP"]["weapon_color"], &Settings::ESP::weapon_color);
	GetVal(settings["ESP"]["chicken_color"], &Settings::ESP::chicken_color);
	GetVal(settings["ESP"]["fish_color"], &Settings::ESP::fish_color);
	GetVal(settings["ESP"]["smoke_color"], &Settings::ESP::smoke_color);
	GetVal(settings["ESP"]["decoy_color"], &Settings::ESP::decoy_color);
	GetVal(settings["ESP"]["flashbang_color"], &Settings::ESP::flashbang_color);
	GetVal(settings["ESP"]["grenade_color"], &Settings::ESP::grenade_color);
	GetVal(settings["ESP"]["molotov_color"], &Settings::ESP::molotov_color);
	GetVal(settings["ESP"]["Glow"]["enabled"], &Settings::ESP::Glow::enabled);
	GetVal(settings["ESP"]["Glow"]["ally_color"], &Settings::ESP::Glow::ally_color);
	GetVal(settings["ESP"]["Glow"]["enemy_color"], &Settings::ESP::Glow::enemy_color);
	GetVal(settings["ESP"]["Glow"]["enemy_visible_color"], &Settings::ESP::Glow::enemy_visible_color);
	GetVal(settings["ESP"]["Glow"]["weapon_color"], &Settings::ESP::Glow::weapon_color);
	GetVal(settings["ESP"]["Glow"]["grenade_color"], &Settings::ESP::Glow::grenade_color);
	GetVal(settings["ESP"]["Glow"]["defuser_color"], &Settings::ESP::Glow::defuser_color);
	GetVal(settings["ESP"]["Glow"]["chicken_color"], &Settings::ESP::Glow::chicken_color);
	GetVal(settings["ESP"]["Filters"]["legit"], &Settings::ESP::Filters::legit);
	GetVal(settings["ESP"]["Filters"]["visibility_check"], &Settings::ESP::Filters::visibility_check);
	GetVal(settings["ESP"]["Filters"]["smoke_check"], &Settings::ESP::Filters::smoke_check);
	GetVal(settings["ESP"]["Filters"]["enemies"], &Settings::ESP::Filters::enemies);
	GetVal(settings["ESP"]["Filters"]["allies"], &Settings::ESP::Filters::allies);
	GetVal(settings["ESP"]["Filters"]["bomb"], &Settings::ESP::Filters::bomb);
	GetVal(settings["ESP"]["Filters"]["hostages"], &Settings::ESP::Filters::hostages);
	GetVal(settings["ESP"]["Filters"]["defusers"], &Settings::ESP::Filters::defusers);
	GetVal(settings["ESP"]["Filters"]["weapons"], &Settings::ESP::Filters::weapons);
	GetVal(settings["ESP"]["Filters"]["chickens"], &Settings::ESP::Filters::chickens);
	GetVal(settings["ESP"]["Filters"]["fishes"], &Settings::ESP::Filters::fishes);
	GetVal(settings["ESP"]["Filters"]["throwables"], &Settings::ESP::Filters::throwables);
	GetVal(settings["ESP"]["Info"]["name"], &Settings::ESP::Info::name);
	GetVal(settings["ESP"]["Info"]["clan"], &Settings::ESP::Info::clan);
	GetVal(settings["ESP"]["Info"]["steam_id"], &Settings::ESP::Info::steam_id);
	GetVal(settings["ESP"]["Info"]["rank"], &Settings::ESP::Info::rank);
	GetVal(settings["ESP"]["Info"]["health"], &Settings::ESP::Info::health);
	GetVal(settings["ESP"]["Info"]["weapon"], &Settings::ESP::Info::weapon);
	GetVal(settings["ESP"]["Info"]["scoped"], &Settings::ESP::Info::scoped);
	GetVal(settings["ESP"]["Info"]["reloading"], &Settings::ESP::Info::reloading);
	GetVal(settings["ESP"]["Info"]["flashed"], &Settings::ESP::Info::flashed);
	GetVal(settings["ESP"]["Info"]["planting"], &Settings::ESP::Info::planting);
	GetVal(settings["ESP"]["Info"]["has_defuser"], &Settings::ESP::Info::has_defuser);
	GetVal(settings["ESP"]["Info"]["defusing"], &Settings::ESP::Info::defusing);
	GetVal(settings["ESP"]["Info"]["grabbing_hostage"], &Settings::ESP::Info::grabbing_hostage);
	GetVal(settings["ESP"]["Info"]["rescuing"], &Settings::ESP::Info::rescuing);
	GetVal(settings["ESP"]["Info"]["location"], &Settings::ESP::Info::location);
	GetVal(settings["ESP"]["Boxes"]["enabled"], &Settings::ESP::Boxes::enabled);
	GetVal(settings["ESP"]["Boxes"]["type"], &Settings::ESP::Boxes::type);
	GetVal(settings["ESP"]["Skeleton"]["enabled"], &Settings::ESP::Skeleton::enabled);
	GetVal(settings["ESP"]["Skeleton"]["color"], &Settings::ESP::Skeleton::color);
	GetVal(settings["ESP"]["Bars"]["enabled"], &Settings::ESP::Bars::enabled);
	GetVal(settings["ESP"]["Bars"]["color_type"], &Settings::ESP::Bars::color_type);
	GetVal(settings["ESP"]["Bars"]["type"], &Settings::ESP::Bars::type);
	GetVal(settings["ESP"]["Tracers"]["enabled"], &Settings::ESP::Tracers::enabled);
	GetVal(settings["ESP"]["Tracers"]["type"], &Settings::ESP::Tracers::type);
	GetVal(settings["ESP"]["BulletTracers"]["enabled"], &Settings::ESP::BulletTracers::enabled);
	GetVal(settings["ESP"]["FOVCrosshair"]["enabled"], &Settings::ESP::FOVCrosshair::enabled);
	GetVal(settings["ESP"]["FOVCrosshair"]["color"], &Settings::ESP::FOVCrosshair::color);
	GetVal(settings["ESP"]["Chams"]["Arms"]["enabled"], &Settings::ESP::Chams::Arms::enabled);
	GetVal(settings["ESP"]["Chams"]["Arms"]["type"], &Settings::ESP::Chams::Arms::type);
	GetVal(settings["ESP"]["Chams"]["Arms"]["color"], &Settings::ESP::Chams::Arms::color);
	GetVal(settings["ESP"]["Chams"]["players_ally_color"], &Settings::ESP::Chams::ally_color);
	GetVal(settings["ESP"]["Chams"]["players_ally_visible_color"], &Settings::ESP::Chams::ally_visible_color);
	GetVal(settings["ESP"]["Chams"]["players_enemy_color"], &Settings::ESP::Chams::enemy_color);
	GetVal(settings["ESP"]["Chams"]["players_enemy_visible_color"], &Settings::ESP::Chams::enemy_visible_color);
	GetVal(settings["ESP"]["Chams"]["type"], &Settings::ESP::Chams::type);
	GetVal(settings["ESP"]["Chams"]["enabled"], &Settings::ESP::Chams::enabled);
	GetVal(settings["ESP"]["Sounds"]["enabled"], &Settings::ESP::Sounds::enabled);
	GetVal(settings["ESP"]["Sounds"]["time"], &Settings::ESP::Sounds::time);
	GetVal(settings["ESP"]["Hitmarker"]["enabled"], &Settings::ESP::Hitmarker::enabled);
	GetVal(settings["ESP"]["Hitmarker"]["enemies"], &Settings::ESP::Hitmarker::enemies);
	GetVal(settings["ESP"]["Hitmarker"]["allies"], &Settings::ESP::Hitmarker::allies);
	GetVal(settings["ESP"]["Hitmarker"]["color"], &Settings::ESP::Hitmarker::color);
	GetVal(settings["ESP"]["Hitmarker"]["duration"], &Settings::ESP::Hitmarker::duration);
	GetVal(settings["ESP"]["Hitmarker"]["size"], &Settings::ESP::Hitmarker::size);
	GetVal(settings["ESP"]["Hitmarker"]["inner_gap"], &Settings::ESP::Hitmarker::inner_gap);

	GetVal(settings["Dlights"]["enabled"], &Settings::Dlights::enabled);
	GetVal(settings["Dlights"]["radius"], &Settings::Dlights::radius);

	GetVal(settings["Spammer"]["spammer_type"], &Settings::Spammer::type);
	GetVal(settings["Spammer"]["say_team"], &Settings::Spammer::say_team);
	GetVal(settings["Spammer"]["KillSpammer"]["enabled"], &Settings::Spammer::KillSpammer::enabled);
	GetVal(settings["Spammer"]["KillSpammer"]["say_team"], &Settings::Spammer::KillSpammer::say_team);
	GetVal(settings["Spammer"]["KillSpammer"]["message"], &Settings::Spammer::KillSpammer::message);
	if (!settings["Spammer"]["NormalSpammer"]["messages"].isNull())
	{
		Settings::Spammer::NormalSpammer::messages.clear();
		for (const Json::Value& message : settings["Spammer"]["NormalSpammer"]["messages"])
			Settings::Spammer::NormalSpammer::messages.push_back(message.asString());
	}
	GetVal(settings["Spammer"]["PositionSpammer"]["show_name"], &Settings::Spammer::PositionSpammer::show_name);
	GetVal(settings["Spammer"]["PositionSpammer"]["show_weapon"], &Settings::Spammer::PositionSpammer::show_weapon);
	GetVal(settings["Spammer"]["PositionSpammer"]["show_rank"], &Settings::Spammer::PositionSpammer::show_rank);
	GetVal(settings["Spammer"]["PositionSpammer"]["show_wins"], &Settings::Spammer::PositionSpammer::show_wins);
	GetVal(settings["Spammer"]["PositionSpammer"]["show_health"], &Settings::Spammer::PositionSpammer::show_health);
	GetVal(settings["Spammer"]["PositionSpammer"]["show_money"], &Settings::Spammer::PositionSpammer::show_money);
	GetVal(settings["Spammer"]["PositionSpammer"]["show_lastplace"], &Settings::Spammer::PositionSpammer::show_lastplace);

	GetVal(settings["BHop"]["enabled"], &Settings::BHop::enabled);

	GetVal(settings["AutoStrafe"]["enabled"], &Settings::AutoStrafe::enabled);
	GetVal(settings["AutoStrafe"]["type"], &Settings::AutoStrafe::type);

	GetVal(settings["Noflash"]["enabled"], &Settings::Noflash::enabled);
	GetVal(settings["Noflash"]["value"], &Settings::Noflash::value);

	GetVal(settings["Radar"]["enabled"], &Settings::Radar::enabled);
	GetVal(settings["Radar"]["zoom"], &Settings::Radar::zoom);
	GetVal(settings["Radar"]["enemies"], &Settings::Radar::enemies);
	GetVal(settings["Radar"]["allies"], &Settings::Radar::allies);
	GetVal(settings["Radar"]["legit"], &Settings::Radar::legit);
	GetVal(settings["Radar"]["visibility_check"], &Settings::Radar::visibility_check);
	GetVal(settings["Radar"]["smoke_check"], &Settings::Radar::smoke_check);
	GetVal(settings["Radar"]["InGame"]["enabled"], &Settings::Radar::InGame::enabled);
	LoadUIColor(settings["Radar"]["enemy_color"], Settings::Radar::enemy_color);
	LoadUIColor(settings["Radar"]["enemy_visible_color"], Settings::Radar::enemy_visible_color);
	LoadUIColor(settings["Radar"]["ally_color"], Settings::Radar::ally_color);
	LoadUIColor(settings["Radar"]["ally_visible_color"], Settings::Radar::ally_visible_color);
	LoadUIColor(settings["Radar"]["t_color"], Settings::Radar::t_color);
	LoadUIColor(settings["Radar"]["t_visible_color"], Settings::Radar::t_visible_color);
	LoadUIColor(settings["Radar"]["ct_color"], Settings::Radar::ct_color);
	LoadUIColor(settings["Radar"]["ct_visible_color"], Settings::Radar::ct_visible_color);
	LoadUIColor(settings["Radar"]["bomb_color"], Settings::Radar::bomb_color);
	LoadUIColor(settings["Radar"]["bomb_defusing_color"], Settings::Radar::bomb_defusing_color);
	GetVal(settings["Radar"]["icons_scale"], &Settings::Radar::icons_scale);


	GetVal(settings["Recoilcrosshair"]["enabled"], &Settings::Recoilcrosshair::enabled);
	GetVal(settings["Recoilcrosshair"]["showOnlyWhenShooting"], &Settings::Recoilcrosshair::showOnlyWhenShooting);

	GetVal(settings["FOVChanger"]["enabled"], &Settings::FOVChanger::enabled);
	GetVal(settings["FOVChanger"]["value"], &Settings::FOVChanger::value);
	GetVal(settings["FOVChanger"]["viewmodel_enabled"], &Settings::FOVChanger::viewmodel_enabled);
	GetVal(settings["FOVChanger"]["viewmodel_value"], &Settings::FOVChanger::viewmodel_value);
	GetVal(settings["FOVChanger"]["ignore_scope"], &Settings::FOVChanger::ignore_scope);

	GetVal(settings["Airstuck"]["enabled"], &Settings::Airstuck::enabled);
	GetButtonCode(settings["Airstuck"]["key"], &Settings::Airstuck::key);

	Settings::Skinchanger::enabled = false;
	Settings::Skinchanger::skins.clear();

	for (Json::ValueIterator itr = settings["Skinchanger"]["skins"].begin(); itr != settings["Skinchanger"]["skins"].end(); itr++)
	{
		std::string skinDataKey = itr.key().asString();
		auto skinSetting = settings["Skinchanger"]["skins"][skinDataKey];

		// XXX Using exception handling to deal with this is stupid, but I don't care to find a better solution
		// XXX We can't use GetOrdinal() since the key type is a string...
		int weaponID;
		try
		{
			weaponID = std::stoi(skinDataKey);
		}
		catch (std::invalid_argument) // Not a number
		{
			weaponID = Util::Items::GetItemIndex(skinDataKey);
		}

		enum ItemDefinitionIndex defIndex;
		GetOrdinal<enum ItemDefinitionIndex, Util::Items::GetItemIndex>(skinSetting["ItemDefinitionIndex"], &defIndex);

		Settings::Skinchanger::Skin skin = Settings::Skinchanger::Skin(
				skinSetting["PaintKit"].asInt(),
				defIndex,
				skinSetting["Seed"].asInt(),
				skinSetting["Wear"].asFloat(),
				skinSetting["StatTrak"].asInt(),
				skinSetting["CustomName"].asString(),
				skinSetting["Model"].asString()
		);

		Settings::Skinchanger::skins[weaponID] = skin;
	}

	SkinChanger::ForceFullUpdate = true;

	GetVal(settings["Skinchanger"]["enabled"], &Settings::Skinchanger::enabled);

	GetVal(settings["ShowRanks"]["enabled"], &Settings::ShowRanks::enabled);

	GetVal(settings["ShowSpectators"]["enabled"], &Settings::ShowSpectators::enabled);

	GetVal(settings["ClanTagChanger"]["value"], &Settings::ClanTagChanger::value);
	GetVal(settings["ClanTagChanger"]["enabled"], &Settings::ClanTagChanger::enabled);
	GetVal(settings["ClanTagChanger"]["animation"], &Settings::ClanTagChanger::animation);
	GetVal(settings["ClanTagChanger"]["animation_speed"], &Settings::ClanTagChanger::animation_speed);
	GetVal(settings["ClanTagChanger"]["type"], &Settings::ClanTagChanger::type);
	::ClanTagChanger::UpdateClanTagCallback();

	GetVal(settings["View"]["NoViewPunch"]["enabled"], &Settings::View::NoViewPunch::enabled);
	GetVal(settings["View"]["NoAimPunch"]["enabled"], &Settings::View::NoAimPunch::enabled);

	GetVal(settings["Teleport"]["enabled"], &Settings::Teleport::enabled);
	GetButtonCode(settings["Teleport"]["key"], &Settings::Teleport::key);

	GetVal(settings["FakeLag"]["enabled"], &Settings::FakeLag::enabled);

	GetVal(settings["AutoAccept"]["enabled"], &Settings::AutoAccept::enabled);

	GetVal(settings["NoSky"]["enabled"], &Settings::NoSky::enabled);
	GetVal(settings["NoSky"]["color"], &Settings::NoSky::color);

	GetVal(settings["ASUSWalls"]["enabled"], &Settings::ASUSWalls::enabled);
	GetVal(settings["ASUSWalls"]["color"], &Settings::ASUSWalls::color);

	GetVal(settings["NoScopeBorder"]["enabled"], &Settings::NoScopeBorder::enabled);

	GetVal(settings["Autoblock"]["enabled"], &Settings::Autoblock::enabled);
	GetButtonCode(settings["Autoblock"]["key"], &Settings::Autoblock::key);

	GetVal(settings["AutoDefuse"]["enabled"], &Settings::AutoDefuse::enabled);

	GetVal(settings["NoSmoke"]["enabled"], &Settings::NoSmoke::enabled);

	GetVal(settings["ScreenshotCleaner"]["enabled"], &Settings::ScreenshotCleaner::enabled);
}