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

Function inputdevice_get_compatibility_input

src/inputdevice.cpp:7221–7289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7219}
7220
7221int inputdevice_get_compatibility_input (struct uae_prefs *prefs, int index, int *typelist, int *inputlist, const int **at)
7222{
7223 if (index >= MAX_JPORTS || joymodes[index] < 0)
7224 return -1;
7225 if (typelist != NULL)
7226 *typelist = joymodes[index];
7227 if (at != NULL)
7228 *at = axistable;
7229 if (inputlist == NULL)
7230 return -1;
7231
7232 //write_log (_T("%d %p %p\n"), *typelist, *inputlist, *at);
7233 int cnt;
7234 for (cnt = 0; joyinputs[index] && joyinputs[index][cnt] >= 0; cnt++) {
7235 inputlist[cnt] = joyinputs[index][cnt];
7236 }
7237 inputlist[cnt] = -1;
7238
7239 // find custom events (custom event = event that is mapped to same port but not included in joyinputs[]
7240 int devnum = 0;
7241 while (inputdevice_get_device_status (devnum) >= 0) {
7242 for (int j = 0; j < inputdevice_get_widget_num (devnum); j++) {
7243 for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
7244 int port, k, l;
7245 uae_u64 flags;
7246 bool ignore = false;
7247 int evtnum2 = inputdevice_get_mapping (devnum, j, &flags, &port, NULL, NULL, sub);
7248 if (port - 1 != index)
7249 continue;
7250 for (k = 0; axistable[k] >= 0; k += 3) {
7251 if (evtnum2 == axistable[k + 0]) {
7252 for (l = 0; inputlist[l] >= 0; l++) {
7253 if (inputlist[l] == axistable[k + 1] || inputlist[l] == axistable[k + 2]) {
7254 ignore = true;
7255 }
7256 }
7257 }
7258 if (evtnum2 == axistable[k + 1] || evtnum2 == axistable[k + 2]) {
7259 for (l = 0; inputlist[l] >= 0; l++) {
7260 if (inputlist[l] == axistable[k + 0]) {
7261 ignore = true;
7262 }
7263 }
7264 }
7265 }
7266 if (!ignore) {
7267 for (k = 0; inputlist[k] >= 0; k++) {
7268 if (evtnum2 == inputlist[k])
7269 break;
7270 }
7271 if (inputlist[k] < 0) {
7272 inputlist[k] = evtnum2;
7273 inputlist[k + 1] = -1;
7274 cnt++;
7275 }
7276 }
7277 }
7278 }

Callers 1

remove_compa_configFunction · 0.85

Calls 5

inputdevice_get_mappingFunction · 0.85
write_logFunction · 0.70

Tested by

no test coverage detected