Index: code/branches/network/src/core/ConfigValueIncludes.h
===================================================================
--- code/branches/network/src/core/ConfigValueIncludes.h	(revision 1426)
+++ code/branches/network/src/core/ConfigValueIncludes.h	(revision 1428)
@@ -53,4 +53,19 @@
         container##varname = new orxonox::ConfigValueContainer(CFT_Settings, this->getIdentifier(), #varname, varname = defvalue); \
         this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \
+    } \
+    container##varname->getValue(&varname)
+
+/**
+    @brief Assigns the value, defined in the config-file, to the variable (or the default-value, if there is no entry in the file).
+    @param classname name in which the config value should be stored
+    @param varname The name of the variable
+    @param defvalue The default-value of the variable
+*/
+#define SetConfigValueGeneric(classname, varname, defvalue) \
+    orxonox::ConfigValueContainer* container##varname = ClassManager<classname>::getIdentifier()->getConfigValueContainer(#varname); \
+    if (!container##varname) \
+    { \
+        container##varname = new orxonox::ConfigValueContainer(CFT_Settings, ClassManager<classname>::getIdentifier(), #varname, varname = defvalue); \
+        ClassManager<classname>::getIdentifier()->addConfigValueContainer(#varname, container##varname); \
     } \
     container##varname->getValue(&varname)
Index: code/branches/network/src/core/InputManager.cc
===================================================================
--- code/branches/network/src/core/InputManager.cc	(revision 1426)
+++ code/branches/network/src/core/InputManager.cc	(revision 1428)
@@ -371,4 +371,20 @@
   }
 
+  void InputManager::_saveState()
+  {
+    savedHandlers_.activeHandlers_ = activeHandlers_;
+    savedHandlers_.activeJoyStickHandlers_ = activeJoyStickHandlers_;
+    savedHandlers_.activeKeyHandlers_ = activeKeyHandlers_;
+    savedHandlers_.activeMouseHandlers_ = activeMouseHandlers_;
+  }
+
+  void InputManager::_restoreState()
+  {
+    activeHandlers_ = savedHandlers_.activeHandlers_;
+    activeJoyStickHandlers_ = savedHandlers_.activeJoyStickHandlers_;
+    activeKeyHandlers_ = savedHandlers_.activeKeyHandlers_;
+    activeMouseHandlers_ = savedHandlers_.activeMouseHandlers_;
+  }
+
   void InputManager::_updateTickables()
   {
@@ -405,10 +421,9 @@
       return;
 
-    // reset the game if it has changed
     if (state_ != stateRequest_)
     {
       if (stateRequest_ != IS_CUSTOM)
       {
-        if (stateRequest_ != IS_NODETECT && stateRequest_ != IS_DETECT)
+        if (stateRequest_ != IS_DETECT)
         {
           activeKeyHandlers_.clear();
@@ -439,4 +454,11 @@
         case IS_DETECT:
           savedState_ = state_;
+          _saveState();
+
+          activeKeyHandlers_.clear();
+          activeMouseHandlers_.clear();
+          for (unsigned int i = 0; i < joySticksSize_; i++)
+            activeJoyStickHandlers_[i].clear();
+
           enableKeyHandler("keydetector");
           enableMouseHandler("keydetector");
@@ -445,7 +467,5 @@
 
         case IS_NODETECT:
-          disableKeyHandler("keydetector");
-          disableMouseHandler("keydetector");
-          disableJoyStickHandler("keydetector", 0);
+          _restoreState();
           break;
 
Index: code/branches/network/src/core/InputManager.h
===================================================================
--- code/branches/network/src/core/InputManager.h	(revision 1426)
+++ code/branches/network/src/core/InputManager.h	(revision 1428)
@@ -65,4 +65,15 @@
   public:
     IntVector2 sliderStates[4];
+  };
+
+  /**
+  * Struct for storing a custom input state
+  */
+  struct StoredState
+  {
+    std::vector<KeyHandler*>                    activeKeyHandlers_;
+    std::vector<MouseHandler*>                  activeMouseHandlers_;
+    std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_;
+    std::vector<std::pair<InputTickable*, HandlerState> > activeHandlers_;
   };
 
@@ -158,4 +169,7 @@
     void _updateTickables();
 
+    void _saveState();
+    void _restoreState();
+
     void tick(float dt);
 
@@ -191,4 +205,5 @@
     unsigned int keyboardModifiers_;
     InputState savedState_;
+    StoredState savedHandlers_;
 
     //! Keeps track of the joy stick POV states
Index: code/branches/network/src/core/KeyBinder.cc
===================================================================
--- code/branches/network/src/core/KeyBinder.cc	(revision 1426)
+++ code/branches/network/src/core/KeyBinder.cc	(revision 1428)
@@ -321,4 +321,5 @@
         delete paramCommands_[i];
       delete[] paramCommands_;
+      nParamCommands_ = 0;
     }
     else
@@ -543,12 +544,13 @@
   void KeyBinder::setConfigValues()
   {
-    SetConfigValue(analogThreshold_, 0.01f)  .description("Threshold for analog axes until which the state is 0.");
-    SetConfigValue(mouseSensitivity_, 1.0f)  .description("Mouse sensitivity.");
-    SetConfigValue(bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value.");
-    SetConfigValue(derivePeriod_, 0.5f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
-    SetConfigValue(mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived.");
+    SetConfigValueGeneric(KeyBinder, analogThreshold_, 0.01f)  .description("Threshold for analog axes until which the state is 0.");
+    SetConfigValueGeneric(KeyBinder, mouseSensitivity_, 1.0f)  .description("Mouse sensitivity.");
+    SetConfigValueGeneric(KeyBinder, bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value.");
+    SetConfigValueGeneric(KeyBinder, derivePeriod_, 0.5f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
+    SetConfigValueGeneric(KeyBinder, mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived.");
+    SetConfigValueGeneric(KeyBinder, bClipMouse_, true).description("Whether or not to clip absolute value of mouse in non derive mode.");
 
     float oldThresh = buttonThreshold_;
-    SetConfigValue(buttonThreshold_, 0.80f).description("Threshold for analog axes until which the button is not pressed.");
+    SetConfigValueGeneric(KeyBinder, buttonThreshold_, 0.80f).description("Threshold for analog axes until which the button is not pressed.");
     if (oldThresh != buttonThreshold_)
       for (unsigned int i = 0; i < nHalfAxes_s; i++)
@@ -573,9 +575,9 @@
   {
     // config value stuff
-    ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer(button.name_);
+    ConfigValueContainer* cont = ClassManager<KeyBinder>::getIdentifier()->getConfigValueContainer(button.name_);
     if (!cont)
     {
-      cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), button.name_, "");
-      getIdentifier()->addConfigValueContainer(button.name_, cont);
+      cont = new ConfigValueContainer(CFT_Keybindings, ClassManager<KeyBinder>::getIdentifier(), button.name_, "");
+      ClassManager<KeyBinder>::getIdentifier()->addConfigValueContainer(button.name_, cont);
     }
     std::string old = button.bindingString_;
@@ -585,4 +587,7 @@
     if (old != button.bindingString_)
     {
+      // clear everything so we don't get old axis ParamCommands mixed up
+      button.clear();
+
       // binding has changed
       button.parse(paramCommandBuffer_);
@@ -678,4 +683,6 @@
           //COUT(3) << mouseRelative_[i] << " | ";
           mouseRelative_[i] = 0;
+          halfAxes_[2*i + 0].hasChanged_ = true;
+          halfAxes_[2*i + 1].hasChanged_ = true;
         }
         deriveTime_ = 0.0f;
@@ -731,11 +738,9 @@
   void KeyBinder::mouseMoved(IntVector2 abs_, IntVector2 rel_, IntVector2 clippingSize)
   {
+    // y axis of mouse input is inverted
+    int rel[] = { rel_.x, -rel_.y };
+
     if (!bDeriveMouseInput_)
     {
-      // y axis of mouse input is inverted
-      int rel[] = { rel_.x, -rel_.y };
-
-      //COUT(3) << rel[0] << " | " << rel[1] << std::endl;
-
       for (int i = 0; i < 2; i++)
       {
@@ -743,40 +748,26 @@
         {
           // absolute
+          halfAxes_[2*i + 0].hasChanged_ = true;
+          halfAxes_[2*i + 1].hasChanged_ = true;
+          mousePosition_[i] += rel[i];
+
+          if (bClipMouse_)
+          {
+            if (mousePosition_[i] > 1024)
+              mousePosition_[i] =  1024;
+            if (mousePosition_[i] < -1024)
+              mousePosition_[i] = -1024;
+          }
+
           if (mousePosition_[i] >= 0)
           {
-            mousePosition_[i] += rel[i];
-            halfAxes_[0 + 2*i].hasChanged_ = true;
-            if (mousePosition_[i] < 0)
-            {
-              halfAxes_[1 + 2*i].hasChanged_ = true;
-              halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_;
-              halfAxes_[0 + 2*i].absVal_ =  0.0f;
-            }
-            else
-              halfAxes_[0 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
+            halfAxes_[2*i + 0].absVal_ =   mousePosition_[i]/1024.0f * mouseSensitivity_;
+            halfAxes_[2*i + 1].absVal_ =  0.0f;
           }
           else
           {
-            mousePosition_[i] += rel[i];
-            halfAxes_[1 + 2*i].hasChanged_ = true;
-            if (mousePosition_[i] > 0)
-            {
-              halfAxes_[0 + 2*i].hasChanged_ = true;
-              halfAxes_[0 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
-              halfAxes_[1 + 2*i].absVal_ =  0.0f;
-            }
-            else
-              halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_;
-          }
-          //COUT(3) << "half axis 0: " << halfAxes_[0].absVal_ << std::endl;
-          //COUT(3) << "half axis 1: " << halfAxes_[1].absVal_ << std::endl;
-          //COUT(3) << "half axis 2: " << halfAxes_[2].absVal_ << std::endl;
-          //COUT(3) << "half axis 3: " << halfAxes_[3].absVal_ << std::endl;
-
-          // relative
-          if (rel[i] > 0)
-            halfAxes_[0 + 2*i].relVal_ =  ((float)rel[i])/1024 * mouseSensitivity_;
-          else
-            halfAxes_[1 + 2*i].relVal_ = -((float)rel[i])/1024 * mouseSensitivity_;
+            halfAxes_[2*i + 0].absVal_ =  0.0f;
+            halfAxes_[2*i + 1].absVal_ =  -mousePosition_[i]/1024.0f * mouseSensitivity_;
+          }
         }
       }
@@ -784,6 +775,15 @@
     else
     {
-      mouseRelative_[0] += rel_.x;
-      mouseRelative_[1] -= rel_.y;
+      mouseRelative_[0] += rel[0];
+      mouseRelative_[1] += rel[1];
+    }
+
+    // relative
+    for (int i = 0; i < 2; i++)
+    {
+      if (rel[i] > 0)
+        halfAxes_[0 + 2*i].relVal_ =  ((float)rel[i])/1024 * mouseSensitivity_;
+      else
+        halfAxes_[1 + 2*i].relVal_ = -((float)rel[i])/1024 * mouseSensitivity_;
     }
   }
@@ -871,27 +871,6 @@
   }
 
-  /**
-    @brief Loader for the key bindings, managed by config values.
-  */
-  void KeyDetector::setConfigValues()
-  {
-    // keys
-    for (unsigned int i = 0; i < nKeys_s; i++)
-      readTrigger(keys_[i]);
-    // mouse buttons
-    for (unsigned int i = 0; i < nMouseButtons_s; i++)
-      readTrigger(mouseButtons_[i]);
-    // joy stick buttons
-    for (unsigned int i = 0; i < nJoyStickButtons_s; i++)
-      readTrigger(joyStickButtons_[i]);
-    // half axes
-    for (unsigned int i = 0; i < nHalfAxes_s; i++)
-      readTrigger(halfAxes_[i]);
-  }
-
   void KeyDetector::readTrigger(Button& button)
   {
-    // binding has changed
-    button.parse(paramCommandBuffer_);
     SimpleCommand* cmd = new SimpleCommand();
     cmd->evaluation_ = CommandExecutor::evaluate("storeKeyStroke " + button.name_);
Index: code/branches/network/src/core/KeyBinder.h
===================================================================
--- code/branches/network/src/core/KeyBinder.h	(revision 1426)
+++ code/branches/network/src/core/KeyBinder.h	(revision 1428)
@@ -150,5 +150,5 @@
     void tickInput(float dt, const HandlerState& state);
 
-    void readTrigger(Button& button);
+    virtual void readTrigger(Button& button);
 
     void keyPressed (const KeyEvent& evt);
@@ -222,4 +222,6 @@
     //! mouse sensitivity if mouse input is derived
     float mouseSensitivityDerived_;
+    //! Whether or not to clip abslute mouse values to 1024
+    bool bClipMouse_;
   };
 
@@ -231,5 +233,4 @@
     ~KeyDetector();
     void loadBindings();
-    void setConfigValues();
 
   protected:
