| 9163 | } |
| 9164 | |
| 9165 | int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af) |
| 9166 | { |
| 9167 | const struct inputdevice_functions *idf = getidf (devnum); |
| 9168 | static int id_iterator; |
| 9169 | const struct inputevent *ie; |
| 9170 | int mask, data, type; |
| 9171 | uae_u64 flags; |
| 9172 | int devindex = inputdevice_get_device_index (devnum); |
| 9173 | |
| 9174 | *af = 0; |
| 9175 | *name = 0; |
| 9176 | for (;;) { |
| 9177 | ie = &events[++id_iterator]; |
| 9178 | if (!ie->confname) { |
| 9179 | id_iterator = 0; |
| 9180 | return 0; |
| 9181 | } |
| 9182 | mask = 0; |
| 9183 | type = idf->get_widget_type (devindex, num, NULL, NULL); |
| 9184 | if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) { |
| 9185 | if (idf == &idev[IDTYPE_JOYSTICK]) { |
| 9186 | mask |= AM_JOY_BUT; |
| 9187 | } else { |
| 9188 | mask |= AM_MOUSE_BUT; |
| 9189 | } |
| 9190 | } else if (type == IDEV_WIDGET_AXIS) { |
| 9191 | if (idf == &idev[IDTYPE_JOYSTICK]) { |
| 9192 | mask |= AM_JOY_AXIS; |
| 9193 | } else { |
| 9194 | mask |= AM_MOUSE_AXIS; |
| 9195 | } |
| 9196 | } else if (type == IDEV_WIDGET_KEY) { |
| 9197 | mask |= AM_K; |
| 9198 | } |
| 9199 | if (ie->allow_mask & AM_INFO) { |
| 9200 | const struct inputevent *ie2 = ie + 1; |
| 9201 | while (!(ie2->allow_mask & AM_INFO)) { |
| 9202 | if (is_event_used (idf, devindex, (int)(ie2 - ie), -1)) { |
| 9203 | ie2++; |
| 9204 | continue; |
| 9205 | } |
| 9206 | if (ie2->allow_mask & mask) |
| 9207 | break; |
| 9208 | ie2++; |
| 9209 | } |
| 9210 | if (!(ie2->allow_mask & AM_INFO)) |
| 9211 | mask |= AM_INFO; |
| 9212 | } |
| 9213 | if (!(ie->allow_mask & mask)) |
| 9214 | continue; |
| 9215 | get_event_data (idf, devindex, num, &data, NULL, &flags, NULL, 0); |
| 9216 | inputdevice_get_eventname (ie, name); |
| 9217 | *af = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0; |
| 9218 | return 1; |
| 9219 | } |
| 9220 | } |
| 9221 | |
| 9222 | // return mapped event from devnum/num/sub |
nothing calls this directly
no test coverage detected