| 378 | } |
| 379 | |
| 380 | int FCEUI_DelCheat(uint32 which) |
| 381 | { |
| 382 | struct CHEATF *prev; |
| 383 | struct CHEATF *cur; |
| 384 | uint32 x=0; |
| 385 | |
| 386 | for(prev=0,cur=cheats;;) |
| 387 | { |
| 388 | if(x==which) // Remove this cheat. |
| 389 | { |
| 390 | if(prev) // Update pointer to this cheat. |
| 391 | { |
| 392 | if(cur->next) // More cheats. |
| 393 | prev->next=cur->next; |
| 394 | else // No more. |
| 395 | { |
| 396 | prev->next=0; |
| 397 | cheatsl=prev; // Set the previous cheat as the last cheat. |
| 398 | } |
| 399 | } |
| 400 | else // This is the first cheat. |
| 401 | { |
| 402 | if(cur->next) // More cheats |
| 403 | cheats=cur->next; |
| 404 | else |
| 405 | cheats=cheatsl=0; // No (more) cheats. |
| 406 | } |
| 407 | delete cur; // free the memory. |
| 408 | break; |
| 409 | } // *END REMOVE THIS CHEAT* |
| 410 | |
| 411 | |
| 412 | if(!cur->next) // No more cheats to go through(this shouldn't ever happen...) |
| 413 | return(0); |
| 414 | prev=cur; |
| 415 | cur=prev->next; |
| 416 | x++; |
| 417 | } |
| 418 | |
| 419 | savecheats=1; |
| 420 | RebuildSubCheats(); |
| 421 | return(1); |
| 422 | } |
| 423 | |
| 424 | void FCEU_ApplyPeriodicCheats(void) |
| 425 | { |
no test coverage detected