More correct visualisation of virtual and physical memory.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-06-05 16:40:06 +01:00
parent 4205bc852f
commit 087f0f7942
2 changed files with 30 additions and 10 deletions

View file

@ -30,6 +30,14 @@
namespace
{
struct MemoryTab
{
void * basePtr;
size_t baseAddr;
size_t length;
std::string name;
};
void HelpMarker(const char* desc)
{
ImGui::TextDisabled("(?)");
@ -804,18 +812,31 @@ namespace sa2
{
if (ImGui::BeginTabBar("Memory"))
{
if (ImGui::BeginTabItem("Main"))
std::vector<MemoryTab> banks;
banks.push_back({mem, 0, _6502_MEM_LEN, "Memory"});
banks.push_back({MemGetCxRomPeripheral(), _6502_IO_BEGIN, 4 * 1024, "Cx ROM"});
size_t i = 0;
void * bank;
while ((bank = MemGetBankPtr(i)))
{
void * mainBase = MemGetMainPtr(0);
myMainMemoryEditor.DrawContents(mainBase, _6502_MEM_LEN);
ImGui::EndTabItem();
const std::string name = "Bank " + std::to_string(i);
banks.push_back({bank, 0, _6502_MEM_LEN, name});
++i;
}
if (ImGui::BeginTabItem("AUX"))
myMemoryEditors.resize(banks.size());
for (i = 0; i < banks.size(); ++i)
{
void * auxBase = MemGetAuxPtr(0);
myAuxMemoryEditor.DrawContents(auxBase, _6502_MEM_LEN);
ImGui::EndTabItem();
if (ImGui::BeginTabItem(banks[i].name.c_str()))
{
myMemoryEditors[i].DrawContents(banks[i].basePtr, banks[i].length, banks[i].baseAddr);
ImGui::EndTabItem();
}
}
ImGui::EndTabBar();
}
}

View file

@ -38,8 +38,7 @@ namespace sa2
uint64_t myBaseDebuggerCycles;
std::unordered_map<DWORD, uint64_t> myAddressCycles;
MemoryEditor myMainMemoryEditor;
MemoryEditor myAuxMemoryEditor;
std::vector<MemoryEditor> myMemoryEditors;
std::vector<SoundInfo> myAudioInfo;