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

Method GetInput

source/ControllerLib/Controllers/Xbox360WirelessController.cpp:112–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112Result Xbox360WirelessController::GetInput()
113{
114 uint8_t input_bytes[64];
115
116 Result rc = m_inPipe->Read(input_bytes, sizeof(input_bytes));
117
118 uint8_t type = input_bytes[0];
119
120 if (input_bytes[0] & 0x08)
121 {
122 bool newPresence = (input_bytes[1] & 0x80) != 0;
123
124 if (m_presence != newPresence)
125 {
126 m_presence = newPresence;
127
128 if (m_presence)
129 OnControllerConnect();
130 else
131 OnControllerDisconnect();
132 }
133 }
134
135 if (input_bytes[1] != 0x1)
136 return 1;
137
138 if (type == XBOX360INPUT_BUTTON)
139 {
140 m_buttonData = *reinterpret_cast<Xbox360ButtonData *>(input_bytes + 4);
141 }
142
143 return rc;
144}
145
146float Xbox360WirelessController::NormalizeTrigger(uint8_t deadzonePercent, uint8_t value)
147{

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.80

Tested by

no test coverage detected