MCPcopy Create free account
hub / github.com/360Controller/360Controller / remapButtons

Method remapButtons

360Controller/Controller.cpp:232–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void Xbox360ControllerClass::remapButtons(void *buffer)
233{
234 XBOX360_IN_REPORT *report360 = (XBOX360_IN_REPORT*)buffer;
235 UInt16 new_buttons = 0;
236
237 new_buttons |= ((report360->buttons & 1) == 1) << GetOwner(this)->mapping[0];
238 new_buttons |= ((report360->buttons & 2) == 2) << GetOwner(this)->mapping[1];
239 new_buttons |= ((report360->buttons & 4) == 4) << GetOwner(this)->mapping[2];
240 new_buttons |= ((report360->buttons & 8) == 8) << GetOwner(this)->mapping[3];
241 new_buttons |= ((report360->buttons & 16) == 16) << GetOwner(this)->mapping[4];
242 new_buttons |= ((report360->buttons & 32) == 32) << GetOwner(this)->mapping[5];
243 new_buttons |= ((report360->buttons & 64) == 64) << GetOwner(this)->mapping[6];
244 new_buttons |= ((report360->buttons & 128) == 128) << GetOwner(this)->mapping[7];
245 new_buttons |= ((report360->buttons & 256) == 256) << GetOwner(this)->mapping[8];
246 new_buttons |= ((report360->buttons & 512) == 512) << GetOwner(this)->mapping[9];
247 new_buttons |= ((report360->buttons & 1024) == 1024) << GetOwner(this)->mapping[10];
248 new_buttons |= ((report360->buttons & 4096) == 4096) << GetOwner(this)->mapping[11];
249 new_buttons |= ((report360->buttons & 8192) == 8192) << GetOwner(this)->mapping[12];
250 new_buttons |= ((report360->buttons & 16384) == 16384) << GetOwner(this)->mapping[13];
251 new_buttons |= ((report360->buttons & 32768) == 32768) << GetOwner(this)->mapping[14];
252
253// IOLog("BUTTON PACKET - %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", GetOwner(this)->mapping[0], GetOwner(this)->mapping[1], GetOwner(this)->mapping[2], GetOwner(this)->mapping[3], GetOwner(this)->mapping[4], GetOwner(this)->mapping[5], GetOwner(this)->mapping[6], GetOwner(this)->mapping[7], GetOwner(this)->mapping[8], GetOwner(this)->mapping[9], GetOwner(this)->mapping[10], GetOwner(this)->mapping[11], GetOwner(this)->mapping[12], GetOwner(this)->mapping[13], GetOwner(this)->mapping[14]);
254
255 report360->buttons = new_buttons;
256}
257
258void Xbox360ControllerClass::remapAxes(void *buffer)
259{

Callers

nothing calls this directly

Calls 1

GetOwnerFunction · 0.85

Tested by

no test coverage detected