MCPcopy Create free account
hub / github.com/TASEmulators/fceux / InsertWatch

Function InsertWatch

src/drivers/win/ramwatch.cpp:105–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105bool 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
134bool InsertWatch(const AddressWatcher& Watch, HWND parent)
135{

Callers 6

CheatConsoleCallBFunction · 0.85
InsertWatchesFunction · 0.85
OpenRWRecentFileFunction · 0.85
Load_WatchesFunction · 0.85
EditWatchFunction · 0.85
RamWatchProcFunction · 0.85

Calls 5

GetCurrentValueFunction · 0.85
SeparatorCacheClass · 0.85
ToAddressWatchesMethod · 0.80

Tested by

no test coverage detected