Esempio n. 1
0
        void MatchControllers()
        {
            PrimaryController = PlayerIndex.Unknown;

            for (int i = 0; i < _configuredNpads.Length; ++i)
            {
                ref NpadConfig config = ref _configuredNpads[i];

                if (config.State == FilterState.Unconfigured)
                {
                    continue; // Ignore unconfigured
                }

                if ((config.ConfiguredType & _supportedStyleSets) == 0)
                {
                    Logger.PrintWarning(LogClass.Hid, $"ControllerType {config.ConfiguredType} (connected to {(PlayerIndex)i}) not supported by game. Removing...");

                    config.State = FilterState.Configured;
                    _device.Hid.SharedMemory.Npads[i] = new ShMemNpad(); // Zero it

                    continue;
                }

                InitController((PlayerIndex)i, config.ConfiguredType);
            }
Esempio n. 2
0
        private void MatchControllers()
        {
            PrimaryControllerId = HidControllerID.Unknown;

            for (int i = 0; i < _configuredNpads.Length; ++i)
            {
                ref NpadConfig p = ref _configuredNpads[i];

                if (p.State == FilterState.Unconfigured)
                {
                    continue;                                       // Ignore unconfigured
                }
                if ((p.ConfiguredType & _supportedStyleSets) == 0)
                {
                    Logger.PrintWarning(LogClass.Hid, $"ControllerType {p.ConfiguredType} (connected to {(HidControllerID)i}) not supported by game. Removing...");
                    p.State = FilterState.Configured;
                    _device.Hid.SharedMemory.Controllers[i] = new HidController();  // Zero it
                    continue;
                }

                InitController((HidControllerID)i, p.ConfiguredType);
            }
Esempio n. 3
0
        public void AddControllers(params ControllerConfig[] configs)
        {
            for (int i = 0; i < configs.Length; ++i)
            {
                HidControllerID playerId = configs[i].PlayerId;
                ControllerType  type     = configs[i].Type;
                if (playerId > HidControllerID.Handheld)
                {
                    throw new ArgumentOutOfRangeException("playerId must be Player1-8 or Handheld");
                }

                if (type == ControllerType.Handheld)
                {
                    playerId = HidControllerID.Handheld;
                }

                _configuredNpads[(int)playerId] = new NpadConfig {
                    ConfiguredType = type, State = FilterState.Configured
                };
            }

            MatchControllers();
        }
Esempio n. 4
0
        public void AddControllers(params ControllerConfig[] configs)
        {
            for (int i = 0; i < configs.Length; ++i)
            {
                PlayerIndex    player         = configs[i].Player;
                ControllerType controllerType = configs[i].Type;

                if (player > PlayerIndex.Handheld)
                {
                    throw new ArgumentOutOfRangeException("Player must be Player1-8 or Handheld");
                }

                if (controllerType == ControllerType.Handheld)
                {
                    player = PlayerIndex.Handheld;
                }

                _configuredNpads[(int)player] = new NpadConfig {
                    ConfiguredType = controllerType, State = FilterState.Configured
                };
            }

            MatchControllers();
        }