| 157 | } |
| 158 | |
| 159 | Result XboxOneController::GetInput() |
| 160 | { |
| 161 | uint8_t input_bytes[64]; |
| 162 | |
| 163 | Result rc = m_inPipe->Read(input_bytes, sizeof(input_bytes)); |
| 164 | if (R_FAILED(rc)) |
| 165 | return rc; |
| 166 | |
| 167 | uint8_t type = input_bytes[0]; |
| 168 | |
| 169 | if (type == XBONEINPUT_BUTTON) //Button data |
| 170 | { |
| 171 | m_buttonData = *reinterpret_cast<XboxOneButtonData *>(input_bytes); |
| 172 | } |
| 173 | else if (type == XBONEINPUT_GUIDEBUTTON) //Guide button Result |
| 174 | { |
| 175 | m_GuidePressed = input_bytes[4]; |
| 176 | |
| 177 | //Xbox one S needs to be sent an ack report for guide buttons |
| 178 | //TODO: needs testing |
| 179 | if (input_bytes[1] == 0x30) |
| 180 | { |
| 181 | rc = WriteAckGuideReport(input_bytes[2]); |
| 182 | if (R_FAILED(rc)) |
| 183 | return rc; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | return rc; |
| 188 | } |
| 189 | |
| 190 | Result XboxOneController::SendInitBytes() |
| 191 | { |