| 1173 | static HWND die; |
| 1174 | |
| 1175 | static INT_PTR CALLBACK DWBCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 1176 | { |
| 1177 | static int key = 0; |
| 1178 | switch(uMsg) { |
| 1179 | case WM_DESTROY: |
| 1180 | die = NULL; |
| 1181 | return(0); |
| 1182 | |
| 1183 | case WM_TIMER: |
| 1184 | { |
| 1185 | uint8 devicenum; |
| 1186 | uint16 buttonnum; |
| 1187 | GUID guid; |
| 1188 | ButtConfig *bc = DWBButtons; |
| 1189 | char *nstr; |
| 1190 | |
| 1191 | if(DoJoyWaitTest(&guid, &devicenum, &buttonnum)) |
| 1192 | { |
| 1193 | if (DWBFirstPress) |
| 1194 | { |
| 1195 | bc->NumC = 0; |
| 1196 | DWBFirstPress = 0; |
| 1197 | } |
| 1198 | int wc = bc->NumC; |
| 1199 | bc->ButtType[wc]=BUTTC_JOYSTICK; |
| 1200 | bc->DeviceNum[wc]=devicenum; |
| 1201 | bc->ButtonNum[wc]=buttonnum; |
| 1202 | bc->DeviceInstance[wc] = guid; |
| 1203 | |
| 1204 | /* Stop config if the user pushes the same button twice in a row. */ |
| 1205 | if(wc && bc->ButtType[wc]==bc->ButtType[wc-1] && bc->DeviceNum[wc]==bc->DeviceNum[wc-1] && |
| 1206 | bc->ButtonNum[wc]==bc->ButtonNum[wc-1]) |
| 1207 | goto gornk; |
| 1208 | |
| 1209 | bc->NumC++; |
| 1210 | |
| 1211 | /* Stop config if we reached our maximum button limit. */ |
| 1212 | if(bc->NumC >= MAXBUTTCONFIG) |
| 1213 | goto gornk; |
| 1214 | nstr = MakeButtString(bc); |
| 1215 | SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr); |
| 1216 | free(nstr); |
| 1217 | } |
| 1218 | { |
| 1219 | int newkey; |
| 1220 | int meta = GetKeyMeta(key); |
| 1221 | |
| 1222 | KeyboardUpdateState(); |
| 1223 | |
| 1224 | newkey = GetKeyPressed(); |
| 1225 | if ((newkey != 0) && (newkey != 0x80)) |
| 1226 | { |
| 1227 | key = newkey | meta; |
| 1228 | ClearExtraMeta(&key); |
| 1229 | if (DWBFirstPress) |
| 1230 | { |
| 1231 | bc->NumC = 0; |
| 1232 | DWBFirstPress = 0; |
nothing calls this directly
no test coverage detected