| 1 | #cxx . . $ `<file>/src/VramTiledView.cpp`/include "VramTiledView.h"cxx . . $ `<file>/src/VramTiledView.h`/ |
| 2 | #include "VDPDataStore.h"cxx . . $ `<file>/src/VDPDataStore.h`/ |
| 3 | #include "Convert.h"cxx . . $ `<file>/src/Convert.h`/ |
| 4 | #include "ranges.h"cxx . . $ `<file>/src/ranges.h`/ |
| 5 | #include <QPainter> |
| 6 | #include <algorithm> |
| 7 | #include <cstdio> |
| 8 | |
| 9 | VramTiledViewcxx . . $ VramTiledView#::VramTiledViewcxx . . $ VramTiledView#VramTiledView(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 10 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent) |
| 11 | , imagecxx . . $ VramTiledView#image.(512, 512, QImagecxx . . $ QImage#::Format_RGB32cxx . . $ QImage#Format_RGB32.) |
| 12 | { |
| 13 | rangescxx . . $ ranges/::fillcxx . . $ ranges/fill(af49599c1c6f79df).(msxPalettecxx . . $ VramTiledView#msxPalette., qRgbcxx . . $ qRgb(530956271a9518a5).(80, 80, 80)); |
| 14 | setZoomcxx . . $ VramTiledView#setZoom(9364e6e7bff7660).(1.0f); |
| 15 | |
| 16 | // Mouse update events when mouse is moved over the image, Quibus likes this |
| 17 | // better than my preferred click-on-the-image. |
| 18 | setMouseTrackingcxx . . $ QWidget#setMouseTracking(b45ddcbc8423892c).(true); |
| 19 | } |
| 20 | |
| 21 | void VramTiledViewcxx . . $ VramTiledView#::setZoomcxx . . $ VramTiledView#setZoom(9364e6e7bff7660).(float zoom) |
| 22 | { |
| 23 | zoomFactorcxx . . $ VramTiledView#zoomFactor. = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0f, zoom); |
| 24 | if (vramBasecxx . . $ VramTiledView#vramBase.) { |
| 25 | const auto* regs = VDPDataStorecxx . . $ VDPDataStore#::instancecxx . . $ VDPDataStore#instance(6179f7cf4255f5b).().getRegsPointercxx . . $ VDPDataStore#getRegsPointer(7eb257f306f79f97).(); |
| 26 | linescxx . . $ VramTiledView#lines. = (forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows. != 0.0f) ? int(8 * forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows.) : (regs[9] & 128 ? 212 : 192); |
| 27 | } else { |
| 28 | linescxx . . $ VramTiledView#lines. = (forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows. != 0.0f) ? int(8 * forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows.) : 192; |
| 29 | } |
| 30 | int imageW = screenModecxx . . $ VramTiledView#screenMode. == 0 ? 40 * 6 * 2 |
| 31 | : screenModecxx . . $ VramTiledView#screenMode. == 80 ? 80 * 6 |
| 32 | : 512; |
| 33 | setFixedSizecxx . . $ QWidget#setFixedSize(3e454b8ccf442868).(int(zoomFactorcxx . . $ VramTiledView#zoomFactor. * float(imageW)), |
| 34 | int(zoomFactorcxx . . $ VramTiledView#zoomFactor. * float(linescxx . . $ VramTiledView#lines.) * 2)); |
| 35 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 36 | } |
| 37 | |
| 38 | void VramTiledViewcxx . . $ VramTiledView#::decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).() |
| 39 | { |
| 40 | if (!vramBasecxx . . $ VramTiledView#vramBase.) return; |
| 41 | |
| 42 | //also everytime we decode we adjust height of widget to the correct screenheight |
| 43 | const auto* regs = VDPDataStorecxx . . $ VDPDataStore#::instancecxx . . $ VDPDataStore#instance(6179f7cf4255f5b).().getRegsPointercxx . . $ VDPDataStore#getRegsPointer(7eb257f306f79f97).(); |
| 44 | linescxx . . $ VramTiledView#lines. = (forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows. != 0.0f) ? int(8 * forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows.) : (regs[9] & 128 ? 212 : 192); |
| 45 | int imageW = screenModecxx . . $ VramTiledView#screenMode. == 0 ? 40 * 6 * 2 |
| 46 | : screenModecxx . . $ VramTiledView#screenMode. == 80 ? 80 * 6 |
| 47 | : 512; |
| 48 | setFixedSizecxx . . $ QWidget#setFixedSize(3e454b8ccf442868).(int(zoomFactorcxx . . $ VramTiledView#zoomFactor. * float(imageW)), |
| 49 | int(zoomFactorcxx . . $ VramTiledView#zoomFactor. * float(linescxx . . $ VramTiledView#lines.) * 2)); |
| 50 | |
| 51 | imagecxx . . $ VramTiledView#image..fillcxx . . $ QImage#fill(cd98eb3c6d110ca7).(Qtcxx . . $ Qt/::graycxx . . $ Qt/gray.); |
| 52 | |
| 53 | switch (tableToShowcxx . . $ VramTiledView#tableToShow.) { |
| 54 | case 0: |
| 55 | decodePatternTablecxx . . $ VramTiledView#decodePatternTable(49f6e7a06ebc5aa8).(); |
| 56 | break; |
| 57 | case 1: |
| 58 | decodeNameTablecxx . . $ VramTiledView#decodeNameTable(49f6e7a06ebc5aa8).(); |
| 59 | break; |
| 60 | case 2: |
| 61 | decodeNameTablecxx . . $ VramTiledView#decodeNameTable(49f6e7a06ebc5aa8).(); |
| 62 | overLayNameTablecxx . . $ VramTiledView#overLayNameTable(49f6e7a06ebc5aa8).(); |
| 63 | break; |
| 64 | } |
| 65 | |
| 66 | horiStepcxx . . $ VramTiledView#horiStep. = charWidthcxx . . $ VramTiledView#charWidth. * ((screenModecxx . . $ VramTiledView#screenMode. == 80 && tableToShowcxx . . $ VramTiledView#tableToShow. > 0) ? 1 : 2); |
| 67 | |
| 68 | if (drawGridcxx . . $ VramTiledView#drawGrid. && screenModecxx . . $ VramTiledView#screenMode. != 255) { |
| 69 | QPaintercxx . . $ QPainter# qpcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(&imagecxx . . $ VramTiledView#image.); |
| 70 | qp.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(QColorcxx . . $ QColor#QColor(2261ffe5112eab06).(55, 55, 55, 128)); |
| 71 | for (int yy = 15; yy < 16 * screenHeightcxx . . $ VramTiledView#screenHeight.; yy += 16) { |
| 72 | qp.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(0, yy, horiStepcxx . . $ VramTiledView#horiStep. * screenWidthcxx . . $ VramTiledView#screenWidth. - 1, yy); |
| 73 | } |
| 74 | for (int xx = horiStepcxx . . $ VramTiledView#horiStep. - 1; xx < horiStepcxx . . $ VramTiledView#horiStep. * screenWidthcxx . . $ VramTiledView#screenWidth.; xx += horiStepcxx . . $ VramTiledView#horiStep.) { |
| 75 | qp.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(xx, 0, xx, 16*screenHeightcxx . . $ VramTiledView#screenHeight. - 1); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | pixImagecxx . . $ VramTiledView#pixImage. =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). QPixmapcxx . . $ QPixmap#::fromImagecxx . . $ QPixmap#fromImage(e89e6101063912f).(imagecxx . . $ VramTiledView#image.); |
| 80 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 81 | } |
| 82 | |
| 83 | void VramTiledViewcxx . . $ VramTiledView#::decodePalettecxx . . $ VramTiledView#decodePalette(49f6e7a06ebc5aa8).() |
| 84 | { |
| 85 | if (!palettecxx . . $ VramTiledView#palette.) return; |
| 86 | //printf("VramTiledView::decodePallet palletpointer %p \n", palette); |
| 87 | |
| 88 | for (int i = 0; i < 16; ++i) { |
| 89 | int r = (palettecxx . . $ VramTiledView#palette.[2 * i + 0] & 0xf0) >> 4; |
| 90 | int b = (palettecxx . . $ VramTiledView#palette.[2 * i + 0] & 0x0f); |
| 91 | int g = (palettecxx . . $ VramTiledView#palette.[2 * i + 1] & 0x0f); |
| 92 | |
| 93 | auto scale = [](int x) { return (x >> 1) | (x << 2) | (x << 5); }; |
| 94 | msxPalettecxx . . $ VramTiledView#msxPalette.[i] = qRgbcxx . . $ qRgb(530956271a9518a5).(scale(cxx . . $ VramTiledView#decodePalette(49f6e7a06ebc5aa8).$anonymous_type_0#`operator()`(7ccb52b1bfe01045).r), scale(cxx . . $ VramTiledView#decodePalette(49f6e7a06ebc5aa8).$anonymous_type_0#`operator()`(7ccb52b1bfe01045).g), scale(cxx . . $ VramTiledView#decodePalette(49f6e7a06ebc5aa8).$anonymous_type_0#`operator()`(7ccb52b1bfe01045).b)); |
| 95 | //printf("VramTiledView::decodePallet color %d => r %d g %d b %d \n", i, r, g, b); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | void VramTiledViewcxx . . $ VramTiledView#::decodePatternTablecxx . . $ VramTiledView#decodePatternTable(49f6e7a06ebc5aa8).() |
| 100 | { |
| 101 | screenWidthcxx . . $ VramTiledView#screenWidth. = 32; |
| 102 | screenHeightcxx . . $ VramTiledView#screenHeight. = 8; // 32 * 8 => 256 chars by default |
| 103 | charWidthcxx . . $ VramTiledView#charWidth. = 8; |
| 104 | |
| 105 | switch (screenModecxx . . $ VramTiledView#screenMode.) { |
| 106 | case 0: |
| 107 | case 80: |
| 108 | charWidthcxx . . $ VramTiledView#charWidth. = 6; |
| 109 | decodePatternTableRegularCharscxx . . $ VramTiledView#decodePatternTableRegularChars(49f6e7a06ebc5aa8).(); |
| 110 | break; |
| 111 | case 2: |
| 112 | case 4: |
| 113 | screenHeightcxx . . $ VramTiledView#screenHeight. = 24; |
| 114 | [[fallthrough]]; |
| 115 | case 1: |
| 116 | decodePatternTableRegularCharscxx . . $ VramTiledView#decodePatternTableRegularChars(49f6e7a06ebc5aa8).(); |
| 117 | break; |
| 118 | case 3: |
| 119 | // Since patterns in multicolor are 2 color nibles they act more like a 'colortable' |
| 120 | // and to avoid too much special case in the generic decodePatternTableRegularChars() |
| 121 | // this has been seperated in a single method. |
| 122 | decodePatternTableMultiColorcxx . . $ VramTiledView#decodePatternTableMultiColor(49f6e7a06ebc5aa8).(); |
| 123 | return; |
| 124 | default: |
| 125 | warningImagecxx . . $ VramTiledView#warningImage(49f6e7a06ebc5aa8).(); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | void VramTiledViewcxx . . $ VramTiledView#::warningImagecxx . . $ VramTiledView#warningImage(49f6e7a06ebc5aa8).() |
| 130 | { |
| 131 | QPaintercxx . . $ QPainter# qpcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(&imagecxx . . $ VramTiledView#image.); |
| 132 | qp.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(Qtcxx . . $ QColor#QColor(408ec4d5924bfb00).::blackcxx . . $ Qt/black.); |
| 133 | qp.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(16, 16, "Not a tile based screenmode! Please use the 'Bitmapped VRAM' viewer."cxx . . $ QString#QString(85c52e162fed56f9).); |
| 134 | } |
| 135 | |
| 136 | void VramTiledViewcxx . . $ VramTiledView#::decodeNameTablecxx . . $ VramTiledView#decodeNameTable(49f6e7a06ebc5aa8).() |
| 137 | { |
| 138 | const auto* regs = VDPDataStorecxx . . $ VDPDataStore#::instancecxx . . $ VDPDataStore#instance(6179f7cf4255f5b).().getRegsPointercxx . . $ VDPDataStore#getRegsPointer(7eb257f306f79f97).(); |
| 139 | |
| 140 | screenWidthcxx . . $ VramTiledView#screenWidth. = 32; |
| 141 | charWidthcxx . . $ VramTiledView#charWidth. = 8; |
| 142 | screenHeightcxx . . $ VramTiledView#screenHeight. = (forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows. != 0.0f) ? int(forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows. + 0.5) : (regs[9] & 128 ? 27 : 24); // Check LN bit of vdp reg #9 to determine screenheight |
| 143 | |
| 144 | switch (screenModecxx . . $ VramTiledView#screenMode.) { |
| 145 | case 0: |
| 146 | screenWidthcxx . . $ VramTiledView#screenWidth. = 40; |
| 147 | charWidthcxx . . $ VramTiledView#charWidth. = 6; |
| 148 | decodeNameTableRegularCharscxx . . $ VramTiledView#decodeNameTableRegularChars(49f6e7a06ebc5aa8).(); |
| 149 | break; |
| 150 | case 80: |
| 151 | screenWidthcxx . . $ VramTiledView#screenWidth. = 80; |
| 152 | charWidthcxx . . $ VramTiledView#charWidth. = 6; |
| 153 | decodeNameTableRegularCharscxx . . $ VramTiledView#decodeNameTableRegularChars(49f6e7a06ebc5aa8).(); |
| 154 | break; |
| 155 | case 4: |
| 156 | case 1: |
| 157 | case 2: |
| 158 | decodeNameTableRegularCharscxx . . $ VramTiledView#decodeNameTableRegularChars(49f6e7a06ebc5aa8).(); |
| 159 | break; |
| 160 | case 3: |
| 161 | decodeNameTableMultiColorcxx . . $ VramTiledView#decodeNameTableMultiColor(49f6e7a06ebc5aa8).(); |
| 162 | return; |
| 163 | default: |
| 164 | warningImagecxx . . $ VramTiledView#warningImage(49f6e7a06ebc5aa8).(); |
| 165 | } |
| 166 | |
| 167 | } |
| 168 | |
| 169 | void VramTiledViewcxx . . $ VramTiledView#::overLayNameTablecxx . . $ VramTiledView#overLayNameTable(49f6e7a06ebc5aa8).() |
| 170 | { |
| 171 | if (screenModecxx . . $ VramTiledView#screenMode. == 255) return; // No overlay if not tile based! |
| 172 | |
| 173 | // screenwidth, screenheight, charwidth are all calculated by decodeNameTable already... |
| 174 | |
| 175 | // Now draw the char numbers from the overlay over all the chars |
| 176 | QImagecxx . . $ QImage# overlayimagecxx . . $ QImage#QImage(7ced637d9e669cca).(":/overlay.png"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 177 | QPaintercxx . . $ QPainter# qpcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(&imagecxx . . $ VramTiledView#image.); |
| 178 | int pWidth = screenModecxx . . $ VramTiledView#screenMode. != 80 ? 2 : 1; |
| 179 | |
| 180 | for (int charY = 0; charY < screenHeightcxx . . $ VramTiledView#screenHeight.; ++charY) { |
| 181 | for (int charX = 0; charX < screenWidthcxx . . $ VramTiledView#screenWidth.; ++charX) { |
| 182 | int ch = vramBasecxx . . $ VramTiledView#vramBase.[nameTableAddresscxx . . $ VramTiledView#nameTableAddress. + charX + charY * screenWidthcxx . . $ VramTiledView#screenWidth.]; |
| 183 | int x = 6 * ((ch >> 4) & 15); |
| 184 | int y = (ch == highlightCharcxx . . $ VramTiledView#highlightChar. ? 8 : 0); // White letters or red variant if highlighted |
| 185 | qp.drawImagecxx . . $ QPainter#drawImage(24e2182690a926fc).(pWidth * charX * charWidthcxx . . $ VramTiledView#charWidth., 16 * charY, overlayimage, x, y, 5, 8); |
| 186 | x = 6 * (ch & 15); |
| 187 | if (screenModecxx . . $ VramTiledView#screenMode. != 80) { |
| 188 | qp.drawImagecxx . . $ QPainter#drawImage(24e2182690a926fc).(pWidth * charX * charWidthcxx . . $ VramTiledView#charWidth. + 6, charY * 16, overlayimage, x, y, 5, 8); // draw to the right |
| 189 | } else { |
| 190 | qp.drawImagecxx . . $ QPainter#drawImage(24e2182690a926fc).(pWidth * charX * charWidthcxx . . $ VramTiledView#charWidth., charY * 16 + 7, overlayimage, x, y, 5, 8); // draw below |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | void VramTiledViewcxx . . $ VramTiledView#::setPixel1x2cxx . . $ VramTiledView#setPixel1x2(f59d17f8b9f2d3e1).(int x, int y, QRgbcxx . . $ QRgb# c) |
| 197 | { |
| 198 | imagecxx . . $ VramTiledView#image..setPixelcxx . . $ QImage#setPixel(f59d17f8b9f2d3e1).(x, 2 * y + 0, c); |
| 199 | imagecxx . . $ VramTiledView#image..setPixelcxx . . $ QImage#setPixel(f59d17f8b9f2d3e1).(x, 2 * y + 1, c); |
| 200 | } |
| 201 | |
| 202 | void VramTiledViewcxx . . $ VramTiledView#::setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(int x, int y, QRgbcxx . . $ QRgb# c) |
| 203 | { |
| 204 | imagecxx . . $ VramTiledView#image..setPixelcxx . . $ QImage#setPixel(f59d17f8b9f2d3e1).(2 * x + 0, 2 * y + 0, c); |
| 205 | imagecxx . . $ VramTiledView#image..setPixelcxx . . $ QImage#setPixel(f59d17f8b9f2d3e1).(2 * x + 1, 2 * y + 0, c); |
| 206 | imagecxx . . $ VramTiledView#image..setPixelcxx . . $ QImage#setPixel(f59d17f8b9f2d3e1).(2 * x + 0, 2 * y + 1, c); |
| 207 | imagecxx . . $ VramTiledView#image..setPixelcxx . . $ QImage#setPixel(f59d17f8b9f2d3e1).(2 * x + 1, 2 * y + 1, c); |
| 208 | } |
| 209 | |
| 210 | |
| 211 | QRgbcxx . . $ QRgb# VramTiledViewcxx . . $ VramTiledView#::getColorcxx . . $ VramTiledView#getColor(46cc46841198e427).(int c) |
| 212 | { |
| 213 | // TODO do we need to look at the TP bit??? |
| 214 | return msxPalettecxx . . $ VramTiledView#msxPalette.[c ? c : (tpBitcxx . . $ VramTiledView#tpBit. ? 0 : borderColorcxx . . $ VramTiledView#borderColor.)]; |
| 215 | } |
| 216 | |
| 217 | const uint8_tcxx . . $ uint8_t# *VramTiledViewcxx . . $ VramTiledView#::getPaletteSourcecxx . . $ VramTiledView#getPaletteSource(7eb257f306f79f97).() const |
| 218 | { |
| 219 | return palettecxx . . $ VramTiledView#palette.; |
| 220 | } |
| 221 | |
| 222 | int VramTiledViewcxx . . $ VramTiledView#::getScreenModecxx . . $ VramTiledView#getScreenMode(455f465bc33b4cdf).() const |
| 223 | { |
| 224 | return screenModecxx . . $ VramTiledView#screenMode.; |
| 225 | } |
| 226 | |
| 227 | void VramTiledViewcxx . . $ VramTiledView#::setHighlightCharcxx . . $ VramTiledView#setHighlightChar(d4f767463ce0a6b3).(int value) |
| 228 | { |
| 229 | if (highlightCharcxx . . $ VramTiledView#highlightChar. == value) return; |
| 230 | |
| 231 | highlightCharcxx . . $ VramTiledView#highlightChar. = value; |
| 232 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 233 | |
| 234 | if (vramBasecxx . . $ VramTiledView#vramBase. == nullptr || value < 0 || value > 255) return; |
| 235 | |
| 236 | // Count how many 'value'-characters there are in the nametable |
| 237 | int count = 0; |
| 238 | for (int i = 0; i < screenHeightcxx . . $ VramTiledView#screenHeight. * screenWidthcxx . . $ VramTiledView#screenWidth.; ++i) { |
| 239 | if (vramBasecxx . . $ VramTiledView#vramBase.[nameTableAddresscxx . . $ VramTiledView#nameTableAddress. + i] == value) { |
| 240 | count++; |
| 241 | } |
| 242 | } |
| 243 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! highlightCountcxx . . $ VramTiledView#highlightCount(d5cb1b1d97598ec6).(value & 255, count); |
| 244 | } |
| 245 | |
| 246 | void VramTiledViewcxx . . $ VramTiledView#::setForcedScreenRowscxx . . $ VramTiledView#setForcedScreenRows(9364e6e7bff7660).(float value) |
| 247 | { |
| 248 | if (forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows. == value) return; |
| 249 | |
| 250 | forcedScreenRowscxx . . $ VramTiledView#forcedScreenRows. = value; |
| 251 | setZoomcxx . . $ VramTiledView#setZoom(9364e6e7bff7660).(zoomFactorcxx . . $ VramTiledView#zoomFactor.); // Redo fixed size of widget |
| 252 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 253 | } |
| 254 | |
| 255 | void VramTiledViewcxx . . $ VramTiledView#::setUseBlinkcxx . . $ VramTiledView#setUseBlink(b45ddcbc8423892c).(bool value) |
| 256 | { |
| 257 | if (useBlinkcxx . . $ VramTiledView#useBlink. == value) return; |
| 258 | useBlinkcxx . . $ VramTiledView#useBlink. = value; |
| 259 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 260 | } |
| 261 | |
| 262 | void VramTiledViewcxx . . $ VramTiledView#::setTpBitcxx . . $ VramTiledView#setTpBit(b45ddcbc8423892c).(bool value) |
| 263 | { |
| 264 | if (tpBitcxx . . $ VramTiledView#tpBit. == value) return; |
| 265 | tpBitcxx . . $ VramTiledView#tpBit. = value; |
| 266 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 267 | } |
| 268 | |
| 269 | void VramTiledViewcxx . . $ VramTiledView#::decodePatternTableRegularCharscxx . . $ VramTiledView#decodePatternTableRegularChars(49f6e7a06ebc5aa8).() |
| 270 | { |
| 271 | for (int charY = 0; charY < screenHeightcxx . . $ VramTiledView#screenHeight.; ++charY) { |
| 272 | for (int charX = 0; charX < screenWidthcxx . . $ VramTiledView#screenWidth.; ++charX) { |
| 273 | drawCharAtcxx . . $ VramTiledView#drawCharAt(b1146eedae1e1d0b).(charX + charY * screenWidthcxx . . $ VramTiledView#screenWidth., charX, charY); |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | void VramTiledViewcxx . . $ VramTiledView#::decodePatternTableMultiColorcxx . . $ VramTiledView#decodePatternTableMultiColor(49f6e7a06ebc5aa8).() |
| 279 | { |
| 280 | for (int charY = 0; charY < screenHeightcxx . . $ VramTiledView#screenHeight.; ++charY) { |
| 281 | for (int charX = 0; charX < screenWidthcxx . . $ VramTiledView#screenWidth.; ++charX) { |
| 282 | for (int charRow = 0; charRow < 8; ++charRow) { |
| 283 | int ch = vramBasecxx . . $ VramTiledView#vramBase.[patternTableAddresscxx . . $ VramTiledView#patternTableAddress. + 8 * (charX + charY * screenWidthcxx . . $ VramTiledView#screenWidth.) + charRow]; |
| 284 | QRgbcxx . . $ QRgb# col = getColorcxx . . $ VramTiledView#getColor(46cc46841198e427).(ch >> 4); |
| 285 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 0, 8 * charY + charRow, col); |
| 286 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 1, 8 * charY + charRow, col); |
| 287 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 2, 8 * charY + charRow, col); |
| 288 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 3, 8 * charY + charRow, col); |
| 289 | col = getColorcxx . . $ VramTiledView#getColor(46cc46841198e427).(ch & 15); |
| 290 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 4, 8 * charY + charRow, col); |
| 291 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 5, 8 * charY + charRow, col); |
| 292 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 6, 8 * charY + charRow, col); |
| 293 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 7, 8 * charY + charRow, col); |
| 294 | } |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | void VramTiledViewcxx . . $ VramTiledView#::decodeNameTableRegularCharscxx . . $ VramTiledView#decodeNameTableRegularChars(49f6e7a06ebc5aa8).() |
| 300 | { |
| 301 | for (int charY = 0; charY < screenHeightcxx . . $ VramTiledView#screenHeight.; ++charY) { |
| 302 | for (int charX = 0; charX < screenWidthcxx . . $ VramTiledView#screenWidth.; ++charX) { |
| 303 | int ch = vramBasecxx . . $ VramTiledView#vramBase.[nameTableAddresscxx . . $ VramTiledView#nameTableAddress. + charX + charY * screenWidthcxx . . $ VramTiledView#screenWidth.]; |
| 304 | // special case screen2/screen4a since they have 3*256 chars |
| 305 | if (charY > 7 && (screenModecxx . . $ VramTiledView#screenMode. == 2 || screenModecxx . . $ VramTiledView#screenMode. == 4)) { |
| 306 | ch += 256 * (charY >> 3); |
| 307 | } |
| 308 | drawCharAtcxx . . $ VramTiledView#drawCharAt(b1146eedae1e1d0b).(ch, charX, charY); |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | void VramTiledViewcxx . . $ VramTiledView#::decodeNameTableMultiColorcxx . . $ VramTiledView#decodeNameTableMultiColor(49f6e7a06ebc5aa8).() |
| 314 | { |
| 315 | for (int charY = 0; charY < screenHeightcxx . . $ VramTiledView#screenHeight.; ++charY) { |
| 316 | for (int charX = 0; charX < screenWidthcxx . . $ VramTiledView#screenWidth.; ++charX) { |
| 317 | uint8_tcxx . . $ uint8_t# ch = vramBasecxx . . $ VramTiledView#vramBase.[nameTableAddresscxx . . $ VramTiledView#nameTableAddress. + charX + charY * screenWidthcxx . . $ VramTiledView#screenWidth.]; |
| 318 | for (int charRow = 0; charRow < 8; ++charRow) { |
| 319 | uint8_tcxx . . $ uint8_t# patternByte = vramBasecxx . . $ VramTiledView#vramBase.[patternTableAddresscxx . . $ VramTiledView#patternTableAddress. + 8 * ch + 2 * (charY & 3) + (charRow >> 2)]; |
| 320 | QRgbcxx . . $ QRgb# col = getColorcxx . . $ VramTiledView#getColor(46cc46841198e427).(patternByte >> 4); |
| 321 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 0, 8 * charY + charRow, col); |
| 322 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 1, 8 * charY + charRow, col); |
| 323 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 2, 8 * charY + charRow, col); |
| 324 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 3, 8 * charY + charRow, col); |
| 325 | col = getColorcxx . . $ VramTiledView#getColor(46cc46841198e427).(patternByte & 15); |
| 326 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 4, 8 * charY + charRow, col); |
| 327 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 5, 8 * charY + charRow, col); |
| 328 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 6, 8 * charY + charRow, col); |
| 329 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(8 * charX + 7, 8 * charY + charRow, col); |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | uint8_tcxx . . $ uint8_t# VramTiledViewcxx . . $ VramTiledView#::getCharColorBytecxx . . $ VramTiledView#getCharColorByte(e12c616fd99d5ff1).(int character, int x, int y, int row) |
| 336 | { |
| 337 | const auto* regs = VDPDataStorecxx . . $ VDPDataStore#::instancecxx . . $ VDPDataStore#instance(6179f7cf4255f5b).().getRegsPointercxx . . $ VDPDataStore#getRegsPointer(7eb257f306f79f97).(); |
| 338 | uint8_tcxx . . $ uint8_t# colorByte = regs[7]; |
| 339 | switch (screenModecxx . . $ VramTiledView#screenMode.) { |
| 340 | case 0: |
| 341 | break; |
| 342 | case 80: |
| 343 | // If blink bit set then show alternate colors |
| 344 | if (useBlinkcxx . . $ VramTiledView#useBlink. && (tableToShowcxx . . $ VramTiledView#tableToShow. > 0) && |
| 345 | (vramBasecxx . . $ VramTiledView#vramBase.[colorTableAddresscxx . . $ VramTiledView#colorTableAddress. + (x >> 3) + 10 * y] & (1 << (7 - (7 & x))))) { |
| 346 | colorByte = regs[12]; |
| 347 | } |
| 348 | break; |
| 349 | case 2: |
| 350 | case 4: |
| 351 | colorByte = vramBasecxx . . $ VramTiledView#vramBase.[colorTableAddresscxx . . $ VramTiledView#colorTableAddress. + 8 * character + row]; |
| 352 | break; |
| 353 | case 1: |
| 354 | colorByte = vramBasecxx . . $ VramTiledView#vramBase.[colorTableAddresscxx . . $ VramTiledView#colorTableAddress. + (character >> 3)]; |
| 355 | break; |
| 356 | case 3: |
| 357 | //decodePatternTableMultiColor(); |
| 358 | colorByte = 0xf0; |
| 359 | } |
| 360 | return colorByte; |
| 361 | } |
| 362 | |
| 363 | void VramTiledViewcxx . . $ VramTiledView#::drawCharAtcxx . . $ VramTiledView#drawCharAt(b1146eedae1e1d0b).(int character, int x, int y) |
| 364 | { |
| 365 | for (int charRow = 0; charRow < 8; ++charRow) { |
| 366 | uint8_tcxx . . $ uint8_t# patternByte = vramBasecxx . . $ VramTiledView#vramBase.[patternTableAddresscxx . . $ VramTiledView#patternTableAddress. + 8 * character + charRow]; |
| 367 | for (int charCol = 0; charCol < charWidthcxx . . $ VramTiledView#charWidth.; ++charCol) { |
| 368 | uint8_tcxx . . $ uint8_t# mask = 1 << (7 - charCol); |
| 369 | uint8_tcxx . . $ uint8_t# colors = getCharColorBytecxx . . $ VramTiledView#getCharColorByte(e12c616fd99d5ff1).(character, x, y, charRow); |
| 370 | QRgbcxx . . $ QRgb# col = getColorcxx . . $ VramTiledView#getColor(46cc46841198e427).(patternByte & mask ? (colors >> 4) : (colors & 15)); |
| 371 | if (screenModecxx . . $ VramTiledView#screenMode. == 80 && tableToShowcxx . . $ VramTiledView#tableToShow. > 0) { |
| 372 | setPixel1x2cxx . . $ VramTiledView#setPixel1x2(f59d17f8b9f2d3e1).(x * charWidthcxx . . $ VramTiledView#charWidth. + charCol, 8 * y + charRow, col); |
| 373 | } else { |
| 374 | setPixel2x2cxx . . $ VramTiledView#setPixel2x2(f59d17f8b9f2d3e1).(x * charWidthcxx . . $ VramTiledView#charWidth. + charCol, 8 * y + charRow, col); |
| 375 | } |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | void VramTiledViewcxx . . $ VramTiledView#::drawCharAtImagecxx . . $ VramTiledView#drawCharAtImage(53669dd2d54c178f).(int character, int x, int y, QImagecxx . . $ QImage#& image) |
| 381 | { |
| 382 | QPaintercxx . . $ QPainter# qpcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(&image); |
| 383 | qp.setPencxx . . $ QPainter#setPen(de7d79e7246fa26d).(Qtcxx . . $ Qt/::NoPencxx . . $ Qt/NoPen.); |
| 384 | for (int charRow = 0; charRow < 8; ++charRow) { |
| 385 | uint8_tcxx . . $ uint8_t# patternByte = vramBasecxx . . $ VramTiledView#vramBase.[patternTableAddresscxx . . $ VramTiledView#patternTableAddress. + 8 * character + charRow]; |
| 386 | for (int charCol = 0; charCol < 8; ++charCol) { // Always draw the 8 bits even for screen 0 |
| 387 | uint8_tcxx . . $ uint8_t# mask = 1 << (7 - charCol); |
| 388 | uint8_tcxx . . $ uint8_t# colors = getCharColorBytecxx . . $ VramTiledView#getCharColorByte(e12c616fd99d5ff1).(character, x, y, charRow); |
| 389 | QRgbcxx . . $ QRgb# col = getColorcxx . . $ VramTiledView#getColor(46cc46841198e427).(patternByte & mask ? (colors >> 4) : (colors & 15)); |
| 390 | // local setPixel4x4 routine :-) |
| 391 | qp.setBrushcxx . . $ QPainter#setBrush(ffc9f5d0bda78261).(QColorcxx . . $ QBrush#QBrush(b50947b0752ea6ac).(col)); |
| 392 | qp.drawRectcxx . . $ QPainter#drawRect(748afa4755bc9595).(4 * charCol, 4 * charRow, 4, 4); |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | void VramTiledViewcxx . . $ VramTiledView#::setTabletoShowcxx . . $ VramTiledView#setTabletoShow(d4f767463ce0a6b3).(int value) |
| 398 | { |
| 399 | if (tableToShowcxx . . $ VramTiledView#tableToShow. == value) return; |
| 400 | tableToShowcxx . . $ VramTiledView#tableToShow. = value; |
| 401 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 402 | } |
| 403 | |
| 404 | void VramTiledViewcxx . . $ VramTiledView#::setDrawGridcxx . . $ VramTiledView#setDrawGrid(b45ddcbc8423892c).(bool value) |
| 405 | { |
| 406 | if (drawGridcxx . . $ VramTiledView#drawGrid. == value) return; |
| 407 | drawGridcxx . . $ VramTiledView#drawGrid. = value; |
| 408 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 409 | } |
| 410 | |
| 411 | unsigned VramTiledViewcxx . . $ VramTiledView#::getColorTableAddresscxx . . $ VramTiledView#getColorTableAddress(ddd8539a2fcdd4ce).() const |
| 412 | { |
| 413 | return colorTableAddresscxx . . $ VramTiledView#colorTableAddress.; |
| 414 | } |
| 415 | |
| 416 | unsigned VramTiledViewcxx . . $ VramTiledView#::getPatternTableAddresscxx . . $ VramTiledView#getPatternTableAddress(ddd8539a2fcdd4ce).() const |
| 417 | { |
| 418 | return patternTableAddresscxx . . $ VramTiledView#patternTableAddress.; |
| 419 | } |
| 420 | |
| 421 | unsigned VramTiledViewcxx . . $ VramTiledView#::getNameTableAddresscxx . . $ VramTiledView#getNameTableAddress(ddd8539a2fcdd4ce).() const |
| 422 | { |
| 423 | return nameTableAddresscxx . . $ VramTiledView#nameTableAddress.; |
| 424 | } |
| 425 | |
| 426 | void VramTiledViewcxx . . $ VramTiledView#::paintEventcxx . . $ VramTiledView#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent#* /*event*/) |
| 427 | { |
| 428 | QRectcxx . . $ QRect# srcRectcxx . . $ QRect#QRect(2261ffe5112eab06).(0, 0, 512, 2 * linescxx . . $ VramTiledView#lines.); |
| 429 | QRectcxx . . $ QRect# dstRectcxx . . $ QRect#QRect(2261ffe5112eab06).(0, 0, int(512 * zoomFactorcxx . . $ VramTiledView#zoomFactor.), int(2 * float(linescxx . . $ VramTiledView#lines.) * zoomFactorcxx . . $ VramTiledView#zoomFactor.)); |
| 430 | QPaintercxx . . $ QPainter# qpcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this); |
| 431 | //qp.drawImage(rect(), image, srcRect); |
| 432 | qp.drawPixmapcxx . . $ QPainter#drawPixmap(583800ea2588537e).(dstRect, pixImagecxx . . $ VramTiledView#pixImage., srcRect); |
| 433 | } |
| 434 | |
| 435 | void VramTiledViewcxx . . $ VramTiledView#::refreshcxx . . $ VramTiledView#refresh(49f6e7a06ebc5aa8).() |
| 436 | { |
| 437 | decodePalettecxx . . $ VramTiledView#decodePalette(49f6e7a06ebc5aa8).(); |
| 438 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 439 | } |
| 440 | |
| 441 | QStringcxx . . $ QString# VramTiledViewcxx . . $ VramTiledView#::byteAsPatterncxx . . $ VramTiledView#byteAsPattern(e76153c3c184c917).(uint8_tcxx . . $ uint8_t# byte) |
| 442 | { |
| 443 | QStringcxx . . $ QString# valcxx . . $ QString#QString(ced63f7c635d850d).; |
| 444 | for (int i = 7; i >= 0; --i) { |
| 445 | val.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(QCharcxx . . $ QChar#(byte & (1 << i) ? '1' : '.')); |
| 446 | } |
| 447 | val.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(QStringcxx . . $ QString#QString(85c52e162fed56f9).(" %1").argcxx . . $ QString#arg(bc823072288cbbb5).(hexValuecxx . . $ hexValue(f4fd9db251ca774b).(byte, 2))); |
| 448 | return valcxx . . $ QString#QString(28715ad661ad3cec).; |
| 449 | } |
| 450 | |
| 451 | QStringcxx . . $ QString# VramTiledViewcxx . . $ VramTiledView#::textInfocxx . . $ VramTiledView#textInfo(6694d7ed84229d90).(int x, int y, int character) |
| 452 | { |
| 453 | QStringcxx . . $ QString# infocxx . . $ QString#QString(85c52e162fed56f9).("Generator Data Color data\n"); |
| 454 | |
| 455 | // Now the initial color data to be displayed |
| 456 | const auto* regs = VDPDataStorecxx . . $ VDPDataStore#::instancecxx . . $ VDPDataStore#instance(6179f7cf4255f5b).().getRegsPointercxx . . $ VDPDataStore#getRegsPointer(7eb257f306f79f97).(); |
| 457 | QStringcxx . . $ QString# colordata = QStringcxx . . $ QString#QString(85c52e162fed56f9).("- VDP reg 7 is %1").argcxx . . $ QString#arg(bc823072288cbbb5).(hexValuecxx . . $ hexValue(f4fd9db251ca774b).(regs[7], 2)); |
| 458 | // If blink bit set then show alternate colors |
| 459 | if (screenModecxx . . $ VramTiledView#screenMode. == 80 && useBlinkcxx . . $ VramTiledView#useBlink. && (tableToShowcxx . . $ VramTiledView#tableToShow. > 0) && |
| 460 | (vramBasecxx . . $ VramTiledView#vramBase.[colorTableAddresscxx . . $ VramTiledView#colorTableAddress. + (x >> 3) + 10 * y] & (1 << (7 - (7 & x))))) |
| 461 | { |
| 462 | colordata =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("- VDP reg 12 is %1").argcxx . . $ QString#arg(bc823072288cbbb5).(hexValuecxx . . $ hexValue(f4fd9db251ca774b).(regs[12], 2)); |
| 463 | } else if (screenModecxx . . $ VramTiledView#screenMode. == 1) { |
| 464 | colordata =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("- %1: %2").argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).( |
| 465 | hexValuecxx . . $ hexValue(f4fd9db251ca774b).(colorTableAddresscxx . . $ VramTiledView#colorTableAddress. + (character >> 3), 4), |
| 466 | hexValuecxx . . $ hexValue(f4fd9db251ca774b).(vramBasecxx . . $ VramTiledView#vramBase.[colorTableAddresscxx . . $ VramTiledView#colorTableAddress.+(character >> 3)], 2)); |
| 467 | } else if (screenModecxx . . $ VramTiledView#screenMode. == 3) { |
| 468 | colordata =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("- not used"); |
| 469 | } |
| 470 | |
| 471 | // Now build the text |
| 472 | for (int charRow = 0; charRow < 8; ++charRow) { |
| 473 | int addr = patternTableAddresscxx . . $ VramTiledView#patternTableAddress. + 8 * character + charRow; |
| 474 | // Color data changes per line for screen 2 and 4 |
| 475 | if (screenModecxx . . $ VramTiledView#screenMode. == 2 || screenModecxx . . $ VramTiledView#screenMode. == 4) { |
| 476 | colordata =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" %1: %2").argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).( |
| 477 | hexValuecxx . . $ hexValue(f4fd9db251ca774b).(colorTableAddresscxx . . $ VramTiledView#colorTableAddress. + 8 * character + charRow, 4), |
| 478 | hexValuecxx . . $ hexValue(f4fd9db251ca774b).(vramBasecxx . . $ VramTiledView#vramBase.[colorTableAddresscxx . . $ VramTiledView#colorTableAddress. + 8 * character + charRow], 2)); |
| 479 | } |
| 480 | |
| 481 | info.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1: %2 %3\n").argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).( |
| 482 | hexValuecxx . . $ hexValue(f4fd9db251ca774b).(addr, 4), |
| 483 | byteAsPatterncxx . . $ VramTiledView#byteAsPattern(e76153c3c184c917).(vramBasecxx . . $ VramTiledView#vramBase.[addr]), |
| 484 | colordata)); |
| 485 | colordata.clearcxx . . $ QString#clear(49f6e7a06ebc5aa8).(); |
| 486 | } |
| 487 | return infocxx . . $ QString#QString(28715ad661ad3cec).; |
| 488 | } |
| 489 | |
| 490 | void VramTiledViewcxx . . $ VramTiledView#::mousePressEventcxx . . $ VramTiledView#mousePressEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent#* e) |
| 491 | { |
| 492 | if (auto i = infoFromMouseEventcxx . . $ VramTiledView#infoFromMouseEvent(fc9e3ed00c14e4ca).(e)) { |
| 493 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! imageClickedcxx . . $ VramTiledView#imageClicked(13c75376313d168e).(i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).xcxx . . $ VramTiledView#MouseEventInfo#x., i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).ycxx . . $ VramTiledView#MouseEventInfo#y., i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).charactercxx . . $ VramTiledView#MouseEventInfo#character., textInfocxx . . $ VramTiledView#textInfo(6694d7ed84229d90).(i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).xcxx . . $ VramTiledView#MouseEventInfo#x., i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).ycxx . . $ VramTiledView#MouseEventInfo#y., i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).charactercxx . . $ VramTiledView#MouseEventInfo#character.)); |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | void VramTiledViewcxx . . $ VramTiledView#::mouseMoveEventcxx . . $ VramTiledView#mouseMoveEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent#* e) |
| 498 | { |
| 499 | if (auto i = infoFromMouseEventcxx . . $ VramTiledView#infoFromMouseEvent(fc9e3ed00c14e4ca).(e)) { |
| 500 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! imageHoveredcxx . . $ VramTiledView#imageHovered(b1146eedae1e1d0b).(i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).xcxx . . $ VramTiledView#MouseEventInfo#x., i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).ycxx . . $ VramTiledView#MouseEventInfo#y., i->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).charactercxx . . $ VramTiledView#MouseEventInfo#character.); |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | stdcxx . . $ std/::optionalcxx . . $ std/optional#<VramTiledViewcxx . . $ VramTiledView#::MouseEventInfocxx . . $ VramTiledView#MouseEventInfo#> VramTiledViewcxx . . $ VramTiledView#::infoFromMouseEventcxx . . $ VramTiledView#infoFromMouseEvent(fc9e3ed00c14e4ca).(QMouseEventcxx . . $ QMouseEvent#* e) |
| 505 | { |
| 506 | if (!vramBasecxx . . $ VramTiledView#vramBase.) return {cxx . . $ std/optional#optional(ced63f7c635d850d).}; |
| 507 | |
| 508 | // I see negative y-coords sometimes, so for safety clip the coords |
| 509 | int x = stdcxx . . $ std/::clampcxx . . $ std/clamp(3dbe0c69cb86ae06).(int(float(e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).()) / zoomFactorcxx . . $ VramTiledView#zoomFactor.), 0, 511); |
| 510 | int y = stdcxx . . $ std/::clampcxx . . $ std/clamp(3dbe0c69cb86ae06).(int(float(e->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).()) / zoomFactorcxx . . $ VramTiledView#zoomFactor.) / 2, 0, 255); |
| 511 | if (x >= horiStepcxx . . $ VramTiledView#horiStep. * screenWidthcxx . . $ VramTiledView#screenWidth.) return {cxx . . $ std/optional#optional(ced63f7c635d850d).}; |
| 512 | if (y >= 8 * screenHeightcxx . . $ VramTiledView#screenHeight.) return {cxx . . $ std/optional#optional(ced63f7c635d850d).}; |
| 513 | |
| 514 | x = int(x / horiStepcxx . . $ VramTiledView#horiStep.); |
| 515 | y = int(y / 8); |
| 516 | int character = 0; |
| 517 | switch (tableToShowcxx . . $ VramTiledView#tableToShow.) { |
| 518 | case 0: |
| 519 | character = x + y * screenWidthcxx . . $ VramTiledView#screenWidth.; |
| 520 | if (!(screenModecxx . . $ VramTiledView#screenMode. == 2 || screenModecxx . . $ VramTiledView#screenMode. == 4)) { |
| 521 | character &= 255; |
| 522 | } |
| 523 | break; |
| 524 | case 1: |
| 525 | case 2: |
| 526 | character = vramBasecxx . . $ VramTiledView#vramBase.[nameTableAddresscxx . . $ VramTiledView#nameTableAddress. + x + y * screenWidthcxx . . $ VramTiledView#screenWidth.]; |
| 527 | if (screenModecxx . . $ VramTiledView#screenMode. == 2 || screenModecxx . . $ VramTiledView#screenMode. == 4) { |
| 528 | character += 256 * int(y / 8); |
| 529 | } |
| 530 | break; |
| 531 | } |
| 532 | return MouseEventInfocxx . . $ std/optional#optional(e3f0d6382bd52f24).{x, y, character}; |
| 533 | } |
| 534 | |
| 535 | void VramTiledViewcxx . . $ VramTiledView#::setBorderColorcxx . . $ VramTiledView#setBorderColor(d4f767463ce0a6b3).(int value) |
| 536 | { |
| 537 | borderColorcxx . . $ VramTiledView#borderColor. = stdcxx . . $ std/::clampcxx . . $ std/clamp(3dbe0c69cb86ae06).(value, 0, 15); |
| 538 | refreshcxx . . $ VramTiledView#refresh(49f6e7a06ebc5aa8).(); |
| 539 | } |
| 540 | |
| 541 | void VramTiledViewcxx . . $ VramTiledView#::setScreenModecxx . . $ VramTiledView#setScreenMode(d4f767463ce0a6b3).(int mode) |
| 542 | { |
| 543 | screenModecxx . . $ VramTiledView#screenMode. = mode; |
| 544 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 545 | } |
| 546 | |
| 547 | void VramTiledViewcxx . . $ VramTiledView#::setVramSourcecxx . . $ VramTiledView#setVramSource(28caea9380bfac8a).(const uint8_tcxx . . $ uint8_t#* adr) |
| 548 | { |
| 549 | vramBasecxx . . $ VramTiledView#vramBase. = adr; |
| 550 | refreshcxx . . $ VramTiledView#refresh(49f6e7a06ebc5aa8).(); |
| 551 | } |
| 552 | |
| 553 | void VramTiledViewcxx . . $ VramTiledView#::setNameTableAddresscxx . . $ VramTiledView#setNameTableAddress(d4f767463ce0a6b3).(int adr) |
| 554 | { |
| 555 | nameTableAddresscxx . . $ VramTiledView#nameTableAddress. = adr; |
| 556 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 557 | } |
| 558 | |
| 559 | void VramTiledViewcxx . . $ VramTiledView#::setPatternTableAddresscxx . . $ VramTiledView#setPatternTableAddress(d4f767463ce0a6b3).(int adr) |
| 560 | { |
| 561 | patternTableAddresscxx . . $ VramTiledView#patternTableAddress. = adr; |
| 562 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 563 | } |
| 564 | |
| 565 | void VramTiledViewcxx . . $ VramTiledView#::setColorTableAddresscxx . . $ VramTiledView#setColorTableAddress(d4f767463ce0a6b3).(int adr) |
| 566 | { |
| 567 | colorTableAddresscxx . . $ VramTiledView#colorTableAddress. = adr; |
| 568 | decodecxx . . $ VramTiledView#decode(49f6e7a06ebc5aa8).(); |
| 569 | } |
| 570 | |
| 571 | void VramTiledViewcxx . . $ VramTiledView#::setPaletteSourcecxx . . $ VramTiledView#setPaletteSource(28caea9380bfac8a).(const uint8_tcxx . . $ uint8_t#* adr) |
| 572 | { |
| 573 | if (palettecxx . . $ VramTiledView#palette. == adr) return; |
| 574 | palettecxx . . $ VramTiledView#palette. = adr; |
| 575 | refreshcxx . . $ VramTiledView#refresh(49f6e7a06ebc5aa8).(); |
| 576 | } |