From c20e1a92ab0aecf81ec37051593caff0c72a2028 Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Wed, 13 Nov 2024 22:52:56 +0100 Subject: [PATCH] wip of property rework --- src/cadmium.cpp | 23 +++++++++++++++++------ src/debugger.cpp | 6 +++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/cadmium.cpp b/src/cadmium.cpp index 5e65292..b30c275 100644 --- a/src/cadmium.cpp +++ b/src/cadmium.cpp @@ -30,9 +30,7 @@ #include #include "configuration.hpp" -extern "C" { #include -}; #include #include @@ -504,7 +502,7 @@ class Cadmium : public emu::EmuHostEx using ExecMode = emu::IChip8Emulator::ExecMode; using CpuState = emu::IChip8Emulator::CpuState; enum MemFlags { eNONE = 0, eBREAKPOINT = 1, eWATCHPOINT = 2 }; - enum MainView { eVIDEO, eDEBUGGER, eEDITOR, eTRACELOG, eSETTINGS, eROM_SELECTOR, eROM_EXPORT }; + enum MainView { eVIDEO, eDEBUGGER, eEDITOR, eTRACELOG, eSETTINGS, eROM_SELECTOR, eROM_EXPORT, eLIBRARY }; enum EmulationMode { eCOSMAC_VIP_CHIP8, eGENERIC_CHIP8 }; enum FileBrowserMode { eLOAD, eSAVE, eWEB_SAVE }; static constexpr int MIN_SCREEN_WIDTH = 512; @@ -1648,6 +1646,11 @@ void main() _librarian.fetchDir(_currentDirectory); #endif } +#ifndef PLATFORM_WEB + if (iconButton(ICON_NOTEBOOK, _mainView == eLIBRARY)) { + _mainView = eLIBRARY; + } +#endif SetNextWidth(130); SetStyle(TEXTBOX, BORDER_WIDTH, 1); TextBox(_romName, 4095); @@ -1704,7 +1707,7 @@ void main() } } SetTooltip("RESTART"); - int buttonsRight = 7; + int buttonsRight = 8; ++buttonsRight; int avail = 202; #ifdef RESIZABLE_GUI @@ -1742,12 +1745,10 @@ void main() static Vector2 versionSize = MeasureTextEx(GuiGetFont(), "v" CADMIUM_VERSION, 8, 0); DrawTextEx(GuiGetFont(), "v" CADMIUM_VERSION, {spacePos.x + (spaceWidth - versionSize.x) / 2, spacePos.y + 6}, 8, 0, WHITE); -#ifndef RESIZABLE_GUI Space(10); if (iconButton(ICON_HIDPI, _scaleBy2)) _scaleBy2 = !_scaleBy2; SetTooltip("TOGGLE ZOOM "); -#endif } EndColumns(); @@ -1875,6 +1876,16 @@ void main() _mainView = _lastView; break; } + case eLIBRARY: { + _lastView = _mainView; + SetSpacing(0); + Begin(); + BeginPanel("Library / Research"); + Space(_screenHeight - GetCurrentPos().y - 20 - 1); + EndPanel(); + End(); + break; + } } if (_colorSelectOpen) { diff --git a/src/debugger.cpp b/src/debugger.cpp index 83adcac..b98bab7 100644 --- a/src/debugger.cpp +++ b/src/debugger.cpp @@ -207,9 +207,9 @@ void Debugger::render(Font& font, std::function drawScreen) auto area = GetContentAvailable(); pos.x += 0; Space(area.height); - auto stack = _core->focussedExecutionUnit()->stack(); - for (int i = 0; i < _core->focussedExecutionUnit()->stackSize(); ++i) { - auto element = formatStackElement(stack, i, _stackBackup[_activeInstructionsTab].data()); + auto stack = _core->executionUnit(_visibleExecUnit)->stack(); + for (int i = 0; i < _core->executionUnit(_visibleExecUnit)->stackSize(); ++i) { + auto element = formatStackElement(stack, i, _stackBackup[_visibleExecUnit].data()); DrawTextEx(font, TextFormat("%X:%s", i & 0xF, element.first), {pos.x, pos.y + i * lineSpacing}, 8, 0, element.second ? yellowCol : lightgrayCol); } }