diff options
author | MANTANI Nobutaka <nobutaka@FreeBSD.org> | 2023-02-15 14:25:12 +0000 |
---|---|---|
committer | MANTANI Nobutaka <nobutaka@FreeBSD.org> | 2023-02-15 14:26:42 +0000 |
commit | b72dc62032a1313942c465d602ee4041daaa5467 (patch) | |
tree | 5e973233fb84e8547f6dfbd1567b95e8665ea5c9 /editors/imhex/files | |
parent | 6c5242302936254a372b300268764327b9cbb8bb (diff) | |
download | ports-b72dc62032a1313942c465d602ee4041daaa5467.tar.gz ports-b72dc62032a1313942c465d602ee4041daaa5467.zip |
editors/imhex: Update to 1.27.1
Diffstat (limited to 'editors/imhex/files')
16 files changed, 244 insertions, 168 deletions
diff --git a/editors/imhex/files/patch-CMakeLists.txt b/editors/imhex/files/patch-CMakeLists.txt index 210b207d0448..4839db5e37f7 100644 --- a/editors/imhex/files/patch-CMakeLists.txt +++ b/editors/imhex/files/patch-CMakeLists.txt @@ -1,15 +1,6 @@ ---- CMakeLists.txt.orig 2022-11-14 09:07:21 UTC +--- CMakeLists.txt.orig 2023-02-15 08:39:23 UTC +++ CMakeLists.txt -@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20) - # Options - option(IMHEX_USE_BUNDLED_CA "Use the CA bundle in romfs instead of the system one" OFF) - option(IMHEX_PLUGINS_IN_SHARE "Put the plugins in share/imhex/plugins instead of lib[..]/imhex/plugins" OFF) --option(IMHEX_STRIP_RELEASE "Strip the release builds" ON) -+option(IMHEX_STRIP_RELEASE "Strip the release builds" OFF) - option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF) - option(IMHEX_IGNORE_BAD_CLONE "Disable the bad clone prevention checks" OFF) - option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF) -@@ -23,8 +23,6 @@ project(imhex VERSION ${IMHEX_VERSION}) +@@ -28,8 +28,6 @@ project(imhex # Make sure project is configured correctly setDefaultBuiltTypeIfUnset() diff --git a/editors/imhex/files/patch-cmake_build__helpers.cmake b/editors/imhex/files/patch-cmake_build__helpers.cmake index 3aed175bcc8d..375109f88029 100644 --- a/editors/imhex/files/patch-cmake_build__helpers.cmake +++ b/editors/imhex/files/patch-cmake_build__helpers.cmake @@ -1,4 +1,4 @@ ---- cmake/build_helpers.cmake.orig 2023-01-05 08:53:49 UTC +--- cmake/build_helpers.cmake.orig 2023-02-15 13:56:27 UTC +++ cmake/build_helpers.cmake @@ -370,13 +370,13 @@ function(downloadImHexPatternsFiles dest) @@ -24,11 +24,3 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IMHEX_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMHEX_C_FLAGS}") -@@ -434,7 +433,6 @@ macro(addBundledLibraries) - endif() - - if (NOT USE_SYSTEM_NFD) -- set(NFD_PORTAL ON CACHE BOOL "Use Portals for Linux file dialogs" FORCE) - add_subdirectory(${EXTERN_LIBS_FOLDER}/nativefiledialog EXCLUDE_FROM_ALL) - set_target_properties(nfd PROPERTIES POSITION_INDEPENDENT_CODE ON) - set(NFD_LIBRARIES nfd) diff --git a/editors/imhex/files/patch-lib_external_pattern__language_CMakeLists.txt b/editors/imhex/files/patch-lib_external_pattern__language_CMakeLists.txt deleted file mode 100644 index 23723b28f688..000000000000 --- a/editors/imhex/files/patch-lib_external_pattern__language_CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ ---- lib/external/pattern_language/CMakeLists.txt.orig 2023-01-05 15:06:41 UTC -+++ lib/external/pattern_language/CMakeLists.txt -@@ -8,8 +8,6 @@ option(LIBPL_ENABLE_TESTS "Enable testing" OFF) - option(LIBPL_ENABLE_CLI "Enable building the CLI tool" ON) - option(LIBPL_ENABLE_EXAMPLE "Enable building the examples" OFF) - --set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-overflow -Wno-array-bounds") -- - if (WIN32) - add_compile_definitions(OS_WINDOWS) - elseif (APPLE) diff --git a/editors/imhex/files/patch-lib_external_pattern__language_lib_include_pl_core_token.hpp b/editors/imhex/files/patch-lib_external_pattern__language_lib_include_pl_core_token.hpp index 51443a6ce271..d33644543603 100644 --- a/editors/imhex/files/patch-lib_external_pattern__language_lib_include_pl_core_token.hpp +++ b/editors/imhex/files/patch-lib_external_pattern__language_lib_include_pl_core_token.hpp @@ -1,6 +1,6 @@ ---- lib/external/pattern_language/lib/include/pl/core/token.hpp.orig 2023-01-09 11:44:49 UTC +--- lib/external/pattern_language/lib/include/pl/core/token.hpp.orig 2023-02-13 14:23:14 UTC +++ lib/external/pattern_language/lib/include/pl/core/token.hpp -@@ -151,14 +151,14 @@ namespace pl::core { +@@ -155,7 +155,7 @@ namespace pl::core { bool global; std::string comment; @@ -8,22 +8,22 @@ + bool operator==(const DocComment &) const = default; }; - using Literal = std::variant<char, bool, u128, i128, double, std::string, ptrn::Pattern *>; + struct Literal : public std::variant<char, bool, u128, i128, double, std::string, ptrn::Pattern *> { +@@ -183,7 +183,7 @@ namespace pl::core { + using ValueTypes = std::variant<Keyword, Identifier, Operator, Literal, ValueType, Separator, DocComment>; -+ // These changes are necessary for Clang -+ inline Token(Type type, auto value, u32 line, u32 column) : type(type), value(std::move(value)), line(line), column(column) {} - constexpr Token(Type type, auto value, u32 line, u32 column) : type(type), value(std::move(value)), line(line), column(column) {} -- ++ inline Token(Type type, auto value, u32 line, u32 column) : type(type), value(std::move(value)), line(line), column(column) {} + [[nodiscard]] constexpr static inline bool isInteger(const ValueType &type) { return isUnsigned(type) || isSigned(type); - } -@@ -227,134 +227,134 @@ namespace pl::core { +@@ -220,136 +220,136 @@ namespace pl::core { namespace tkn { - constexpr inline Token createToken(const core::Token::Type type, const core::Token::ValueTypes &value) { -+ inline pl::core::Token createToken(const core::Token::Type type, const core::Token::ValueTypes &value) { ++ inline Token createToken(const core::Token::Type type, const core::Token::ValueTypes &value) { return { type, value, 1, 1 }; } @@ -50,6 +50,8 @@ - constexpr auto In = createToken(core::Token::Type::Keyword, Token::Keyword::In); - constexpr auto Out = createToken(core::Token::Type::Keyword, Token::Keyword::Out); - constexpr auto Reference = createToken(core::Token::Type::Keyword, Token::Keyword::Reference); +- constexpr auto Null = createToken(core::Token::Type::Keyword, Token::Keyword::Null); +- constexpr auto Const = createToken(core::Token::Type::Keyword, Token::Keyword::Const); + inline auto If = createToken(core::Token::Type::Keyword, Token::Keyword::If); + inline auto Else = createToken(core::Token::Type::Keyword, Token::Keyword::Else); + inline auto While = createToken(core::Token::Type::Keyword, Token::Keyword::While); @@ -71,6 +73,8 @@ + inline auto In = createToken(core::Token::Type::Keyword, Token::Keyword::In); + inline auto Out = createToken(core::Token::Type::Keyword, Token::Keyword::Out); + inline auto Reference = createToken(core::Token::Type::Keyword, Token::Keyword::Reference); ++ inline auto Null = createToken(core::Token::Type::Keyword, Token::Keyword::Null); ++ inline auto Const = createToken(core::Token::Type::Keyword, Token::Keyword::Const); } diff --git a/editors/imhex/files/patch-lib_external_pattern__language_lib_include_pl_patterns_pattern.hpp b/editors/imhex/files/patch-lib_external_pattern__language_lib_include_pl_patterns_pattern.hpp new file mode 100644 index 000000000000..04b38f4f4b6c --- /dev/null +++ b/editors/imhex/files/patch-lib_external_pattern__language_lib_include_pl_patterns_pattern.hpp @@ -0,0 +1,11 @@ +--- lib/external/pattern_language/lib/include/pl/patterns/pattern.hpp.orig 2023-02-15 14:19:06 UTC ++++ lib/external/pattern_language/lib/include/pl/patterns/pattern.hpp +@@ -317,7 +317,7 @@ namespace pl::ptrn { + auto startOffset = child->getOffset(); + + child->setOffset(offset); +- PL_ON_SCOPE_EXIT { child->setOffset(startOffset); }; ++ [[maybe_unused]] auto PL_ANONYMOUS_VARIABLE(SCOPE_EXIT_) = ::pl::scope_guard::ScopeGuardOnExit() + [&, child=child]() { child->setOffset(startOffset); }; + + auto bytes = child->getBytes(); + std::copy(bytes.begin(), bytes.end(), std::back_inserter(result)); diff --git a/editors/imhex/files/patch-lib_libimhex_include_hex_data__processor_node.hpp b/editors/imhex/files/patch-lib_libimhex_include_hex_data__processor_node.hpp index b0388d966bd2..75f1f09572bf 100644 --- a/editors/imhex/files/patch-lib_libimhex_include_hex_data__processor_node.hpp +++ b/editors/imhex/files/patch-lib_libimhex_include_hex_data__processor_node.hpp @@ -1,6 +1,6 @@ ---- lib/libimhex/include/hex/data_processor/node.hpp.orig 2022-10-08 08:03:47 UTC +--- lib/libimhex/include/hex/data_processor/node.hpp.orig 2023-02-12 18:24:04 UTC +++ lib/libimhex/include/hex/data_processor/node.hpp -@@ -46,6 +46,7 @@ namespace hex::dp { +@@ -49,6 +49,7 @@ namespace hex::dp { struct NodeError { Node *node; std::string message; diff --git a/editors/imhex/files/patch-lib_libimhex_include_hex_helpers_patches.hpp b/editors/imhex/files/patch-lib_libimhex_include_hex_helpers_patches.hpp new file mode 100644 index 000000000000..fb97498212b6 --- /dev/null +++ b/editors/imhex/files/patch-lib_libimhex_include_hex_helpers_patches.hpp @@ -0,0 +1,26 @@ +--- lib/libimhex/include/hex/helpers/patches.hpp.orig 2023-02-13 15:24:10 UTC ++++ lib/libimhex/include/hex/helpers/patches.hpp +@@ -4,7 +4,7 @@ + + #include <map> + #include <vector> +-#include <expected> ++#include <tl/expected.hpp> + + namespace hex { + +@@ -18,9 +18,9 @@ namespace hex { + MissingEOF + }; + +- std::expected<std::vector<u8>, IPSError> generateIPSPatch(const Patches &patches); +- std::expected<std::vector<u8>, IPSError> generateIPS32Patch(const Patches &patches); ++ tl::expected<std::vector<u8>, IPSError> generateIPSPatch(const Patches &patches); ++ tl::expected<std::vector<u8>, IPSError> generateIPS32Patch(const Patches &patches); + +- std::expected<Patches, IPSError> loadIPSPatch(const std::vector<u8> &ipsPatch); +- std::expected<Patches, IPSError> loadIPS32Patch(const std::vector<u8> &ipsPatch); ++ tl::expected<Patches, IPSError> loadIPSPatch(const std::vector<u8> &ipsPatch); ++ tl::expected<Patches, IPSError> loadIPS32Patch(const std::vector<u8> &ipsPatch); + } +\ No newline at end of file diff --git a/editors/imhex/files/patch-lib_libimhex_source_api_project__file__manager.cpp b/editors/imhex/files/patch-lib_libimhex_source_api_project__file__manager.cpp new file mode 100644 index 000000000000..f8ed1e496d67 --- /dev/null +++ b/editors/imhex/files/patch-lib_libimhex_source_api_project__file__manager.cpp @@ -0,0 +1,11 @@ +--- lib/libimhex/source/api/project_file_manager.cpp.orig 2023-02-13 15:22:20 UTC ++++ lib/libimhex/source/api/project_file_manager.cpp +@@ -43,7 +43,7 @@ namespace hex { + return false; + } + +- auto providers = auto(ImHexApi::Provider::getProviders()); ++ auto providers = ImHexApi::Provider::getProviders(); + for (const auto &provider : providers) { + ImHexApi::Provider::remove(provider); + } diff --git a/editors/imhex/files/patch-lib_libimhex_source_helpers_fs.cpp b/editors/imhex/files/patch-lib_libimhex_source_helpers_fs.cpp index a1901ae5fa7c..ca035f5b4856 100644 --- a/editors/imhex/files/patch-lib_libimhex_source_helpers_fs.cpp +++ b/editors/imhex/files/patch-lib_libimhex_source_helpers_fs.cpp @@ -1,6 +1,6 @@ ---- lib/libimhex/source/helpers/fs.cpp.orig 2023-01-05 08:53:49 UTC +--- lib/libimhex/source/helpers/fs.cpp.orig 2023-02-12 18:24:04 UTC +++ lib/libimhex/source/helpers/fs.cpp -@@ -14,10 +14,15 @@ +@@ -15,10 +15,15 @@ #include <shlobj.h> #elif defined(OS_LINUX) #include <xdg.hpp> @@ -16,3 +16,12 @@ #include <filesystem> namespace hex::fs { +@@ -101,7 +106,7 @@ namespace hex::fs { + result = NFD::PickFolder(outPath, defaultPath.empty() ? nullptr : defaultPath.c_str()); + break; + default: +- std::unreachable(); ++ pl::hlp::unreachable(); + } + + if (result == NFD_OKAY){ diff --git a/editors/imhex/files/patch-lib_libimhex_source_helpers_patches.cpp b/editors/imhex/files/patch-lib_libimhex_source_helpers_patches.cpp new file mode 100644 index 000000000000..dd41c9f794f8 --- /dev/null +++ b/editors/imhex/files/patch-lib_libimhex_source_helpers_patches.cpp @@ -0,0 +1,126 @@ +--- lib/libimhex/source/helpers/patches.cpp.orig 2023-02-13 15:36:19 UTC ++++ lib/libimhex/source/helpers/patches.cpp +@@ -18,7 +18,7 @@ namespace hex { + std::memcpy((&buffer.back() - sizeof(T)) + 1, &bytes, sizeof(T)); + } + +- std::expected<std::vector<u8>, IPSError> generateIPSPatch(const Patches &patches) { ++ tl::expected<std::vector<u8>, IPSError> generateIPSPatch(const Patches &patches) { + std::vector<u8> result; + + pushStringBack(result, "PATCH"); +@@ -43,9 +43,9 @@ namespace hex { + bytes.push_back(values[i]); + + if (bytes.size() > 0xFFFF) +- return std::unexpected(IPSError::PatchTooLarge); ++ return tl::unexpected(IPSError::PatchTooLarge); + if (startAddress > 0xFFFF'FFFF) +- return std::unexpected(IPSError::AddressOutOfRange); ++ return tl::unexpected(IPSError::AddressOutOfRange); + + u32 address = startAddress.value(); + auto addressBytes = reinterpret_cast<u8 *>(&address); +@@ -68,7 +68,7 @@ namespace hex { + return result; + } + +- std::expected<std::vector<u8>, IPSError> generateIPS32Patch(const Patches &patches) { ++ tl::expected<std::vector<u8>, IPSError> generateIPS32Patch(const Patches &patches) { + std::vector<u8> result; + + pushStringBack(result, "IPS32"); +@@ -93,9 +93,9 @@ namespace hex { + bytes.push_back(values[i]); + + if (bytes.size() > 0xFFFF) +- return std::unexpected(IPSError::PatchTooLarge); ++ return tl::unexpected(IPSError::PatchTooLarge); + if (startAddress > 0xFFFF'FFFF) +- return std::unexpected(IPSError::AddressOutOfRange); ++ return tl::unexpected(IPSError::AddressOutOfRange); + + u32 address = startAddress.value(); + auto addressBytes = reinterpret_cast<u8 *>(&address); +@@ -119,12 +119,12 @@ namespace hex { + return result; + } + +- std::expected<Patches, IPSError> loadIPSPatch(const std::vector<u8> &ipsPatch) { ++ tl::expected<Patches, IPSError> loadIPSPatch(const std::vector<u8> &ipsPatch) { + if (ipsPatch.size() < (5 + 3)) +- return std::unexpected(IPSError::InvalidPatchHeader); ++ return tl::unexpected(IPSError::InvalidPatchHeader); + + if (std::memcmp(ipsPatch.data(), "PATCH", 5) != 0) +- return std::unexpected(IPSError::InvalidPatchHeader); ++ return tl::unexpected(IPSError::InvalidPatchHeader); + + Patches result; + bool foundEOF = false; +@@ -139,7 +139,7 @@ namespace hex { + // Handle normal record + if (size > 0x0000) { + if (ipsOffset + size > ipsPatch.size() - 3) +- return std::unexpected(IPSError::InvalidPatchFormat); ++ return tl::unexpected(IPSError::InvalidPatchFormat); + + for (u16 i = 0; i < size; i++) + result[offset + i] = ipsPatch[ipsOffset + i]; +@@ -148,7 +148,7 @@ namespace hex { + // Handle RLE record + else { + if (ipsOffset + 3 > ipsPatch.size() - 3) +- return std::unexpected(IPSError::InvalidPatchFormat); ++ return tl::unexpected(IPSError::InvalidPatchFormat); + + u16 rleSize = ipsPatch[ipsOffset + 0] | (ipsPatch[ipsOffset + 1] << 8); + +@@ -167,15 +167,15 @@ namespace hex { + if (foundEOF) + return result; + else +- return std::unexpected(IPSError::MissingEOF); ++ return tl::unexpected(IPSError::MissingEOF); + } + +- std::expected<Patches, IPSError> loadIPS32Patch(const std::vector<u8> &ipsPatch) { ++ tl::expected<Patches, IPSError> loadIPS32Patch(const std::vector<u8> &ipsPatch) { + if (ipsPatch.size() < (5 + 4)) +- return std::unexpected(IPSError::InvalidPatchHeader); ++ return tl::unexpected(IPSError::InvalidPatchHeader); + + if (std::memcmp(ipsPatch.data(), "IPS32", 5) != 0) +- return std::unexpected(IPSError::InvalidPatchHeader); ++ return tl::unexpected(IPSError::InvalidPatchHeader); + + Patches result; + bool foundEEOF = false; +@@ -190,7 +190,7 @@ namespace hex { + // Handle normal record + if (size > 0x0000) { + if (ipsOffset + size > ipsPatch.size() - 3) +- return std::unexpected(IPSError::InvalidPatchFormat); ++ return tl::unexpected(IPSError::InvalidPatchFormat); + + for (u16 i = 0; i < size; i++) + result[offset + i] = ipsPatch[ipsOffset + i]; +@@ -199,7 +199,7 @@ namespace hex { + // Handle RLE record + else { + if (ipsOffset + 3 > ipsPatch.size() - 3) +- return std::unexpected(IPSError::InvalidPatchFormat); ++ return tl::unexpected(IPSError::InvalidPatchFormat); + + u16 rleSize = ipsPatch[ipsOffset + 0] | (ipsPatch[ipsOffset + 1] << 8); + +@@ -218,7 +218,7 @@ namespace hex { + if (foundEEOF) + return result; + else +- return std::unexpected(IPSError::MissingEOF); ++ return tl::unexpected(IPSError::MissingEOF); + } + + } +\ No newline at end of file diff --git a/editors/imhex/files/patch-main_CMakeLists.txt b/editors/imhex/files/patch-main_CMakeLists.txt new file mode 100644 index 000000000000..47e20ae36dda --- /dev/null +++ b/editors/imhex/files/patch-main_CMakeLists.txt @@ -0,0 +1,11 @@ +--- main/CMakeLists.txt.orig 2023-02-13 15:50:24 UTC ++++ main/CMakeLists.txt +@@ -30,7 +30,7 @@ set_target_properties(main PROPERTIES + + add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}") + +-target_link_libraries(main PRIVATE libromfs-imhex libimhex ${FMT_LIBRARIES}) ++target_link_libraries(main PRIVATE libromfs-imhex libimhex ${FMT_LIBRARIES} execinfo) + if (WIN32) + target_link_libraries(main PRIVATE usp10 wsock32 ws2_32 Dwmapi.lib) + else () diff --git a/editors/imhex/files/patch-plugins_builtin_source_content_settings__entries.cpp b/editors/imhex/files/patch-plugins_builtin_source_content_settings__entries.cpp index a4402a37bf5a..554360faa23e 100644 --- a/editors/imhex/files/patch-plugins_builtin_source_content_settings__entries.cpp +++ b/editors/imhex/files/patch-plugins_builtin_source_content_settings__entries.cpp @@ -1,6 +1,6 @@ ---- plugins/builtin/source/content/settings_entries.cpp.orig 2023-01-05 08:53:49 UTC +--- plugins/builtin/source/content/settings_entries.cpp.orig 2023-02-12 18:24:04 UTC +++ plugins/builtin/source/content/settings_entries.cpp -@@ -22,8 +22,7 @@ namespace { +@@ -24,8 +24,7 @@ namespace { userFolders.clear(); std::vector<std::string> paths = setting; for (const auto &path : paths) { diff --git a/editors/imhex/files/patch-plugins_builtin_source_content_views_view__find.cpp b/editors/imhex/files/patch-plugins_builtin_source_content_views_view__find.cpp index c548e2681e57..10e2dd5a7c40 100644 --- a/editors/imhex/files/patch-plugins_builtin_source_content_views_view__find.cpp +++ b/editors/imhex/files/patch-plugins_builtin_source_content_views_view__find.cpp @@ -1,106 +1,6 @@ ---- plugins/builtin/source/content/views/view_find.cpp.orig 2023-01-05 08:53:49 UTC +--- plugins/builtin/source/content/views/view_find.cpp.orig 2023-02-12 18:24:04 UTC +++ plugins/builtin/source/content/views/view_find.cpp -@@ -153,34 +153,86 @@ namespace hex::plugin::builtin { - } - - template<typename Type, typename StorageType> -- static std::tuple<bool, std::variant<u64, i64, float, double>, size_t> parseNumericValue(const std::string &string) { -+ static std::tuple<bool, u64, size_t> parseNumericValue_u(const std::string &string) { - static_assert(sizeof(StorageType) >= sizeof(Type)); - - StorageType value = 0x00; -- auto result = std::from_chars(string.data(), string.data() + string.size(), value); -- if (result.ec != std::errc() || result.ptr != string.data() + string.size()) -+ try { -+ value = std::stoull(string.data()); -+ } catch (...) { - return { false, { }, 0 }; -+ } -+ if (value < std::numeric_limits<Type>::lowest() || value > std::numeric_limits<Type>::max()) -+ return { false, { }, 0 }; - -+ return { true, value, sizeof(Type) }; -+ } -+ -+ template<typename Type, typename StorageType> -+ static std::tuple<bool, i64, size_t> parseNumericValue_i(const std::string &string) { -+ static_assert(sizeof(StorageType) >= sizeof(Type)); -+ -+ StorageType value = 0x00; -+ try { -+ value = std::stoll(string.data()); -+ } catch (...) { -+ return { false, { }, 0 }; -+ } -+ - if (value < std::numeric_limits<Type>::lowest() || value > std::numeric_limits<Type>::max()) - return { false, { }, 0 }; - - return { true, value, sizeof(Type) }; - } - -+ template<typename Type, typename StorageType> -+ static std::tuple<bool, float, size_t> parseNumericValue_f(const std::string &string) { -+ static_assert(sizeof(StorageType) >= sizeof(Type)); -+ -+ StorageType value = 0x00; -+ try { -+ value = std::stof(string.data()); -+ } catch (...) { -+ return { false, { }, 0 }; -+ } -+ -+ if (value < std::numeric_limits<Type>::lowest() || value > std::numeric_limits<Type>::max()) -+ return { false, { }, 0 }; -+ -+ return { true, value, sizeof(float) }; -+ } -+ -+ template<typename Type, typename StorageType> -+ static std::tuple<bool, double, size_t> parseNumericValue_d(const std::string &string) { -+ static_assert(sizeof(StorageType) >= sizeof(Type)); -+ -+ StorageType value = 0x00; -+ try { -+ value = std::stod(string.data()); -+ } catch (...) { -+ return { false, { }, 0 }; -+ } -+ -+ if (value < std::numeric_limits<Type>::lowest() || value > std::numeric_limits<Type>::max()) -+ return { false, { }, 0 }; -+ -+ return { true, value, sizeof(Type) }; -+ } -+ - std::tuple<bool, std::variant<u64, i64, float, double>, size_t> ViewFind::parseNumericValueInput(const std::string &input, SearchSettings::Value::Type type) { - switch (type) { - using enum SearchSettings::Value::Type; - -- case U8: return parseNumericValue<u8, u64>(input); -- case U16: return parseNumericValue<u16, u64>(input); -- case U32: return parseNumericValue<u32, u64>(input); -- case U64: return parseNumericValue<u64, u64>(input); -- case I8: return parseNumericValue<i8, i64>(input); -- case I16: return parseNumericValue<i16, i64>(input); -- case I32: return parseNumericValue<i32, i64>(input); -- case I64: return parseNumericValue<i64, i64>(input); -- case F32: return parseNumericValue<float, float>(input); -- case F64: return parseNumericValue<double, double>(input); -+ case U8: return parseNumericValue_u<u8, u64>(input); -+ case U16: return parseNumericValue_u<u16, u64>(input); -+ case U32: return parseNumericValue_u<u32, u64>(input); -+ case U64: return parseNumericValue_u<u64, u64>(input); -+ case I8: return parseNumericValue_i<i8, i64>(input); -+ case I16: return parseNumericValue_i<i16, i64>(input); -+ case I32: return parseNumericValue_i<i32, i64>(input); -+ case I64: return parseNumericValue_i<i64, i64>(input); -+ case F32: return parseNumericValue_f<float, float>(input); -+ case F64: return parseNumericValue_d<double, double>(input); - default: return { false, { }, 0 }; - } - } -@@ -293,7 +345,7 @@ namespace hex::plugin::builtin { +@@ -305,7 +305,7 @@ namespace hex::plugin::builtin { auto occurrence = reader.begin(); while (true) { @@ -109,18 +9,12 @@ if (occurrence == reader.end()) break; -@@ -377,8 +429,12 @@ namespace hex::plugin::builtin { - reader.seek(searchRegion.getStartAddress()); - reader.setEndAddress(searchRegion.getEndAddress()); +@@ -407,7 +407,7 @@ namespace hex::plugin::builtin { + if (validBytes == size) { + bytes &= hex::bitmask(size * 8); -- const auto [validMin, min, sizeMin] = parseNumericValueInput(settings.inputMin, settings.type); -- const auto [validMax, max, sizeMax] = parseNumericValueInput(settings.inputMax, settings.type); -+ const auto validMin = std::get<0>(parseNumericValueInput(settings.inputMin, settings.type)); -+ const auto min = std::get<1>(parseNumericValueInput(settings.inputMin, settings.type)); -+ const auto sizeMin = std::get<2>(parseNumericValueInput(settings.inputMin, settings.type)); -+ const auto validMax = std::get<0>(parseNumericValueInput(settings.inputMax, settings.type)); -+ const auto max = std::get<1>(parseNumericValueInput(settings.inputMax, settings.type)); -+ const auto sizeMax = std::get<2>(parseNumericValueInput(settings.inputMax, settings.type)); +- auto result = std::visit([&](auto tag) { ++ auto result = std::visit([&, min=min, max=max](auto tag) { + using T = std::remove_cvref_t<std::decay_t<decltype(tag)>>; - if (!validMin || !validMax || sizeMin != sizeMax) - return { }; + auto minValue = std::get<T>(min); diff --git a/editors/imhex/files/patch-plugins_builtin_source_content_views_view__hex__editor.cpp b/editors/imhex/files/patch-plugins_builtin_source_content_views_view__hex__editor.cpp index ba671e2666d4..d2e69f0e0684 100644 --- a/editors/imhex/files/patch-plugins_builtin_source_content_views_view__hex__editor.cpp +++ b/editors/imhex/files/patch-plugins_builtin_source_content_views_view__hex__editor.cpp @@ -1,6 +1,6 @@ ---- plugins/builtin/source/content/views/view_hex_editor.cpp.orig 2022-11-14 09:07:21 UTC +--- plugins/builtin/source/content/views/view_hex_editor.cpp.orig 2023-02-12 18:24:04 UTC +++ plugins/builtin/source/content/views/view_hex_editor.cpp -@@ -296,7 +296,7 @@ namespace hex::plugin::builtin { +@@ -297,7 +297,7 @@ namespace hex::plugin::builtin { reader.seek(this->m_searchPosition.value_or(provider->getBaseAddress())); constexpr static auto searchFunction = [](const auto &haystackBegin, const auto &haystackEnd, const auto &needleBegin, const auto &needleEnd) { diff --git a/editors/imhex/files/patch-plugins_builtin_source_content_views_view__pattern__editor.cpp b/editors/imhex/files/patch-plugins_builtin_source_content_views_view__pattern__editor.cpp index ba4910f07c4d..fe12e229b4fb 100644 --- a/editors/imhex/files/patch-plugins_builtin_source_content_views_view__pattern__editor.cpp +++ b/editors/imhex/files/patch-plugins_builtin_source_content_views_view__pattern__editor.cpp @@ -1,15 +1,15 @@ ---- plugins/builtin/source/content/views/view_pattern_editor.cpp.orig 2023-01-05 08:53:49 UTC +--- plugins/builtin/source/content/views/view_pattern_editor.cpp.orig 2023-02-15 08:39:23 UTC +++ plugins/builtin/source/content/views/view_pattern_editor.cpp -@@ -439,7 +439,7 @@ namespace hex::plugin::builtin { +@@ -437,7 +437,7 @@ namespace hex::plugin::builtin { dataProvider->setReadOnly(true); auto hexEditor = ui::HexEditor(); - hexEditor.setBackgroundHighlightCallback([this, id](u64 address, const u8 *, size_t) -> std::optional<color_t> { -+ hexEditor.setBackgroundHighlightCallback([this, id = id](u64 address, const u8 *, size_t) -> std::optional<color_t> { ++ hexEditor.setBackgroundHighlightCallback([this, id=id](u64 address, const u8 *, size_t) -> std::optional<color_t> { if (this->m_runningEvaluators != 0) return std::nullopt; if (!ImHexApi::Provider::isValid()) -@@ -461,7 +461,7 @@ namespace hex::plugin::builtin { +@@ -459,7 +459,7 @@ namespace hex::plugin::builtin { auto patternProvider = ImHexApi::Provider::get(); @@ -18,7 +18,7 @@ hexEditor.setProvider(dataProvider.get()); hexEditor.draw(480_scaled); -@@ -934,7 +934,7 @@ namespace hex::plugin::builtin { +@@ -931,7 +931,7 @@ namespace hex::plugin::builtin { if (type->isTemplateType()) continue; diff --git a/editors/imhex/files/patch-plugins_builtin_source_ui_pattern__drawer.cpp b/editors/imhex/files/patch-plugins_builtin_source_ui_pattern__drawer.cpp new file mode 100644 index 000000000000..3a6ff03be6c5 --- /dev/null +++ b/editors/imhex/files/patch-plugins_builtin_source_ui_pattern__drawer.cpp @@ -0,0 +1,12 @@ +--- plugins/builtin/source/ui/pattern_drawer.cpp.orig 2023-02-12 18:24:04 UTC ++++ plugins/builtin/source/ui/pattern_drawer.cpp +@@ -134,7 +134,8 @@ namespace hex::plugin::builtin::ui { + ImGui::TextUnformatted("hex.builtin.pattern_drawer.visualizer.invalid_parameter_count"_lang); + } else { + try { +- visualizer.callback(pattern, iteratable, reset, { arguments.begin() + 1, arguments.end() }); ++ const std::vector<pl::core::Token::Literal> args = { arguments.begin() + 1, arguments.end() }; ++ visualizer.callback(pattern, iteratable, reset, args); + } catch (std::exception &e) { + this->m_lastVisualizerError = e.what(); + } |