* Checks what ListView line was selected and shows the dialog * that prompts the user to enter a hotkey. **/
| 345 | * that prompts the user to enter a hotkey. |
| 346 | **/ |
| 347 | void AskForHotkey(HWND hwndDlg, HWND hwndListView) |
| 348 | { |
| 349 | int nSel = SendMessage(hwndListView, LVM_GETNEXTITEM, (WPARAM)-1, LVNI_SELECTED); |
| 350 | |
| 351 | if (nSel != -1) |
| 352 | { |
| 353 | LVITEM lvi; |
| 354 | |
| 355 | // Get the corresponding input |
| 356 | memset(&lvi, 0, sizeof(lvi)); |
| 357 | lvi.mask = LVIF_PARAM; |
| 358 | lvi.iItem = nSel; |
| 359 | lvi.iSubItem = 0; |
| 360 | |
| 361 | SendMessage(hwndListView, LVM_GETITEM, 0, (LPARAM)&lvi); |
| 362 | |
| 363 | int nCmd = lvi.lParam; |
| 364 | |
| 365 | EMUCMDTABLE* cmd = GetEmuCommandById(nCmd); |
| 366 | DWaitButton(hwndDlg, cmd->name, &FCEUD_CommandMapping[nCmd]); |
| 367 | |
| 368 | memset(&lvi, 0, sizeof(lvi)); |
| 369 | lvi.mask = LVIF_TEXT; |
| 370 | lvi.iItem = nSel; |
| 371 | lvi.iSubItem = 2; |
| 372 | lvi.pszText = MakeButtString(&FCEUD_CommandMapping[nCmd], 0); |
| 373 | SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi); |
| 374 | free(lvi.pszText); |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * Restores the default hotkey mapping. |
no test coverage detected