add memory_editor.h for hex editor and rom diff checker

This commit is contained in:
scawful
2024-07-19 16:34:37 -04:00
parent afbf0d888b
commit d73a970e57
3 changed files with 94 additions and 39 deletions

View File

@@ -618,44 +618,7 @@ void MasterEditor::DrawViewMenu() {
}
if (show_memory_editor) {
static MemoryEditor mem_edit;
static MemoryEditor comp_edit;
static bool show_compare_rom = false;
static Rom comparison_rom;
ImGui::Begin("Hex Editor", &show_memory_editor);
if (ImGui::Button("Compare Rom")) {
auto file_name = FileDialogWrapper::ShowOpenFileDialog();
PRINT_IF_ERROR(comparison_rom.LoadFromFile(file_name));
show_compare_rom = true;
}
static uint64_t convert_address = 0;
gui::InputHex("SNES to PC", (int*)&convert_address, 6, 200.f);
SameLine();
Text("%x", core::SnesToPc(convert_address));
// mem_edit.DrawWindow("Memory Editor", (void*)&(*rom()), rom()->size());
BEGIN_TABLE("Memory Comparison", 2, ImGuiTableFlags_Resizable);
SETUP_COLUMN("Source")
SETUP_COLUMN("Dest")
NEXT_COLUMN()
Text("%s", rom()->filename().data());
mem_edit.DrawContents((void*)&(*rom()), rom()->size());
NEXT_COLUMN()
if (show_compare_rom) {
comp_edit.SetComparisonData((void*)&(*rom()));
ImGui::BeginGroup();
ImGui::BeginChild("Comparison ROM");
Text("%s", comparison_rom.filename().data());
comp_edit.DrawContents((void*)&(comparison_rom), comparison_rom.size());
ImGui::EndChild();
ImGui::EndGroup();
}
END_TABLE()
ImGui::End();
memory_editor_.Update(show_memory_editor);
}
if (show_imgui_demo) {
@@ -675,7 +638,7 @@ void MasterEditor::DrawViewMenu() {
if (BeginMenu("View")) {
MenuItem("Emulator", nullptr, &show_emulator);
Separator();
MenuItem("Hex Editor", nullptr, &show_memory_editor);
MenuItem("Memory Editor", nullptr, &show_memory_editor);
MenuItem("Assembly Editor", nullptr, &show_asm_editor);
MenuItem("Palette Editor", nullptr, &show_palette_editor);
Separator();