Skip to content

Commit

Permalink
Merge branch 'master' into xtex-202403
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed May 1, 2024
2 parents fb2350d + 6fbbf89 commit fbde116
Show file tree
Hide file tree
Showing 78 changed files with 2,555 additions and 618 deletions.
15 changes: 10 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
path = lib/third_party/jthread/jthread
url = https://github.com/josuttis/jthread
ignore = dirty
url = https://github.com/WerWolv/HashLibPlus
[submodule "lib/third_party/edlib"]
path = lib/third_party/edlib
url = https://github.com/Martinsos/edlib
ignore = dirty
[submodule "lib/third_party/lunasvg"]
path = lib/third_party/lunasvg
url = https://github.com/sammycage/lunasvg
ignore = dirty

[submodule "lib/external/libromfs"]
path = lib/external/libromfs
Expand All @@ -34,8 +43,4 @@
url = https://github.com/WerWolv/libwolv

[submodule "lib/third_party/HashLibPlus"]
path = lib/third_party/HashLibPlus
url = https://github.com/WerWolv/HashLibPlus
[submodule "lib/third_party/edlib"]
path = lib/third_party/edlib
url = https://github.com/Martinsos/edlib
path = lib/third_party/HashLibPlus
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<a href="https://imhex.werwolv.net">
<h1 align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./resources/projects/logo_text_light.svg">
<img height="100px" src="./resources/projects/logo_text_dark.svg">
<img height="300px" src="./resources/dist/common/logo/ImHexLogoSVGBG.svg">
</picture>
</h1>
</a>
Expand Down
8 changes: 8 additions & 0 deletions cmake/build_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,14 @@ macro(addBundledLibraries)
set(NLOHMANN_JSON_LIBRARIES nlohmann_json::nlohmann_json)
endif()

if (NOT USE_SYSTEM_LUNASVG)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/lunasvg EXCLUDE_FROM_ALL)
set(LUNASVG_LIBRARIES lunasvg)
else()
find_package(LunaSVG REQUIRED)
set(LUNASVG_LIBRARIES lunasvg)
endif()

if (NOT USE_SYSTEM_LLVM)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/llvm-demangle EXCLUDE_FROM_ALL)
else()
Expand Down
2 changes: 1 addition & 1 deletion cmake/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ add_subdirectory(lib/libimhex)
if (WIN32)
set_target_properties(libimhex PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libimhex.dll"
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/liblibimhex.dll.a"
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.dll.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include")
elseif (APPLE)
file(GLOB LIBIMHEX_DYLIB "${CMAKE_CURRENT_SOURCE_DIR}/../../Frameworks/libimhex.*.dylib")
Expand Down
2 changes: 1 addition & 1 deletion lib/external/pattern_language
Submodule pattern_language updated 42 files
+3 −3 lib/include/pl/core/ast/ast_node_mathematical_expression.hpp
+2 −2 lib/include/pl/core/errors/error.hpp
+1 −1 lib/include/pl/core/errors/runtime_errors.hpp
+2 −2 lib/include/pl/core/evaluator.hpp
+1 −0 lib/include/pl/core/parser_manager.hpp
+23 −0 lib/include/pl/core/preprocessor.hpp
+3 −1 lib/include/pl/core/token.hpp
+2 −0 lib/include/pl/core/tokens.hpp
+4 −0 lib/include/pl/pattern_language.hpp
+1 −1 lib/source/pl/core/ast/ast_node.cpp
+26 −26 lib/source/pl/core/ast/ast_node_array_variable_decl.cpp
+24 −24 lib/source/pl/core/ast/ast_node_attribute.cpp
+7 −7 lib/source/pl/core/ast/ast_node_bitfield.cpp
+7 −7 lib/source/pl/core/ast/ast_node_bitfield_array_variable_decl.cpp
+4 −4 lib/source/pl/core/ast/ast_node_bitfield_field.cpp
+1 −1 lib/source/pl/core/ast/ast_node_builtin_type.cpp
+5 −5 lib/source/pl/core/ast/ast_node_cast.cpp
+2 −2 lib/source/pl/core/ast/ast_node_conditional_statement.cpp
+2 −2 lib/source/pl/core/ast/ast_node_enum.cpp
+4 −4 lib/source/pl/core/ast/ast_node_function_call.cpp
+3 −3 lib/source/pl/core/ast/ast_node_function_definition.cpp
+1 −1 lib/source/pl/core/ast/ast_node_lvalue_assignment.cpp
+3 −3 lib/source/pl/core/ast/ast_node_match_statement.cpp
+5 −5 lib/source/pl/core/ast/ast_node_mathematical_expression.cpp
+9 −8 lib/source/pl/core/ast/ast_node_pointer_variable_decl.cpp
+13 −13 lib/source/pl/core/ast/ast_node_rvalue.cpp
+2 −2 lib/source/pl/core/ast/ast_node_rvalue_assignment.cpp
+2 −2 lib/source/pl/core/ast/ast_node_scope_resolution.cpp
+3 −3 lib/source/pl/core/ast/ast_node_ternary_expression.cpp
+3 −3 lib/source/pl/core/ast/ast_node_type_decl.cpp
+3 −3 lib/source/pl/core/ast/ast_node_type_operator.cpp
+9 −9 lib/source/pl/core/ast/ast_node_variable_decl.cpp
+2 −2 lib/source/pl/core/ast/ast_node_while_statement.cpp
+8 −9 lib/source/pl/core/evaluator.cpp
+1 −1 lib/source/pl/core/lexer.cpp
+48 −18 lib/source/pl/core/parser.cpp
+4 −1 lib/source/pl/core/parser_manager.cpp
+13 −2 lib/source/pl/core/preprocessor.cpp
+6 −0 lib/source/pl/core/token.cpp
+1 −1 lib/source/pl/lib/std/file.cpp
+1 −1 lib/source/pl/lib/std/math.cpp
+7 −3 lib/source/pl/pattern_language.cpp
4 changes: 2 additions & 2 deletions lib/libimhex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.16)
project(libimhex)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_SHARED_LIBRARY_PREFIX "")

