From fde9dc7961d9ca2e91d0008e31fd1b6e51241805 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 27 Nov 2020 09:09:59 +0100 Subject: [PATCH] Various small fixes --- CMakeLists.txt | 8 +++----- source/lang/evaluator.cpp | 2 +- source/views/view_hashes.cpp | 4 ++-- source/views/view_tools.cpp | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 699a48cbf..74deb28c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(HexEditor) set(CMAKE_CXX_STANDARD 20) find_package(PkgConfig REQUIRED) +pkg_search_module(CRYPTO REQUIRED crypto) pkg_search_module(GLFW REQUIRED glfw3) pkg_search_module(GLM REQUIRED glm) pkg_search_module(CRYPTO REQUIRED libcrypto) @@ -14,7 +15,6 @@ find_package(LLVM REQUIRED CONFIG) llvm_map_components_to_libnames(demangler) include_directories(include ${GLFW_INCLUDE_DIRS} ${CAPSTONE_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} libs/ImGui/include libs/glad/include) -add_definitions(${LLVM_DEFINITIONS}) SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -DIMGUI_IMPL_OPENGL_LOADER_GLAD") @@ -65,12 +65,10 @@ add_executable(ImHex resource.rc ) -llvm_map_components_to_libnames(LLVM_LIBRARIES Demangle) - if (WIN32) - target_link_libraries(ImHex libglfw3.a libgcc.a libstdc++.a libmagic.a libgnurx.a libtre.a libintl.a libiconv.a shlwapi.lib libcrypto.a libwinpthread.a libcapstone.a ${LLVM_LIBRARIES}) + target_link_libraries(ImHex libglfw3.a libgcc.a libstdc++.a libmagic.a libgnurx.a libtre.a libintl.a libiconv.a shlwapi.lib libcrypto.a libwinpthread.a libcapstone.a libLLVMDemangle.a) endif (WIN32) if (UNIX) - target_link_libraries(ImHex libglfw.so libmagic.so libcrypto.so libdl.so libcapstone.so ${LLVM_LIBRARIES}) + target_link_libraries(ImHex libglfw.so libmagic.so libcrypto.so libdl.so libcapstone.so libLLVMDemangle.so) endif (UNIX) \ No newline at end of file diff --git a/source/lang/evaluator.cpp b/source/lang/evaluator.cpp index 70fa0dad9..884bbb8f8 100644 --- a/source/lang/evaluator.cpp +++ b/source/lang/evaluator.cpp @@ -251,7 +251,7 @@ namespace hex::lang { delete nonArrayVarDeclNode; } - return { new PatternDataArray(offset, arrayOffset, varDeclNode->getVariableName(), entries, 0x00FFFFFF), arrayOffset }; + return { new PatternDataArray(offset, arrayOffset, varDeclNode->getVariableName(), entries, arrayColor.value()), arrayOffset }; } std::pair Evaluator::createStringPattern(ASTNodeVariableDecl *varDeclNode, u64 offset) { diff --git a/source/views/view_hashes.cpp b/source/views/view_hashes.cpp index 2b65b3498..179701d91 100644 --- a/source/views/view_hashes.cpp +++ b/source/views/view_hashes.cpp @@ -59,7 +59,7 @@ namespace hex { switch (this->m_currHashFunction) { case 0: // CRC16 { - int polynomial = 0, init = 0; + static int polynomial = 0, init = 0; ImGui::InputInt("Initial Value", &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; @@ -83,7 +83,7 @@ namespace hex { break; case 1: // CRC32 { - int polynomial = 0, init = 0; + static int polynomial = 0, init = 0; ImGui::InputInt("Initial Value", &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; diff --git a/source/views/view_tools.cpp b/source/views/view_tools.cpp index d7d9c33b6..9db06836d 100644 --- a/source/views/view_tools.cpp +++ b/source/views/view_tools.cpp @@ -13,7 +13,6 @@ namespace hex { this->m_mangledBuffer = new char[0xF'FFFF]; std::memset(this->m_mangledBuffer, 0x00, 0xF'FFFF); - this->m_demangledName = "< ??? >"; this->m_regexInput = new char[0xF'FFFF]; this->m_regexPattern = new char[0xF'FFFF]; @@ -28,6 +27,7 @@ namespace hex { delete[] this->m_regexInput; delete[] this->m_regexPattern; + delete[] this->m_replacePattern; } void ViewTools::drawDemangler() {