diff --git a/src/app/editor/agent/agent_chat_widget.cc b/src/app/editor/agent/agent_chat_widget.cc index 41fac193..43f2e01d 100644 --- a/src/app/editor/agent/agent_chat_widget.cc +++ b/src/app/editor/agent/agent_chat_widget.cc @@ -671,7 +671,6 @@ void AgentChatWidget::Draw() { ImGui::EndTabBar(); } - ImGui::PopStyleVar(4); // Pop the 4 style vars we pushed ImGui::End(); } diff --git a/src/app/editor/code/memory_editor_enhanced.cc b/src/app/editor/code/memory_editor_enhanced.cc new file mode 100644 index 00000000..08dfd3f5 --- /dev/null +++ b/src/app/editor/code/memory_editor_enhanced.cc @@ -0,0 +1,89 @@ +#include "app/editor/code/memory_editor_enhanced.h" +#include "app/gui/icons.h" +#include "imgui/imgui.h" + +namespace yaze { +namespace editor { + +void EnhancedMemoryEditor::UpdateEnhanced(bool& show) { + ImGui::SetNextWindowSize(ImVec2(1000, 700), ImGuiCond_FirstUseEver); + if (!ImGui::Begin(ICON_MD_DATA_ARRAY " Enhanced Hex Editor", &show)) { + ImGui::End(); + return; + } + + DrawToolbar(); + ImGui::Separator(); + + // Call base memory editor + static MemoryEditor mem_edit; + mem_edit.DrawContents((void*)&(*rom()), rom()->size()); + + ImGui::End(); +} + +void EnhancedMemoryEditor::DrawToolbar() { + if (ImGui::Button(ICON_MD_LOCATION_SEARCHING " Jump to Address")) { + ImGui::OpenPopup("JumpToAddress"); + } + + ImGui::SameLine(); + if (ImGui::Button(ICON_MD_SEARCH " Search Pattern")) { + ImGui::OpenPopup("SearchPattern"); + } + + ImGui::SameLine(); + if (ImGui::Button(ICON_MD_BOOKMARK " Bookmarks")) { + ImGui::OpenPopup("Bookmarks"); + } + + ImGui::SameLine(); + if (ImGui::Button(ICON_MD_COMPARE " Diff View")) { + // TODO: Show diff + } + + // Jump to address popup + if (ImGui::BeginPopup("JumpToAddress")) { + ImGui::Text("Jump to Address"); + ImGui::Separator(); + ImGui::InputText("Address (hex)", jump_address_, IM_ARRAYSIZE(jump_address_)); + if (ImGui::Button("Go")) { + // TODO: Parse and jump + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); + } + + // Search popup + if (ImGui::BeginPopup("SearchPattern")) { + ImGui::Text("Search Hex Pattern"); + ImGui::Separator(); + ImGui::InputText("Pattern", search_pattern_, IM_ARRAYSIZE(search_pattern_)); + ImGui::TextDisabled("Use ?? for wildcard (e.g. FF 00 ?? 12)"); + if (ImGui::Button("Search")) { + // TODO: Implement search + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); + } + + // Bookmarks popup + if (ImGui::BeginPopup("Bookmarks")) { + ImGui::Text("Memory Bookmarks"); + ImGui::Separator(); + for (const auto& bm : bookmarks_) { + if (ImGui::Selectable(bm.name.c_str())) { + current_address_ = bm.address; + } + ImGui::TextDisabled(" 0x%06X - %s", bm.address, bm.description.c_str()); + } + ImGui::EndPopup(); + } +} + +void EnhancedMemoryEditor::DrawJumpToAddress() {} +void EnhancedMemoryEditor::DrawSearch() {} +void EnhancedMemoryEditor::DrawBookmarks() {} + +} // namespace editor +} // namespace yaze diff --git a/src/app/editor/code/memory_editor_enhanced.h b/src/app/editor/code/memory_editor_enhanced.h new file mode 100644 index 00000000..3ccb7724 --- /dev/null +++ b/src/app/editor/code/memory_editor_enhanced.h @@ -0,0 +1,37 @@ +#ifndef YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_ENHANCED_H_ +#define YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_ENHANCED_H_ + +#include "app/editor/code/memory_editor.h" +#include "app/gui/icons.h" + +namespace yaze { +namespace editor { + +struct MemoryBookmark { + uint32_t address; + std::string name; + std::string description; +}; + +class EnhancedMemoryEditor : public MemoryEditorWithDiffChecker { + public: + explicit EnhancedMemoryEditor(Rom* rom) : MemoryEditorWithDiffChecker(rom) {} + + void UpdateEnhanced(bool& show); + + private: + void DrawToolbar(); + void DrawJumpToAddress(); + void DrawSearch(); + void DrawBookmarks(); + + std::vector bookmarks_; + char jump_address_[16] = "0x000000"; + char search_pattern_[256] = ""; + uint32_t current_address_ = 0; +}; + +} // namespace editor +} // namespace yaze + +#endif // YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_ENHANCED_H_