| 201 | } |
| 202 | |
| 203 | int ShowResults(HWND hwndDlg, bool supressUpdate = false) |
| 204 | { |
| 205 | |
| 206 | if (possiList.size() > 64) |
| 207 | possiList.clear(); |
| 208 | |
| 209 | int count = FCEUI_CheatSearchGetCount(); |
| 210 | |
| 211 | if (count != possiTotalCount) |
| 212 | { |
| 213 | char str[20]; |
| 214 | sprintf(str, "%d Possibilit%s", count, count == 1 ? "y" : "ies"); |
| 215 | SetDlgItemText(hwndDlg, IDC_CHEAT_BOX_POSSIBILITIES, str); |
| 216 | SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_SETITEMCOUNT, count, 0); |
| 217 | possiTotalCount = count; |
| 218 | } |
| 219 | |
| 220 | if (count) |
| 221 | { |
| 222 | int first = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETTOPINDEX, 0, 0); |
| 223 | if (first < 0) |
| 224 | first = 0; |
| 225 | int last = first + possiItemCount + 1; |
| 226 | if (last > count) |
| 227 | last = count; |
| 228 | |
| 229 | int tmpPossiItemCount = possiItemCount; |
| 230 | possiItemCount = first; |
| 231 | FCEUI_CheatSearchGetRange(first, last, ShowResultsCallB); |
| 232 | possiItemCount = tmpPossiItemCount; |
| 233 | if (possibleUpdate && !supressUpdate) |
| 234 | { |
| 235 | int start = -1, end = -1; |
| 236 | for (int i = first; i < last; ++i) |
| 237 | if (possiList[i - first].update) |
| 238 | { |
| 239 | if (start == -1) |
| 240 | start = i; |
| 241 | end = i; |
| 242 | } |
| 243 | |
| 244 | SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_REDRAWITEMS, start, end); |
| 245 | } |
| 246 | possibleUpdate = false; |
| 247 | possiStart = first; |
| 248 | } |
| 249 | |
| 250 | return 1; |
| 251 | } |
| 252 | |
| 253 | void EnableCheatButtons(HWND hwndDlg, int enable) |
| 254 | { |
no test coverage detected