21#include "imgui_stdlib.h"
33using namespace std::literals;
35static constexpr int MidColsCount = 8;
36static constexpr auto HighlightColor = IM_COL32(255, 255, 255, 50);
37static constexpr auto HighlightSymbolColor = IM_COL32(148, 95, 35, 255);
41 , symbolManager(manager.getReactor().getSymbolManager())
42 , title(
std::move(debuggableName_))
44 debuggableNameSize = title.size();
58 parseSearchString(searchString);
66DebuggableEditor::Sizes DebuggableEditor::calcSizes(
unsigned memSize)
const
69 const auto& style = ImGui::GetStyle();
71 s.addrDigitsCount = 0;
72 for (
unsigned n = memSize - 1; n > 0; n >>= 4) {
76 s.lineHeight = ImGui::GetTextLineHeight();
78 s.hexCellWidth = truncf(s.glyphWidth * 2.5f);
79 s.spacingBetweenMidCols = truncf(s.hexCellWidth * 0.25f);
80 s.posHexStart = float(s.addrDigitsCount + 2) * s.glyphWidth;
81 auto posHexEnd = s.posHexStart + (s.hexCellWidth * float(columns));
82 s.posAsciiStart = s.posAsciiEnd = posHexEnd;
84 int numMacroColumns = (columns + MidColsCount - 1) / MidColsCount;
85 s.posAsciiStart = posHexEnd + s.glyphWidth + float(numMacroColumns) * s.spacingBetweenMidCols;
86 s.posAsciiEnd = s.posAsciiStart + float(columns) * s.glyphWidth;
88 s.windowWidth = s.posAsciiEnd + style.ScrollbarSize + style.WindowPadding.x * 2 + s.glyphWidth;
94 if (!
open || !motherBoard)
return;
97 if (!debuggable)
return;
101 unsigned memSize = debuggable->getSize();
102 columns = std::min(columns, narrow<int>(memSize));
103 auto s = calcSizes(memSize);
104 ImGui::SetNextWindowSize(ImVec2(s.windowWidth, s.windowWidth * 0.60f), ImGuiCond_FirstUseEver);
106 im::Window(title.c_str(), &
open, ImGuiWindowFlags_NoScrollbar, [&]{
107 if (ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows) &&
108 ImGui::IsMouseReleased(ImGuiMouseButton_Right)) {
109 ImGui::OpenPopup(
"context");
111 drawContents(s, *debuggable, memSize);
115[[nodiscard]]
static unsigned DataTypeGetSize(ImGuiDataType dataType)
117 std::array<unsigned, 8> sizes = { 1, 1, 2, 2, 4, 4, 8, 8 };
118 assert(dataType >= 0 && dataType < 8);
119 return sizes[dataType];
122[[nodiscard]]
static std::optional<int> parseHexDigit(
char c)
124 if (
'0' <= c && c <=
'9')
return c -
'0';
125 if (
'a' <= c && c <=
'f')
return c -
'a' + 10;
126 if (
'A' <= c && c <=
'F')
return c -
'A' + 10;
130[[nodiscard]]
static std::optional<uint8_t> parseDataValue(std::string_view str)
132 if (str.size() == 1) {
133 return parseHexDigit(str[0]);
134 }
else if (str.size() == 2) {
135 if (
auto digit0 = parseHexDigit(str[0])) {
136 if (
auto digit1 = parseHexDigit(str[1])) {
137 return 16 * *digit0 + *digit1;
152 if (str.empty())
return r;
162 r.
addr = TclObject(str).eval(interp).getInt(interp);
163 }
catch (CommandException& e) {
169[[nodiscard]]
static std::string formatData(uint8_t val)
171 return strCat(hex_string<2, HexCase::upper>(val));
174[[nodiscard]]
static char formatAsciiData(uint8_t val)
176 return (val < 32 || val >= 128) ?
'.' : char(val);
179[[nodiscard]] std::string DebuggableEditor::formatAddr(
const Sizes& s,
unsigned addr)
const
181 return strCat(hex_string<HexCase::upper>(
Digits{size_t(s.addrDigitsCount)}, addr));
183void DebuggableEditor::setStrings(
const Sizes& s, Debuggable& debuggable)
185 addrStr =
strCat(
"0x", formatAddr(s, currentAddr));
186 auto b = debuggable.read(currentAddr);
187 if (dataEditingActive == HEX ) dataInput = formatData(b);
188 if (dataEditingActive == ASCII) dataInput = std::string(1, formatAsciiData(b));
190bool DebuggableEditor::setAddr(
const Sizes& s, Debuggable& debuggable,
unsigned memSize,
unsigned addr)
192 addr = std::min(addr, memSize - 1);
193 if (currentAddr == addr)
return false;
195 setStrings(s, debuggable);
198void DebuggableEditor::scrollAddr(
const Sizes& s, Debuggable& debuggable,
unsigned memSize,
unsigned addr,
bool forceScroll)
200 if (setAddr(s, debuggable, memSize, addr) || forceScroll) {
202 int row = narrow<int>(currentAddr) / columns;
203 ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y +
float(row) * ImGui::GetTextLineHeight());
208void DebuggableEditor::drawContents(
const Sizes& s, Debuggable& debuggable,
unsigned memSize)
210 const auto& style = ImGui::GetStyle();
213 scrollAddr(s, debuggable, memSize, currentAddr,
true);
216 setAddr(s, debuggable, memSize, currentAddr);
219 float footerHeight = 0.0f;
221 footerHeight += style.ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
224 footerHeight += style.ItemSpacing.y + 2 * ImGui::GetFrameHeightWithSpacing();
226 if (showDataPreview) {
227 footerHeight += style.ItemSpacing.y + ImGui::GetFrameHeightWithSpacing() + 3 * ImGui::GetTextLineHeightWithSpacing();
229 if (showSymbolInfo) {
230 footerHeight += style.ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
234 int cFlags = ImGuiWindowFlags_NoMove;
239 cFlags |= ImGuiWindowFlags_HorizontalScrollbar;
240 ImGui::BeginChild(
"##scrolling", ImVec2(0, -footerHeight), ImGuiChildFlags_None, cFlags);
241 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
242 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
244 std::optional<unsigned> nextAddr;
246 if (addrMode == CURSOR) {
247 const auto& shortcuts = manager.getShortcuts();
248 if ((
int(currentAddr) >= columns) &&
249 shortcuts.checkShortcut({.keyChord = ImGuiKey_UpArrow, .repeat = true})) {
250 nextAddr = currentAddr - columns;
252 if ((
int(currentAddr) <
int(memSize - columns)) &&
253 shortcuts.checkShortcut({.keyChord = ImGuiKey_DownArrow, .repeat = true})) {
254 nextAddr = currentAddr + columns;
256 if ((
int(currentAddr) > 0) &&
257 shortcuts.checkShortcut({.keyChord = ImGuiKey_LeftArrow, .repeat = true})) {
258 nextAddr = currentAddr - 1;
260 if ((
int(currentAddr) <
int(memSize - 1)) &&
261 shortcuts.checkShortcut({.keyChord = ImGuiKey_RightArrow, .repeat = true})) {
262 nextAddr = currentAddr + 1;
267 auto* drawList = ImGui::GetWindowDrawList();
268 ImVec2 windowPos = ImGui::GetWindowPos();
270 drawList->AddLine(ImVec2(windowPos.x + s.posAsciiStart - s.glyphWidth, windowPos.y),
271 ImVec2(windowPos.x + s.posAsciiStart - s.glyphWidth, windowPos.y + 9999),
272 ImGui::GetColorU32(ImGuiCol_Border));
275 auto handleInput = [&](
unsigned addr,
int width,
auto formatData,
auto parseData,
int extraFlags = 0) {
277 if (dataEditingTakeFocus) {
278 ImGui::SetKeyboardFocusHere();
279 setStrings(s, debuggable);
283 static int Callback(ImGuiInputTextCallbackData* data) {
284 auto* userData =
static_cast<UserData*
>(data->UserData);
285 if (!data->HasSelection()) {
286 userData->cursorPos = data->CursorPos;
288 if (data->SelectionStart == 0 && data->SelectionEnd == data->BufTextLen) {
291 data->DeleteChars(0, data->BufTextLen);
292 userData->format(data);
295 data->SelectionStart = 0;
300 std::function<void(ImGuiInputTextCallbackData* data)>
format;
304 userData.format = formatData;
305 ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue
306 | ImGuiInputTextFlags_AutoSelectAll
307 | ImGuiInputTextFlags_NoHorizontalScroll
308 | ImGuiInputTextFlags_CallbackAlways
309 | ImGuiInputTextFlags_AlwaysOverwrite
311 ImGui::SetNextItemWidth(s.glyphWidth *
float(width));
312 bool dataWrite =
false;
314 if (ImGui::InputText(
"##data", &dataInput, flags, UserData::Callback, &userData)) {
316 }
else if (!ImGui::IsItemActive()) {
317 setStrings(s, debuggable);
320 dataEditingTakeFocus =
false;
321 dataWrite |= userData.cursorPos >= width;
322 if (nextAddr) dataWrite =
false;
324 if (
auto value = parseData(dataInput)) {
325 debuggable.write(addr, *value);
327 nextAddr = currentAddr + 1;
332 const auto totalLineCount = int((memSize + columns - 1) / columns);
334 auto addr = unsigned(line) * columns;
335 ImGui::StrCat(formatAddr(s, addr),
':');
337 auto previewDataTypeSize = DataTypeGetSize(previewDataType);
338 auto inside = [](unsigned a, unsigned start, unsigned size) {
339 return (start <= a) && (a < (start + size));
341 auto highLightDataPreview = [&](
unsigned a) {
342 return inside(a, currentAddr, previewDataTypeSize);
344 auto highLightSearch = [&](
unsigned a) {
345 if (!searchPattern)
return false;
346 auto len = narrow<unsigned>(searchPattern->size());
347 if (searchHighlight ==
static_cast<int>(SearchHighlight::SINGLE)) {
349 return inside(a, *searchResult, len);
351 }
else if (searchHighlight ==
static_cast<int>(SearchHighlight::ALL)) {
352 int start = std::max(0,
int(a - len + 1));
353 for (
unsigned i = start; i <= a; ++i) {
354 if (
match(debuggable, memSize, i))
return true;
359 auto highLight = [&](
unsigned a) {
360 return highLightDataPreview(a) || highLightSearch(a);
364 for (
int n = 0; n < columns && addr < memSize; ++n, ++addr) {
365 int macroColumn = n / MidColsCount;
366 float bytePosX = s.posHexStart + float(n) * s.hexCellWidth
367 + float(macroColumn) * s.spacingBetweenMidCols;
368 ImGui::SameLine(bytePosX);
371 if (highLight(addr)) {
372 ImVec2 pos = ImGui::GetCursorScreenPos();
373 float highlightWidth = s.glyphWidth * 2;
374 if (highLight(addr + 1)) {
375 highlightWidth = s.hexCellWidth;
376 if (n > 0 && (n + 1) < columns && ((n + 1) % MidColsCount) == 0) {
377 highlightWidth += s.spacingBetweenMidCols;
380 drawList->AddRectFilled(pos, ImVec2(pos.x + highlightWidth, pos.y + s.lineHeight), HighlightColor);
384 if (showSymbolInfo) {
385 auto symbol = symbolManager.
lookupValue(narrow_cast<uint16_t>(addr));
386 if (!symbol.empty()) {
387 float highlightWidth = s.glyphWidth * 2;
388 ImVec2 pos = ImGui::GetCursorScreenPos();
389 drawList->AddRectFilled(pos, ImVec2(pos.x + highlightWidth, pos.y + s.lineHeight), HighlightSymbolColor);
393 if (currentAddr == addr && (dataEditingActive == HEX)) {
395 [&](ImGuiInputTextCallbackData* data) {
396 auto valStr = formatData(debuggable.read(addr));
397 data->InsertChars(0, valStr.data(), valStr.data() + valStr.size());
398 data->SelectionEnd = 2;
400 [&](std::string_view data) {
401 return parseDataValue(data);
403 ImGuiInputTextFlags_CharsHexadecimal);
405 uint8_t b = debuggable.read(addr);
409 if (ImGui::IsItemHovered() && ImGui::IsMouseClicked(0)) {
410 dataEditingActive = HEX;
411 dataEditingTakeFocus =
true;
419 ImGui::SameLine(s.posAsciiStart);
420 gl::vec2 pos = ImGui::GetCursorPos();
421 gl::vec2 scrnPos = ImGui::GetCursorScreenPos();
422 addr = unsigned(line) * columns;
427 if (ImGui::InvisibleButton(
"ascii", ImVec2(s.posAsciiEnd - s.posAsciiStart, s.lineHeight))) {
428 dataEditingActive = ASCII;
429 dataEditingTakeFocus = true;
430 nextAddr = addr + unsigned((ImGui::GetIO().MousePos.x - scrnPos.x) / s.glyphWidth);
434 for (
int n = 0; n < columns && addr < memSize; ++n, ++addr) {
435 if (highLight(addr)) {
436 auto start = scrnPos +
gl::vec2(
float(n) * s.glyphWidth, 0.0f);
437 drawList->AddRectFilled(start, start +
gl::vec2(s.glyphWidth, s.lineHeight), ImGui::GetColorU32(HighlightColor));
440 ImGui::SetCursorPos(pos);
441 if (currentAddr == addr && (dataEditingActive == ASCII)) {
443 [&](ImGuiInputTextCallbackData* data) {
444 char valChar = formatAsciiData(debuggable.read(addr));
445 data->InsertChars(0, &valChar, &valChar + 1);
446 data->SelectionEnd = 1;
448 [&](std::string_view data) -> std::optional<uint8_t> {
449 if (data.empty())
return {};
451 if (b < 32 || b >= 128)
return {};
455 uint8_t c = debuggable.read(addr);
456 char display = formatAsciiData(c);
461 pos.x += s.glyphWidth;
465 ImGui::PopStyleVar(2);
469 setAddr(s, debuggable, memSize, *nextAddr);
470 dataEditingTakeFocus =
true;
475 bool forceScroll = ImGui::IsWindowAppearing();
478 ImGui::AlignTextToFramePadding();
481 ImGui::SetNextItemWidth(2.0f * style.FramePadding.x +
ImGui::CalcTextSize(
"Expression").x + ImGui::GetFrameHeight());
482 if (ImGui::Combo(
"##mode", &addrMode,
"Cursor\0Expression\0Link BC\0Link DE\0Link HL\0")) {
483 dataEditingTakeFocus =
true;
486 static constexpr std::array linkExpr = {
487 "[reg bc]",
"[reg de]",
"[reg hl]"
489 addrExpr = linkExpr[addrMode - 2];
490 addrMode = EXPRESSION;
495 std::string* as = addrMode == CURSOR ? &addrStr : &addrExpr;
496 auto r = parseAddressExpr(*as, symbolManager, manager.getInterpreter());
498 if (addrMode == EXPRESSION && r.
error.empty()) {
499 scrollAddr(s, debuggable, memSize, r.addr, forceScroll);
501 if (manager.getShortcuts().checkShortcut(Shortcuts::ID::HEX_GOTO_ADDR)) {
502 ImGui::SetKeyboardFocusHere();
504 ImGui::SetNextItemWidth(15.0f * ImGui::GetFontSize());
505 if (ImGui::InputText(
"##addr", as, ImGuiInputTextFlags_EnterReturnsTrue)) {
506 auto r2 = parseAddressExpr(addrStr, symbolManager, manager.getInterpreter());
507 if (r2.error.empty()) {
508 scrollAddr(s, debuggable, memSize, r2.addr, forceScroll);
509 dataEditingTakeFocus =
true;
518 HelpMarker(
"Address-mode:\n"
519 " Cursor: view the cursor position\n"
520 " Expression: continuously re-evaluate an expression and view that address\n"
522 "Addresses can be entered as:\n"
523 " Decimal or hexadecimal values (e.g. 0x1234)\n"
524 " A calculation like 0x1234 + 7*22\n"
525 " The name of a label (e.g. CHPUT)\n"
526 " A Tcl expression (e.g. [reg hl] to follow the content of register HL)\n"
528 "Right-click to configure this view.");
533 drawSearch(s, debuggable, memSize);
535 if (showDataPreview) {
537 drawPreviewLine(s, debuggable, memSize);
539 if (showSymbolInfo) {
541 ImGui::AlignTextToFramePadding();
542 auto symbol = symbolManager.
lookupValue(narrow_cast<uint16_t>(currentAddr));
543 if (!symbol.empty()) {
544 ImGui::Text(
"Current symbol: %s", symbol[0]->name.c_str());
551 ImGui::SetNextItemWidth(7.5f * s.glyphWidth + 2.0f * style.FramePadding.x);
552 if (ImGui::InputInt(
"Columns", &columns, 1, 0)) {
553 columns = std::clamp(columns, 1, MAX_COLUMNS);
555 ImGui::Checkbox(
"Show Address bar", &showAddress);
556 ImGui::Checkbox(
"Show Search pane", &showSearch);
557 ImGui::Checkbox(
"Show Data Preview", &showDataPreview);
558 ImGui::Checkbox(
"Show Ascii", &showAscii);
559 ImGui::Checkbox(
"Show Symbol info", &showSymbolInfo);
560 ImGui::Checkbox(
"Grey out zeroes", &greyOutZeroes);
567[[nodiscard]]
static const char* DataTypeGetDesc(ImGuiDataType dataType)
569 std::array<const char*, 8> desc = {
570 "Int8",
"Uint8",
"Int16",
"Uint16",
"Int32",
"Uint32",
"Int64",
"Uint64"
572 assert(dataType >= 0 && dataType < 8);
573 return desc[dataType];
577[[nodiscard]]
static T read(std::span<const uint8_t> buf)
579 assert(buf.size() >=
sizeof(T));
581 memcpy(&
t, buf.data(),
sizeof(T));
585static void formatDec(std::span<const uint8_t> buf, ImGuiDataType dataType)
588 case ImGuiDataType_S8:
591 case ImGuiDataType_U8:
594 case ImGuiDataType_S16:
597 case ImGuiDataType_U16:
600 case ImGuiDataType_S32:
603 case ImGuiDataType_U32:
606 case ImGuiDataType_S64:
609 case ImGuiDataType_U64:
617static void formatHex(std::span<const uint8_t> buf, ImGuiDataType data_type)
620 case ImGuiDataType_S8:
621 case ImGuiDataType_U8:
624 case ImGuiDataType_S16:
625 case ImGuiDataType_U16:
628 case ImGuiDataType_S32:
629 case ImGuiDataType_U32:
632 case ImGuiDataType_S64:
633 case ImGuiDataType_U64:
641static void formatBin(std::span<const uint8_t> buf)
643 for (
int i =
int(buf.size()) - 1; i >= 0; --i) {
645 if (i != 0) ImGui::SameLine();
649void DebuggableEditor::parseSearchString(std::string_view str)
651 searchPattern.reset();
652 searchResult.reset();
653 std::vector<uint8_t> result;
655 if (searchType ==
static_cast<int>(SearchType::ASCII)) {
656 const auto*
begin = std::bit_cast<const uint8_t*>(str.data());
657 const auto*
end =
begin + str.size();
660 assert(searchType ==
static_cast<int>(SearchType::HEX));
661 std::optional<int> partial;
663 if (c ==
' ')
continue;
664 auto digit = parseHexDigit(c);
667 result.push_back(narrow<uint8_t>(16 * *partial + *digit));
676 searchPattern = std::move(result);
679void DebuggableEditor::drawSearch(
const Sizes& s, Debuggable& debuggable,
unsigned memSize)
681 const auto& style = ImGui::GetStyle();
683 bool doSearch =
false;
685 ImGui::SetNextItemWidth(-(buttonSize + style.WindowPadding.x));
687 auto callback = [](ImGuiInputTextCallbackData* data) {
688 if (data->EventFlag == ImGuiInputTextFlags_CallbackEdit) {
689 auto& self = *
static_cast<DebuggableEditor*
>(data->UserData);
690 self.parseSearchString(std::string_view(data->Buf, data->BufTextLen));
694 ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue
695 | ImGuiInputTextFlags_CallbackEdit;
696 if (ImGui::InputText(
"##search_string", &searchString, flags, callback,
this)) {
702 doSearch |= ImGui::Button(
"Search");
704 if (!searchPattern) {
705 simpleToolTip(
"Must be an even number of hex digits, optionally separated by spaces");
707 if (searchPattern && doSearch) {
708 search(s, debuggable, memSize);
711 auto arrowSize = ImGui::GetFrameHeight();
712 auto extra = arrowSize + 2.0f * style.FramePadding.x;
713 ImGui::AlignTextToFramePadding();
717 if (ImGui::Combo(
"##search_type", &searchType,
"Hex\0Ascii\0\0")) {
718 parseSearchString(searchString);
721 ImGui::SameLine(0.0f, 2 * ImGui::GetFontSize());
725 ImGui::Combo(
"##search_direction", &searchDirection,
"Forwards\0Backwards\0\0");
727 ImGui::SameLine(0.0f, 2 * ImGui::GetFontSize());
731 ImGui::Combo(
"##search_highlight", &searchHighlight,
"None\0Single\0All\0\0");
734bool DebuggableEditor::match(Debuggable& debuggable,
unsigned memSize,
unsigned addr)
736 assert(searchPattern);
737 if ((addr + searchPattern->size()) > memSize)
return false;
738 for (
auto [i, c] :
enumerate(*searchPattern)) {
739 if (debuggable.read(narrow<unsigned>(addr + i)) != c)
return false;
744void DebuggableEditor::search(
const Sizes& s, Debuggable& debuggable,
unsigned memSize)
746 std::optional<unsigned> found;
747 auto test = [&](
unsigned addr) {
748 if (
match(debuggable, memSize, addr)) {
754 if (searchDirection ==
static_cast<int>(SearchDirection::FWD)) {
755 for (
unsigned addr = currentAddr + 1; addr < memSize; ++addr) {
756 if (
test(addr))
break;
759 for (
unsigned addr = 0; addr <= currentAddr; ++addr) {
760 if (
test(addr))
break;
764 for (
int addr = currentAddr - 1; addr > 0; --addr) {
765 if (
test(
unsigned(addr)))
break;
768 for (
int addr = memSize - 1; addr >= int(currentAddr); --addr) {
769 if (
test(
unsigned(addr)))
break;
774 searchResult = *found;
775 scrollAddr(s, debuggable, memSize, *found,
false);
776 dataEditingTakeFocus =
true;
779 searchResult.reset();
780 ImGui::OpenPopup(
"NotFound");
784void DebuggableEditor::drawPreviewLine(
const Sizes& s, Debuggable& debuggable,
unsigned memSize)
786 const auto& style = ImGui::GetStyle();
787 ImGui::AlignTextToFramePadding();
790 ImGui::SetNextItemWidth((s.glyphWidth * 10.0f) + style.FramePadding.x * 2.0f + style.ItemInnerSpacing.x);
791 if (ImGui::BeginCombo(
"##combo_type", DataTypeGetDesc(previewDataType), ImGuiComboFlags_HeightLargest)) {
792 for (ImGuiDataType n = 0; n < 8; ++n) {
793 if (ImGui::Selectable(DataTypeGetDesc(n), previewDataType == n)) {
800 ImGui::SetNextItemWidth((s.glyphWidth * 6.0f) + style.FramePadding.x * 2.0f + style.ItemInnerSpacing.x);
801 ImGui::Combo(
"##combo_endianess", &previewEndianess,
"LE\0BE\0\0");
803 std::array<uint8_t, 8> dataBuf = {};
804 auto elemSize = DataTypeGetSize(previewDataType);
805 for (
auto i :
xrange(elemSize)) {
806 auto addr = currentAddr + i;
807 dataBuf[i] = (addr < memSize) ? debuggable.read(addr) : 0;
810 static constexpr bool nativeIsLittle = std::endian::native == std::endian::little;
811 if (
bool previewIsLittle = previewEndianess == LE;
812 nativeIsLittle != previewIsLittle) {
813 std::reverse(dataBuf.begin(), dataBuf.begin() + elemSize);
818 formatDec(dataBuf, previewDataType);
822 formatHex(dataBuf, previewDataType);
826 formatBin(
subspan(dataBuf, 0, elemSize));
void test(const IterableBitSet< N > &s, std::initializer_list< size_t > list)
void paint(MSXMotherBoard *motherBoard) override
DebuggableEditor(ImGuiManager &manager_, std::string debuggableName, size_t index)
std::string_view getDebuggableName() const
void loadLine(std::string_view name, zstring_view value) override
void save(ImGuiTextBuffer &buf) override
Debuggable * findDebuggable(std::string_view name)
std::span< Symbol const *const > lookupValue(uint16_t value)
std::optional< uint16_t > parseSymbolOrValue(std::string_view s) const
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....
auto CalcTextSize(std::string_view str)
void TextUnformatted(const std::string &str)
void Window(const char *name, bool *p_open, ImGuiWindowFlags flags, std::invocable<> auto next)
void ID(const char *str_id, std::invocable<> auto next)
void StyleColor(bool active, Args &&...args)
void Child(const char *str_id, const ImVec2 &size, ImGuiChildFlags child_flags, ImGuiWindowFlags window_flags, std::invocable<> auto next)
void Disabled(bool b, std::invocable<> auto next)
void Font(ImFont *font, std::invocable<> auto next)
void ListClipper(size_t count, int forceIndex, float lineHeight, std::invocable< int > auto next)
void Popup(const char *str_id, ImGuiWindowFlags flags, std::invocable<> auto next)
void format(SectorAccessibleDisk &disk, MSXBootSectorType bootType)
Format the given disk (= a single partition).
This file implemented 3 utility functions:
bool loadOnePersistent(std::string_view name, zstring_view value, C &c, const std::tuple< Elements... > &tup)
void simpleToolTip(std::string_view desc)
void savePersistent(ImGuiTextBuffer &buf, C &c, const std::tuple< Elements... > &tup)
std::optional< bool > match(const BooleanInput &binding, const Event &event, function_ref< int(JoystickId)> getJoyDeadZone)
ImU32 getColor(imColor col)
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)
void strAppend(std::string &result, Ts &&...ts)
constexpr auto xrange(T e)
constexpr auto begin(const zstring_view &x)
constexpr auto end(const zstring_view &x)