diff --git a/plugins/builtin/include/content/views/view_hex_editor.hpp b/plugins/builtin/include/content/views/view_hex_editor.hpp index bf6a56014..d11a0d59a 100644 --- a/plugins/builtin/include/content/views/view_hex_editor.hpp +++ b/plugins/builtin/include/content/views/view_hex_editor.hpp @@ -55,8 +55,8 @@ namespace hex::plugin::builtin { i64 m_gotoAddressRelative = 0; bool m_gotoRequested = false; - char m_baseAddressBuffer[0x20] = { 0 }; - u64 m_resizeSize = 0; + u64 m_baseAddress = 0; + u64 m_resizeSize = 0; std::vector m_dataToSave; std::set m_highlightedPatterns; diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index cffde1764..83df470a8 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -330,12 +330,12 @@ namespace hex::plugin::builtin { } if (ImGui::BeginPopupModal("hex.builtin.view.hex_editor.menu.edit.set_base"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::InputText("hex.builtin.common.address"_lang, this->m_baseAddressBuffer, 16, ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_baseAddress, ImGuiInputTextFlags_CharsHexadecimal); ImGui::NewLine(); confirmButtons( "hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang, [this, &provider] { - provider->setBaseAddress(strtoull(this->m_baseAddressBuffer, nullptr, 16)); + provider->setBaseAddress(this->m_baseAddress); ImGui::CloseCurrentPopup(); }, [] { ImGui::CloseCurrentPopup(); }); if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape))) @@ -802,7 +802,7 @@ namespace hex::plugin::builtin { ImGui::Separator(); if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.bookmark"_lang, nullptr, false, this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) { - auto base = ImHexApi::Provider::get()->getBaseAddress(); + auto base = provider->getBaseAddress(); size_t start = base + std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd); size_t end = base + std::max(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd); @@ -811,7 +811,7 @@ namespace hex::plugin::builtin { } if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.set_base"_lang, nullptr, false, providerValid && provider->isReadable())) { - std::memset(this->m_baseAddressBuffer, 0x00, sizeof(this->m_baseAddressBuffer)); + this->m_baseAddress = provider->getBaseAddress(); ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.view.hex_editor.menu.edit.set_base"_lang); }); }