| 103 | |
| 104 | |
| 105 | bool InsertWatch(const AddressWatcher& Watch) |
| 106 | { |
| 107 | if(!VerifyWatchNotAlreadyAdded(Watch)) |
| 108 | return false; |
| 109 | |
| 110 | if(WatchCount >= MAX_WATCH_COUNT) |
| 111 | return false; |
| 112 | |
| 113 | int i = WatchCount++; |
| 114 | AddressWatcher& NewWatch = rswatches[i]; |
| 115 | NewWatch = Watch; |
| 116 | |
| 117 | NewWatch.CurValue = GetCurrentValue(NewWatch); |
| 118 | extern int FCEU_CalcCheatAffectedBytes(uint32, uint32); |
| 119 | NewWatch.Cheats = FCEU_CalcCheatAffectedBytes(NewWatch.Address, WatchSizeConv(NewWatch)); |
| 120 | NewWatch.comment = strcpy((char*)malloc(strlen(Watch.comment) + 2), Watch.comment); |
| 121 | |
| 122 | // currently it's impossible to add a separator from outside RAM Watch, so no need to check the handle |
| 123 | if (NewWatch.Type == 'S') |
| 124 | separatorCache[i] = SeparatorCache(RamWatchHWnd, NewWatch.comment); |
| 125 | |
| 126 | // In case the window is not open and somebody call this method outside. |
| 127 | if (RamWatchHWnd) |
| 128 | ListView_SetItemCount(GetDlgItem(RamWatchHWnd, IDC_WATCHLIST), WatchCount); |
| 129 | RWfileChanged = true; |
| 130 | |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | bool InsertWatch(const AddressWatcher& Watch, HWND parent) |
| 135 | { |
no test coverage detected