| 1 | #cxx . . $ `<file>/src/DisasmViewer.cpp`/include "DisasmViewer.h"cxx . . $ `<file>/src/DisasmViewer.h`/ |
| 2 | #include "OpenMSXConnection.h"cxx . . $ `<file>/src/OpenMSXConnection.h`/ |
| 3 | #include "CommClient.h"cxx . . $ `<file>/src/CommClient.h`/ |
| 4 | #include "DebuggerData.h"cxx . . $ `<file>/src/DebuggerData.h`/ |
| 5 | #include "Settings.h"cxx . . $ `<file>/src/Settings.h`/ |
| 6 | #include <QPaintEvent> |
| 7 | #include <QPainter> |
| 8 | #include <QStyleOptionFocusRect> |
| 9 | #include <QScrollBar> |
| 10 | #include <QWheelEvent> |
| 11 | #include <QApplication> |
| 12 | #include <QClipboard> |
| 13 | #include <QDesktopWidget> |
| 14 | #include <algorithm> |
| 15 | #include <cmath> |
| 16 | #include <cassert> |
| 17 | #include <regex> |
| 18 | |
| 19 | class CommMemoryRequestcxx . . $ CommMemoryRequest# : public ReadDebugBlockCommandcxx . . $ ReadDebugBlockCommand# |
| 20 | { |
| 21 | public: |
| 22 | CommMemoryRequestcxx . . $ CommMemoryRequest#CommMemoryRequest(5741f64ea5381e5c).(uint16_tcxx . . $ uint16_t# offset_, uint16_tcxx . . $ uint16_t# size_, unsigned char* target, |
| 23 | DisasmViewercxx . . $ DisasmViewer#& viewer_) |
| 24 | : ReadDebugBlockCommandcxx . . $ ReadDebugBlockCommand#("memory"cxx . . $ QString#QString(85c52e162fed56f9)., offset_, size_, target) |
| 25 | , offsetcxx . . $ CommMemoryRequest#offset.(offset_), sizecxx . . $ CommMemoryRequest#size.(size_) |
| 26 | , viewercxx . . $ CommMemoryRequest#viewer.(viewer_) |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | void replyOkcxx . . $ CommMemoryRequest#replyOk(3520e46b33348bf6).(const QStringcxx . . $ QString#& message) override |
| 31 | { |
| 32 | copyDatacxx . . $ ReadDebugBlockCommand#copyData(3520e46b33348bf6).(message); |
| 33 | viewercxx . . $ CommMemoryRequest#viewer..memoryUpdatedcxx . . $ DisasmViewer#memoryUpdated(e15786835b1a8b73).(this); |
| 34 | } |
| 35 | |
| 36 | void cancelcxx . . $ CommMemoryRequest#cancel(49f6e7a06ebc5aa8).() override |
| 37 | { |
| 38 | viewercxx . . $ CommMemoryRequest#viewer..updateCancelledcxx . . $ DisasmViewer#updateCancelled(e15786835b1a8b73).(this); |
| 39 | } |
| 40 | |
| 41 | // TODO Refactor: public members are ugly |
| 42 | unsigned offsetcxx . . $ CommMemoryRequest#offset.; |
| 43 | unsigned sizecxx . . $ CommMemoryRequest#size.; |
| 44 | int addresscxx . . $ CommMemoryRequest#address.; |
| 45 | int linecxx . . $ CommMemoryRequest#line.; |
| 46 | int methodcxx . . $ CommMemoryRequest#method.; |
| 47 | |
| 48 | private: |
| 49 | DisasmViewercxx . . $ DisasmViewer#& viewercxx . . $ CommMemoryRequest#viewer.; |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | |
| 54 | DisasmViewercxx . . $ DisasmViewer#::DisasmViewercxx . . $ DisasmViewer#DisasmViewer(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 55 | : QFramecxx . . $ QFrame#(parent) |
| 56 | , wheelRemaindercxx . . $ DisasmViewer#wheelRemainder.(0) |
| 57 | { |
| 58 | setFrameStylecxx . . $ QFrame#setFrameStyle(d4f767463ce0a6b3).(WinPanelcxx . . $ QFrame#WinPanel. |cxx . . $ `operator|`(44af6e16e9fc6bb). Sunkencxx . . $ QFrame#Sunken.); |
| 59 | setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::StrongFocuscxx . . $ Qt/StrongFocus.); |
| 60 | setBackgroundRolecxx . . $ QWidget#setBackgroundRole(656661f550a99654).(QPalettecxx . . $ QPalette#::Basecxx . . $ QPalette#Base.); |
| 61 | setSizePolicycxx . . $ QWidget#setSizePolicy(41340f53ecd443dd).(QSizePolicycxx . . $ QSizePolicy#QSizePolicy(dc90913e2b9d0ddb).(QSizePolicycxx . . $ QSizePolicy#::Minimumcxx . . $ QSizePolicy#Minimum., QSizePolicycxx . . $ QSizePolicy#::Preferredcxx . . $ QSizePolicy#Preferred.)); |
| 62 | breakMarkercxx . . $ DisasmViewer#breakMarker. =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). QPixmapcxx . . $ QPixmap#QPixmap(dec4543235ec9b46).(":/icons/breakpoint.png"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 63 | watchMarkercxx . . $ DisasmViewer#watchMarker. =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). QPixmapcxx . . $ QPixmap#QPixmap(dec4543235ec9b46).(":/icons/watchpoint.png"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 64 | pcMarkercxx . . $ DisasmViewer#pcMarker. =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). QPixmapcxx . . $ QPixmap#QPixmap(dec4543235ec9b46).(":/icons/pcarrow.png"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 65 | |
| 66 | memorycxx . . $ DisasmViewer#memory. = nullptr; |
| 67 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = 0; |
| 68 | cursorLinecxx . . $ DisasmViewer#cursorLine. = 0; |
| 69 | visibleLinescxx . . $ DisasmViewer#visibleLines. = 0; |
| 70 | programAddrcxx . . $ DisasmViewer#programAddr. = 0xFFFF; |
| 71 | waitingForDatacxx . . $ DisasmViewer#waitingForData. = false; |
| 72 | nextRequestcxx . . $ DisasmViewer#nextRequest. = nullptr; |
| 73 | |
| 74 | scrollBarcxx . . $ DisasmViewer#scrollBar. = new QScrollBarcxx . . $ QScrollBar#QScrollBar(370ffd1f04771b4e).(Qtcxx . . $ Qt/::Verticalcxx . . $ Qt/Vertical., this); |
| 75 | scrollBarcxx . . $ DisasmViewer#scrollBar.->setMinimumcxx . . $ QAbstractSlider#setMinimum(d4f767463ce0a6b3).(0); |
| 76 | scrollBarcxx . . $ DisasmViewer#scrollBar.->setMaximumcxx . . $ QAbstractSlider#setMaximum(d4f767463ce0a6b3).(0xFFFF); |
| 77 | scrollBarcxx . . $ DisasmViewer#scrollBar.->setSingleStepcxx . . $ QAbstractSlider#setSingleStep(d4f767463ce0a6b3).(0); |
| 78 | scrollBarcxx . . $ DisasmViewer#scrollBar.->setPageStepcxx . . $ QAbstractSlider#setPageStep(d4f767463ce0a6b3).(0); |
| 79 | |
| 80 | updateLayoutcxx . . $ DisasmViewer#updateLayout(49f6e7a06ebc5aa8).(); |
| 81 | |
| 82 | // manual scrollbar handling routines (real size of the data is not known) |
| 83 | connectcxx . . $ QObject#connect(835f87066c895669).(scrollBarcxx . . $ DisasmViewer#scrollBar., &QScrollBarcxx . . $ QScrollBar#::actionTriggeredcxx . . $ QAbstractSlider#actionTriggered(d4f767463ce0a6b3)., |
| 84 | this, &DisasmViewercxx . . $ DisasmViewer#::scrollBarActioncxx . . $ DisasmViewer#scrollBarAction(d4f767463ce0a6b3).); |
| 85 | connectcxx . . $ QObject#connect(835f87066c895669).(scrollBarcxx . . $ DisasmViewer#scrollBar., &QScrollBarcxx . . $ QScrollBar#::valueChangedcxx . . $ QAbstractSlider#valueChanged(d4f767463ce0a6b3)., |
| 86 | this, &DisasmViewercxx . . $ DisasmViewer#::scrollBarChangedcxx . . $ DisasmViewer#scrollBarChanged(d4f767463ce0a6b3).); |
| 87 | } |
| 88 | |
| 89 | QSizecxx . . $ QSize# DisasmViewercxx . . $ DisasmViewer#::sizeHintcxx . . $ DisasmViewer#sizeHint(4b3b776e5ee2b367).() const |
| 90 | { |
| 91 | return {cxx . . $ QSize#QSize(c0d38f4800714fae).xMnemArgcxx . . $ DisasmViewer#xMnemArg. + xMCodecxx . . $ DisasmViewer#xMCode.[0], 20 * codeFontHeightcxx . . $ DisasmViewer#codeFontHeight.}; |
| 92 | } |
| 93 | |
| 94 | void DisasmViewercxx . . $ DisasmViewer#::resizeEventcxx . . $ DisasmViewer#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent#* e) |
| 95 | { |
| 96 | QFramecxx . . $ QFrame#::resizeEventcxx . . $ QWidget#resizeEvent(eeeec21cf8dc0387).(e); |
| 97 | |
| 98 | scrollBarcxx . . $ DisasmViewer#scrollBar.->setGeometrycxx . . $ QWidget#setGeometry(748afa4755bc9595).(widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameRcxx . . $ DisasmViewer#frameR., frameTcxx . . $ DisasmViewer#frameT., |
| 99 | scrollBarcxx . . $ DisasmViewer#scrollBar.->sizeHintcxx . . $ QScrollBar#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).(), |
| 100 | heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameTcxx . . $ DisasmViewer#frameT. - frameBcxx . . $ DisasmViewer#frameB.); |
| 101 | |
| 102 | // reset the address in order to trigger a check on the disasmLines |
| 103 | if (!waitingForDatacxx . . $ DisasmViewer#waitingForData.) { |
| 104 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(scrollBarcxx . . $ DisasmViewer#scrollBar.->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).()); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | void DisasmViewercxx . . $ DisasmViewer#::updateLayoutcxx . . $ DisasmViewer#updateLayout(49f6e7a06ebc5aa8).() |
| 109 | { |
| 110 | frameLcxx . . $ DisasmViewer#frameL. = frameTcxx . . $ DisasmViewer#frameT. = frameBcxx . . $ DisasmViewer#frameB. = frameWidthcxx . . $ QFrame#frameWidth(455f465bc33b4cdf).(); |
| 111 | frameRcxx . . $ DisasmViewer#frameR. = frameLcxx . . $ DisasmViewer#frameL. + scrollBarcxx . . $ DisasmViewer#scrollBar.->sizeHintcxx . . $ QScrollBar#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).(); |
| 112 | setMinimumHeightcxx . . $ QWidget#setMinimumHeight(d4f767463ce0a6b3).(frameTcxx . . $ DisasmViewer#frameT. + 5 * fontMetricscxx . . $ QWidget#fontMetrics(ee264e9e8967f9a7).().heightcxx . . $ QFontMetrics#height(455f465bc33b4cdf).() + frameBcxx . . $ DisasmViewer#frameB.); |
| 113 | |
| 114 | // set font sizes |
| 115 | Settingscxx . . $ Settings#& s = Settingscxx . . $ Settings#::getcxx . . $ Settings#get(493e506a9691bc24).(); |
| 116 | QFontMetricscxx . . $ QFontMetrics# lfmcxx . . $ QFontMetrics#QFontMetrics(d0a4bd0c8524b912).(s.fontcxx . . $ Settings#font(feb6b15adc4fed84).(Settingscxx . . $ Settings#::LABEL_FONTcxx . . $ Settings#LABEL_FONT.)); |
| 117 | QFontMetricscxx . . $ QFontMetrics# cfmcxx . . $ QFontMetrics#QFontMetrics(d0a4bd0c8524b912).(s.fontcxx . . $ Settings#font(feb6b15adc4fed84).(Settingscxx . . $ Settings#::CODE_FONTcxx . . $ Settings#CODE_FONT.)); |
| 118 | labelFontHeightcxx . . $ DisasmViewer#labelFontHeight. = lfm.heightcxx . . $ QFontMetrics#height(455f465bc33b4cdf).(); |
| 119 | labelFontAscentcxx . . $ DisasmViewer#labelFontAscent. = lfm.ascentcxx . . $ QFontMetrics#ascent(455f465bc33b4cdf).(); |
| 120 | codeFontHeightcxx . . $ DisasmViewer#codeFontHeight. = cfm.heightcxx . . $ QFontMetrics#height(455f465bc33b4cdf).(); |
| 121 | codeFontAscentcxx . . $ DisasmViewer#codeFontAscent. = cfm.ascentcxx . . $ QFontMetrics#ascent(455f465bc33b4cdf).(); |
| 122 | |
| 123 | // calculate layout locations |
| 124 | int charWidth = cfm.horizontalAdvancecxx . . $ QFontMetrics#horizontalAdvance(91f46685ef4c12b5).("0"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 125 | xAddrcxx . . $ DisasmViewer#xAddr. = frameLcxx . . $ DisasmViewer#frameL. + 40; |
| 126 | xMCodecxx . . $ DisasmViewer#xMCode.[0] = xAddrcxx . . $ DisasmViewer#xAddr. + 6 * charWidth; |
| 127 | xMCodecxx . . $ DisasmViewer#xMCode.[1] = xMCodecxx . . $ DisasmViewer#xMCode.[0] + 3 * charWidth; |
| 128 | xMCodecxx . . $ DisasmViewer#xMCode.[2] = xMCodecxx . . $ DisasmViewer#xMCode.[1] + 3 * charWidth; |
| 129 | xMCodecxx . . $ DisasmViewer#xMCode.[3] = xMCodecxx . . $ DisasmViewer#xMCode.[2] + 3 * charWidth; |
| 130 | xMnemcxx . . $ DisasmViewer#xMnem. = xMCodecxx . . $ DisasmViewer#xMCode.[3] + 4 * charWidth; |
| 131 | xMnemArgcxx . . $ DisasmViewer#xMnemArg. = xMnemcxx . . $ DisasmViewer#xMnem. + 7 * charWidth; |
| 132 | |
| 133 | setMinimumSizecxx . . $ QWidget#setMinimumSize(3e454b8ccf442868).(xMCodecxx . . $ DisasmViewer#xMCode.[0], 2*codeFontHeightcxx . . $ DisasmViewer#codeFontHeight.); |
| 134 | setMaximumSizecxx . . $ QWidget#setMaximumSize(3e454b8ccf442868).(QApplicationcxx . . $ QApplication#::desktopcxx . . $ QApplication#desktop(b97132749444d255).()->widthcxx . . $ QWidget#width(455f465bc33b4cdf).(), |
| 135 | QApplicationcxx . . $ QApplication#::desktopcxx . . $ QApplication#desktop(b97132749444d255).()->heightcxx . . $ QWidget#height(455f465bc33b4cdf).()); |
| 136 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 137 | } |
| 138 | |
| 139 | void DisasmViewercxx . . $ DisasmViewer#::requestMemorycxx . . $ DisasmViewer#requestMemory(30710014fe633fb5).(uint16_tcxx . . $ uint16_t# start, uint16_tcxx . . $ uint16_t# end, uint16_tcxx . . $ uint16_t# addr, int infoLine, int method) |
| 140 | { |
| 141 | auto* req = new CommMemoryRequestcxx . . $ CommMemoryRequest#CommMemoryRequest(5741f64ea5381e5c).(start, end - start, &memorycxx . . $ DisasmViewer#memory.[start], *this); |
| 142 | req->addresscxx . . $ CommMemoryRequest#address. = addr; |
| 143 | req->linecxx . . $ CommMemoryRequest#line. = infoLine; |
| 144 | req->methodcxx . . $ CommMemoryRequest#method. = method; |
| 145 | |
| 146 | if (waitingForDatacxx . . $ DisasmViewer#waitingForData.) { |
| 147 | delete nextRequestcxx . . $ DisasmViewer#nextRequest.; |
| 148 | nextRequestcxx . . $ DisasmViewer#nextRequest. = req; |
| 149 | } else { |
| 150 | waitingForDatacxx . . $ DisasmViewer#waitingForData. = true; |
| 151 | CommClientcxx . . $ CommClient#::instancecxx . . $ CommClient#instance(8cca9d0b1334f685).().sendCommandcxx . . $ CommClient#sendCommand(6fe5d9dff2ed3a64).(req); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | void DisasmViewercxx . . $ DisasmViewer#::refreshcxx . . $ DisasmViewer#refresh(49f6e7a06ebc5aa8).() |
| 156 | { |
| 157 | int start = disasmLinescxx . . $ DisasmViewer#disasmLines..frontcxx . . $ std/vector#front(6baabfa6fc7b3a8e).().addrcxx . . $ DisasmRow#addr.; |
| 158 | int end = disasmLinescxx . . $ DisasmViewer#disasmLines..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().addrcxx . . $ DisasmRow#addr. + disasmLinescxx . . $ DisasmViewer#disasmLines..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().numBytescxx . . $ DisasmRow#numBytes.; |
| 159 | int infoLine = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.].infoLinecxx . . $ DisasmRow#infoLine.; |
| 160 | |
| 161 | requestMemorycxx . . $ DisasmViewer#requestMemory(30710014fe633fb5).(start, end, disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.].addrcxx . . $ DisasmRow#addr., infoLine, TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 162 | } |
| 163 | |
| 164 | void DisasmViewercxx . . $ DisasmViewer#::paintEventcxx . . $ DisasmViewer#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent#* e) |
| 165 | { |
| 166 | // call parent for drawing the actual frame |
| 167 | QFramecxx . . $ QFrame#::paintEventcxx . . $ QFrame#paintEvent(f239c9e85d61a220).(e); |
| 168 | |
| 169 | QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this); |
| 170 | |
| 171 | // calc and set drawing bounds |
| 172 | QRectcxx . . $ QRect# r(e->rectcxx . . $ QPaintEvent#rect(f4023511c62cad66).()); |
| 173 | if (r.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() < frameLcxx . . $ DisasmViewer#frameL.) r.setLeftcxx . . $ QRect#setLeft(f349c77f591a7878).(frameLcxx . . $ DisasmViewer#frameL.); |
| 174 | if (r.topcxx . . $ QRect#top(ea6fe5115c70a13f).() < frameTcxx . . $ DisasmViewer#frameT.) r.setTopcxx . . $ QRect#setTop(f349c77f591a7878).(frameTcxx . . $ DisasmViewer#frameT.); |
| 175 | if (r.rightcxx . . $ QRect#right(ea6fe5115c70a13f).() > widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameRcxx . . $ DisasmViewer#frameR. - 1) r.setRightcxx . . $ QRect#setRight(f349c77f591a7878). (widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameRcxx . . $ DisasmViewer#frameR. - 1); |
| 176 | if (r.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).() > heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ DisasmViewer#frameB. - 1) r.setBottomcxx . . $ QRect#setBottom(f349c77f591a7878).(heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ DisasmViewer#frameB. - 1); |
| 177 | p.setClipRectcxx . . $ QPainter#setClipRect(2f5004bd5eb598d2).(r); |
| 178 | |
| 179 | // draw background |
| 180 | p.fillRectcxx . . $ QPainter#fillRect(b6f7dd7f1bbb6c84).(frameLcxx . . $ DisasmViewer#frameL. + 32, frameTcxx . . $ DisasmViewer#frameT., widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - 32 - frameLcxx . . $ DisasmViewer#frameL. - frameRcxx . . $ DisasmViewer#frameR., |
| 181 | heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameTcxx . . $ DisasmViewer#frameT. - frameBcxx . . $ DisasmViewer#frameB., palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Basecxx . . $ QPalette#Base.)); |
| 182 | |
| 183 | // calculate lines while drawing |
| 184 | visibleLinescxx . . $ DisasmViewer#visibleLines. = 0; |
| 185 | int y = frameTcxx . . $ DisasmViewer#frameT.; |
| 186 | |
| 187 | QStringcxx . . $ QString# hexStrcxx . . $ QString#QString(ced63f7c635d850d).; |
| 188 | const DisasmRowcxx . . $ DisasmRow#* row; |
| 189 | bool displayDisasm = memorycxx . . $ DisasmViewer#memory. != nullptr && isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).(); |
| 190 | |
| 191 | Settingscxx . . $ Settings#& s = Settingscxx . . $ Settings#::getcxx . . $ Settings#get(493e506a9691bc24).(); |
| 192 | p.setFontcxx . . $ QPainter#setFont(d0a4bd0c8524b912).(s.fontcxx . . $ Settings#font(feb6b15adc4fed84).(Settingscxx . . $ Settings#::CODE_FONTcxx . . $ Settings#CODE_FONT.)); |
| 193 | while (y < heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ DisasmViewer#frameB.) { |
| 194 | // fetch the data for this line |
| 195 | row = displayDisasm |
| 196 | ? &disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.+visibleLinescxx . . $ DisasmViewer#visibleLines.] |
| 197 | : &DISABLED_ROWcxx . . $ DISABLED_ROW.; |
| 198 | int h, a; |
| 199 | switch (row->rowTypecxx . . $ DisasmRow#rowType.) { |
| 200 | case DisasmRowcxx . . $ DisasmRow#::LABELcxx . . $ DisasmRow#LABEL.: |
| 201 | h = labelFontHeightcxx . . $ DisasmViewer#labelFontHeight.; |
| 202 | a = labelFontAscentcxx . . $ DisasmViewer#labelFontAscent.; |
| 203 | break; |
| 204 | case DisasmRowcxx . . $ DisasmRow#::INSTRUCTIONcxx . . $ DisasmRow#INSTRUCTION.: |
| 205 | h = codeFontHeightcxx . . $ DisasmViewer#codeFontHeight.; |
| 206 | a = codeFontAscentcxx . . $ DisasmViewer#codeFontAscent.; |
| 207 | break; |
| 208 | } |
| 209 | |
| 210 | // draw cursor line |
| 211 | bool isCursorLine = cursorAddrcxx . . $ DisasmViewer#cursorAddr. >= row->addrcxx . . $ DisasmRow#addr. && cursorAddrcxx . . $ DisasmViewer#cursorAddr. < row->addrcxx . . $ DisasmRow#addr.+row->numBytescxx . . $ DisasmRow#numBytes. && |
| 212 | row->infoLinecxx . . $ DisasmRow#infoLine. == cursorLinecxx . . $ DisasmViewer#cursorLine.; |
| 213 | if (isCursorLine) { |
| 214 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = row->addrcxx . . $ DisasmRow#addr.; |
| 215 | p.fillRectcxx . . $ QPainter#fillRect(b6f7dd7f1bbb6c84).(frameLcxx . . $ DisasmViewer#frameL. + 32, y, widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - 32 - frameLcxx . . $ DisasmViewer#frameL. - frameRcxx . . $ DisasmViewer#frameR., h, |
| 216 | palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Highlightcxx . . $ QPalette#Highlight.)); |
| 217 | if (hasFocuscxx . . $ QWidget#hasFocus(50ce9a9e25b4a850).()) { |
| 218 | QStyleOptionFocusRectcxx . . $ QStyleOptionFocusRect# socxx . . $ QStyleOptionFocusRect#QStyleOptionFocusRect(49f6e7a06ebc5aa8).; |
| 219 | so.backgroundColorcxx . . $ QStyleOptionFocusRect#backgroundColor. =cxx . . $ QColor#`operator=`(a3db1be773b26671). palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Highlightcxx . . $ QPalette#Highlight.); |
| 220 | so.rectcxx . . $ QStyleOption#rect. =cxx . . $ QRect#`operator=`(2f0950bc81ec7a1b). QRectcxx . . $ QRect#QRect(2261ffe5112eab06).(frameLcxx . . $ DisasmViewer#frameL. + 32, y, widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - 32 - frameLcxx . . $ DisasmViewer#frameL. - frameRcxx . . $ DisasmViewer#frameR., h); |
| 221 | stylecxx . . $ QWidget#style(5bbb00d3017c281f).()->drawPrimitivecxx . . $ QStyle#drawPrimitive(68b0feb4a84cbdce).(QStylecxx . . $ QStyle#::PE_FrameFocusRectcxx . . $ QStyle#PE_FrameFocusRect., &so, &p, this); |
| 222 | } |
| 223 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::HighlightedTextcxx . . $ QPalette#HighlightedText.)); |
| 224 | } |
| 225 | |
| 226 | // if there is a label here, draw the label, otherwise code |
| 227 | if (row->rowTypecxx . . $ DisasmRow#rowType. == DisasmRowcxx . . $ DisasmRow#::LABELcxx . . $ DisasmRow#LABEL.) { |
| 228 | // draw label |
| 229 | hexStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1:").argcxx . . $ QString#arg(bc823072288cbbb5).(rowcxx . . $ QString#QString(85c52e162fed56f9).->instrcxx . . $ DisasmRow#instr..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 230 | p.setFontcxx . . $ QPainter#setFont(d0a4bd0c8524b912).(s.fontcxx . . $ Settings#font(feb6b15adc4fed84).(Settingscxx . . $ Settings#::LABEL_FONTcxx . . $ Settings#LABEL_FONT.)); |
| 231 | if (!isCursorLine) { |
| 232 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(s.fontColorcxx . . $ Settings#fontColor(28f2b0e220c74f2e).(Settingscxx . . $ Settings#::LABEL_FONTcxx . . $ Settings#LABEL_FONT.)); |
| 233 | } |
| 234 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(xAddrcxx . . $ DisasmViewer#xAddr., y + a, hexStr); |
| 235 | p.setFontcxx . . $ QPainter#setFont(d0a4bd0c8524b912).(s.fontcxx . . $ Settings#font(feb6b15adc4fed84).(Settingscxx . . $ Settings#::CODE_FONTcxx . . $ Settings#CODE_FONT.)); |
| 236 | } else { |
| 237 | // draw code line |
| 238 | // default to text pen |
| 239 | if (!isCursorLine) { |
| 240 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(s.fontColorcxx . . $ Settings#fontColor(28f2b0e220c74f2e).(Settingscxx . . $ Settings#::CODE_FONTcxx . . $ Settings#CODE_FONT.)); |
| 241 | } |
| 242 | |
| 243 | // draw breakpoint marker |
| 244 | if (row->infoLinecxx . . $ DisasmRow#infoLine. == 0) { |
| 245 | if (breakpointscxx . . $ DisasmViewer#breakpoints.->isBreakpointcxx . . $ Breakpoints#isBreakpoint(921e847d993b8ffc).(row->addrcxx . . $ DisasmRow#addr.)) { |
| 246 | p.drawPixmapcxx . . $ QPainter#drawPixmap(c906314a67120896).(frameLcxx . . $ DisasmViewer#frameL. + 2, y + h / 2 -5, breakMarkercxx . . $ DisasmViewer#breakMarker.); |
| 247 | if (!isCursorLine) { |
| 248 | p.fillRectcxx . . $ QPainter#fillRect(bfcc8075f94a0bd9).(frameLcxx . . $ DisasmViewer#frameL. + 32, y, widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - 32 - frameLcxx . . $ DisasmViewer#frameL. - frameRcxx . . $ DisasmViewer#frameR., h, |
| 249 | Qtcxx . . $ Qt/::redcxx . . $ Qt/red.); |
| 250 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(Qtcxx . . $ QColor#QColor(408ec4d5924bfb00).::whitecxx . . $ Qt/white.); |
| 251 | } |
| 252 | } else if (breakpointscxx . . $ DisasmViewer#breakpoints.->isWatchpointcxx . . $ Breakpoints#isWatchpoint(921e847d993b8ffc).(row->addrcxx . . $ DisasmRow#addr.)) { |
| 253 | p.drawPixmapcxx . . $ QPainter#drawPixmap(c906314a67120896).(frameLcxx . . $ DisasmViewer#frameL. + 2, y + h / 2 -5, watchMarkercxx . . $ DisasmViewer#watchMarker.); |
| 254 | } |
| 255 | } |
| 256 | // draw PC marker |
| 257 | if (row->addrcxx . . $ DisasmRow#addr. == programAddrcxx . . $ DisasmViewer#programAddr. && row->infoLinecxx . . $ DisasmRow#infoLine. == 0) { |
| 258 | p.drawPixmapcxx . . $ QPainter#drawPixmap(c906314a67120896).(frameLcxx . . $ DisasmViewer#frameL. + 18, y + h / 2 - 5, pcMarkercxx . . $ DisasmViewer#pcMarker.); |
| 259 | } |
| 260 | |
| 261 | // print the address |
| 262 | hexStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1").argcxx . . $ QString#arg(ba69ea7f5cd360b4).(row->addrcxx . . $ DisasmRow#addr., 4, 16, QCharcxx . . $ QChar#('0')).toUppercxx . . $ QString#toUpper(30b3b70527b1c61a).(); |
| 263 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(xAddrcxx . . $ DisasmViewer#xAddr., y + a, hexStr); |
| 264 | |
| 265 | // print 1 to 4 bytes |
| 266 | for (int j = 0; j < row->numBytescxx . . $ DisasmRow#numBytes.; ++j) { |
| 267 | hexStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1").argcxx . . $ QString#arg(64ab2ed17cc11715).(displayDisasm ? memorycxx . . $ DisasmViewer#memory.[row->addrcxx . . $ DisasmRow#addr. + j] : 0, 2, 16, QCharcxx . . $ QChar#('0')).toUppercxx . . $ QString#toUpper(30b3b70527b1c61a).(); |
| 268 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(xMCodecxx . . $ DisasmViewer#xMCode.[j], y + a, hexStr); |
| 269 | } |
| 270 | |
| 271 | // print the instruction and arguments |
| 272 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(xMnemcxx . . $ DisasmViewer#xMnem., y + a, rowcxx . . $ QString#QString(85c52e162fed56f9).->instrcxx . . $ DisasmRow#instr..substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0, 7).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 273 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(xMnemArgcxx . . $ DisasmViewer#xMnemArg., y + a, rowcxx . . $ QString#QString(85c52e162fed56f9).->instrcxx . . $ DisasmRow#instr..substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(7 ).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 274 | } |
| 275 | // next line |
| 276 | y += h; |
| 277 | ++visibleLinescxx . . $ DisasmViewer#visibleLines.; |
| 278 | // check for end of data |
| 279 | if (disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.+visibleLinescxx . . $ DisasmViewer#visibleLines. == int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())) break; |
| 280 | } |
| 281 | partialBottomLinecxx . . $ DisasmViewer#partialBottomLine. = y > heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ DisasmViewer#frameB.; |
| 282 | visibleLinescxx . . $ DisasmViewer#visibleLines. -= partialBottomLinecxx . . $ DisasmViewer#partialBottomLine.; |
| 283 | } |
| 284 | |
| 285 | void DisasmViewercxx . . $ DisasmViewer#::copyCodeToClipboardcxx . . $ DisasmViewer#copyCodeToClipboard(83f5f38750778ac8).() const |
| 286 | { |
| 287 | if (!memorycxx . . $ DisasmViewer#memory. || !isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).()) return; |
| 288 | |
| 289 | QClipboardcxx . . $ QClipboard# *clipboard = QApplicationcxx . . $ QApplication#::clipboardcxx . . $ QGuiApplication#clipboard(a5a00f8d44f5ac9e).(); |
| 290 | QStringcxx . . $ QString# buffercxx . . $ QString#QString(ced63f7c635d850d).; |
| 291 | |
| 292 | // calculate lines while writing |
| 293 | int maxY = heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ DisasmViewer#frameB.; |
| 294 | int maxLine = int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); |
| 295 | int y = frameTcxx . . $ DisasmViewer#frameT.; |
| 296 | |
| 297 | for (int currentLine = disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.; |
| 298 | (y < maxY) && (currentLine < maxLine); |
| 299 | ++currentLine) { |
| 300 | const DisasmRowcxx . . $ DisasmRow#* row = &disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).currentLine]; |
| 301 | switch (row->rowTypecxx . . $ DisasmRow#rowType.) { |
| 302 | case DisasmRowcxx . . $ DisasmRow#::INSTRUCTIONcxx . . $ DisasmRow#INSTRUCTION.: |
| 303 | buffer +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1%2\n") |
| 304 | .argcxx . . $ QString#arg(bc823072288cbbb5).(rowcxx . . $ QString#QString(85c52e162fed56f9).->instrcxx . . $ DisasmRow#instr..substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0, 7).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()) |
| 305 | .argcxx . . $ QString#arg(bc823072288cbbb5).(rowcxx . . $ QString#QString(85c52e162fed56f9).->instrcxx . . $ DisasmRow#instr..substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(7 ).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 306 | break; |
| 307 | case DisasmRowcxx . . $ DisasmRow#::LABELcxx . . $ DisasmRow#LABEL.: |
| 308 | buffer +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1:\n").argcxx . . $ QString#arg(bc823072288cbbb5).(rowcxx . . $ QString#QString(85c52e162fed56f9).->instrcxx . . $ DisasmRow#instr..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 309 | break; |
| 310 | } |
| 311 | // next line |
| 312 | y += row->rowTypecxx . . $ DisasmRow#rowType. == DisasmRowcxx . . $ DisasmRow#::INSTRUCTIONcxx . . $ DisasmRow#INSTRUCTION. ? codeFontHeightcxx . . $ DisasmViewer#codeFontHeight. : labelFontHeightcxx . . $ DisasmViewer#labelFontHeight.; |
| 313 | } |
| 314 | |
| 315 | clipboard->setTextcxx . . $ QClipboard#setText(9f492b8a441aa8de).(buffer, QClipboardcxx . . $ QClipboard#::Clipboardcxx . . $ QClipboard#Clipboard.); |
| 316 | } |
| 317 | |
| 318 | void DisasmViewercxx . . $ DisasmViewer#::setCursorAddresscxx . . $ DisasmViewer#setCursorAddress(a82834d34fbe7001).(uint16_tcxx . . $ uint16_t# addr, int infoLine, int method) |
| 319 | { |
| 320 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = addr; |
| 321 | cursorLinecxx . . $ DisasmViewer#cursorLine. = 0; |
| 322 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(addr, infoLine, method); |
| 323 | } |
| 324 | |
| 325 | int DisasmViewercxx . . $ DisasmViewer#::findPositioncxx . . $ DisasmViewer#findPosition(ec4a7933931c32af).(uint16_tcxx . . $ uint16_t# addr, int infoLine, int method) |
| 326 | { |
| 327 | if (int line = findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(addr, infoLine); line >= 0) { |
| 328 | int dt, db; |
| 329 | |
| 330 | switch (method) { |
| 331 | case Topcxx . . $ DisasmViewer#Top.: |
| 332 | case Middlecxx . . $ DisasmViewer#Middle.: |
| 333 | case Bottomcxx . . $ DisasmViewer#Bottom.: |
| 334 | case Closestcxx . . $ DisasmViewer#Closest.: |
| 335 | dt = db = 10; |
| 336 | break; |
| 337 | case TopAlwayscxx . . $ DisasmViewer#TopAlways.: |
| 338 | dt = 10; |
| 339 | db = visibleLinescxx . . $ DisasmViewer#visibleLines. + 10; |
| 340 | break; |
| 341 | case MiddleAlwayscxx . . $ DisasmViewer#MiddleAlways.: |
| 342 | dt = db = 10 + visibleLinescxx . . $ DisasmViewer#visibleLines. / 2; |
| 343 | break; |
| 344 | case BottomAlwayscxx . . $ DisasmViewer#BottomAlways.: |
| 345 | dt = 10 + visibleLinescxx . . $ DisasmViewer#visibleLines.; |
| 346 | db = 10; |
| 347 | break; |
| 348 | default: |
| 349 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(false); |
| 350 | dt = db = 0; // avoid warning |
| 351 | } |
| 352 | |
| 353 | if ((line > dt || disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].addrcxx . . $ DisasmRow#addr. == 0) && |
| 354 | (line < int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()) - db || |
| 355 | disasmLinescxx . . $ DisasmViewer#disasmLines..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().addrcxx . . $ DisasmRow#addr. + disasmLinescxx . . $ DisasmViewer#disasmLines..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().numBytescxx . . $ DisasmRow#numBytes. > 0xFFFF)) { |
| 356 | return line; |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | return -1; |
| 361 | } |
| 362 | |
| 363 | void DisasmViewercxx . . $ DisasmViewer#::setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(uint16_tcxx . . $ uint16_t# addr, int infoLine, int method) |
| 364 | { |
| 365 | if (method != Reloadcxx . . $ DisasmViewer#Reload.) { |
| 366 | int line = findPositioncxx . . $ DisasmViewer#findPosition(ec4a7933931c32af).(addr, infoLine, method); |
| 367 | |
| 368 | if (line >= 0) { |
| 369 | // line is within existing disasm'd data. Find where to put it. |
| 370 | if (method == Topcxx . . $ DisasmViewer#Top. || method == TopAlwayscxx . . $ DisasmViewer#TopAlways. || (method == Closestcxx . . $ DisasmViewer#Closest. && line < disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.)) { |
| 371 | // Move line to top |
| 372 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = line; |
| 373 | } else if (method == Bottomcxx . . $ DisasmViewer#Bottom. || method == BottomAlwayscxx . . $ DisasmViewer#BottomAlways. || |
| 374 | (method == Closestcxx . . $ DisasmViewer#Closest. && line >= disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + visibleLinescxx . . $ DisasmViewer#visibleLines.)) { |
| 375 | // Move line to bottom |
| 376 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = line - visibleLinescxx . . $ DisasmViewer#visibleLines. + 1; |
| 377 | } else if (method == MiddleAlwayscxx . . $ DisasmViewer#MiddleAlways. || |
| 378 | (method == Middlecxx . . $ DisasmViewer#Middle. && (line < disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. || line >= disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + visibleLinescxx . . $ DisasmViewer#visibleLines.))) { |
| 379 | // Move line to middle |
| 380 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = line - visibleLinescxx . . $ DisasmViewer#visibleLines. / 2; |
| 381 | } |
| 382 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).( |
| 383 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine., int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()) - visibleLinescxx . . $ DisasmViewer#visibleLines.); |
| 384 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(disasmTopLinecxx . . $ DisasmViewer#disasmTopLine., 0); |
| 385 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 386 | return; |
| 387 | } |
| 388 | |
| 389 | if (method == Closestcxx . . $ DisasmViewer#Closest.) { |
| 390 | if (addr < disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.].addrcxx . . $ DisasmRow#addr.) { |
| 391 | method = Topcxx . . $ DisasmViewer#Top.; |
| 392 | } else { |
| 393 | method = Bottomcxx . . $ DisasmViewer#Bottom.; |
| 394 | } |
| 395 | } |
| 396 | } else { |
| 397 | // cursor always on the middle when on break state anyway. |
| 398 | method = MiddleAlwayscxx . . $ DisasmViewer#MiddleAlways.; |
| 399 | } |
| 400 | |
| 401 | // The requested address it outside the pre-disassembled bounds. |
| 402 | // This means that a new block of memory must be transfered from |
| 403 | // openMSX and disassembled. |
| 404 | |
| 405 | // determine disasm bounds |
| 406 | int disasmStart; |
| 407 | int disasmEnd; |
| 408 | int extra = 4 * (visibleLinescxx . . $ DisasmViewer#visibleLines. > 9 ? visibleLinescxx . . $ DisasmViewer#visibleLines.+partialBottomLinecxx . . $ DisasmViewer#partialBottomLine. : 10); |
| 409 | switch (method) { |
| 410 | case Middlecxx . . $ DisasmViewer#Middle.: |
| 411 | case MiddleAlwayscxx . . $ DisasmViewer#MiddleAlways.: |
| 412 | disasmStart = addr - 3 * extra / 2; |
| 413 | disasmEnd = addr + 3 * extra / 2; |
| 414 | break; |
| 415 | case Bottomcxx . . $ DisasmViewer#Bottom.: |
| 416 | case BottomAlwayscxx . . $ DisasmViewer#BottomAlways.: |
| 417 | disasmStart = addr - 2 * extra; |
| 418 | disasmEnd = addr + extra; |
| 419 | break; |
| 420 | default: |
| 421 | disasmStart = addr - extra; |
| 422 | disasmEnd = addr + 2 * extra; |
| 423 | } |
| 424 | disasmStart = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(disasmStart, 0); |
| 425 | disasmEnd = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(disasmEnd, 0xFFFF); |
| 426 | |
| 427 | requestMemorycxx . . $ DisasmViewer#requestMemory(30710014fe633fb5).(disasmStart, disasmEnd + 1, addr, infoLine, method); |
| 428 | } |
| 429 | |
| 430 | void DisasmViewercxx . . $ DisasmViewer#::memoryUpdatedcxx . . $ DisasmViewer#memoryUpdated(e15786835b1a8b73).(CommMemoryRequestcxx . . $ CommMemoryRequest#* req) |
| 431 | { |
| 432 | // disassemble the newly received memory |
| 433 | dasmcxx . . $ dasm(8eaa81ad2a87061c).(memorycxx . . $ DisasmViewer#memory., req->offsetcxx . . $ CommMemoryRequest#offset., req->offsetcxx . . $ CommMemoryRequest#offset. + req->sizecxx . . $ CommMemoryRequest#size. - 1, disasmLinescxx . . $ DisasmViewer#disasmLines., |
| 434 | memLayoutcxx . . $ DisasmViewer#memLayout., symTablecxx . . $ DisasmViewer#symTable., programAddrcxx . . $ DisasmViewer#programAddr.); |
| 435 | |
| 436 | // locate the requested line |
| 437 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(req->addresscxx . . $ CommMemoryRequest#address., req->linecxx . . $ CommMemoryRequest#line.); |
| 438 | |
| 439 | switch (req->methodcxx . . $ CommMemoryRequest#method.) { |
| 440 | case Middlecxx . . $ DisasmViewer#Middle.: |
| 441 | case MiddleAlwayscxx . . $ DisasmViewer#MiddleAlways.: |
| 442 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. -= visibleLinescxx . . $ DisasmViewer#visibleLines. / 2; |
| 443 | break; |
| 444 | case Bottomcxx . . $ DisasmViewer#Bottom.: |
| 445 | case BottomAlwayscxx . . $ DisasmViewer#BottomAlways.: |
| 446 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. -= visibleLinescxx . . $ DisasmViewer#visibleLines. - 1; |
| 447 | break; |
| 448 | } |
| 449 | |
| 450 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(disasmTopLinecxx . . $ DisasmViewer#disasmTopLine., |
| 451 | int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()) - visibleLinescxx . . $ DisasmViewer#visibleLines.); |
| 452 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(disasmTopLinecxx . . $ DisasmViewer#disasmTopLine., 0); |
| 453 | |
| 454 | updateCancelledcxx . . $ DisasmViewer#updateCancelled(e15786835b1a8b73).(req); |
| 455 | |
| 456 | // sync the scrollbar with the actual address reached |
| 457 | if (!waitingForDatacxx . . $ DisasmViewer#waitingForData.) { |
| 458 | // set the slider with without the signal |
| 459 | disconnectcxx . . $ QObject#disconnect(bacd0f9184cd8ee1).(scrollBarcxx . . $ DisasmViewer#scrollBar., &QScrollBarcxx . . $ QScrollBar#::valueChangedcxx . . $ QAbstractSlider#valueChanged(d4f767463ce0a6b3)., |
| 460 | this, &DisasmViewercxx . . $ DisasmViewer#::scrollBarChangedcxx . . $ DisasmViewer#scrollBarChanged(d4f767463ce0a6b3).); |
| 461 | scrollBarcxx . . $ DisasmViewer#scrollBar.->setSliderPositioncxx . . $ QAbstractSlider#setSliderPosition(d4f767463ce0a6b3).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.].addrcxx . . $ DisasmRow#addr.); |
| 462 | connectcxx . . $ QObject#connect(835f87066c895669).(scrollBarcxx . . $ DisasmViewer#scrollBar., &QScrollBarcxx . . $ QScrollBar#::valueChangedcxx . . $ QAbstractSlider#valueChanged(d4f767463ce0a6b3)., |
| 463 | this, &DisasmViewercxx . . $ DisasmViewer#::scrollBarChangedcxx . . $ DisasmViewer#scrollBarChanged(d4f767463ce0a6b3).); |
| 464 | // set the line |
| 465 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.].addrcxx . . $ DisasmRow#addr., |
| 466 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.].infoLinecxx . . $ DisasmRow#infoLine.); |
| 467 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | void DisasmViewercxx . . $ DisasmViewer#::updateCancelledcxx . . $ DisasmViewer#updateCancelled(e15786835b1a8b73).(CommMemoryRequestcxx . . $ CommMemoryRequest#* req) |
| 472 | { |
| 473 | delete req; |
| 474 | if (nextRequestcxx . . $ DisasmViewer#nextRequest.) { |
| 475 | CommClientcxx . . $ CommClient#::instancecxx . . $ CommClient#instance(8cca9d0b1334f685).().sendCommandcxx . . $ CommClient#sendCommand(6fe5d9dff2ed3a64).(nextRequestcxx . . $ DisasmViewer#nextRequest.); |
| 476 | nextRequestcxx . . $ DisasmViewer#nextRequest. = nullptr; |
| 477 | } else { |
| 478 | waitingForDatacxx . . $ DisasmViewer#waitingForData. = false; |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | uint16_tcxx . . $ uint16_t# DisasmViewercxx . . $ DisasmViewer#::cursorAddresscxx . . $ DisasmViewer#cursorAddress(72085aa11f4b6e09).() const |
| 483 | { |
| 484 | return cursorAddrcxx . . $ DisasmViewer#cursorAddr.; |
| 485 | } |
| 486 | |
| 487 | uint16_tcxx . . $ uint16_t# DisasmViewercxx . . $ DisasmViewer#::programCountercxx . . $ DisasmViewer#programCounter(72085aa11f4b6e09).() const |
| 488 | { |
| 489 | return programAddrcxx . . $ DisasmViewer#programAddr.; |
| 490 | } |
| 491 | |
| 492 | void DisasmViewercxx . . $ DisasmViewer#::setProgramCountercxx . . $ DisasmViewer#setProgramCounter(aa266def8759b091).(uint16_tcxx . . $ uint16_t# pc, bool reload) |
| 493 | { |
| 494 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = pc; |
| 495 | programAddrcxx . . $ DisasmViewer#programAddr. = pc; |
| 496 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(pc, 0, reload ? Reloadcxx . . $ DisasmViewer#Reload. : MiddleAlwayscxx . . $ DisasmViewer#MiddleAlways.); |
| 497 | } |
| 498 | |
| 499 | int DisasmViewercxx . . $ DisasmViewer#::findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(uint16_tcxx . . $ uint16_t# lineAddr, int infoLine) |
| 500 | { |
| 501 | int line = disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() - 1; |
| 502 | while (line >= 0) { |
| 503 | if (lineAddr >= disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].addrcxx . . $ DisasmRow#addr.) { |
| 504 | if (infoLine == 0) { |
| 505 | return line; |
| 506 | } |
| 507 | if (infoLine == LAST_INFO_LINEcxx . . $ LAST_INFO_LINE.) { |
| 508 | return line - 1; |
| 509 | } |
| 510 | while (disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].infoLinecxx . . $ DisasmRow#infoLine. != infoLine && disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].addrcxx . . $ DisasmRow#addr. == lineAddr) { |
| 511 | line--; |
| 512 | if (line < 0) return -1; |
| 513 | } |
| 514 | return line; |
| 515 | } |
| 516 | line--; |
| 517 | } |
| 518 | return -1; |
| 519 | } |
| 520 | |
| 521 | void DisasmViewercxx . . $ DisasmViewer#::scrollBarActioncxx . . $ DisasmViewer#scrollBarAction(d4f767463ce0a6b3).(int action) |
| 522 | { |
| 523 | switch (action) { |
| 524 | case QScrollBarcxx . . $ QScrollBar#::SliderSingleStepAddcxx . . $ QAbstractSlider#SliderSingleStepAdd.: |
| 525 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + 1].addrcxx . . $ DisasmRow#addr., |
| 526 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + 1].infoLinecxx . . $ DisasmRow#infoLine., |
| 527 | TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 528 | break; |
| 529 | case QScrollBarcxx . . $ QScrollBar#::SliderSingleStepSubcxx . . $ QAbstractSlider#SliderSingleStepSub.: |
| 530 | if (disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. > 0) { |
| 531 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. - 1].addrcxx . . $ DisasmRow#addr., |
| 532 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. - 1].infoLinecxx . . $ DisasmRow#infoLine., |
| 533 | TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 534 | } |
| 535 | break; |
| 536 | case QScrollBarcxx . . $ QScrollBar#::SliderPageStepAddcxx . . $ QAbstractSlider#SliderPageStepAdd.: { |
| 537 | int line = disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + visibleLinescxx . . $ DisasmViewer#visibleLines. + partialBottomLinecxx . . $ DisasmViewer#partialBottomLine. - 1; |
| 538 | if (line < int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())) { |
| 539 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].addrcxx . . $ DisasmRow#addr., |
| 540 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].infoLinecxx . . $ DisasmRow#infoLine., |
| 541 | TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 542 | } |
| 543 | break; |
| 544 | } |
| 545 | case QScrollBarcxx . . $ QScrollBar#::SliderPageStepSubcxx . . $ QAbstractSlider#SliderPageStepSub.: |
| 546 | if (disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. > 0) { |
| 547 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. - 1].addrcxx . . $ DisasmRow#addr., |
| 548 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. - 1].infoLinecxx . . $ DisasmRow#infoLine., |
| 549 | BottomAlwayscxx . . $ DisasmViewer#BottomAlways.); |
| 550 | } |
| 551 | break; |
| 552 | default: |
| 553 | break; |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | // moving the slider is handled separately because |
| 558 | // the SliderMoved action won't catch the extreme values |
| 559 | void DisasmViewercxx . . $ DisasmViewer#::scrollBarChangedcxx . . $ DisasmViewer#scrollBarChanged(d4f767463ce0a6b3).(int value) |
| 560 | { |
| 561 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(value, FIRST_INFO_LINEcxx . . $ FIRST_INFO_LINE., TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 562 | } |
| 563 | |
| 564 | void DisasmViewercxx . . $ DisasmViewer#::setMemorycxx . . $ DisasmViewer#setMemory(f25546b61a629de7).(unsigned char* memPtr) |
| 565 | { |
| 566 | memorycxx . . $ DisasmViewer#memory. = memPtr; |
| 567 | // init disasmLines |
| 568 | DisasmRowcxx . . $ DisasmRow# newRow; |
| 569 | newRow.rowTypecxx . . $ DisasmRow#rowType. = DisasmRowcxx . . $ DisasmRow#::INSTRUCTIONcxx . . $ DisasmRow#INSTRUCTION.; |
| 570 | newRow.numBytescxx . . $ DisasmRow#numBytes. = 1; |
| 571 | newRow.infoLinecxx . . $ DisasmRow#infoLine. = 0; |
| 572 | newRow.instrcxx . . $ DisasmRow#instr. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "nop"; |
| 573 | newRow.instrcxx . . $ DisasmRow#instr..resizecxx . . $ std/__cxx11/basic_string#resize(cc73ddaffac1a975).(8, ' '); |
| 574 | for (int i = 0; i < 150; ++i) { |
| 575 | newRow.addrcxx . . $ DisasmRow#addr. = i; |
| 576 | disasmLinescxx . . $ DisasmViewer#disasmLines..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(newRow); |
| 577 | } |
| 578 | disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. = 50; |
| 579 | } |
| 580 | |
| 581 | void DisasmViewercxx . . $ DisasmViewer#::setBreakpointscxx . . $ DisasmViewer#setBreakpoints(a6f64075c1962c5e).(Breakpointscxx . . $ Breakpoints#* bps) |
| 582 | { |
| 583 | breakpointscxx . . $ DisasmViewer#breakpoints. = bps; |
| 584 | } |
| 585 | |
| 586 | void DisasmViewercxx . . $ DisasmViewer#::setMemoryLayoutcxx . . $ DisasmViewer#setMemoryLayout(64b27f19295a45ce).(MemoryLayoutcxx . . $ MemoryLayout#* ml) |
| 587 | { |
| 588 | memLayoutcxx . . $ DisasmViewer#memLayout. = ml; |
| 589 | } |
| 590 | |
| 591 | void DisasmViewercxx . . $ DisasmViewer#::setSymbolTablecxx . . $ DisasmViewer#setSymbolTable(e4a7acf13c981465).(SymbolTablecxx . . $ SymbolTable#* st) |
| 592 | { |
| 593 | symTablecxx . . $ DisasmViewer#symTable. = st; |
| 594 | } |
| 595 | |
| 596 | void DisasmViewercxx . . $ DisasmViewer#::keyPressEventcxx . . $ DisasmViewer#keyPressEvent(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent#* e) |
| 597 | { |
| 598 | switch (e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).()) { |
| 599 | case Qtcxx . . $ Qt/::Key_Upcxx . . $ Qt/Key_Up.: { |
| 600 | int line = findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine.); |
| 601 | if (line > 0) { |
| 602 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line - 1].addrcxx . . $ DisasmRow#addr.; |
| 603 | cursorLinecxx . . $ DisasmViewer#cursorLine. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line - 1].infoLinecxx . . $ DisasmRow#infoLine.; |
| 604 | } |
| 605 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine., Closestcxx . . $ DisasmViewer#Closest.); |
| 606 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 607 | break; |
| 608 | } |
| 609 | case Qtcxx . . $ Qt/::Key_Downcxx . . $ Qt/Key_Down.: { |
| 610 | int line = findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine.); |
| 611 | if (line >= 0 && line < int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()) - 1) { |
| 612 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line + 1].addrcxx . . $ DisasmRow#addr.; |
| 613 | cursorLinecxx . . $ DisasmViewer#cursorLine. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line + 1].infoLinecxx . . $ DisasmRow#infoLine.; |
| 614 | } |
| 615 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine., Closestcxx . . $ DisasmViewer#Closest.); |
| 616 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 617 | break; |
| 618 | } |
| 619 | case Qtcxx . . $ Qt/::Key_PageUpcxx . . $ Qt/Key_PageUp.: { |
| 620 | int line = findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine.); |
| 621 | if (line >= disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. && line < disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.+visibleLinescxx . . $ DisasmViewer#visibleLines.) { |
| 622 | line -= visibleLinescxx . . $ DisasmViewer#visibleLines.; |
| 623 | if (line >= 0) { |
| 624 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].addrcxx . . $ DisasmRow#addr.; |
| 625 | cursorLinecxx . . $ DisasmViewer#cursorLine. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].infoLinecxx . . $ DisasmRow#infoLine.; |
| 626 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. - 1].addrcxx . . $ DisasmRow#addr., |
| 627 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. - 1].infoLinecxx . . $ DisasmRow#infoLine., |
| 628 | BottomAlwayscxx . . $ DisasmViewer#BottomAlways.); |
| 629 | } else { |
| 630 | setCursorAddresscxx . . $ DisasmViewer#setCursorAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].addrcxx . . $ DisasmRow#addr., |
| 631 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].infoLinecxx . . $ DisasmRow#infoLine., |
| 632 | Closestcxx . . $ DisasmViewer#Closest.); |
| 633 | } |
| 634 | } else |
| 635 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine., Closestcxx . . $ DisasmViewer#Closest.); |
| 636 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 637 | break; |
| 638 | } |
| 639 | case Qtcxx . . $ Qt/::Key_PageDowncxx . . $ Qt/Key_PageDown.: { |
| 640 | int line = findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine.); |
| 641 | if (line >= disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. && line < disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.+visibleLinescxx . . $ DisasmViewer#visibleLines.) { |
| 642 | line += visibleLinescxx . . $ DisasmViewer#visibleLines.; |
| 643 | if (line < int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())) { |
| 644 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].addrcxx . . $ DisasmRow#addr.; |
| 645 | cursorLinecxx . . $ DisasmViewer#cursorLine. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].infoLinecxx . . $ DisasmRow#infoLine.; |
| 646 | line = disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + visibleLinescxx . . $ DisasmViewer#visibleLines. + partialBottomLinecxx . . $ DisasmViewer#partialBottomLine. - 1; |
| 647 | line = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(line, int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())); |
| 648 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].addrcxx . . $ DisasmRow#addr., |
| 649 | disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].infoLinecxx . . $ DisasmRow#infoLine., |
| 650 | TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 651 | } else { |
| 652 | setCursorAddresscxx . . $ DisasmViewer#setCursorAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().addrcxx . . $ DisasmRow#addr., |
| 653 | disasmLinescxx . . $ DisasmViewer#disasmLines..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().infoLinecxx . . $ DisasmRow#infoLine., |
| 654 | Closestcxx . . $ DisasmViewer#Closest.); |
| 655 | } |
| 656 | } else |
| 657 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine., Closestcxx . . $ DisasmViewer#Closest.); |
| 658 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 659 | break; |
| 660 | } |
| 661 | case Qtcxx . . $ Qt/::Key_Homecxx . . $ Qt/Key_Home.: { |
| 662 | setCursorAddresscxx . . $ DisasmViewer#setCursorAddress(a82834d34fbe7001).(0, 0, Middlecxx . . $ DisasmViewer#Middle.); |
| 663 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 664 | break; |
| 665 | } |
| 666 | case Qtcxx . . $ Qt/::Key_Endcxx . . $ Qt/Key_End.: { |
| 667 | setCursorAddresscxx . . $ DisasmViewer#setCursorAddress(a82834d34fbe7001).(0xffff, 0, Middlecxx . . $ DisasmViewer#Middle.); |
| 668 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 669 | break; |
| 670 | } |
| 671 | case Qtcxx . . $ Qt/::Key_Rightcxx . . $ Qt/Key_Right.: |
| 672 | case Qtcxx . . $ Qt/::Key_Returncxx . . $ Qt/Key_Return.: { |
| 673 | int line = findDisasmLinecxx . . $ DisasmViewer#findDisasmLine(3727f65dc41d151e).(cursorAddrcxx . . $ DisasmViewer#cursorAddr., cursorLinecxx . . $ DisasmViewer#cursorLine.); |
| 674 | if (line >= 0 && line < int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())) { |
| 675 | int naddr = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!; |
| 676 | const DisasmRowcxx . . $ DisasmRow# &row = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line]; |
| 677 | stdcxx . . $ std/::stringcxx . . $ std/string# instr = rowcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..instrcxx . . $ DisasmRow#instr.; |
| 678 | stdcxx . . $ std/::regexcxx . . $ std/__cxx11/regex# re_absolutecxx . . $ std/__cxx11/basic_regex#basic_regex(d1adbc785ae219ab).("(call|jp)\\ .*"); |
| 679 | stdcxx . . $ std/::regexcxx . . $ std/__cxx11/regex# re_relativecxx . . $ std/__cxx11/basic_regex#basic_regex(d1adbc785ae219ab).("(djnz|jr)\\ .*"); |
| 680 | if (stdcxx . . $ std/::regex_matchcxx . . $ std/regex_match(dbfa5bd607d7b136).(instr, re_absolute)) |
| 681 | naddr = memorycxx . . $ DisasmViewer#memory.[row.addrcxx . . $ DisasmRow#addr. + 1] + memorycxx . . $ DisasmViewer#memory.[row.addrcxx . . $ DisasmRow#addr. + 2] * 256; |
| 682 | else if (stdcxx . . $ std/::regex_matchcxx . . $ std/regex_match(dbfa5bd607d7b136).(instr, re_relative)) |
| 683 | naddr = (row.addrcxx . . $ DisasmRow#addr. + 2 + (signed char)memorycxx . . $ DisasmViewer#memory.[row.addrcxx . . $ DisasmRow#addr. + 1]) & 0xFFFF; |
| 684 | if (naddr != INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!) { |
| 685 | jumpStackcxx . . $ DisasmViewer#jumpStack..push_backcxx . . $ QList#push_back(77d9f17553126ecb).(cursorAddrcxx . . $ DisasmViewer#cursorAddr.); |
| 686 | setCursorAddresscxx . . $ DisasmViewer#setCursorAddress(a82834d34fbe7001).(naddr, 0, Middlecxx . . $ DisasmViewer#Middle.); |
| 687 | } |
| 688 | } |
| 689 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 690 | break; |
| 691 | } |
| 692 | case Qtcxx . . $ Qt/::Key_Leftcxx . . $ Qt/Key_Left.: |
| 693 | case Qtcxx . . $ Qt/::Key_Backspacecxx . . $ Qt/Key_Backspace.: { |
| 694 | if (!jumpStackcxx . . $ DisasmViewer#jumpStack..emptycxx . . $ QList#empty(50ce9a9e25b4a850).()) { |
| 695 | int addr = jumpStackcxx . . $ DisasmViewer#jumpStack..takeLastcxx . . $ QList#takeLast(5f357b03ed472e5e).(); |
| 696 | setCursorAddresscxx . . $ DisasmViewer#setCursorAddress(a82834d34fbe7001).(addr, 0, Middlecxx . . $ DisasmViewer#Middle.); |
| 697 | } |
| 698 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 699 | break; |
| 700 | } |
| 701 | default: |
| 702 | QFramecxx . . $ QFrame#::keyReleaseEventcxx . . $ QWidget#keyReleaseEvent(c92999c1b6b09cc0).(e); |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | void DisasmViewercxx . . $ DisasmViewer#::wheelEventcxx . . $ DisasmViewer#wheelEvent(92d40974398e4832).(QWheelEventcxx . . $ QWheelEvent#* e) |
| 707 | { |
| 708 | wheelRemaindercxx . . $ DisasmViewer#wheelRemainder. += e->angleDeltacxx . . $ QWheelEvent#angleDelta(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(455f465bc33b4cdf).(); |
| 709 | const int delta = wheelRemaindercxx . . $ DisasmViewer#wheelRemainder. / 40; |
| 710 | wheelRemaindercxx . . $ DisasmViewer#wheelRemainder. %= 40; |
| 711 | if (delta) { |
| 712 | int line = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(0, disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. - delta); |
| 713 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].addrcxx . . $ DisasmRow#addr., disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line].infoLinecxx . . $ DisasmRow#infoLine., TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 714 | } |
| 715 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 716 | } |
| 717 | |
| 718 | void DisasmViewercxx . . $ DisasmViewer#::mousePressEventcxx . . $ DisasmViewer#mousePressEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent#* e) |
| 719 | { |
| 720 | if (!(e->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton.)) { |
| 721 | QFramecxx . . $ QFrame#::mousePressEventcxx . . $ QWidget#mousePressEvent(702858a82d06265c).(e); |
| 722 | return; |
| 723 | } |
| 724 | |
| 725 | if (e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).() >= frameLcxx . . $ DisasmViewer#frameL. && e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).() < widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameRcxx . . $ DisasmViewer#frameR. && |
| 726 | e->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).() >= frameTcxx . . $ DisasmViewer#frameT. && e->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).() < heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ DisasmViewer#frameB.) { |
| 727 | int line = lineAtPoscxx . . $ DisasmViewer#lineAtPos(7f6a8dc075353cdd).(e->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).()); |
| 728 | if (e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).() > frameLcxx . . $ DisasmViewer#frameL. + 32) { |
| 729 | // check if the line exists |
| 730 | // (bottom of memory could have an empty line) |
| 731 | if (line + disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. < int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())) { |
| 732 | cursorAddrcxx . . $ DisasmViewer#cursorAddr. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + line].addrcxx . . $ DisasmRow#addr.; |
| 733 | cursorLinecxx . . $ DisasmViewer#cursorLine. = disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + line].infoLinecxx . . $ DisasmRow#infoLine.; |
| 734 | } else { |
| 735 | return; |
| 736 | } |
| 737 | |
| 738 | // scroll if partial line |
| 739 | if (line == visibleLinescxx . . $ DisasmViewer#visibleLines.) { |
| 740 | setAddresscxx . . $ DisasmViewer#setAddress(a82834d34fbe7001).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. + 1].addrcxx . . $ DisasmRow#addr., TopAlwayscxx . . $ DisasmViewer#TopAlways.); |
| 741 | } else { |
| 742 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 743 | } |
| 744 | } else if (e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).() < frameLcxx . . $ DisasmViewer#frameL. + 16) { |
| 745 | // clicked on the breakpoint area |
| 746 | if (line + disasmTopLinecxx . . $ DisasmViewer#disasmTopLine. < int(disasmLinescxx . . $ DisasmViewer#disasmLines..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())) { |
| 747 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! breakpointToggledcxx . . $ DisasmViewer#breakpointToggled(d4f767463ce0a6b3).(disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).line + disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.].addrcxx . . $ DisasmRow#addr.); |
| 748 | } |
| 749 | } |
| 750 | } |
| 751 | } |
| 752 | |
| 753 | int DisasmViewercxx . . $ DisasmViewer#::lineAtPoscxx . . $ DisasmViewer#lineAtPos(7f6a8dc075353cdd).(const QPointcxx . . $ QPoint#& pos) |
| 754 | { |
| 755 | int line = -1; |
| 756 | int y = frameTcxx . . $ DisasmViewer#frameT.; |
| 757 | do { |
| 758 | ++line; |
| 759 | switch (disasmLinescxx . . $ DisasmViewer#disasmLines.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).disasmTopLinecxx . . $ DisasmViewer#disasmTopLine.+line].rowTypecxx . . $ DisasmRow#rowType.) { |
| 760 | case DisasmRowcxx . . $ DisasmRow#::LABELcxx . . $ DisasmRow#LABEL.: |
| 761 | y += labelFontHeightcxx . . $ DisasmViewer#labelFontHeight.; |
| 762 | break; |
| 763 | case DisasmRowcxx . . $ DisasmRow#::INSTRUCTIONcxx . . $ DisasmRow#INSTRUCTION.: |
| 764 | y += codeFontHeightcxx . . $ DisasmViewer#codeFontHeight.; |
| 765 | break; |
| 766 | } |
| 767 | } while (y < pos.ycxx . . $ QPoint#y(455f465bc33b4cdf).()); |
| 768 | |
| 769 | return line; |
| 770 | } |