diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index c4c8bbf6c..02d6ac16f 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -512,7 +512,9 @@ namespace ImGuiExt { PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F); PushStyleColor(ImGuiCol_Text, iconColor); + ImGui::PushID(text); Button(icon); + ImGui::PopID(); PopStyleColor(); if (IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { diff --git a/plugins/disassembler/romfs/lang/en_US.json b/plugins/disassembler/romfs/lang/en_US.json index 073c0b0d5..7ba6b99d8 100644 --- a/plugins/disassembler/romfs/lang/en_US.json +++ b/plugins/disassembler/romfs/lang/en_US.json @@ -16,6 +16,7 @@ "hex.disassembler.view.disassembler.bpf.classic": "Classic", "hex.disassembler.view.disassembler.bpf.extended": "Extended", "hex.disassembler.view.disassembler.image_base_address": "Image Base Address", + "hex.disassembler.view.disassembler.image_base_address.hint": "This is the start address of the code region in the loaded data. For example the begin of the .text section", "hex.disassembler.view.disassembler.disassemble": "Disassemble", "hex.disassembler.view.disassembler.disassembling": "Disassembling...", "hex.disassembler.view.disassembler.disassembly.address": "Address", @@ -25,6 +26,7 @@ "hex.disassembler.view.disassembler.export": "Export instructions as...", "hex.disassembler.view.disassembler.export.popup.error": "Failed to export to ASM file!", "hex.disassembler.view.disassembler.image_load_address": "Image Load Address", + "hex.disassembler.view.disassembler.image_load_address.hint": "This is the address of where the disassembled code is being loaded into memory before it's being executed", "hex.disassembler.view.disassembler.m680x.6301": "6301", "hex.disassembler.view.disassembler.m680x.6309": "6309", "hex.disassembler.view.disassembler.m680x.6800": "6800", diff --git a/plugins/disassembler/source/content/views/view_disassembler.cpp b/plugins/disassembler/source/content/views/view_disassembler.cpp index e79f5a0e5..1afad4c63 100644 --- a/plugins/disassembler/source/content/views/view_disassembler.cpp +++ b/plugins/disassembler/source/content/views/view_disassembler.cpp @@ -145,11 +145,15 @@ namespace hex::plugin::disasm { // Draw base address input ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_load_address"_lang, &m_imageLoadAddress, ImGuiInputTextFlags_CharsHexadecimal); + ImGui::SameLine(); + ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_load_address.hint"_lang, ICON_VS_INFO); // Draw code region start address input ImGui::BeginDisabled(m_range == ui::RegionType::EntireData); { ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_base_address"_lang, &m_imageBaseAddress, ImGuiInputTextFlags_CharsHexadecimal); + ImGui::SameLine(); + ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_base_address.hint"_lang, ICON_VS_INFO); } ImGui::EndDisabled(); @@ -428,14 +432,14 @@ namespace hex::plugin::disasm { m_mode = cs_mode(u32(m_mode) | CS_MODE_BIG_ENDIAN); } - ImGuiExt::EndBox(); } + ImGuiExt::EndBox(); } // Draw disassemble button ImGui::BeginDisabled(m_disassemblerTask.isRunning() || m_regionToDisassemble.getStartAddress() < m_imageBaseAddress); { - if (ImGui::Button("hex.disassembler.view.disassembler.disassemble"_lang)) + if (ImGuiExt::DimmedButton("hex.disassembler.view.disassembler.disassemble"_lang)) this->disassemble(); } ImGui::EndDisabled(); diff --git a/plugins/hashes/romfs/lang/en_US.json b/plugins/hashes/romfs/lang/en_US.json index f70ffb30a..695fd8b8a 100644 --- a/plugins/hashes/romfs/lang/en_US.json +++ b/plugins/hashes/romfs/lang/en_US.json @@ -11,7 +11,9 @@ "hex.hashes.view.hashes.hover_info": "Hover over the Hex Editor selection and hold down SHIFT to view the hashes of that region.", "hex.hashes.view.hashes.name": "Hashes", "hex.hashes.view.hashes.no_settings": "No settings available", + "hex.hashes.view.hashes.add": "Add hash", "hex.hashes.view.hashes.remove": "Remove hash", + "hex.hashes.view.hashes.hash_name": "Hash Name", "hex.hashes.view.hashes.table.name": "Name", "hex.hashes.view.hashes.table.result": "Result", "hex.hashes.view.hashes.table.type": "Type", diff --git a/plugins/hashes/source/content/views/view_hashes.cpp b/plugins/hashes/source/content/views/view_hashes.cpp index 5cc88b5f3..df04b06ad 100644 --- a/plugins/hashes/source/content/views/view_hashes.cpp +++ b/plugins/hashes/source/content/views/view_hashes.cpp @@ -152,48 +152,56 @@ namespace hex::plugin::hashes { m_selectedHash = hashes.front().get(); } - if (ImGui::BeginCombo("hex.hashes.view.hashes.function"_lang, m_selectedHash != nullptr ? Lang(m_selectedHash->getUnlocalizedName()) : "")) { + if (ImGuiExt::DimmedButton("hex.hashes.view.hashes.add"_lang)) { + ImGui::OpenPopup("##CreateHash"); + } - for (const auto &hash : hashes) { - if (ImGui::Selectable(Lang(hash->getUnlocalizedName()), m_selectedHash == hash.get())) { - m_selectedHash = hash.get(); - m_newHashName.clear(); + if (ImGui::BeginPopup("##CreateHash")) { + ImGuiExt::InputTextIcon("hex.hashes.view.hashes.hash_name"_lang, ICON_VS_SYMBOL_KEY, m_newHashName); + + ImGui::NewLine(); + + if (ImGui::BeginCombo("hex.hashes.view.hashes.function"_lang, m_selectedHash != nullptr ? Lang(m_selectedHash->getUnlocalizedName()) : "")) { + for (const auto &hash : hashes) { + if (ImGui::Selectable(Lang(hash->getUnlocalizedName()), m_selectedHash == hash.get())) { + m_selectedHash = hash.get(); + m_newHashName.clear(); + } + } + + ImGui::EndCombo(); + } + + if (m_newHashName.empty() && m_selectedHash != nullptr) + m_newHashName = hex::format("{} {}", Lang(m_selectedHash->getUnlocalizedName()), static_cast("hex.hashes.view.hashes.hash"_lang)); + + if (ImGuiExt::BeginSubWindow("hex.builtin.common.settings"_lang, nullptr, scaled({ 400, 200 }))) { + if (m_selectedHash != nullptr) { + auto startPos = ImGui::GetCursorPosY(); + m_selectedHash->draw(); + + // Check if no elements have been added + if (startPos == ImGui::GetCursorPosY()) { + ImGuiExt::TextFormattedCentered("hex.hashes.view.hashes.no_settings"_lang); + } } } + ImGuiExt::EndSubWindow(); - ImGui::EndCombo(); - } - - if (m_newHashName.empty() && m_selectedHash != nullptr) - m_newHashName = hex::format("{} {}", Lang(m_selectedHash->getUnlocalizedName()), static_cast("hex.hashes.view.hashes.hash"_lang)); - - if (ImGui::BeginChild("##settings", ImVec2(ImGui::GetContentRegionAvail().x, 200_scaled), true)) { - if (m_selectedHash != nullptr) { - auto startPos = ImGui::GetCursorPosY(); - m_selectedHash->draw(); - - // Check if no elements have been added - if (startPos == ImGui::GetCursorPosY()) { - ImGuiExt::TextFormattedCentered("hex.hashes.view.hashes.no_settings"_lang); + ImGui::BeginDisabled(m_newHashName.empty() || m_selectedHash == nullptr); + if (ImGuiExt::DimmedButton("hex.hashes.view.hashes.add"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) { + if (m_selectedHash != nullptr) { + m_hashFunctions->push_back(m_selectedHash->create(m_newHashName)); + AchievementManager::unlockAchievement("hex.builtin.achievement.misc", "hex.hashes.achievement.misc.create_hash.name"); + ImGui::CloseCurrentPopup(); } } + ImGui::EndDisabled(); + + ImGui::EndPopup(); } - ImGui::EndChild(); - - ImGuiExt::InputTextIcon("##hash_name", ICON_VS_SYMBOL_KEY, m_newHashName); - ImGui::SameLine(); - - ImGui::BeginDisabled(m_newHashName.empty() || m_selectedHash == nullptr); - if (ImGuiExt::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { - if (m_selectedHash != nullptr) { - m_hashFunctions->push_back(m_selectedHash->create(m_newHashName)); - AchievementManager::unlockAchievement("hex.builtin.achievement.misc", "hex.hashes.achievement.misc.create_hash.name"); - } - } - ImGui::EndDisabled(); - - ImGui::SameLine(); + ImGui::SameLine(0, 10_scaled); ImGuiExt::HelpHover("hex.hashes.view.hashes.hover_info"_lang, ICON_VS_INFO); if (ImGui::BeginTable("##hashes", 4, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY)) { @@ -247,7 +255,7 @@ namespace hex::plugin::hashes { PopupTextHash::open(function); } ImGui::SameLine(); - if (ImGuiExt::IconButton(ICON_VS_X, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) { + if (ImGuiExt::IconButton(ICON_VS_X, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { indexToRemove = i; } diff --git a/plugins/yara_rules/source/content/views/view_yara.cpp b/plugins/yara_rules/source/content/views/view_yara.cpp index 996145604..6325f7eb3 100644 --- a/plugins/yara_rules/source/content/views/view_yara.cpp +++ b/plugins/yara_rules/source/content/views/view_yara.cpp @@ -163,15 +163,18 @@ namespace hex::plugin::yara { } ImGui::SameLine(); + ImGui::BeginDisabled(*m_selectedRule >= m_rulePaths->size()); if (ImGuiExt::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { - if (*m_selectedRule < m_rulePaths->size()) { - m_rulePaths->erase(m_rulePaths->begin() + *m_selectedRule); - m_selectedRule = std::min(*m_selectedRule, u32(m_rulePaths->size() - 1)); - } + m_rulePaths->erase(m_rulePaths->begin() + *m_selectedRule); + m_selectedRule = std::min(*m_selectedRule, u32(m_rulePaths->size() - 1)); } + ImGui::EndDisabled(); ImGui::NewLine(); - if (ImGui::Button("hex.yara_rules.view.yara.match"_lang)) this->applyRules(); + + ImGui::BeginDisabled(m_rulePaths->empty()); + if (ImGuiExt::DimmedButton("hex.yara_rules.view.yara.match"_lang)) this->applyRules(); + ImGui::EndDisabled(); if (m_matcherTask.isRunning()) { ImGui::SameLine();