| 243 | } |
| 244 | |
| 245 | void updateCheatMenu() { |
| 246 | bool redraw=false; |
| 247 | if (cheatMenuSelection >= numCheats) { |
| 248 | cheatMenuSelection = 0; |
| 249 | } |
| 250 | |
| 251 | if (keyPressedAutoRepeat(KEY_UP)) { |
| 252 | if (cheatMenuSelection > 0) { |
| 253 | cheatMenuSelection--; |
| 254 | redraw = true; |
| 255 | } |
| 256 | } |
| 257 | else if (keyPressedAutoRepeat(KEY_DOWN)) { |
| 258 | if (cheatMenuSelection < numCheats-1) { |
| 259 | cheatMenuSelection++; |
| 260 | redraw = true; |
| 261 | } |
| 262 | } |
| 263 | else if (keyJustPressed(KEY_RIGHT | KEY_LEFT)) { |
| 264 | toggleCheat(cheatMenuSelection, !(cheats[cheatMenuSelection].flags & FLAG_ENABLED)); |
| 265 | redraw = true; |
| 266 | } |
| 267 | else if (keyJustPressed(KEY_R)) { |
| 268 | cheatMenuSelection += cheatsPerPage; |
| 269 | if (cheatMenuSelection >= numCheats) |
| 270 | cheatMenuSelection = 0; |
| 271 | redraw = true; |
| 272 | } |
| 273 | else if (keyJustPressed(KEY_L)) { |
| 274 | cheatMenuSelection -= cheatsPerPage; |
| 275 | if (cheatMenuSelection < 0) |
| 276 | cheatMenuSelection = numCheats-1; |
| 277 | redraw = true; |
| 278 | } |
| 279 | if (keyJustPressed(KEY_B)) { |
| 280 | closeSubMenu(); |
| 281 | if (!cheatMenu_gameboyWasPaused) |
| 282 | unpauseGameboy(); |
| 283 | } |
| 284 | |
| 285 | if (redraw) |
| 286 | doAtVBlank(redrawCheatMenu); |
| 287 | } |
| 288 | |
| 289 | bool startCheatMenu() { |
| 290 | if (numCheats == 0) |
nothing calls this directly
no test coverage detected