this didn't seem to get through the first time, so I'm resending it...

> Hello,
> 
> I notice the Reload Input menu item does not do anything, at least when
> tuning the joystick configuration file. This seems to be related to none
> of the classes derived from FGInput overriding the reinit method
> inherited from SGSubsystemGroup. Is this just a missing feature, or was
> there a reason not to implement this?
> 
> If it is just a missing feature, would it be an acceptable solution for
> FGJoystickInput::reinit to delete all /input/joysticks/js* nodes and
> call init and postinit, or would this raise some Nasal/property node
> listeners/memory corruption issues that aren't obvious from glancing at
> FGJoystickInput.cxx?

In the meantime I played around with this a little and came up with the
attached patch which does what I describe above. This seems to work,
though I didn't do any checks to rule out the suspected issues.

Best regards,
        Andreas
commit f020ee10ff1b758c9b99e31642147eecfc0facac
Author: Andreas Gaeb <a.g...@web.de>
Date:   Thu Jan 27 11:32:10 2011 +0100

    Reload Input für Joysticks

diff --git a/src/Input/FGJoystickInput.cxx b/src/Input/FGJoystickInput.cxx
index 349782d..17f1f35 100644
--- a/src/Input/FGJoystickInput.cxx
+++ b/src/Input/FGJoystickInput.cxx
@@ -119,6 +119,14 @@ void FGJoystickInput::init()
   }
 }
 
+void FGJoystickInput::reinit() {
+  SG_LOG(SG_INPUT, SG_DEBUG, "Re-Initializing joystick bindings");
+  SGPropertyNode * js_nodes = fgGetNode("/input/joysticks", true);
+  js_nodes->removeChildren("js", false);
+  FGJoystickInput::init();
+  FGJoystickInput::postinit();
+}
+
 void FGJoystickInput::postinit()
 {
   FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
diff --git a/src/Input/FGJoystickInput.hxx b/src/Input/FGJoystickInput.hxx
index ef1530e..2a5c4cc 100644
--- a/src/Input/FGJoystickInput.hxx
+++ b/src/Input/FGJoystickInput.hxx
@@ -44,6 +44,7 @@ public:
 
   virtual void init();
   virtual void postinit();
+  virtual void reinit();
   virtual void update( double dt );
 
   static const int MAX_JOYSTICKS        = 10;
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to