Ejemplo n.º 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.Config config = LoaderConfigParser.ParseConfig();

            // 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 + ".json";
                }

                else if (ConfigType == DirectInputConfigType.ProductGUID)
                {
                    ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/" +
                                                PathSanitizer.ForceValidFilePath(dInputController.Information.ProductName) + ".json";
                }
            }
            else if (DeviceType == InputDeviceType.XInput)
            {
                ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/XInput/" + "Controller_" + XInputPort + ".json";
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads all configurations to be used by the program, alongside with their parsers.
        /// </summary>
        private void InitializeGlobalProperties()
        {
            // Instantiate the Global Config Manager
            Global.ConfigurationManager = new ConfigManager();

            // Grab relevant configs.
            // Note: Game list is grabbed upon entry to the main screen form.
            Global.LoaderConfiguration = LoaderConfigParser.ParseConfig();

            // Initialize other Properties.
            Global.Theme = new Theme();

            // Set the initial menu name.
            Global.CurrentMenuName = "Main Menu";
        }