コード例 #1
0
        // Identifies if the extension in the wiimote is a Nunchuck or not
        // Will not recognise any othe extension
        private void RespondIdentifyExtension(byte[] data)
        {
            if (data.Length != 6)
            {
                return;
            }

            byte[] resized = new byte[8];
            for (int x = 0; x < 6; x++)
            {
                resized[x] = data[5 - x];
            }
            long val = BitConverter.ToInt64(resized, 0);


            if (val == ID_Nunchuck || val == ID_Nunchuck2)
            {
                _current_ext = ExtensionController.NUNCHUCK;
                if (_Extension == null || _Extension.GetType() != typeof(CS_NunchuckData))
                {
                    _Extension = new CS_NunchuckData(this);
                }
            }
            else
            {
                _current_ext = ExtensionController.NONE;
                _Extension   = null;
            }
        }
コード例 #2
0
 public CS_WiiMote(IntPtr hidapi_handle, string hidapi_path, WiimoteType Type)
 {
     _hidapi_handle = hidapi_handle;
     _hidapi_path   = hidapi_path;
     _Type          = Type;
     _Status        = new CS_StatusData(this);
     _Extension     = null;
 }