set(LIBIMHEX_SOURCES
source/api/imhex_api.cpp
Expand Down Expand Up @@ -143,11 +142,12 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
precompileHeaders(libimhex "${CMAKE_CURRENT_SOURCE_DIR}/include")
endif()

target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${NLOHMANN_JSON_LIBRARIES} imgui_all_includes ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES})
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${NLOHMANN_JSON_LIBRARIES} imgui_all_includes ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${LUNASVG_LIBRARIES})

set_property(TARGET libimhex PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)

add_dependencies(imhex_all libimhex)

install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS})
set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set_target_properties(libimhex PROPERTIES PREFIX "")
2 changes: 1 addition & 1 deletion lib/libimhex/include/hex/api/achievement_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ namespace hex {
if (m_icon.isValid())
return m_icon;

m_icon = ImGuiExt::Texture(m_iconData.data(), m_iconData.size(), ImGuiExt::Texture::Filter::Linear);
m_icon = ImGuiExt::Texture::fromImage(m_iconData.data(), m_iconData.size(), ImGuiExt::Texture::Filter::Linear);

return m_icon;
}
Expand Down
23 changes: 15 additions & 8 deletions lib/libimhex/include/hex/ui/imgui_imhex_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,21 @@ namespace ImGuiExt {
};

Texture() = default;
Texture(const ImU8 *buffer, int size, Filter filter = Filter::Nearest, int width = 0, int height = 0);
Texture(std::span<const std::byte> bytes, Filter filter = Filter::Nearest, int width = 0, int height = 0);
explicit Texture(const char *path, Filter filter = Filter::Nearest);
explicit Texture(const std::fs::path &path, Filter filter = Filter::Nearest);
Texture(unsigned int texture, int width, int height);
Texture(const Texture&) = delete;
Texture(Texture&& other) noexcept;

static Texture fromImage(const ImU8 *buffer, int size, Filter filter = Filter::Nearest);
static Texture fromImage(std::span<const std::byte> buffer, Filter filter = Filter::Nearest);
static Texture fromImage(const char *path, Filter filter = Filter::Nearest);
static Texture fromImage(const std::fs::path &path, Filter filter = Filter::Nearest);
static Texture fromGLTexture(unsigned int texture, int width, int height);
static Texture fromBitmap(const ImU8 *buffer, int size, int width, int height, Filter filter = Filter::Nearest);
static Texture fromBitmap(std::span<const std::byte> buffer, int width, int height, Filter filter = Filter::Nearest);
static Texture fromSVG(const char *path, int width = 0, int height = 0, Filter filter = Filter::Nearest);
static Texture fromSVG(const std::fs::path &path, int width = 0, int height = 0, Filter filter = Filter::Nearest);
static Texture fromSVG(std::span<const std::byte> buffer, int width = 0, int height = 0, Filter filter = Filter::Nearest);


~Texture();

Texture& operator=(const Texture&) = delete;
Expand Down Expand Up @@ -187,8 +194,8 @@ namespace ImGuiExt {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2());
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4());

ImGui::PushItemWidth(-FLT_MIN);
ImGui::InputText("##", const_cast<char *>(text.c_str()), text.size(), ImGuiInputTextFlags_ReadOnly);
ImGui::PushItemWidth(ImGui::CalcTextSize(text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2);
ImGui::InputText("##", const_cast<char *>(text.c_str()), text.size(), ImGuiInputTextFlags_ReadOnly | ImGuiInputTextFlags_NoHorizontalScroll);
ImGui::PopItemWidth();

ImGui::PopStyleColor();
Expand Down Expand Up @@ -222,7 +229,7 @@ namespace ImGuiExt {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2());
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4());

ImGui::PushItemWidth(-FLT_MIN);
ImGui::PushItemWidth(ImGui::CalcTextSize(text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2);
ImGui::InputTextMultiline(
"##",
const_cast<char *>(text.c_str()),
Expand Down
2 changes: 1 addition & 1 deletion lib/libimhex/include/hex/ui/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace hex {
ImGui::EndPopup();
}

if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
if (ImGui::IsKeyPressed(ImGuiKey_Escape))
this->getWindowOpenState() = false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/libimhex/source/api/theme_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace hex {
AutoReset<std::string> s_imageTheme;
AutoReset<std::string> s_currTheme;

std::mutex s_themeMutex;
std::recursive_mutex s_themeMutex;
}


Expand Down

0 comments on commit fbde116

Please sign in to comment.