bool saveData = false;
ofstream cachefile;
if (fgGetBool("/sim/ai/groundnet-cache")) {
- SGPath cacheData(fgGetString("/sim/fg-home"));
+ SGPath cacheData(globals->get_fg_home());
cacheData.append("ai");
string airport = parent->getId();
bool saveData = false;
ofstream cachefile;
if (fgGetBool("/sim/ai/groundnet-cache")) {
- SGPath cacheData(fgGetString("/sim/fg-home"));
+ SGPath cacheData(globals->get_fg_home());
cacheData.append("ai");
string airport = parent->getId();
//cerr << "Done initializing ground network" << endl;
//exit(1);
if (fgGetBool("/sim/ai/groundnet-cache")) {
- SGPath cacheData(fgGetString("/sim/fg-home"));
+ SGPath cacheData(globals->get_fg_home());
cacheData.append("ai");
string airport = parent->getId();
if (_path.create_dir( 0755 )) {
SG_LOG(SG_GENERAL, SG_ALERT, "Cannot create screenshot directory '"
<< dir << "'. Trying home directory.");
- dir = fgGetString("/sim/fg-home");
+ dir = globals->get_fg_home();
}
char filename[24];
if (path.create_dir( 0755 )) {
SG_LOG(SG_GENERAL, SG_ALERT, "Cannot create screenshot directory '"
<< dir << "'. Trying home directory.");
- dir = fgGetString("/sim/fg-home");
+ dir = globals->get_fg_home();
}
char filename[24];
childname(aChildname)
{
int index = 1000;
+ scan_dir( SGPath(globals->get_fg_home(), relative_path), &index);
scan_dir( SGPath(globals->get_fg_root(), relative_path), &index);
PropertyList childNodes = base->getChildren(childname);
jsInit();
SG_LOG(SG_INPUT, SG_DEBUG, "Initializing joystick bindings");
SGPropertyNode_ptr js_nodes = fgGetNode("/input/joysticks", true);
+ status_node = fgGetNode("/devices/status/joysticks", true);
FGDeviceConfigurationMap configMap("Input/Joysticks", js_nodes, "js-named");
js->read(&buttons, axis_values);
if (js->notWorking()) // If js is disconnected
continue;
+
+ // Update device status
+ SGPropertyNode_ptr status = status_node->getChild("joystick", i, true);
+ for (int j = 0; j < MAX_JOYSTICK_AXES; j++) {
+ status->getChild("axis", j, true)->setFloatValue(axis_values[j]);
+ }
+
+ for (int j = 0; j < MAX_JOYSTICK_BUTTONS; j++) {
+ status->getChild("button", j, true)->setBoolValue((buttons & (1u << j)) > 0 );
+ }
// Fire bindings for the axes.
for (int j = 0; j < bindings[i].naxes; j++) {
private:
void _remove(bool all);
+ SGPropertyNode_ptr status_node;
/**
* Settings for a single joystick axis.
int nbuttons;
axis * axes;
FGButton * buttons;
- bool predefined;
+ bool predefined;
};
joystick bindings[MAX_JOYSTICKS];
const char *fg_home = getenv("FG_HOME");
if (fg_home)
dataPath = fg_home;
+
+ globals->set_fg_home(dataPath.c_str());
simgear::Dir exportDir(simgear::Dir(dataPath).file("Export"));
if (!exportDir.exists()) {
string fltType;
string acOperator;
SGPath acData;
- try {
- acData = fgGetString("/sim/fg-home");
+ try {
+ acData = globals->get_fg_home();
acData.append("aircraft-data");
string acfile = fgGetString("/sim/aircraft") + string(".xml");
acData.append(acfile);
event_mgr( new SGEventMgr ),
sim_time_sec( 0.0 ),
fg_root( "" ),
+ fg_home( "" ),
time_params( NULL ),
ephem( NULL ),
mag( NULL ),
locale = NULL;
}
-
// set the fg_root path
void FGGlobals::set_fg_root (const string &root) {
SGPath tmp(root);
simgear::ResourceManager::PRIORITY_DEFAULT);
}
+// set the fg_home path
+void FGGlobals::set_fg_home (const string &home) {
+ SGPath tmp(home);
+ fg_home = tmp.realpath();
+}
+
void FGGlobals::append_fg_scenery (const string &paths)
{
// fg_scenery.clear();
// don't save settings more than once on shutdown
haveUserSettings = false;
- SGPath autosaveFile(fgGetString("/sim/fg-home"));
+ SGPath autosaveFile(globals->get_fg_home());
autosaveFile.append( "autosave.xml" );
autosaveFile.create_dir( 0700 );
SG_LOG(SG_IO, SG_INFO, "Saving user settings to " << autosaveFile.str());
// Root of FlightGear data tree
std::string fg_root;
+ // Users home directory for data
+ std::string fg_home;
+
// Roots of FlightGear scenery tree
string_list fg_scenery;
inline const std::string &get_fg_root () const { return fg_root; }
void set_fg_root (const std::string &root);
+ inline const std::string &get_fg_home () const { return fg_home; }
+ void set_fg_home (const std::string &home);
+
inline const string_list &get_fg_scenery () const { return fg_scenery; }
void append_fg_scenery (const std::string &scenery);
cerr << "Revision: " << REVISION << endl;
cerr << "Build-Id: " << HUDSON_BUILD_ID << endl;
cerr << "FG_ROOT=" << globals->get_fg_root() << endl;
- cerr << "FG_HOME=" << fgGetString("/sim/fg-home") << endl;
+ cerr << "FG_HOME=" << globals->get_fg_home() << endl;
cerr << "FG_SCENERY=";
int didsome = 0;
if (fgGetBool("/sim/terrasync/enabled")) {
string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
if (terrasyncDir.empty()) {
- SGPath p(fgGetString("/sim/fg-home"));
+ SGPath p(globals->get_fg_home());
p.append("TerraSync");
if (!p.exists()) {
simgear::Dir dd(p);
void FGRadioAntenna::load_NEC_antenna_pattern(string type) {
- //SGPath pattern_file(fgGetString("/sim/fg-home"));
+ //SGPath pattern_file(globals->get_fg_home());
SGPath pattern_file(globals->get_fg_root());
pattern_file.append("Navaids/Antennas");
pattern_file.append(type + ".txt");
bool saveData = false;
ofstream cachefile;
if (fgGetBool("/sim/traffic-manager/heuristics")) {
- SGPath cacheData(fgGetString("/sim/fg-home"));
+ SGPath cacheData(globals->get_fg_home());
cacheData.append("ai");
string airport = fgGetString("/sim/presets/airport-id");
HeuristicMap heurMap;
//cerr << "Processing Heuristics" << endl;
// Load the heuristics data
- SGPath cacheData(fgGetString("/sim/fg-home"));
+ SGPath cacheData(globals->get_fg_home());
cacheData.append("ai");
string airport = fgGetString("/sim/presets/airport-id");
if ((airport) != "") {