| 1 |
/** |
| 2 |
* Furnace Tracker - multi-system chiptune tracker |
| 3 |
* Copyright (C) 2021-2025 tildearrow and contributors |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License along |
| 16 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 17 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include "gui.h" |
| 21 |
#include <imgui.h> |
| 22 |
|
| 23 |
void FurnaceGUI::drawRegView() { |
| 24 |
if (nextWindow==GUI_WINDOW_REGISTER_VIEW) { |
| 25 |
channelsOpen=true; |
| 26 |
ImGui::SetNextWindowFocus(); |
| 27 |
nextWindow=GUI_WINDOW_NOTHING; |
| 28 |
} |
| 29 |
if (!regViewOpen) return; |
| 30 |
if (ImGui::Begin("Register View",®ViewOpen,globalWinFlags,_("Register View"))) { |
| 31 |
for (int i=0; i<e->song.systemLen; i++) { |
| 32 |
ImGui::Text("%d. %s",i+1,getSystemName(e->song.system[i])); |
| 33 |
int size=0; |
| 34 |
int depth=8; |
| 35 |
unsigned char* regPool=e->getRegisterPool(i,size,depth); |
| 36 |
unsigned short* regPoolW=(unsigned short*)regPool; |
| 37 |
if (regPool==NULL) { |
| 38 |
ImGui::Text(_("- no register pool available")); |
| 39 |
} else { |
| 40 |
ImGui::PushFont(patFont); |
| 41 |
if (ImGui::BeginTable("Memory",17)) { |
| 42 |
ImGui::TableSetupColumn("addr",ImGuiTableColumnFlags_WidthFixed); |
| 43 |
|
| 44 |
ImGui::TableNextRow(); |
| 45 |
ImGui::TableNextColumn(); |
| 46 |
for (int i=0; i<16; i++) { |
| 47 |
ImGui::TableNextColumn(); |
| 48 |
ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX]," %X",i); |
| 49 |
} |
| 50 |
for (int i=0; i<=((size-1)>>4); i++) { |
| 51 |
ImGui::TableNextRow(); |
| 52 |
ImGui::TableNextColumn(); |
| 53 |
ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX],"%.2X",i*16); |
| 54 |
for (int j=0; j<16; j++) { |
| 55 |
ImGui::TableNextColumn(); |
| 56 |
if (i*16+j>=size) continue; |
| 57 |
if (depth == 8) { |
| 58 |
ImGui::Text("%.2x",regPool[i*16+j]); |
| 59 |
} else if (depth == 16) { |
| 60 |
ImGui::Text("%.4x",regPoolW[i*16+j]); |
| 61 |
} else { |
| 62 |
ImGui::Text("??"); |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
ImGui::EndTable(); |
| 67 |
} |
| 68 |
ImGui::PopFont(); |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_REGISTER_VIEW; |
| 73 |
ImGui::End(); |
| 74 |
} |