コード例 #1
0
ファイル: Joycon.cs プロジェクト: quark-zju/BetterJoyForCemu
        public void Detach()
        {
            stop_polling = true;

            if (xin != null)
            {
                xin.Disconnect(); xin.Dispose();
            }

            if (state > state_.NO_JOYCONS)
            {
                HIDapi.hid_set_nonblocking(handle, 0);

                Subcommand(0x40, new byte[] { 0x0 }, 1);
                //Subcommand(0x48, new byte[] { 0x0 }, 1); // Would turn off rumble?

                if (isUSB)
                {
                    byte[] a = Enumerable.Repeat((byte)0, 64).ToArray();
                    a[0] = 0x80; a[1] = 0x05; // Allow device to talk to BT again
                    HIDapi.hid_write(handle, a, new UIntPtr(2));
                    a[0] = 0x80; a[1] = 0x06; // Allow device to talk to BT again
                    HIDapi.hid_write(handle, a, new UIntPtr(2));
                }
            }
            if (state > state_.DROPPED)
            {
                HIDapi.hid_close(handle);
            }
            state = state_.NOT_ATTACHED;
        }
コード例 #2
0
ファイル: Joycon.cs プロジェクト: ghettokon/BetterJoyForCemu
        public void Detach()
        {
            stop_polling = true;

            if (state > state_.NO_JOYCONS)
            {
                Subcommand(0x40, new byte[] { 0x0 }, 1);
                Subcommand(0x48, new byte[] { 0x0 }, 1);

                if (isUSB)
                {
                    byte[] a = Enumerable.Repeat((byte)0, 64).ToArray();
                    a[0] = 0x80; a[1] = 0x05;                     // Allow device to talk to BT again
                    HIDapi.hid_write(handle, a, new UIntPtr(2));
                }
            }
            if (state > state_.DROPPED)
            {
                HIDapi.hid_close(handle);
            }
            state = state_.NOT_ATTACHED;
        }