public static void unpressAll() {
    for (Map.Entry<String, ControllerBinding> entry : joyBindingsMap.entrySet()) {
      if (entry.getValue().bindingOptions.contains(BindingOptions.IS_TOGGLE))
        entry.getValue().toggleState = false;
    }

    KeyBinding.unPressAllKeys();
    VirtualMouse.unpressAllButtons();
  }
  public static void setInputEnabled(int joyIndex, boolean b) {
    unpressAll();
    if (!b) {
      JoypadMouse.AxisReader.setXY(0, 0);
      VirtualMouse.setXY(0, 0);
      inputEnabled = false;
      config.updatePreferedJoy(-1, null);
      return;
    }

    if (joyNo != joyIndex) {
      setController(joyIndex);
      return;
    }

    inputEnabled = true;
    config.updatePreferedJoy(joyIndex, Controllers.getController(joyIndex).getName());
    JoypadMouse.AxisReader.centerCrosshairs();
  }