MCPcopy Create free account
hub / github.com/clementgallet/libTAS / slotAdd

Method slotAdd

src/program/ui/PointerScanWindow.cpp:155–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155void PointerScanWindow::slotAdd()
156{
157 const QModelIndexList indexes = pointerScanView->selectionModel()->selectedRows();
158 pointerScanView->selectionModel()->clear();
159
160 /* If no watch was selected, return */
161 if (indexes.count() == 0) {
162 QMessageBox::critical(nullptr, "Error", QString("You must select an address to add a watch"));
163 return;
164 }
165
166 bool ok;
167 uintptr_t addr = addressInput->text().toULong(&ok, 16);
168 for (int i = 0; i < indexes.count(); i++) {
169 const QModelIndex sourceIndex = proxyModel->mapToSource(indexes[i]);
170 const std::pair<uintptr_t, std::vector<int>> &chain = pointerScanModel->pointer_chains.at(sourceIndex.row());
171 std::unique_ptr<RamWatchDetailed> watch(new RamWatchDetailed(addr, type_index));
172
173 watch->is_pointer = true;
174 watch->base_address = chain.first;
175 watch->base_file = BaseAddresses::getFileAndOffset(chain.first, watch->base_file_offset);
176 watch->pointer_offsets = chain.second;
177 std::reverse(watch->pointer_offsets.begin(), watch->pointer_offsets.end());
178
179 if (indexes.count() == 1) {
180 /* If only one selected pointer chain, fill the watch edit window with
181 * parameters from the selected result */
182 ramWatchWindow->ramWatchView->ensureEditWindow()->fill(watch);
183 ramWatchWindow->ramWatchView->slotAdd();
184 }
185 else {
186 /* Fill the ram watch window without filling labels */
187 ramWatchWindow->ramWatchView->addWatch(std::move(watch));
188 }
189 }
190}
191
192void PointerScanWindow::slotSave()
193{

Callers

nothing calls this directly

Calls 8

textMethod · 0.80
fillMethod · 0.80
ensureEditWindowMethod · 0.80
clearMethod · 0.45
atMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
addWatchMethod · 0.45

Tested by

no test coverage detected