From b7324913e99f38d32238fb878e8deb79472e3356 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 29 Jul 2022 13:59:57 +0200 Subject: [PATCH] sys: Replaced Search view with a generic Find view Closes #551 --- .../include/hex/providers/buffered_reader.hpp | 32 +- plugins/builtin/CMakeLists.txt | 2 +- .../include/content/views/view_find.hpp | 67 +++ .../include/content/views/view_strings.hpp | 39 -- plugins/builtin/source/content/layouts.cpp | 2 +- plugins/builtin/source/content/views.cpp | 4 +- .../source/content/views/view_bookmarks.cpp | 6 +- .../source/content/views/view_find.cpp | 457 ++++++++++++++++++ .../source/content/views/view_strings.cpp | 259 ---------- plugins/builtin/source/lang/de_DE.cpp | 48 +- plugins/builtin/source/lang/en_US.cpp | 50 +- plugins/builtin/source/lang/it_IT.cpp | 46 +- plugins/builtin/source/lang/ja_JP.cpp | 48 +- plugins/builtin/source/lang/pt_BR.cpp | 48 +- plugins/builtin/source/lang/zh_CN.cpp | 50 +- plugins/builtin/source/lang/zh_TW.cpp | 48 +- 16 files changed, 778 insertions(+), 428 deletions(-) create mode 100644 plugins/builtin/include/content/views/view_find.hpp delete mode 100644 plugins/builtin/include/content/views/view_strings.hpp create mode 100644 plugins/builtin/source/content/views/view_find.cpp delete mode 100644 plugins/builtin/source/content/views/view_strings.cpp diff --git a/lib/libimhex/include/hex/providers/buffered_reader.hpp b/lib/libimhex/include/hex/providers/buffered_reader.hpp index 025c23930..5b7241a54 100644 --- a/lib/libimhex/include/hex/providers/buffered_reader.hpp +++ b/lib/libimhex/include/hex/providers/buffered_reader.hpp @@ -9,10 +9,19 @@ namespace hex::prv { class BufferedReader { public: - explicit BufferedReader(Provider *provider, size_t bufferSize = 0xFF'FFFF) : m_provider(provider), m_maxBufferSize(bufferSize), m_buffer(bufferSize) { } + explicit BufferedReader(Provider *provider, size_t bufferSize = 0xFF'FFFF) + : m_provider(provider), m_bufferAddress(provider->getBaseAddress()), m_maxBufferSize(bufferSize), + m_startAddress(0x00), m_endAddress(provider->getActualSize()), + m_buffer(bufferSize) { + + } void seek(u64 address) { - this->m_baseAddress = address; + this->m_startAddress = address; + } + + void setEndAddress(u64 address) { + this->m_endAddress = address; } [[nodiscard]] std::vector read(u64 address, size_t size) { @@ -27,7 +36,7 @@ namespace hex::prv { this->updateBuffer(address, size); - auto result = &this->m_buffer[address - this->m_baseAddress]; + auto result = &this->m_buffer[address - this->m_bufferAddress]; return { result, result + std::min(size, this->m_buffer.size()) }; } @@ -44,7 +53,7 @@ namespace hex::prv { this->updateBuffer(address - std::min(address, this->m_buffer.size()), size); - auto result = &this->m_buffer[address - this->m_baseAddress]; + auto result = &this->m_buffer[address - this->m_startAddress]; return { result, result + std::min(size, this->m_buffer.size()) }; } @@ -192,15 +201,15 @@ namespace hex::prv { }; Iterator begin() { - return { this, this->m_baseAddress }; + return { this, this->m_startAddress }; } Iterator end() { - return { this, this->m_provider->getActualSize() }; + return { this, this->m_endAddress }; } ReverseIterator rbegin() { - return { this, this->m_baseAddress }; + return { this, this->m_startAddress }; } ReverseIterator rend() { @@ -209,13 +218,13 @@ namespace hex::prv { private: void updateBuffer(u64 address, size_t size) { - if (!this->m_bufferValid || address < this->m_baseAddress || address + size > (this->m_baseAddress + this->m_buffer.size())) { - const auto remainingBytes = this->m_provider->getActualSize() - address; + if (!this->m_bufferValid || address < this->m_bufferAddress || address + size > (this->m_bufferAddress + this->m_buffer.size())) { + const auto remainingBytes = this->m_endAddress - address; if (remainingBytes < this->m_maxBufferSize) this->m_buffer.resize(remainingBytes); this->m_provider->read(address, this->m_buffer.data(), this->m_buffer.size()); - this->m_baseAddress = address; + this->m_bufferAddress = address; this->m_bufferValid = true; } } @@ -223,9 +232,10 @@ namespace hex::prv { private: Provider *m_provider; + u64 m_bufferAddress = 0x00; size_t m_maxBufferSize; bool m_bufferValid = false; - u64 m_baseAddress = 0x00; + u64 m_startAddress = 0x00, m_endAddress; std::vector m_buffer; }; diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt index 17687deac..8b382fed8 100644 --- a/plugins/builtin/CMakeLists.txt +++ b/plugins/builtin/CMakeLists.txt @@ -35,7 +35,6 @@ add_library(${PROJECT_NAME} SHARED source/content/views/view_information.cpp source/content/views/view_about.cpp source/content/views/view_tools.cpp - source/content/views/view_strings.cpp source/content/views/view_data_inspector.cpp source/content/views/view_disassembler.cpp source/content/views/view_bookmarks.cpp @@ -48,6 +47,7 @@ add_library(${PROJECT_NAME} SHARED source/content/views/view_store.cpp source/content/views/view_diff.cpp source/content/views/view_provider_settings.cpp + source/content/views/view_find.cpp source/math_evaluator.cpp diff --git a/plugins/builtin/include/content/views/view_find.hpp b/plugins/builtin/include/content/views/view_find.hpp new file mode 100644 index 000000000..bbbe5b289 --- /dev/null +++ b/plugins/builtin/include/content/views/view_find.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include + +#include +#include + +#include +#include + +namespace hex::plugin::builtin { + + class ViewFind : public View { + public: + ViewFind(); + ~ViewFind() override = default; + + void drawContent() override; + + private: + + struct SearchSettings { + int range = 0; + + enum class Mode : int { + Strings, + Sequence, + Regex + } mode = Mode::Strings; + + struct Strings { + int minLength = 5; + enum class Type : int { ASCII = 0, UTF16LE = 1, UTF16BE = 2 } type = Type::ASCII; + bool nullTermination = false; + + bool m_lowerCaseLetters = true; + bool m_upperCaseLetters = true; + bool m_numbers = true; + bool m_underscores = true; + bool m_symbols = true; + bool m_spaces = true; + bool m_lineFeeds = false; + } strings; + + struct Bytes { + std::string sequence; + } bytes; + + struct Regex { + std::string pattern; + } regex; + } m_searchSettings, m_decodeSettings; + + std::map> m_foundRegions, m_sortedRegions; + std::atomic m_searchRunning; + bool m_settingsValid = false; + + private: + static std::vector searchStrings(prv::Provider *provider, Region searchRegion, SearchSettings::Strings settings); + static std::vector searchSequence(prv::Provider *provider, Region searchRegion, SearchSettings::Bytes settings); + static std::vector searchRegex(prv::Provider *provider, Region searchRegion, SearchSettings::Regex settings); + + void runSearch(); + std::string decodeValue(prv::Provider *provider, Region region); + }; + +} \ No newline at end of file diff --git a/plugins/builtin/include/content/views/view_strings.hpp b/plugins/builtin/include/content/views/view_strings.hpp deleted file mode 100644 index 493e25e36..000000000 --- a/plugins/builtin/include/content/views/view_strings.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace hex::plugin::builtin { - - struct FoundString { - u64 offset; - size_t size; - }; - - class ViewStrings : public View { - public: - explicit ViewStrings(); - ~ViewStrings() override; - - void drawContent() override; - - private: - bool m_searching = false; - bool m_regex = false; - bool m_pattern_parsed = true; - - std::vector m_foundStrings; - std::vector m_filterIndices; - int m_minimumLength = 5; - std::string m_filter; - - std::string m_selectedString; - std::string m_demangledName; - - void searchStrings(); - void createStringContextMenu(const FoundString &foundString); - }; - -} \ No newline at end of file diff --git a/plugins/builtin/source/content/layouts.cpp b/plugins/builtin/source/content/layouts.cpp index dd3e00b94..35c151e7b 100644 --- a/plugins/builtin/source/content/layouts.cpp +++ b/plugins/builtin/source/content/layouts.cpp @@ -28,7 +28,7 @@ namespace hex::plugin::builtin { openViewAndDockTo("hex.builtin.view.pattern_editor.name", utils); openViewAndDockTo("hex.builtin.view.hashes.name", utils); openViewAndDockTo("hex.builtin.view.data_information.name", utils); - openViewAndDockTo("hex.builtin.view.strings.name", utils); + openViewAndDockTo("hex.builtin.view.find.name", utils); openViewAndDockTo("hex.builtin.view.bookmarks.name", utils); }); } diff --git a/plugins/builtin/source/content/views.cpp b/plugins/builtin/source/content/views.cpp index 73286449c..a41903d92 100644 --- a/plugins/builtin/source/content/views.cpp +++ b/plugins/builtin/source/content/views.cpp @@ -5,7 +5,6 @@ #include "content/views/view_information.hpp" #include "content/views/view_about.hpp" #include "content/views/view_tools.hpp" -#include "content/views/view_strings.hpp" #include "content/views/view_data_inspector.hpp" #include "content/views/view_disassembler.hpp" #include "content/views/view_bookmarks.hpp" @@ -18,6 +17,7 @@ #include "content/views/view_store.hpp" #include "content/views/view_diff.hpp" #include "content/views/view_provider_settings.hpp" +#include "content/views/view_find.hpp" namespace hex::plugin::builtin { @@ -28,7 +28,6 @@ namespace hex::plugin::builtin { ContentRegistry::Views::add(); ContentRegistry::Views::add(); ContentRegistry::Views::add(); - ContentRegistry::Views::add(); ContentRegistry::Views::add(); ContentRegistry::Views::add(); ContentRegistry::Views::add(); @@ -42,6 +41,7 @@ namespace hex::plugin::builtin { ContentRegistry::Views::add(); ContentRegistry::Views::add(); ContentRegistry::Views::add(); + ContentRegistry::Views::add(); } } \ No newline at end of file diff --git a/plugins/builtin/source/content/views/view_bookmarks.cpp b/plugins/builtin/source/content/views/view_bookmarks.cpp index 0a0c2c5e1..8b5d9e97d 100644 --- a/plugins/builtin/source/content/views/view_bookmarks.cpp +++ b/plugins/builtin/source/content/views/view_bookmarks.cpp @@ -80,14 +80,14 @@ namespace hex::plugin::builtin { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::TextFormatted("Region: "); + ImGui::TextFormatted("{}: ", "hex.builtin.common.region"_lang.get()); ImGui::TableNextColumn(); ImGui::TextFormatted("[ 0x{:08X} - 0x{:08X} ]", bookmark.region.getStartAddress(), bookmark.region.getEndAddress()); if (!bookmark.comment.empty() && bookmark.comment[0] != '\x00') { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::TextFormatted("Comment: "); + ImGui::TextFormatted("{}: ", "hex.builtin.view.bookmarks.header.comment"_lang.get()); ImGui::TableNextColumn(); ImGui::TextFormattedWrapped("\"{}\"", bookmark.comment); } @@ -124,7 +124,7 @@ namespace hex::plugin::builtin { if (ImGui::Begin(View::toWindowName("hex.builtin.view.bookmarks.name").c_str(), &this->getWindowOpenState())) { ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth()); - ImGui::InputTextWithHint("##filter", "Filter", this->m_currFilter); + ImGui::InputTextWithHint("##filter", "hex.builtin.common.filter"_lang, this->m_currFilter); ImGui::PopItemWidth(); ImGui::NewLine(); diff --git a/plugins/builtin/source/content/views/view_find.cpp b/plugins/builtin/source/content/views/view_find.cpp new file mode 100644 index 000000000..e678ee2c9 --- /dev/null +++ b/plugins/builtin/source/content/views/view_find.cpp @@ -0,0 +1,457 @@ +#include "content/views/view_find.hpp" + +#include +#include + +#include +#include +#include +#include +#include + +#include + +namespace hex::plugin::builtin { + + ViewFind::ViewFind() : View("hex.builtin.view.find.name") { + const static auto HighlightColor = [] { return (ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarPurple) & 0x00FFFFFF) | 0x70000000; }; + + const static auto FindRegion = [this](u64 address) -> std::optional { + auto ®ions = this->m_foundRegions[ImHexApi::Provider::get()]; + + auto it = std::upper_bound(regions.begin(), regions.end(), address, [](u64 address, Region ®ion) { + return address < region.getStartAddress(); + }); + + if (it != regions.begin()) + it--; + + if (it != regions.end() && it->getStartAddress() <= address && address <= it->getEndAddress()) + return *it; + else + return std::nullopt; + }; + + ImHexApi::HexEditor::addBackgroundHighlightingProvider([](u64 address, const u8* data, size_t size) -> std::optional { + hex::unused(data, size); + + if (FindRegion(address).has_value()) + return HighlightColor(); + else + return std::nullopt; + }); + + ImHexApi::HexEditor::addTooltipProvider([this](u64 address, const u8* data, size_t size) { + hex::unused(data, size); + + auto region = FindRegion(address); + if (!region.has_value()) + return; + + ImGui::BeginTooltip(); + + ImGui::PushID(®ion); + if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + + { + const auto value = this->decodeValue(ImHexApi::Provider::get(), region.value()); + + ImGui::ColorButton("##color", ImColor(HighlightColor())); + ImGui::SameLine(0, 10); + ImGui::TextFormatted("{}", value); + + if (ImGui::GetIO().KeyShift) { + ImGui::Indent(); + if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) { + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextFormatted("{}: ", "hex.builtin.common.region"_lang.get()); + ImGui::TableNextColumn(); + ImGui::TextFormatted("[ 0x{:08X} - 0x{:08X} ]", region->getStartAddress(), region->getEndAddress()); + + auto demangledValue = llvm::demangle(value); + + if (value != demangledValue) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextFormatted("{}: ", "hex.builtin.view.find.demangled"_lang.get()); + ImGui::TableNextColumn(); + ImGui::TextFormatted("{}", demangledValue); + } + + ImGui::EndTable(); + } + ImGui::Unindent(); + } + } + + + ImGui::PushStyleColor(ImGuiCol_TableRowBg, HighlightColor()); + ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, HighlightColor()); + ImGui::EndTable(); + ImGui::PopStyleColor(2); + } + ImGui::PopID(); + + ImGui::EndTooltip(); + }); + } + + std::vector ViewFind::searchStrings(prv::Provider *provider, hex::Region searchRegion, SearchSettings::Strings settings) { + std::vector results; + + auto reader = prv::BufferedReader(provider); + reader.seek(searchRegion.getStartAddress()); + reader.setEndAddress(searchRegion.getEndAddress()); + + size_t countedCharacters = 0; + u64 startAddress = reader.begin().getAddress(); + for (u8 byte : reader) { + bool validChar = + (settings.m_lowerCaseLetters && std::islower(byte)) || + (settings.m_upperCaseLetters && std::isupper(byte)) || + (settings.m_numbers && std::isdigit(byte)) || + (settings.m_spaces && std::isspace(byte)) || + (settings.m_underscores && byte == '_') || + (settings.m_symbols && std::ispunct(byte)) || + (settings.m_lineFeeds && byte == '\n'); + + if (settings.type == SearchSettings::Strings::Type::UTF16LE) { + // Check if second byte of UTF-16 encoded string is 0x00 + if (countedCharacters % 2 == 1) + validChar = byte == 0x00; + } else if (settings.type == SearchSettings::Strings::Type::UTF16BE) { + // Check if first byte of UTF-16 encoded string is 0x00 + if (countedCharacters % 2 == 0) + validChar = byte == 0x00; + } + + if (validChar) + countedCharacters++; + else { + if (countedCharacters >= size_t(settings.minLength)) { + if (!(settings.nullTermination && byte != 0x00)) { + results.push_back(Region { startAddress, countedCharacters }); + } + } + + startAddress += countedCharacters + 1; + countedCharacters = 0; + } + } + + return results; + } + + std::vector ViewFind::searchSequence(prv::Provider *provider, hex::Region searchRegion, SearchSettings::Bytes settings) { + std::vector results; + + auto reader = prv::BufferedReader(provider); + reader.seek(searchRegion.getStartAddress()); + reader.setEndAddress(searchRegion.getEndAddress()); + + auto sequence = hex::decodeByteString(settings.sequence); + auto occurrence = reader.begin(); + while (true) { + occurrence = std::search(reader.begin(), reader.end(), std::boyer_moore_horspool_searcher(sequence.begin(), sequence.end())); + if (occurrence == reader.end()) + break; + + reader.seek(occurrence.getAddress() + sequence.size()); + results.push_back(Region { occurrence.getAddress(), sequence.size() }); + } + + return results; + } + + std::vector ViewFind::searchRegex(prv::Provider *provider, hex::Region searchRegion, SearchSettings::Regex settings) { + auto stringRegions = searchStrings(provider, searchRegion, SearchSettings::Strings { + .minLength = 1, + .type = SearchSettings::Strings::Type::ASCII, + .m_lowerCaseLetters = true, + .m_upperCaseLetters = true, + .m_numbers = true, + .m_underscores = true, + .m_symbols = true, + .m_spaces = true, + .m_lineFeeds = true + }); + + std::vector result; + std::regex regex(settings.pattern); + for (const auto ®ion : stringRegions) { + std::string string(region.getSize(), '\x00'); + provider->read(region.getStartAddress(), string.data(), region.getSize()); + + if (std::regex_match(string, regex)) + result.push_back(region); + } + + return result; + } + + void ViewFind::runSearch() { + Region searchRegion = [this]{ + if (this->m_searchSettings.range == 0 || !ImHexApi::HexEditor::isSelectionValid()) { + auto provider = ImHexApi::Provider::get(); + return Region { provider->getBaseAddress(), provider->getActualSize() }; + } else { + return ImHexApi::HexEditor::getSelection().value(); + } + }(); + + this->m_searchRunning = true; + std::thread([this, settings = this->m_searchSettings, searchRegion]{ + auto task = ImHexApi::Tasks::createTask("hex.builtin.view.find.searching", 0); + auto provider = ImHexApi::Provider::get(); + + switch (settings.mode) { + using enum SearchSettings::Mode; + case Strings: + this->m_foundRegions[provider] = searchStrings(provider, searchRegion, settings.strings); + break; + case Sequence: + this->m_foundRegions[provider] = searchSequence(provider, searchRegion, settings.bytes); + break; + case Regex: + this->m_foundRegions[provider] = searchRegex(provider, searchRegion, settings.regex); + break; + } + + this->m_sortedRegions = this->m_foundRegions; + this->m_searchRunning = false; + }).detach(); + } + + std::string ViewFind::decodeValue(prv::Provider *provider, hex::Region region) { + std::vector bytes(std::min(region.getSize(), 128)); + provider->read(region.getStartAddress(), bytes.data(), bytes.size()); + + std::string result; + switch (this->m_decodeSettings.mode) { + using enum SearchSettings::Mode; + + case Strings: + { + auto &settings = this->m_decodeSettings.strings; + + switch (settings.type) { + using enum SearchSettings::Strings::Type; + case ASCII: + result = hex::encodeByteString(bytes); + break; + case UTF16LE: + for (size_t i = 0; i < bytes.size(); i += 2) + result += hex::encodeByteString({ bytes[i] }); + break; + case UTF16BE: + for (size_t i = 1; i < bytes.size(); i += 2) + result += hex::encodeByteString({ bytes[i] }); + break; + } + } + break; + case Sequence: + case Regex: + result = hex::encodeByteString(bytes); + break; + } + + return result; + } + + static void drawContextMenu(const std::string &value) { + if (ImGui::IsMouseClicked(ImGuiMouseButton_Right) && ImGui::IsItemHovered()) { + ImGui::OpenPopup("FindContextMenu"); + } + + if (ImGui::BeginPopup("FindContextMenu")) { + if (ImGui::MenuItem("hex.builtin.view.find.context.copy"_lang)) { + ImGui::SetClipboardText(value.c_str()); + if (ImGui::MenuItem("hex.builtin.view.find.context.copy_demangle"_lang)) + ImGui::SetClipboardText(llvm::demangle(value).c_str()); + + ImGui::EndPopup(); + } + } + + void ViewFind::drawContent() { + if (ImGui::Begin(View::toWindowName("hex.builtin.view.find.name").c_str(), &this->getWindowOpenState())) { + + ImGui::BeginDisabled(this->m_searchRunning); + { + ImGui::Header("hex.builtin.view.find.range"_lang, true); + ImGui::RadioButton("hex.builtin.view.find.range.entire_data"_lang, &this->m_searchSettings.range, 0); + ImGui::RadioButton("hex.builtin.view.find.range.selection"_lang, &this->m_searchSettings.range, 1); + + ImGui::NewLine(); + + if (ImGui::BeginTabBar("SearchMethods")) { + auto &mode = this->m_searchSettings.mode; + if (ImGui::BeginTabItem("hex.builtin.view.find.strings"_lang)) { + auto &settings = this->m_searchSettings.strings; + mode = SearchSettings::Mode::Strings; + + ImGui::InputInt("hex.builtin.view.find.strings.min_length"_lang, &settings.minLength, 1, 1); + if (settings.minLength < 1) + settings.minLength = 1; + + const std::array StringTypes = { "hex.builtin.common.encoding.ascii"_lang,"hex.builtin.common.encoding.utf16le"_lang, "hex.builtin.common.encoding.utf16be"_lang }; + if (ImGui::BeginCombo("hex.builtin.common.type"_lang, StringTypes[std::to_underlying(settings.type)].c_str())) { + for (size_t i = 0; i < StringTypes.size(); i++) { + auto type = static_cast(i); + + if (ImGui::Selectable(StringTypes[i].c_str(), type == settings.type)) + settings.type = type; + } + ImGui::EndCombo(); + } + + if (ImGui::CollapsingHeader("hex.builtin.view.find.strings.match_settings"_lang)) { + ImGui::Checkbox("hex.builtin.view.find.strings.null_term"_lang, &settings.nullTermination); + + ImGui::Header("hex.builtin.view.find.strings.chars"_lang); + ImGui::Checkbox(hex::format("{} [a-z]", "hex.builtin.view.find.strings.lower_case"_lang.get()).c_str(), &settings.m_lowerCaseLetters); + ImGui::Checkbox(hex::format("{} [A-Z]", "hex.builtin.view.find.strings.upper_case"_lang.get()).c_str(), &settings.m_upperCaseLetters); + ImGui::Checkbox(hex::format("{} [0-9]", "hex.builtin.view.find.strings.numbers"_lang.get()).c_str(), &settings.m_numbers); + ImGui::Checkbox(hex::format("{} [_]", "hex.builtin.view.find.strings.underscores"_lang.get()).c_str(), &settings.m_underscores); + ImGui::Checkbox(hex::format("{} [!\"#$%...]", "hex.builtin.view.find.strings.symbols"_lang.get()).c_str(), &settings.m_symbols); + ImGui::Checkbox(hex::format("{} [ ]", "hex.builtin.view.find.strings.spaces"_lang.get()).c_str(), &settings.m_spaces); + ImGui::Checkbox(hex::format("{} [\\n]", "hex.builtin.view.find.strings.line_feeds"_lang.get()).c_str(), &settings.m_lineFeeds); + } + + this->m_settingsValid = true; + + ImGui::EndTabItem(); + } + if (ImGui::BeginTabItem("hex.builtin.view.find.sequences"_lang)) { + auto &settings = this->m_searchSettings.bytes; + + mode = SearchSettings::Mode::Sequence; + + ImGui::InputText("hex.builtin.common.value"_lang, settings.sequence); + + this->m_settingsValid = !settings.sequence.empty(); + + ImGui::EndTabItem(); + } + if (ImGui::BeginTabItem("hex.builtin.view.find.regex"_lang)) { + auto &settings = this->m_searchSettings.regex; + + mode = SearchSettings::Mode::Regex; + + ImGui::InputText("hex.builtin.view.find.regex"_lang, settings.pattern); + + try { + std::regex regex(settings.pattern); + this->m_settingsValid = true; + } catch (std::regex_error &e) { + this->m_settingsValid = false; + } + + if (settings.pattern.empty()) + this->m_settingsValid = false; + + ImGui::EndTabItem(); + } + + ImGui::EndTabBar(); + } + + ImGui::NewLine(); + + ImGui::BeginDisabled(!this->m_settingsValid); + { + if (ImGui::Button("hex.builtin.view.find.search"_lang)) { + this->runSearch(); + + this->m_decodeSettings = this->m_searchSettings; + } + } + ImGui::EndDisabled(); + + } + ImGui::EndDisabled(); + + + ImGui::Separator(); + ImGui::NewLine(); + + if (ImGui::BeginTable("##entries", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { + ImGui::TableSetupScrollFreeze(0, 1); + ImGui::TableSetupColumn("hex.builtin.common.offset"_lang, 0, -1, ImGui::GetID("offset")); + ImGui::TableSetupColumn("hex.builtin.common.size"_lang, 0, -1, ImGui::GetID("size")); + ImGui::TableSetupColumn("hex.builtin.common.value"_lang, 0, -1, ImGui::GetID("value")); + + auto provider = ImHexApi::Provider::get(); + auto ®ions = this->m_sortedRegions[provider]; + + auto sortSpecs = ImGui::TableGetSortSpecs(); + + if (sortSpecs->SpecsDirty) { + std::sort(regions.begin(), regions.end(), [this, &sortSpecs, provider](Region &left, Region &right) -> bool { + if (sortSpecs->Specs->ColumnUserID == ImGui::GetID("offset")) { + if (sortSpecs->Specs->SortDirection == ImGuiSortDirection_Ascending) + return left.getStartAddress() > right.getStartAddress(); + else + return left.getStartAddress() < right.getStartAddress(); + } else if (sortSpecs->Specs->ColumnUserID == ImGui::GetID("size")) { + if (sortSpecs->Specs->SortDirection == ImGuiSortDirection_Ascending) + return left.getSize() > right.getSize(); + else + return left.getSize() < right.getSize(); + } else if (sortSpecs->Specs->ColumnUserID == ImGui::GetID("value")) { + if (sortSpecs->Specs->SortDirection == ImGuiSortDirection_Ascending) + return this->decodeValue(provider, left) > this->decodeValue(provider, right); + else + return this->decodeValue(provider, left) < this->decodeValue(provider, right); + } + + return false; + }); + + sortSpecs->SpecsDirty = false; + } + + ImGui::TableHeadersRow(); + + ImGuiListClipper clipper; + clipper.Begin(regions.size()); + + while (clipper.Step()) { + for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) { + auto &foundItem = regions[i]; + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + + ImGui::TextFormatted("0x{:08X}", foundItem.getStartAddress()); + ImGui::TableNextColumn(); + ImGui::TextFormatted("{}", hex::toByteString(foundItem.getSize())); + ImGui::TableNextColumn(); + + ImGui::PushID(i); + + auto value = this->decodeValue(provider, foundItem); + ImGui::TextFormatted("{}", value); + ImGui::SameLine(); + if (ImGui::Selectable("##line", false, ImGuiSelectableFlags_SpanAllColumns)) + ImHexApi::HexEditor::setSelection(foundItem.getStartAddress(), foundItem.getSize()); + drawContextMenu(value); + + ImGui::PopID(); + } + } + clipper.End(); + + ImGui::EndTable(); + } + + } + ImGui::End(); + } + +} diff --git a/plugins/builtin/source/content/views/view_strings.cpp b/plugins/builtin/source/content/views/view_strings.cpp deleted file mode 100644 index 608e44693..000000000 --- a/plugins/builtin/source/content/views/view_strings.cpp +++ /dev/null @@ -1,259 +0,0 @@ -#include "content/views/view_strings.hpp" - -#include -#include - -#include -#include -#include - -#include -#include -#include - -using namespace std::literals::string_literals; - -namespace hex::plugin::builtin { - - ViewStrings::ViewStrings() : View("hex.builtin.view.strings.name") { - EventManager::subscribe(this, [this]() { - this->m_foundStrings.clear(); - }); - - this->m_filter.reserve(0xFFFF); - std::memset(this->m_filter.data(), 0x00, this->m_filter.capacity()); - - EventManager::subscribe(this, [this] { - this->m_foundStrings.clear(); - }); - } - - ViewStrings::~ViewStrings() { - EventManager::unsubscribe(this); - EventManager::unsubscribe(this); - } - - std::string readString(const FoundString &foundString) { - std::string string(foundString.size + 1, '\0'); - ImHexApi::Provider::get()->read(foundString.offset, string.data(), foundString.size); - - return string; - } - - void ViewStrings::createStringContextMenu(const FoundString &foundString) { - if (ImGui::TableGetColumnFlags(2) == ImGuiTableColumnFlags_IsHovered && ImGui::IsMouseReleased(1) && ImGui::IsItemHovered()) { - ImGui::OpenPopup("StringContextMenu"); - this->m_selectedString = readString(foundString); - } - if (ImGui::BeginPopup("StringContextMenu")) { - if (ImGui::MenuItem("hex.builtin.view.strings.copy"_lang)) { - ImGui::SetClipboardText(this->m_selectedString.c_str()); - } - ImGui::Separator(); - if (ImGui::MenuItem("hex.builtin.view.strings.demangle"_lang)) { - this->m_demangledName = llvm::demangle(this->m_selectedString); - if (!this->m_demangledName.empty()) - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.view.strings.demangle.name"_lang); }); - } - ImGui::EndPopup(); - } - } - - void ViewStrings::searchStrings() { - this->m_foundStrings.clear(); - this->m_filterIndices.clear(); - this->m_searching = true; - - std::thread([this] { - auto provider = ImHexApi::Provider::get(); - auto task = ImHexApi::Tasks::createTask("hex.builtin.view.strings.searching", provider->getActualSize()); - - std::vector buffer(1024, 0x00); - u32 foundCharacters = 0; - - for (u64 offset = 0; offset < provider->getActualSize(); offset += buffer.size()) { - task.update(offset); - - size_t readSize = std::min(u64(buffer.size()), provider->getActualSize() - offset); - provider->read(offset + provider->getBaseAddress(), buffer.data(), readSize); - - for (u32 i = 0; i < readSize; i++) { - if (buffer[i] >= ' ' && buffer[i] <= '~' && offset < provider->getActualSize() - 1) - foundCharacters++; - else { - if (foundCharacters >= static_cast(this->m_minimumLength)) { - FoundString foundString = { - offset + i - foundCharacters + provider->getBaseAddress(), - foundCharacters - }; - - this->m_foundStrings.push_back(foundString); - this->m_filterIndices.push_back(this->m_foundStrings.size() - 1); - } - - foundCharacters = 0; - } - } - } - - this->m_searching = false; - }).detach(); - } - - void ViewStrings::drawContent() { - auto provider = ImHexApi::Provider::get(); - - if (ImGui::Begin(View::toWindowName("hex.builtin.view.strings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { - if (ImHexApi::Provider::isValid() && provider->isReadable()) { - ImGui::BeginDisabled(this->m_searching); - { - if (ImGui::InputInt("hex.builtin.view.strings.min_length"_lang, &this->m_minimumLength, 1, 0)) - this->m_foundStrings.clear(); - - if (this->m_minimumLength < 1) - this->m_minimumLength = 1; - - ImGui::Checkbox("hex.builtin.view.strings.regex"_lang, &this->m_regex); - - bool filterError = this->m_regex && !this->m_pattern_parsed; - if (filterError) - ImGui::PushStyleColor(ImGuiCol_FrameBg, ImAlphaBlendColors(ImGui::GetColorU32(ImGuiCol_FrameBg), ImColor(1.0f, 0.2f, 0.2f, 0.5f))); - - ImGui::InputText( - "hex.builtin.view.strings.filter"_lang, this->m_filter.data(), this->m_filter.size(), ImGuiInputTextFlags_CallbackEdit | ImGuiInputTextFlags_CallbackResize, [](ImGuiInputTextCallbackData *data) { - auto &view = *static_cast(data->UserData); - - if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) { - view.m_filter.resize(data->BufSize); - data->Buf = view.m_filter.data(); - } - - if (data->EventFlag == ImGuiInputTextFlags_CallbackEdit) { - view.m_filterIndices.clear(); - - std::regex pattern; - if (view.m_regex) { - try { - pattern = std::regex(data->Buf); - view.m_pattern_parsed = true; - } catch (std::regex_error &e) { - view.m_pattern_parsed = false; - } - } - for (u64 i = 0; i < view.m_foundStrings.size(); i++) { - if (view.m_regex) { - if (view.m_pattern_parsed && std::regex_search(readString(view.m_foundStrings[i]), pattern)) - view.m_filterIndices.push_back(i); - } else if (readString(view.m_foundStrings[i]).find(data->Buf) != std::string::npos) { - view.m_filterIndices.push_back(i); - } - } - } - - return 0; - }, - this); - - if (filterError) - ImGui::PopStyleColor(); - - if (ImGui::Button("hex.builtin.view.strings.extract"_lang)) - this->searchStrings(); - } - ImGui::EndDisabled(); - - if (this->m_searching) { - ImGui::SameLine(); - ImGui::TextSpinner("hex.builtin.view.strings.searching"_lang); - } else if (!this->m_foundStrings.empty()) { - ImGui::SameLine(); - ImGui::TextFormatted("hex.builtin.view.strings.results"_lang, this->m_filterIndices.size()); - } - - - ImGui::Separator(); - ImGui::NewLine(); - - if (ImGui::BeginTable("##strings", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { - ImGui::TableSetupScrollFreeze(0, 1); - ImGui::TableSetupColumn("hex.builtin.view.strings.offset"_lang, 0, -1, ImGui::GetID("offset")); - ImGui::TableSetupColumn("hex.builtin.view.strings.size"_lang, 0, -1, ImGui::GetID("size")); - ImGui::TableSetupColumn("hex.builtin.view.strings.string"_lang, 0, -1, ImGui::GetID("string")); - - auto sortSpecs = ImGui::TableGetSortSpecs(); - - if (sortSpecs->SpecsDirty) { - std::sort(this->m_foundStrings.begin(), this->m_foundStrings.end(), [&sortSpecs](FoundString &left, FoundString &right) -> bool { - if (sortSpecs->Specs->ColumnUserID == ImGui::GetID("offset")) { - if (sortSpecs->Specs->SortDirection == ImGuiSortDirection_Ascending) - return left.offset > right.offset; - else - return left.offset < right.offset; - } else if (sortSpecs->Specs->ColumnUserID == ImGui::GetID("size")) { - if (sortSpecs->Specs->SortDirection == ImGuiSortDirection_Ascending) - return left.size > right.size; - else - return left.size < right.size; - } else if (sortSpecs->Specs->ColumnUserID == ImGui::GetID("string")) { - if (sortSpecs->Specs->SortDirection == ImGuiSortDirection_Ascending) - return readString(left) > readString(right); - else - return readString(left) < readString(right); - } - - return false; - }); - - sortSpecs->SpecsDirty = false; - } - - ImGui::TableHeadersRow(); - - ImGuiListClipper clipper; - clipper.Begin(this->m_filterIndices.size()); - - while (clipper.Step()) { - for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) { - auto &foundString = this->m_foundStrings[this->m_filterIndices[i]]; - auto string = readString(foundString); - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - if (ImGui::Selectable(("##StringLine"s + std::to_string(i)).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) { - ImHexApi::HexEditor::setSelection(foundString.offset, foundString.size); - } - ImGui::PushID(i + 1); - createStringContextMenu(foundString); - ImGui::PopID(); - ImGui::SameLine(); - ImGui::TextFormatted("0x{0:08X} : 0x{1:08X}", foundString.offset, foundString.offset + foundString.size); - ImGui::TableNextColumn(); - ImGui::TextFormatted("0x{0:04X}", foundString.size); - ImGui::TableNextColumn(); - - ImGui::TextUnformatted(string.c_str()); - } - } - clipper.End(); - - ImGui::EndTable(); - } - } - } - ImGui::End(); - - if (ImGui::BeginPopup("hex.builtin.view.strings.demangle.title"_lang)) { - if (ImGui::BeginChild("##scrolling", ImVec2(500, 150))) { - ImGui::TextUnformatted("hex.builtin.view.strings.demangle.title"_lang); - ImGui::Separator(); - ImGui::TextFormattedWrapped("{}", this->m_demangledName.c_str()); - ImGui::NewLine(); - if (ImGui::Button("hex.builtin.view.strings.demangle.copy"_lang)) - ImGui::SetClipboardText(this->m_demangledName.c_str()); - } - ImGui::EndChild(); - ImGui::EndPopup(); - } - } - -} \ No newline at end of file diff --git a/plugins/builtin/source/lang/de_DE.cpp b/plugins/builtin/source/lang/de_DE.cpp index 2ecc3af4b..1103dc320 100644 --- a/plugins/builtin/source/lang/de_DE.cpp +++ b/plugins/builtin/source/lang/de_DE.cpp @@ -81,6 +81,14 @@ namespace hex::plugin::builtin { { "hex.builtin.common.browse", "Druchsuchen..." }, { "hex.builtin.common.choose_file", "Datei auswählen" }, { "hex.builtin.common.processing", "Verarbeiten" }, + { "hex.builtin.common.filter", "Filter" }, + { "hex.builtin.common.value", "Wert" }, + { "hex.builtin.common.offset", "Offset" }, + + { "hex.builtin.common.encoding.ascii", "ASCII" }, + { "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, + { "hex.builtin.common.encoding.utf16be", "UTF-16BE" }, + { "hex.builtin.common.encoding.utf8", "UTF-8" }, { "hex.builtin.popup.exit_application.title", "Applikation verlassen?" }, { "hex.builtin.popup.exit_application.desc", "Es wurden ungespeicherte Änderungen an diesem Projekt vorgenommen\nBist du sicher, dass du ImHex schliessen willst?" }, @@ -330,22 +338,6 @@ namespace hex::plugin::builtin { { "hex.builtin.view.settings.name", "Einstellungen" }, { "hex.builtin.view.settings.restart_question", "Eine Änderung die du gemacht hast benötigt einen neustart von ImHex. Möchtest du ImHex jetzt neu starten?" }, - { "hex.builtin.view.strings.name", "Strings" }, - { "hex.builtin.view.strings.copy", "String kopieren" }, - { "hex.builtin.view.strings.demangle", "Demangle" }, - { "hex.builtin.view.strings.min_length", "Minimallänge" }, - { "hex.builtin.view.strings.regex", "Regex" }, - { "hex.builtin.view.strings.filter", "Filter" }, - { "hex.builtin.view.strings.extract", "Extrahieren" }, - { "hex.builtin.view.strings.regex_error", "Ungültiges Regex" }, - { "hex.builtin.view.strings.results", "{0} Ergebnisse" }, - { "hex.builtin.view.strings.searching", "Suchen..." }, - { "hex.builtin.view.strings.offset", "Offset" }, - { "hex.builtin.view.strings.size", "Grösse" }, - { "hex.builtin.view.strings.string", "String" }, - { "hex.builtin.view.strings.demangle.title", "Demangled Namen" }, - { "hex.builtin.view.strings.demangle.copy", "Kopieren" }, - { "hex.builtin.view.tools.name", "Werkzeuge" }, { "hex.builtin.view.yara.name", "Yara Regeln" }, @@ -389,6 +381,30 @@ namespace hex::plugin::builtin { { "hex.builtin.view.provider_settings.name", "Provider Einstellungen" }, { "hex.builtin.view.provider_settings.load_popup", "Provider öffnen" }, + { "hex.builtin.view.find.name", "Finden" }, + { "hex.builtin.view.find.searching", "Suchen..." }, + { "hex.builtin.view.find.demangled", "Demangled" }, + { "hex.builtin.view.find.range", "Bereich" }, + { "hex.builtin.view.find.range.entire_data", "Gesammte Daten" }, + { "hex.builtin.view.find.range.selection", "Selektion" }, + { "hex.builtin.view.find.strings", "Strings" }, + { "hex.builtin.view.find.strings.min_length", "Minimallänge" }, + { "hex.builtin.view.find.strings.match_settings", "Sucheinstellungen" }, + { "hex.builtin.view.find.strings.null_term", "Null-Terminierung" }, + { "hex.builtin.view.find.strings.chars", "Zeichen" }, + { "hex.builtin.view.find.strings.lower_case", "Kleinbuchstaben" }, + { "hex.builtin.view.find.strings.upper_case", "Grossbuchstaben" }, + { "hex.builtin.view.find.strings.numbers", "Zahlen" }, + { "hex.builtin.view.find.strings.underscores", "Unterstriche" }, + { "hex.builtin.view.find.strings.symbols", "Symbole" }, + { "hex.builtin.view.find.strings.spaces", "Leerzeichen" }, + { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, + { "hex.builtin.view.find.sequences", "Sequenzen" }, + { "hex.builtin.view.find.regex", "Regex" }, + { "hex.builtin.view.find.search", "Suchen" }, + { "hex.builtin.view.find.context.copy", "Wert Kopieren" }, + { "hex.builtin.view.find.context.copy_demangle", "Demangled Wert Kopieren" }, + { "hex.builtin.command.calc.desc", "Rechner" }, { "hex.builtin.command.cmd.desc", "Command" }, { "hex.builtin.command.cmd.result", "Command '{0}' ausführen" }, diff --git a/plugins/builtin/source/lang/en_US.cpp b/plugins/builtin/source/lang/en_US.cpp index 3e8862806..156525bc5 100644 --- a/plugins/builtin/source/lang/en_US.cpp +++ b/plugins/builtin/source/lang/en_US.cpp @@ -82,6 +82,15 @@ namespace hex::plugin::builtin { { "hex.builtin.common.browse", "Browse..." }, { "hex.builtin.common.choose_file", "Choose file" }, { "hex.builtin.common.processing", "Processing" }, + { "hex.builtin.common.filter", "Filter" }, + { "hex.builtin.common.value", "Value" }, + { "hex.builtin.common.type", "Type" }, + { "hex.builtin.common.offset", "Offset" }, + + { "hex.builtin.common.encoding.ascii", "ASCII" }, + { "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, + { "hex.builtin.common.encoding.utf16be", "UTF-16BE" }, + { "hex.builtin.common.encoding.utf8", "UTF-8" }, { "hex.builtin.popup.exit_application.title", "Exit Application?" }, { "hex.builtin.popup.exit_application.desc", "You have unsaved changes made to your Project.\nAre you sure you want to exit?" }, @@ -332,22 +341,6 @@ namespace hex::plugin::builtin { { "hex.builtin.view.settings.name", "Settings" }, { "hex.builtin.view.settings.restart_question", "A change you made requires a restart of ImHex to take effect. Would you like to restart it now?" }, - { "hex.builtin.view.strings.name", "Strings" }, - { "hex.builtin.view.strings.copy", "Copy string" }, - { "hex.builtin.view.strings.demangle", "Demangle" }, - { "hex.builtin.view.strings.min_length", "Minimum length" }, - { "hex.builtin.view.strings.regex", "Regex" }, - { "hex.builtin.view.strings.filter", "Filter" }, - { "hex.builtin.view.strings.extract", "Extract" }, - { "hex.builtin.view.strings.regex_error", "Invalid regex" }, - { "hex.builtin.view.strings.results", "Found {0} occurrences" }, - { "hex.builtin.view.strings.searching", "Searching..." }, - { "hex.builtin.view.strings.offset", "Offset" }, - { "hex.builtin.view.strings.size", "Size" }, - { "hex.builtin.view.strings.string", "String" }, - { "hex.builtin.view.strings.demangle.title", "Demangled name" }, - { "hex.builtin.view.strings.demangle.copy", "Copy" }, - { "hex.builtin.view.tools.name", "Tools" }, { "hex.builtin.view.yara.name", "Yara Rules" }, @@ -392,6 +385,31 @@ namespace hex::plugin::builtin { { "hex.builtin.view.provider_settings.name", "Provider Settings" }, { "hex.builtin.view.provider_settings.load_popup", "Open Provider" }, + { "hex.builtin.view.find.name", "Find" }, + { "hex.builtin.view.find.searching", "Searching..." }, + { "hex.builtin.view.find.demangled", "Demangled" }, + { "hex.builtin.view.find.range", "Range" }, + { "hex.builtin.view.find.range.entire_data", "Entire Data" }, + { "hex.builtin.view.find.range.selection", "Selection" }, + { "hex.builtin.view.find.strings", "Strings" }, + { "hex.builtin.view.find.strings.min_length", "Minimum length" }, + { "hex.builtin.view.find.strings.match_settings", "Match Settings" }, + { "hex.builtin.view.find.strings.null_term", "Require Null Termination" }, + { "hex.builtin.view.find.strings.chars", "Characters" }, + { "hex.builtin.view.find.strings.lower_case", "Lower case letters" }, + { "hex.builtin.view.find.strings.upper_case", "Upper case letters" }, + { "hex.builtin.view.find.strings.numbers", "Numbers" }, + { "hex.builtin.view.find.strings.underscores", "Underscores" }, + { "hex.builtin.view.find.strings.symbols", "Symbols" }, + { "hex.builtin.view.find.strings.spaces", "Spaces" }, + { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, + { "hex.builtin.view.find.sequences", "Sequences" }, + { "hex.builtin.view.find.regex", "Regex" }, + { "hex.builtin.view.find.search", "Search" }, + { "hex.builtin.view.find.context.copy", "Copy Value" }, + { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, + + { "hex.builtin.command.calc.desc", "Calculator" }, { "hex.builtin.command.cmd.desc", "Command" }, { "hex.builtin.command.cmd.result", "Run command '{0}'" }, diff --git a/plugins/builtin/source/lang/it_IT.cpp b/plugins/builtin/source/lang/it_IT.cpp index 47efd62b0..0c44213d7 100644 --- a/plugins/builtin/source/lang/it_IT.cpp +++ b/plugins/builtin/source/lang/it_IT.cpp @@ -81,6 +81,14 @@ namespace hex::plugin::builtin { { "hex.builtin.common.browse", "Esplora..." }, { "hex.builtin.common.choose_file", "Scegli file" }, //{ "hex.builtin.common.processing", "Processing" }, + //{ "hex.builtin.common.filter", "Filter" }, + //{ "hex.builtin.common.value", "Value" }, + { "hex.builtin.common.offset", "Offset" }, + + { "hex.builtin.common.encoding.ascii", "ASCII" }, + { "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, + { "hex.builtin.common.encoding.utf16be", "UTF-16BE" }, + { "hex.builtin.common.encoding.utf8", "UTF-8" }, { "hex.builtin.popup.exit_application.title", "Uscire dall'applicazione?" }, { "hex.builtin.popup.exit_application.desc", "Hai delle modifiche non salvate nel tuo progetto.\nSei sicuro di voler uscire?" }, @@ -334,20 +342,6 @@ namespace hex::plugin::builtin { { "hex.builtin.view.settings.name", "Impostazioni" }, //{ "hex.builtin.view.settings.restart_question", "A change you made requires a restart of ImHex to take effect. Would you like to restart it now?" }, - { "hex.builtin.view.strings.name", "Stringhe" }, - { "hex.builtin.view.strings.copy", "Copia stringa" }, - { "hex.builtin.view.strings.demangle", "Demangle" }, - { "hex.builtin.view.strings.min_length", "Lunghezza minima" }, - //{ "hex.builtin.view.strings.regex", "Regex" }, - { "hex.builtin.view.strings.filter", "Filtro" }, - { "hex.builtin.view.strings.extract", "Estrai" }, - { "hex.builtin.view.strings.searching", "Sto cercando..." }, - { "hex.builtin.view.strings.offset", "Offset" }, - { "hex.builtin.view.strings.size", "Dimensione" }, - { "hex.builtin.view.strings.string", "Stringa" }, - { "hex.builtin.view.strings.demangle.title", "Nome Demangled" }, - { "hex.builtin.view.strings.demangle.copy", "Copia" }, - { "hex.builtin.view.tools.name", "Strumenti" }, { "hex.builtin.view.yara.name", "Regole di Yara" }, @@ -390,6 +384,30 @@ namespace hex::plugin::builtin { { "hex.builtin.view.provider_settings.name", "Impostazioni Provider" }, { "hex.builtin.view.provider_settings.load_popup", "Apri Provider" }, + //{ "hex.builtin.view.find.name", "Find" }, + // { "hex.builtin.view.find.searching", "Searching..." }, + // { "hex.builtin.view.find.demangled", "Demangled" }, + // { "hex.builtin.view.find.range", "Range" }, + // { "hex.builtin.view.find.range.entire_data", "Entire Data" }, + // { "hex.builtin.view.find.range.selection", "Selection" }, + // { "hex.builtin.view.find.strings", "Strings" }, + // { "hex.builtin.view.find.strings.min_length", "Minimum length" }, + // { "hex.builtin.view.find.strings.match_settings", "Match Settings" }, + // { "hex.builtin.view.find.strings.null_term", "Require Null Termination" }, + // { "hex.builtin.view.find.strings.chars", "Characters" }, + // { "hex.builtin.view.find.strings.lower_case", "Lower case letters" }, + // { "hex.builtin.view.find.strings.upper_case", "Upper case letters" }, + // { "hex.builtin.view.find.strings.numbers", "Numbers" }, + // { "hex.builtin.view.find.strings.underscores", "Underscores" }, + // { "hex.builtin.view.find.strings.symbols", "Symbols" }, + // { "hex.builtin.view.find.strings.spaces", "Spaces" }, + // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, + // { "hex.builtin.view.find.sequences", "Sequences" }, + // { "hex.builtin.view.find.regex", "Regex" }, + // { "hex.builtin.view.find.search", "Search" }, + // { "hex.builtin.view.find.context.copy", "Copy Value" }, + // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, + { "hex.builtin.command.calc.desc", "Calcolatrice" }, { "hex.builtin.command.cmd.desc", "Comando" }, { "hex.builtin.command.cmd.result", "Esegui comando '{0}'" }, diff --git a/plugins/builtin/source/lang/ja_JP.cpp b/plugins/builtin/source/lang/ja_JP.cpp index 4175ece64..24f3a2d60 100644 --- a/plugins/builtin/source/lang/ja_JP.cpp +++ b/plugins/builtin/source/lang/ja_JP.cpp @@ -81,6 +81,14 @@ namespace hex::plugin::builtin { { "hex.builtin.common.browse", "ファイルを参照..." }, { "hex.builtin.common.choose_file", "ファイルを選択" }, // { "hex.builtin.common.processing", "Processing" }, + //{ "hex.builtin.common.filter", "Filter" }, + //{ "hex.builtin.common.value", "Value" }, + { "hex.builtin.common.offset", "オフセット" }, + + { "hex.builtin.common.encoding.ascii", "ASCII" }, + { "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, + { "hex.builtin.common.encoding.utf16be", "UTF-16BE" }, + { "hex.builtin.common.encoding.utf8", "UTF-8" }, { "hex.builtin.popup.exit_application.title", "アプリケーションを終了しますか?" }, { "hex.builtin.popup.exit_application.desc", "プロジェクトに保存されていない変更があります。\n終了してもよろしいですか?" }, @@ -333,22 +341,6 @@ namespace hex::plugin::builtin { { "hex.builtin.view.settings.name", "設定" }, //{ "hex.builtin.view.settings.restart_question", "A change you made requires a restart of ImHex to take effect. Would you like to restart it now?" }, - { "hex.builtin.view.strings.name", "文字列" }, - { "hex.builtin.view.strings.copy", "文字列をコピー" }, - { "hex.builtin.view.strings.demangle", "デマングル" }, - { "hex.builtin.view.strings.min_length", "最小の長さ" }, - //{ "hex.builtin.view.strings.regex", "Regex" }, - { "hex.builtin.view.strings.filter", "フィルタ" }, - { "hex.builtin.view.strings.extract", "抽出" }, - { "hex.builtin.view.strings.regex_error", "無効な正規表現" }, - { "hex.builtin.view.strings.results", "{0} 件見つかりました" }, - { "hex.builtin.view.strings.searching", "検索中..." }, - { "hex.builtin.view.strings.offset", "オフセット" }, - { "hex.builtin.view.strings.size", "サイズ" }, - { "hex.builtin.view.strings.string", "文字列" }, - { "hex.builtin.view.strings.demangle.title", "デマングルした名前" }, - { "hex.builtin.view.strings.demangle.copy", "コピー" }, - { "hex.builtin.view.tools.name", "ツール" }, { "hex.builtin.view.yara.name", "Yaraルール" }, @@ -393,6 +385,30 @@ namespace hex::plugin::builtin { { "hex.builtin.view.provider_settings.name", "プロバイダ設定" }, { "hex.builtin.view.provider_settings.load_popup", "プロバイダを開く" }, + //{ "hex.builtin.view.find.name", "Find" }, + // { "hex.builtin.view.find.searching", "Searching..." }, + // { "hex.builtin.view.find.demangled", "Demangled" }, + // { "hex.builtin.view.find.range", "Range" }, + // { "hex.builtin.view.find.range.entire_data", "Entire Data" }, + // { "hex.builtin.view.find.range.selection", "Selection" }, + // { "hex.builtin.view.find.strings", "Strings" }, + // { "hex.builtin.view.find.strings.min_length", "Minimum length" }, + // { "hex.builtin.view.find.strings.match_settings", "Match Settings" }, + // { "hex.builtin.view.find.strings.null_term", "Require Null Termination" }, + // { "hex.builtin.view.find.strings.chars", "Characters" }, + // { "hex.builtin.view.find.strings.lower_case", "Lower case letters" }, + // { "hex.builtin.view.find.strings.upper_case", "Upper case letters" }, + // { "hex.builtin.view.find.strings.numbers", "Numbers" }, + // { "hex.builtin.view.find.strings.underscores", "Underscores" }, + // { "hex.builtin.view.find.strings.symbols", "Symbols" }, + // { "hex.builtin.view.find.strings.spaces", "Spaces" }, + // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, + // { "hex.builtin.view.find.sequences", "Sequences" }, + // { "hex.builtin.view.find.regex", "Regex" }, + // { "hex.builtin.view.find.search", "Search" }, + // { "hex.builtin.view.find.context.copy", "Copy Value" }, + // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, + { "hex.builtin.command.calc.desc", "計算機" }, { "hex.builtin.command.cmd.desc", "コマンド" }, { "hex.builtin.command.cmd.result", "コマンド '{0}' を実行" }, diff --git a/plugins/builtin/source/lang/pt_BR.cpp b/plugins/builtin/source/lang/pt_BR.cpp index e1b90d3fa..ae89ac344 100644 --- a/plugins/builtin/source/lang/pt_BR.cpp +++ b/plugins/builtin/source/lang/pt_BR.cpp @@ -81,6 +81,14 @@ namespace hex::plugin::builtin { { "hex.builtin.common.browse", "Navegar..." }, { "hex.builtin.common.choose_file", "Escolher arquivo" }, { "hex.builtin.common.processing", "Processando" }, + //{ "hex.builtin.common.filter", "Filter" }, + //{ "hex.builtin.common.value", "Value" }, + { "hex.builtin.common.offset", "Offset" }, + + { "hex.builtin.common.encoding.ascii", "ASCII" }, + { "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, + { "hex.builtin.common.encoding.utf16be", "UTF-16BE" }, + { "hex.builtin.common.encoding.utf8", "UTF-8" }, { "hex.builtin.popup.exit_application.title", "Sair da aplicação?" }, { "hex.builtin.popup.exit_application.desc", "Você tem alterações não salvas feitas em seu projeto.\nVocê tem certeza que quer sair?" }, @@ -330,22 +338,6 @@ namespace hex::plugin::builtin { { "hex.builtin.view.settings.name", "Configurações" }, { "hex.builtin.view.settings.restart_question", "Uma alteração que você fez requer uma reinicialização do ImHex para entrar em vigor. Deseja reiniciar agora?" }, - { "hex.builtin.view.strings.name", "Strings" }, - { "hex.builtin.view.strings.copy", "Copiar string" }, - { "hex.builtin.view.strings.demangle", "Demangle" }, - { "hex.builtin.view.strings.min_length", "Comprimento mínimo" }, - //{ "hex.builtin.view.strings.regex", "Regex" }, - { "hex.builtin.view.strings.filter", "Filtro" }, - { "hex.builtin.view.strings.extract", "Extrair" }, - { "hex.builtin.view.strings.regex_error", "Invalid regex" }, - { "hex.builtin.view.strings.results", "Encontrado {0} ocorrências" }, - { "hex.builtin.view.strings.searching", "Procurando..." }, - { "hex.builtin.view.strings.offset", "Desvio" }, - { "hex.builtin.view.strings.size", "Tamanho" }, - { "hex.builtin.view.strings.string", "String" }, - { "hex.builtin.view.strings.demangle.title", "Nome Desmembrado" }, - { "hex.builtin.view.strings.demangle.copy", "Copiar" }, - { "hex.builtin.view.tools.name", "Ferramentas" }, { "hex.builtin.view.yara.name", "Regras Yara" }, @@ -390,6 +382,30 @@ namespace hex::plugin::builtin { { "hex.builtin.view.provider_settings.name", "Configurações do provedor" }, { "hex.builtin.view.provider_settings.load_popup", "Abrir Provedor" }, + //{ "hex.builtin.view.find.name", "Find" }, + // { "hex.builtin.view.find.searching", "Searching..." }, + // { "hex.builtin.view.find.demangled", "Demangled" }, + // { "hex.builtin.view.find.range", "Range" }, + // { "hex.builtin.view.find.range.entire_data", "Entire Data" }, + // { "hex.builtin.view.find.range.selection", "Selection" }, + // { "hex.builtin.view.find.strings", "Strings" }, + // { "hex.builtin.view.find.strings.min_length", "Minimum length" }, + // { "hex.builtin.view.find.strings.match_settings", "Match Settings" }, + // { "hex.builtin.view.find.strings.null_term", "Require Null Termination" }, + // { "hex.builtin.view.find.strings.chars", "Characters" }, + // { "hex.builtin.view.find.strings.lower_case", "Lower case letters" }, + // { "hex.builtin.view.find.strings.upper_case", "Upper case letters" }, + // { "hex.builtin.view.find.strings.numbers", "Numbers" }, + // { "hex.builtin.view.find.strings.underscores", "Underscores" }, + // { "hex.builtin.view.find.strings.symbols", "Symbols" }, + // { "hex.builtin.view.find.strings.spaces", "Spaces" }, + // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, + // { "hex.builtin.view.find.sequences", "Sequences" }, + // { "hex.builtin.view.find.regex", "Regex" }, + // { "hex.builtin.view.find.search", "Search" }, + // { "hex.builtin.view.find.context.copy", "Copy Value" }, + // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, + { "hex.builtin.command.calc.desc", "Calculadora" }, { "hex.builtin.command.cmd.desc", "Comando" }, { "hex.builtin.command.cmd.result", "Iniciar Comando '{0}'" }, diff --git a/plugins/builtin/source/lang/zh_CN.cpp b/plugins/builtin/source/lang/zh_CN.cpp index 2980fbae5..dd9b5ced7 100644 --- a/plugins/builtin/source/lang/zh_CN.cpp +++ b/plugins/builtin/source/lang/zh_CN.cpp @@ -81,6 +81,14 @@ namespace hex::plugin::builtin { { "hex.builtin.common.browse", "浏览..." }, { "hex.builtin.common.choose_file", "选择文件" }, { "hex.builtin.common.processing", "处理" }, + //{ "hex.builtin.common.filter", "Filter" }, + //{ "hex.builtin.common.value", "Value" }, + { "hex.builtin.common.offset", "偏移" }, + + { "hex.builtin.common.encoding.ascii", "ASCII" }, + { "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, + { "hex.builtin.common.encoding.utf16be", "UTF-16BE" }, + { "hex.builtin.common.encoding.utf8", "UTF-8" }, { "hex.builtin.popup.exit_application.title", "退出?" }, { "hex.builtin.popup.exit_application.desc", "工程还有未保存的更改。\n确定要退出吗?" }, @@ -334,24 +342,6 @@ namespace hex::plugin::builtin { { "hex.builtin.view.settings.name", "设置" }, { "hex.builtin.view.settings.restart_question", "一项更改需要重启 ImHex 以生效,您想要现在重启吗?" }, - { "hex.builtin.view.strings.name", "字符串" }, - { "hex.builtin.view.strings.copy", "复制字符串" }, - { "hex.builtin.view.strings.demangle", "还原" }, - { "hex.builtin.view.strings.min_length", "最小长度" }, - { "hex.builtin.view.strings.regex", "使用正则表达式" }, - { "hex.builtin.view.strings.filter", "搜索内容" }, - { "hex.builtin.view.strings.extract", "搜索" }, - { "hex.builtin.view.strings.regex_error", "非法正则" }, - { "hex.builtin.view.strings.results", "找到 {0} 个结果" }, - { "hex.builtin.view.strings.filter", "过滤" }, - { "hex.builtin.view.strings.extract", "提取" }, - { "hex.builtin.view.strings.searching", "搜索中..." }, - { "hex.builtin.view.strings.offset", "偏移" }, - { "hex.builtin.view.strings.size", "大小" }, - { "hex.builtin.view.strings.string", "字符串" }, - { "hex.builtin.view.strings.demangle.title", "还原名" }, - { "hex.builtin.view.strings.demangle.copy", "复制" }, - { "hex.builtin.view.tools.name", "工具" }, { "hex.builtin.view.yara.name", "Yara 规则" }, @@ -395,6 +385,30 @@ namespace hex::plugin::builtin { { "hex.builtin.view.provider_settings.name", "提供器设置" }, { "hex.builtin.view.provider_settings.load_popup", "打开提供器" }, + //{ "hex.builtin.view.find.name", "Find" }, + // { "hex.builtin.view.find.searching", "Searching..." }, + // { "hex.builtin.view.find.demangled", "Demangled" }, + // { "hex.builtin.view.find.range", "Range" }, + // { "hex.builtin.view.find.range.entire_data", "Entire Data" }, + // { "hex.builtin.view.find.range.selection", "Selection" }, + // { "hex.builtin.view.find.strings", "Strings" }, + // { "hex.builtin.view.find.strings.min_length", "Minimum length" }, + // { "hex.builtin.view.find.strings.match_settings", "Match Settings" }, + // { "hex.builtin.view.find.strings.null_term", "Require Null Termination" }, + // { "hex.builtin.view.find.strings.chars", "Characters" }, + // { "hex.builtin.view.find.strings.lower_case", "Lower case letters" }, + // { "hex.builtin.view.find.strings.upper_case", "Upper case letters" }, + // { "hex.builtin.view.find.strings.numbers", "Numbers" }, + // { "hex.builtin.view.find.strings.underscores", "Underscores" }, + // { "hex.builtin.view.find.strings.symbols", "Symbols" }, + // { "hex.builtin.view.find.strings.spaces", "Spaces" }, + // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, + // { "hex.builtin.view.find.sequences", "Sequences" }, + // { "hex.builtin.view.find.regex", "Regex" }, + // { "hex.builtin.view.find.search", "Search" }, + // { "hex.builtin.view.find.context.copy", "Copy Value" }, + // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, + { "hex.builtin.command.calc.desc", "计算器" }, { "hex.builtin.command.cmd.desc", "指令" }, { "hex.builtin.command.cmd.result", "运行指令 '{0}'" }, diff --git a/plugins/builtin/source/lang/zh_TW.cpp b/plugins/builtin/source/lang/zh_TW.cpp index 4e96f8877..1df73e1d8 100644 --- a/plugins/builtin/source/lang/zh_TW.cpp +++ b/plugins/builtin/source/lang/zh_TW.cpp @@ -81,6 +81,14 @@ namespace hex::plugin::builtin { { "hex.builtin.common.browse", "瀏覽..." }, { "hex.builtin.common.choose_file", "選擇檔案" }, { "hex.builtin.common.processing", "正在處理" }, + //{ "hex.builtin.common.filter", "Filter" }, + //{ "hex.builtin.common.value", "Value" }, + { "hex.builtin.common.offset", "位移" }, + + { "hex.builtin.common.encoding.ascii", "ASCII" }, + { "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, + { "hex.builtin.common.encoding.utf16be", "UTF-16BE" }, + { "hex.builtin.common.encoding.utf8", "UTF-8" }, { "hex.builtin.popup.exit_application.title", "離開應用程式?" }, { "hex.builtin.popup.exit_application.desc", "您的專案有未儲存的更動。\n您確定要離開嗎?" }, @@ -331,22 +339,6 @@ namespace hex::plugin::builtin { { "hex.builtin.view.settings.name", "設定" }, { "hex.builtin.view.settings.restart_question", "需要重啟 ImHex 方能使您所做的更動生效。您要現在重新啟動嗎?" }, - { "hex.builtin.view.strings.name", "字串" }, - { "hex.builtin.view.strings.copy", "複製字串" }, - { "hex.builtin.view.strings.demangle", "Demangle" }, - { "hex.builtin.view.strings.min_length", "最小長度" }, - { "hex.builtin.view.strings.regex", "Regex" }, - { "hex.builtin.view.strings.filter", "Filter" }, - { "hex.builtin.view.strings.extract", "Extract" }, - { "hex.builtin.view.strings.regex_error", "Invalid regex" }, - { "hex.builtin.view.strings.results", "Found {0} occurrences" }, - { "hex.builtin.view.strings.searching", "Searching..." }, - { "hex.builtin.view.strings.offset", "位移" }, - { "hex.builtin.view.strings.size", "大小" }, - { "hex.builtin.view.strings.string", "字串" }, - { "hex.builtin.view.strings.demangle.title", "Demangled name" }, - { "hex.builtin.view.strings.demangle.copy", "複製" }, - { "hex.builtin.view.tools.name", "工具" }, { "hex.builtin.view.yara.name", "Yara 規則" }, @@ -391,6 +383,30 @@ namespace hex::plugin::builtin { { "hex.builtin.view.provider_settings.name", "提供者設定" }, { "hex.builtin.view.provider_settings.load_popup", "開啟提供者" }, + //{ "hex.builtin.view.find.name", "Find" }, + // { "hex.builtin.view.find.searching", "Searching..." }, + // { "hex.builtin.view.find.demangled", "Demangled" }, + // { "hex.builtin.view.find.range", "Range" }, + // { "hex.builtin.view.find.range.entire_data", "Entire Data" }, + // { "hex.builtin.view.find.range.selection", "Selection" }, + // { "hex.builtin.view.find.strings", "Strings" }, + // { "hex.builtin.view.find.strings.min_length", "Minimum length" }, + // { "hex.builtin.view.find.strings.match_settings", "Match Settings" }, + // { "hex.builtin.view.find.strings.null_term", "Require Null Termination" }, + // { "hex.builtin.view.find.strings.chars", "Characters" }, + // { "hex.builtin.view.find.strings.lower_case", "Lower case letters" }, + // { "hex.builtin.view.find.strings.upper_case", "Upper case letters" }, + // { "hex.builtin.view.find.strings.numbers", "Numbers" }, + // { "hex.builtin.view.find.strings.underscores", "Underscores" }, + // { "hex.builtin.view.find.strings.symbols", "Symbols" }, + // { "hex.builtin.view.find.strings.spaces", "Spaces" }, + // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, + // { "hex.builtin.view.find.sequences", "Sequences" }, + // { "hex.builtin.view.find.regex", "Regex" }, + // { "hex.builtin.view.find.search", "Search" }, + // { "hex.builtin.view.find.context.copy", "Copy Value" }, + // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, + { "hex.builtin.command.calc.desc", "計算機" }, { "hex.builtin.command.cmd.desc", "命令" }, { "hex.builtin.command.cmd.result", "執行命令 '{0}'" },