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

Method remapButtons

Wireless360Controller/Wireless360Controller.cpp:294–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294void Wireless360Controller::remapButtons(void *buffer)
295{
296 XBOX360_IN_REPORT *report360 = (XBOX360_IN_REPORT*)buffer;
297 UInt16 new_buttons = 0;
298
299 new_buttons |= ((report360->buttons & 1) == 1) << mapping[0];
300 new_buttons |= ((report360->buttons & 2) == 2) << mapping[1];
301 new_buttons |= ((report360->buttons & 4) == 4) << mapping[2];
302 new_buttons |= ((report360->buttons & 8) == 8) << mapping[3];
303 new_buttons |= ((report360->buttons & 16) == 16) << mapping[4];
304 new_buttons |= ((report360->buttons & 32) == 32) << mapping[5];
305 new_buttons |= ((report360->buttons & 64) == 64) << mapping[6];
306 new_buttons |= ((report360->buttons & 128) == 128) << mapping[7];
307 new_buttons |= ((report360->buttons & 256) == 256) << mapping[8];
308 new_buttons |= ((report360->buttons & 512) == 512) << mapping[9];
309 new_buttons |= ((report360->buttons & 1024) == 1024) << mapping[10];
310 new_buttons |= ((report360->buttons & 4096) == 4096) << mapping[11];
311 new_buttons |= ((report360->buttons & 8192) == 8192) << mapping[12];
312 new_buttons |= ((report360->buttons & 16384) == 16384) << mapping[13];
313 new_buttons |= ((report360->buttons & 32768) == 32768) << mapping[14];
314
315// IOLog("BUTTON PACKET - %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", mapping[0], mapping[1], mapping[2], mapping[3], mapping[4], mapping[5], mapping[6], mapping[7], mapping[8], mapping[9], mapping[10], mapping[11], mapping[12], mapping[13], mapping[14]);
316
317 report360->buttons = new_buttons;
318}
319
320void Wireless360Controller::remapAxes(void *buffer)
321{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected