예제 #1
0
 public InputDescriptor(uint port, RetroDevice device, uint index, uint id, string description)
 {
     _port        = port;
     _device      = device;
     _index       = index;
     _id          = id;
     _description = description;
 }
예제 #2
0
        private short _inputState(uint port, RetroDevice device, uint index, uint id)
        {
            if (_inputProcessor[(int)port] == null)
            {
                return(0);
            }

            switch (device)
            {
            case RetroDevice.Joypad:
                switch ((RetroDeviceIdJoypad)id)
                {
                case RetroDeviceIdJoypad.A:
                    return(_inputProcessor[(int)port].B == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.B:
                    return(_inputProcessor[(int)port].A == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.DOWN:
                    return(_inputProcessor[(int)port].DpadDown == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.L:
                    return(_inputProcessor[(int)port].LeftShoulder == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.L2:
                    return(_inputProcessor[(int)port].LeftTrigger);

                case RetroDeviceIdJoypad.L3:
                    return(_inputProcessor[(int)port].LeftStick == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.LEFT:
                    return(_inputProcessor[(int)port].DpadLeft == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.R:
                    return(_inputProcessor[(int)port].RightShoulder == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.R2:
                    return(_inputProcessor[(int)port].RightTrigger);

                case RetroDeviceIdJoypad.R3:
                    return(_inputProcessor[(int)port].RightStick == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.RIGHT:
                    return(_inputProcessor[(int)port].DpadRight == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.SELECT:
                    return(_inputProcessor[(int)port].Back == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.START:
                    return(_inputProcessor[(int)port].Start == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.UP:
                    return(_inputProcessor[(int)port].DpadUp == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.X:
                    return(_inputProcessor[(int)port].Y == GameControllerButtonState.Down ? short.MaxValue : (short)0);

                case RetroDeviceIdJoypad.Y:
                    return(_inputProcessor[(int)port].X == GameControllerButtonState.Down ? short.MaxValue : (short)0);
                }
                break;
            }

            return(0);
        }