MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / memUpdateEdit

Method memUpdateEdit

gui/qt/memorywidget.cpp:58–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void MainWindow::memUpdateEdit(HexWidget *edit, bool force) {
59 if (edit == Q_NULLPTR || !guiEmuValid) {
60 return;
61 }
62
63 QByteArray data;
64
65 if (force || edit->getScrolled() || !edit->getSize()) {
66 bool second = edit->getCursorOffset() & 1;
67 int off = edit->getOffset();
68 int base = edit->getBase();
69 int addr = off + base;
70 int start = addr - 0x1000;
71 int end = addr + 0x1000;
72 off = 0x1000;
73
74 if (start < 0) {
75 off += start;
76 start = 0;
77 }
78 if (end > 0xFFFFFF) {
79 end = 0xFFFFFF;
80 }
81 data.resize(end - start + 1);
82
83 for (int j = 0, i = start; i < end; j++, i++) {
84 data[j] = static_cast<char>(mem_peek_byte(static_cast<uint32_t>(i)));
85 }
86
87 edit->setBase(start);
88 edit->setData(data);
89 if (second) {
90 edit->setCursorOffset(off * 2 + 1);
91 } else {
92 edit->setOffset(off);
93 }
94 } else {
95 int start = edit->getBase();
96 int len = edit->getSize();
97 data.resize(len);
98
99 for (int j = 0, i = start; j < len; j++, i++) {
100 data[j] = static_cast<char>(mem_peek_byte(static_cast<uint32_t>(i)));
101 }
102
103 edit->setData(data);
104 }
105}
106
107void MainWindow::flashGotoPressed() {
108 bool accept = false;

Callers

nothing calls this directly

Calls 10

mem_peek_byteFunction · 0.85
getScrolledMethod · 0.80
getSizeMethod · 0.80
getCursorOffsetMethod · 0.80
getOffsetMethod · 0.80
getBaseMethod · 0.80
setBaseMethod · 0.80
setCursorOffsetMethod · 0.80
setOffsetMethod · 0.80
setDataMethod · 0.45

Tested by

no test coverage detected