| 713 | } |
| 714 | |
| 715 | bool EditWatch(int watchIndex, AddressWatcher& watcher) |
| 716 | { |
| 717 | if (watchIndex >= WatchCount) |
| 718 | return InsertWatch(watcher); |
| 719 | |
| 720 | AddressWatcher& original = rswatches[watchIndex]; |
| 721 | |
| 722 | if (watcher.Type != 'S' && VerifyWatchNotAlreadyAdded(watcher)) |
| 723 | { |
| 724 | |
| 725 | if (original.Address != watcher.Address || original.Size != watcher.Size) |
| 726 | { |
| 727 | extern int FCEU_CalcCheatAffectedBytes(uint32, uint32); |
| 728 | original.Cheats = FCEU_CalcCheatAffectedBytes(watcher.Address, WatchSizeConv(watcher)); |
| 729 | original.CurValue = GetCurrentValue(watcher); |
| 730 | } |
| 731 | |
| 732 | original.Address = watcher.Address; |
| 733 | original.Type = watcher.Type; |
| 734 | original.Size = watcher.Size; |
| 735 | original.WrongEndian = watcher.WrongEndian; |
| 736 | |
| 737 | RWfileChanged = true; |
| 738 | } |
| 739 | |
| 740 | if (strcmp(original.comment, watcher.comment)) |
| 741 | { |
| 742 | if (original.comment) |
| 743 | original.comment = strcpy((char*)realloc(original.comment, strlen(watcher.comment) + 2), watcher.comment); |
| 744 | else |
| 745 | original.comment = strcpy((char*)malloc(strlen(watcher.comment) + 2), watcher.comment); |
| 746 | |
| 747 | if (original.Type == 'S') |
| 748 | separatorCache[watchIndex] = SeparatorCache(RamWatchHWnd, watcher.comment); |
| 749 | |
| 750 | return true; |
| 751 | } |
| 752 | |
| 753 | return false; |
| 754 | } |
| 755 | |
| 756 | void RefreshWatchListSelectedItemControlStatus(HWND hDlg) |
| 757 | { |
no test coverage detected