MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / inputdevice_testrecord_test

Function inputdevice_testrecord_test

src/inputdevice.cpp:9745–9810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9743}
9744
9745static void inputdevice_testrecord_test(int type, int num, int wtype, int wnum, int state, int max)
9746{
9747 if (wnum < 0) {
9748 testmode = -1;
9749 return;
9750 }
9751
9752 if (testmode_count >= TESTMODE_MAX) {
9753 return;
9754 }
9755 if (testmode_oneshot && testmode_count > 0) {
9756 return;
9757 }
9758
9759 if (type == IDTYPE_KEYBOARD) {
9760 if (wnum >= 0x100) {
9761 wnum = 0x100 - wnum;
9762 } else {
9763 struct uae_input_device *na = &keyboards[num];
9764 int j = 0;
9765 while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j] >= 0) {
9766 if (na->extra[j] == wnum) {
9767 wnum = j;
9768 break;
9769 }
9770 j++;
9771 }
9772 if (j >= MAX_INPUT_DEVICE_EVENTS || na->extra[j] < 0)
9773 return;
9774 }
9775 }
9776 // wait until previous event is released before accepting new ones
9777 for (int i = 0; i < TESTMODE_MAX; i++) {
9778 struct teststore *ts2 = &testmode_wait[i];
9779 if (ts2->testmode_num < 0)
9780 continue;
9781 if (ts2->testmode_num != num || ts2->testmode_type != type || ts2->testmode_wtype != wtype || ts2->testmode_wnum != wnum)
9782 continue;
9783 if (max <= 0) {
9784 if (state)
9785 continue;
9786 } else {
9787 if (state < -(max / 2) || state > (max / 2))
9788 continue;
9789 }
9790 ts2->testmode_num = -1;
9791 }
9792 if (max <= 0) {
9793 if (!state)
9794 return;
9795 } else {
9796 if (state >= -(max / 2) && state <= (max / 2))
9797 return;
9798 }
9799
9800 //write_log (_T("%d %d %d %d %d/%d\n"), type, num, wtype, wnum, state, max);
9801
9802 struct teststore *ts = &testmode_data[testmode_count];

Callers 1

inputdevice_testrecordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected