MCPcopy Create free account
hub / github.com/cathery/sys-con / GetInput

Method GetInput

source/ControllerLib/Controllers/XboxOneController.cpp:159–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159Result 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
190Result XboxOneController::SendInitBytes()
191{

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.80

Tested by

no test coverage detected