Beispiel #1
0
        /// <summary>
        /// Retrieves the configuration file location for the individual controller.
        /// If using an XInput controller, pass null.
        /// </summary>
        private void GetConfigLocation(DInputController dInputController)
        {
            // Get Configuration Details
            LoaderConfigParser loaderConfigParser = new LoaderConfigParser();

            LoaderConfigParser.Config config = loaderConfigParser.ParseConfig();

            // Instantiate Controller Config Parser
            ConfigParser = new ControllerConfigParser();

            // Set the device type
            ConfigType = config.DirectInputConfigType;

            // If XInput/DInput
            if (DeviceType == InputDeviceType.DirectInput)
            {
                // If InstanceGUID or ProductGUID.
                if (ConfigType == DirectInputConfigType.InstanceGUID)
                {
                    ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/Instances/" + dInputController.Information.InstanceGuid + ".ini";
                }
                else if (ConfigType == DirectInputConfigType.ProductGUID)
                {
                    ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/" + dInputController.Information.ProductName + ".ini";
                }
            }
            else if (DeviceType == InputDeviceType.XInput)
            {
                ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/XInput/" + "Controller_" + XInputPort + ".ini";
            }
        }
 /// <summary>
 /// Retrieves the current controller mappings from the controller's ini file.
 /// </summary>
 public ControllerCommon.IController GetMappings()
 {
     return(ControllerConfigParser.ParseConfig(ConfigurationFileLocation, Controller));
 }
 /// <summary>
 /// Writes the current controller mappings to the controller's ini file.
 /// </summary>
 public void SetMappings()
 {
     ControllerConfigParser.WriteConfig(ConfigurationFileLocation, Controller);
 }