mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
677036fb9c | ||
|
|
8ccb300ea7 | ||
|
|
dff6e09e1c | ||
|
|
fe1ab12fec | ||
|
|
b17808c6c7 | ||
|
|
6b22464771 | ||
|
|
79ace0a106 | ||
|
|
1770235648 | ||
|
|
f325d50ab8 | ||
|
|
c61e807f13 | ||
|
|
7d0d8d5649 | ||
|
|
318e42be26 | ||
|
|
df26127f88 | ||
|
|
afcd39e162 | ||
|
|
f0c544e7c6 | ||
|
|
aec2626d73 | ||
|
|
23085aee6d | ||
|
|
0ee4b1e336 | ||
|
|
a05d09ffea | ||
|
|
9cd7b746a6 | ||
|
|
78b3f5aef1 | ||
|
|
e25d98ef63 |
4
.github/workflows/analysis.yml
vendored
4
.github/workflows/analysis.yml
vendored
@@ -30,8 +30,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.ccache
|
~/.ccache
|
||||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
||||||
restore-keys: ${{ runner.os }}-build-
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-
|
||||||
|
|
||||||
- name: ⬇️ Install dependencies
|
- name: ⬇️ Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@@ -26,11 +26,16 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.ccache
|
~/.ccache
|
||||||
.flatpak-builder
|
.flatpak-builder
|
||||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
||||||
restore-keys: ${{ runner.os }}-build-
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-
|
||||||
|
|
||||||
- name: ⬇️ Install dependencies
|
- name: ⬇️ Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
sudo rm -rf /usr/share/dotnet
|
||||||
|
sudo rm -rf /opt/ghc
|
||||||
|
sudo rm -rf "/usr/local/share/boost"
|
||||||
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
||||||
|
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo bash dist/get_deps_debian.sh
|
sudo bash dist/get_deps_debian.sh
|
||||||
|
|
||||||
@@ -59,7 +64,7 @@ jobs:
|
|||||||
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
flatpak --user install -y flathub org.freedesktop.Platform//20.08
|
flatpak --user install -y flathub org.freedesktop.Platform//20.08
|
||||||
flatpak --user install -y flathub org.freedesktop.Sdk//20.08
|
flatpak --user install -y flathub org.freedesktop.Sdk//20.08
|
||||||
flatpak-builder --repo=imhex _flatpak dist/net.werwolv.ImHex.yaml --ccache --keep-build-dirs
|
flatpak-builder --jobs=4 --repo=imhex _flatpak dist/net.werwolv.ImHex.yaml --ccache --keep-build-dirs
|
||||||
flatpak build-bundle imhex imhex.flatpak net.werwolv.ImHex stable
|
flatpak build-bundle imhex imhex.flatpak net.werwolv.ImHex stable
|
||||||
|
|
||||||
- name: 📦 Bundle DEB
|
- name: 📦 Bundle DEB
|
||||||
@@ -126,7 +131,6 @@ jobs:
|
|||||||
cmake:p
|
cmake:p
|
||||||
make:p
|
make:p
|
||||||
ccache:p
|
ccache:p
|
||||||
capstone:p
|
|
||||||
glfw:p
|
glfw:p
|
||||||
file:p
|
file:p
|
||||||
mbedtls:p
|
mbedtls:p
|
||||||
@@ -154,8 +158,8 @@ jobs:
|
|||||||
id: cache-ccache
|
id: cache-ccache
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.prep-ccache.outputs.dir }}
|
path: ${{ steps.prep-ccache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
||||||
restore-keys: ${{ runner.os }}-build-
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-
|
||||||
|
|
||||||
- name: 🛠️ Build
|
- name: 🛠️ Build
|
||||||
run: |
|
run: |
|
||||||
@@ -210,8 +214,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.ccache
|
~/.ccache
|
||||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
||||||
restore-keys: ${{ runner.os }}-build-
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-
|
||||||
|
|
||||||
- name: 🛠️ Build
|
- name: 🛠️ Build
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@@ -27,8 +27,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.ccache
|
~/.ccache
|
||||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
||||||
restore-keys: ${{ runner.os }}-build-
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-
|
||||||
|
|
||||||
- name: ⬇️ Install dependencies
|
- name: ⬇️ Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
|
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||||
..
|
..
|
||||||
make -j 4 install
|
make -j4 unit_tests install
|
||||||
|
|
||||||
- name: 🧪 Perform Unit Tests
|
- name: 🧪 Perform Unit Tests
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -18,3 +18,6 @@
|
|||||||
path = external/curl
|
path = external/curl
|
||||||
url = https://github.com/curl/curl
|
url = https://github.com/curl/curl
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
[submodule "external/capstone"]
|
||||||
|
path = external/capstone
|
||||||
|
url = https://github.com/capstone-engine/capstone
|
||||||
|
|||||||
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@@ -2,6 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/external/capstone" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/external/curl" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/external/curl" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/external/fmt" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/external/fmt" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/external/nativefiledialog" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/external/nativefiledialog" vcs="Git" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
# Updating the version here will update it throughout ImHex as well
|
# Updating the version here will update it throughout ImHex as well
|
||||||
set(IMHEX_VERSION "1.12.0")
|
set(IMHEX_VERSION "1.12.1")
|
||||||
project(imhex VERSION ${IMHEX_VERSION})
|
project(imhex VERSION ${IMHEX_VERSION})
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
@@ -18,8 +18,6 @@ set(PLUGINS
|
|||||||
# example_rust
|
# example_rust
|
||||||
)
|
)
|
||||||
|
|
||||||
findLibraries()
|
|
||||||
|
|
||||||
detectOS()
|
detectOS()
|
||||||
detectArch()
|
detectArch()
|
||||||
|
|
||||||
@@ -30,7 +28,7 @@ add_subdirectory(plugins/libimhex)
|
|||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
addVersionDefines()
|
addVersionDefines()
|
||||||
configurePackageCreation()
|
configurePackageCreation()
|
||||||
|
|||||||
@@ -27,22 +27,13 @@ macro(addVersionDefines)
|
|||||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DRELEASE -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}-ReleaseMinimumSize\"\\\"")
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DRELEASE -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}-ReleaseMinimumSize\"\\\"")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(findLibraries)
|
macro(configurePython)
|
||||||
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
|
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
|
||||||
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
|
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
|
||||||
|
|
||||||
# Enforce that we use non system Python 3 on macOS.
|
# Enforce that we use non system Python 3 on macOS.
|
||||||
set(Python_FIND_FRAMEWORK NEVER)
|
set(Python_FIND_FRAMEWORK NEVER)
|
||||||
|
|
||||||
# Find packages
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
|
|
||||||
find_package(mbedTLS 2.26.0 REQUIRED)
|
|
||||||
|
|
||||||
pkg_search_module(CAPSTONE 4.0.2 REQUIRED capstone)
|
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
find_package(Python COMPONENTS Development REQUIRED)
|
find_package(Python COMPONENTS Development REQUIRED)
|
||||||
if(Python_VERSION LESS 3)
|
if(Python_VERSION LESS 3)
|
||||||
message(STATUS ${PYTHON_VERSION_MAJOR_MINOR})
|
message(STATUS ${PYTHON_VERSION_MAJOR_MINOR})
|
||||||
@@ -59,13 +50,6 @@ macro(findLibraries)
|
|||||||
list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR)
|
list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -DPYTHON_VERSION_MAJOR_MINOR=\"\\\"${PYTHON_VERSION_MAJOR_MINOR}\"\\\"")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -DPYTHON_VERSION_MAJOR_MINOR=\"\\\"${PYTHON_VERSION_MAJOR_MINOR}\"\\\"")
|
||||||
|
|
||||||
pkg_search_module(MAGIC libmagic>=5.39)
|
|
||||||
if(NOT MAGIC_FOUND)
|
|
||||||
find_library(MAGIC 5.39 magic REQUIRED)
|
|
||||||
else()
|
|
||||||
set(MAGIC_INCLUDE_DIRS ${MAGIC_INCLUDEDIR})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Detect current OS / System
|
# Detect current OS / System
|
||||||
@@ -203,7 +187,7 @@ macro(createPackage)
|
|||||||
RESOLVED_DEPENDENCIES_VAR _r_deps
|
RESOLVED_DEPENDENCIES_VAR _r_deps
|
||||||
UNRESOLVED_DEPENDENCIES_VAR _u_deps
|
UNRESOLVED_DEPENDENCIES_VAR _u_deps
|
||||||
CONFLICTING_DEPENDENCIES_PREFIX _c_deps
|
CONFLICTING_DEPENDENCIES_PREFIX _c_deps
|
||||||
DIRECTORIES ${DEP_FOLDERS}
|
DIRECTORIES ${DEP_FOLDERS} $ENV{PATH}
|
||||||
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"
|
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
4
dist/AppImage/package.sh
vendored
4
dist/AppImage/package.sh
vendored
@@ -39,7 +39,9 @@ mv ${BUILDDIR}/ImHex.AppDir/AppRun-x86_64 ${APPDIR}/AppRun
|
|||||||
chmod a+x ${BUILDDIR}/ImHex.AppDir/AppRun
|
chmod a+x ${BUILDDIR}/ImHex.AppDir/AppRun
|
||||||
|
|
||||||
## Add all dependencies
|
## Add all dependencies
|
||||||
ldd ${BUILDDIR}/imhex | awk '/ => /{print $3}' | xargs -I '{}' cp '{}' ${APPDIR}/usr/lib
|
ldd ${BUILDDIR}/imhex | awk '/ => /{print $3}' | awk '!/(libc|libstdc++|libc++|libdl|libpthread|libselinux|ld-linux|libgdk)/' | xargs -I '{}' cp '{}' ${APPDIR}/usr/lib
|
||||||
|
ldd ${BUILDDIR}/plugins/builtin/builtin.hexplug | awk '/ => /{print $3}' | awk '!/(libc|libstdc++|libc++|libdl|libpthread|libselinux|ld-linux|libgdk)/' | xargs -I '{}' cp '{}' ${APPDIR}/usr/lib
|
||||||
|
ldd ${BUILDDIR}/plugins/libimhex/libimhex.so | awk '/ => /{print $3}' | awk '!/(libc|libstdc++|libc++|libdl|libpthread|libselinux|ld-linux|libgdk)/' | xargs -I '{}' cp '{}' ${APPDIR}/usr/lib
|
||||||
|
|
||||||
# Package it up as described here:
|
# Package it up as described here:
|
||||||
# https://github.com/AppImage/AppImageKit#appimagetool-usage
|
# https://github.com/AppImage/AppImageKit#appimagetool-usage
|
||||||
|
|||||||
1
dist/Brewfile
vendored
1
dist/Brewfile
vendored
@@ -1,6 +1,5 @@
|
|||||||
brew "glfw3"
|
brew "glfw3"
|
||||||
brew "mbedtls"
|
brew "mbedtls"
|
||||||
brew "capstone"
|
|
||||||
brew "nlohmann-json"
|
brew "nlohmann-json"
|
||||||
brew "cmake"
|
brew "cmake"
|
||||||
brew "ccache"
|
brew "ccache"
|
||||||
|
|||||||
1
dist/Dockerfile
vendored
1
dist/Dockerfile
vendored
@@ -13,7 +13,6 @@ RUN pacman -S --needed --noconfirm \
|
|||||||
glfw-x11 \
|
glfw-x11 \
|
||||||
file \
|
file \
|
||||||
mbedtls \
|
mbedtls \
|
||||||
capstone \
|
|
||||||
python3 \
|
python3 \
|
||||||
freetype2 \
|
freetype2 \
|
||||||
gtk3
|
gtk3
|
||||||
|
|||||||
1
dist/ImHex-9999.ebuild
vendored
1
dist/ImHex-9999.ebuild
vendored
@@ -26,7 +26,6 @@ RDEPEND="${DEPEND}
|
|||||||
media-libs/glfw
|
media-libs/glfw
|
||||||
sys-apps/file
|
sys-apps/file
|
||||||
dev-libs/mbedtls
|
dev-libs/mbedtls
|
||||||
dev-libs/capstone
|
|
||||||
dev-cpp/nlohmann_json
|
dev-cpp/nlohmann_json
|
||||||
x11-libs/gtk+
|
x11-libs/gtk+
|
||||||
"
|
"
|
||||||
|
|||||||
1
dist/get_deps_archlinux.sh
vendored
1
dist/get_deps_archlinux.sh
vendored
@@ -6,7 +6,6 @@ pacman -S --needed \
|
|||||||
glfw \
|
glfw \
|
||||||
file \
|
file \
|
||||||
mbedtls \
|
mbedtls \
|
||||||
capstone \
|
|
||||||
python3 \
|
python3 \
|
||||||
freetype2 \
|
freetype2 \
|
||||||
gtk3
|
gtk3
|
||||||
|
|||||||
1
dist/get_deps_debian.sh
vendored
1
dist/get_deps_debian.sh
vendored
@@ -22,7 +22,6 @@ apt install -y \
|
|||||||
libglm-dev \
|
libglm-dev \
|
||||||
libmagic-dev \
|
libmagic-dev \
|
||||||
libmbedtls-dev \
|
libmbedtls-dev \
|
||||||
libcapstone-dev \
|
|
||||||
python3-dev \
|
python3-dev \
|
||||||
libfreetype-dev \
|
libfreetype-dev \
|
||||||
libgtk-3-dev \
|
libgtk-3-dev \
|
||||||
|
|||||||
1
dist/get_deps_fedora.sh
vendored
1
dist/get_deps_fedora.sh
vendored
@@ -3,7 +3,6 @@
|
|||||||
dnf install \
|
dnf install \
|
||||||
cmake \
|
cmake \
|
||||||
gcc-c++ \
|
gcc-c++ \
|
||||||
capstone-devel \
|
|
||||||
file-devel \
|
file-devel \
|
||||||
glfw-devel \
|
glfw-devel \
|
||||||
mesa-libGL-devel \
|
mesa-libGL-devel \
|
||||||
|
|||||||
1
dist/get_deps_msys2.sh
vendored
1
dist/get_deps_msys2.sh
vendored
@@ -5,7 +5,6 @@ pacman -S --needed --noconfirm \
|
|||||||
mingw-w64-x86_64-cmake \
|
mingw-w64-x86_64-cmake \
|
||||||
mingw-w64-x86_64-make \
|
mingw-w64-x86_64-make \
|
||||||
mingw-w64-x86_64-ccache \
|
mingw-w64-x86_64-ccache \
|
||||||
mingw-w64-x86_64-capstone \
|
|
||||||
mingw-w64-x86_64-glfw \
|
mingw-w64-x86_64-glfw \
|
||||||
mingw-w64-x86_64-file \
|
mingw-w64-x86_64-file \
|
||||||
mingw-w64-x86_64-mbedtls \
|
mingw-w64-x86_64-mbedtls \
|
||||||
|
|||||||
1
dist/msys2/PKGBUILD
vendored
1
dist/msys2/PKGBUILD
vendored
@@ -12,7 +12,6 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
|
|||||||
"${MINGW_PACKAGE_PREFIX}-cmake"
|
"${MINGW_PACKAGE_PREFIX}-cmake"
|
||||||
"${MINGW_PACKAGE_PREFIX}-make"
|
"${MINGW_PACKAGE_PREFIX}-make"
|
||||||
"${MINGW_PACKAGE_PREFIX}-dlfcn"
|
"${MINGW_PACKAGE_PREFIX}-dlfcn"
|
||||||
"${MINGW_PACKAGE_PREFIX}-capstone"
|
|
||||||
"${MINGW_PACKAGE_PREFIX}-glfw"
|
"${MINGW_PACKAGE_PREFIX}-glfw"
|
||||||
"${MINGW_PACKAGE_PREFIX}-file"
|
"${MINGW_PACKAGE_PREFIX}-file"
|
||||||
"${MINGW_PACKAGE_PREFIX}-mbedtls"
|
"${MINGW_PACKAGE_PREFIX}-mbedtls"
|
||||||
|
|||||||
14
dist/net.werwolv.ImHex.yaml
vendored
14
dist/net.werwolv.ImHex.yaml
vendored
@@ -3,7 +3,7 @@ runtime: org.freedesktop.Platform
|
|||||||
runtime-version: '20.08'
|
runtime-version: '20.08'
|
||||||
default-branch: stable
|
default-branch: stable
|
||||||
sdk: org.freedesktop.Sdk
|
sdk: org.freedesktop.Sdk
|
||||||
command: /usr/bin/imhex
|
command: /bin/imhex
|
||||||
|
|
||||||
finish-args:
|
finish-args:
|
||||||
- --share=ipc
|
- --share=ipc
|
||||||
@@ -12,16 +12,6 @@ finish-args:
|
|||||||
- --device=all
|
- --device=all
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
- name: capstone
|
|
||||||
buildsystem: cmake-ninja
|
|
||||||
builddir: true
|
|
||||||
config-opts:
|
|
||||||
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
|
||||||
sources:
|
|
||||||
- type: archive
|
|
||||||
url: https://github.com/aquynh/capstone/archive/4.0.2.tar.gz
|
|
||||||
sha256: 7c81d798022f81e7507f1a60d6817f63aa76e489aa4e7055255f21a22f5e526a
|
|
||||||
|
|
||||||
- name: libiconv
|
- name: libiconv
|
||||||
sources:
|
sources:
|
||||||
- type: archive
|
- type: archive
|
||||||
@@ -64,7 +54,7 @@ modules:
|
|||||||
sha256: 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b
|
sha256: 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b
|
||||||
|
|
||||||
- name: imhex
|
- name: imhex
|
||||||
buildsystem: cmake-ninja
|
buildsystem: cmake
|
||||||
|
|
||||||
sources:
|
sources:
|
||||||
- type: git
|
- type: git
|
||||||
|
|||||||
1
external/ImGui/CMakeLists.txt
vendored
1
external/ImGui/CMakeLists.txt
vendored
@@ -5,6 +5,7 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
find_package(Freetype REQUIRED)
|
find_package(Freetype REQUIRED)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
pkg_search_module(GLFW REQUIRED glfw3)
|
pkg_search_module(GLFW REQUIRED glfw3)
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
|
|||||||
1
external/capstone
vendored
Submodule
1
external/capstone
vendored
Submodule
Submodule external/capstone added at 68102c05f1
7
external/yara/CMakeLists.txt
vendored
7
external/yara/CMakeLists.txt
vendored
@@ -104,6 +104,7 @@ add_compile_definitions("MAGIC_MODULE")
|
|||||||
add_compile_definitions("MACHO_MODULE")
|
add_compile_definitions("MACHO_MODULE")
|
||||||
add_compile_definitions("DEX_MODULE")
|
add_compile_definitions("DEX_MODULE")
|
||||||
|
|
||||||
|
find_package(mbedTLS 2.26.0 REQUIRED)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shift-count-overflow")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shift-count-overflow")
|
||||||
add_library(libyara STATIC ${LIBYARA_SOURCE} ${LIBYARA_INCLUDES} ${LIBYARA_MODULES})
|
add_library(libyara STATIC ${LIBYARA_SOURCE} ${LIBYARA_INCLUDES} ${LIBYARA_MODULES})
|
||||||
@@ -115,10 +116,12 @@ target_include_directories(
|
|||||||
PRIVATE ${LIBYARA_SOURCE_PATH} ${MBEDTLS_INCLUDE_DIR}
|
PRIVATE ${LIBYARA_SOURCE_PATH} ${MBEDTLS_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_directories(libyara PRIVATE ${MBEDTLS_LIBRARY_DIR})
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
target_link_libraries(libyara magic pthread)
|
target_link_libraries(libyara PRIVATE magic ${MBEDTLS_LIBRARIES} pthread)
|
||||||
else ()
|
else ()
|
||||||
target_link_libraries(libyara magic)
|
target_link_libraries(libyara PRIVATE magic ${MBEDTLS_LIBRARIES})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ namespace hex {
|
|||||||
bool m_showTipOfTheDay;
|
bool m_showTipOfTheDay;
|
||||||
std::string m_tipOfTheDay;
|
std::string m_tipOfTheDay;
|
||||||
|
|
||||||
ImGui::Texture m_bannerTexture;
|
ImGui::Texture m_bannerTexture = { 0 };
|
||||||
ImGui::Texture m_logoTexture;
|
ImGui::Texture m_logoTexture = { 0 };
|
||||||
|
|
||||||
std::filesystem::path m_safetyBackupPath;
|
std::filesystem::path m_safetyBackupPath;
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,10 @@ add_library(${PROJECT_NAME} SHARED
|
|||||||
|
|
||||||
# Add additional include directories here #
|
# Add additional include directories here #
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
||||||
|
|
||||||
# Add additional libraries here #
|
# Add additional libraries here #
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle)
|
target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
|
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ namespace hex::plugin::builtin::prv {
|
|||||||
size_t m_fileSize = 0;
|
size_t m_fileSize = 0;
|
||||||
|
|
||||||
bool m_fileStatsValid = false;
|
bool m_fileStatsValid = false;
|
||||||
|
bool m_emptyFile = false;
|
||||||
struct stat m_fileStats = { 0 };
|
struct stat m_fileStats = { 0 };
|
||||||
|
|
||||||
bool m_readable = false, m_writable = false;
|
bool m_readable = false, m_writable = false;
|
||||||
|
|||||||
@@ -37,7 +37,12 @@ namespace hex::plugin::builtin {
|
|||||||
bool m_shouldMatchSelection = false;
|
bool m_shouldMatchSelection = false;
|
||||||
|
|
||||||
Architecture m_architecture = Architecture::ARM;
|
Architecture m_architecture = Architecture::ARM;
|
||||||
cs_mode m_modeBasicARM = cs_mode(0), m_modeExtraARM = cs_mode(0), m_modeBasicMIPS = cs_mode(0), m_modeBasicPPC = cs_mode(0), m_modeBasicX86 = cs_mode(0);
|
cs_mode m_modeBasicARM = cs_mode(0);
|
||||||
|
cs_mode m_modeExtraARM = cs_mode(0);
|
||||||
|
cs_mode m_modeBasicMIPS = cs_mode(0);
|
||||||
|
cs_mode m_modeBasicPPC = cs_mode(0);
|
||||||
|
cs_mode m_modeBasicX86 = cs_mode(0);
|
||||||
|
|
||||||
bool m_littleEndianMode = true, m_micoMode = false, m_sparcV9Mode = false;
|
bool m_littleEndianMode = true, m_micoMode = false, m_sparcV9Mode = false;
|
||||||
|
|
||||||
std::vector<Disassembly> m_disassembly;
|
std::vector<Disassembly> m_disassembly;
|
||||||
|
|||||||
@@ -200,27 +200,35 @@ namespace hex::plugin::builtin::prv {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_mapping = CreateFileMapping(this->m_file, nullptr, PAGE_READWRITE, fileSize.HighPart, fileSize.LowPart, nullptr);
|
if (this->m_fileSize > 0) {
|
||||||
if (this->m_mapping == nullptr || this->m_mapping == INVALID_HANDLE_VALUE) {
|
this->m_mapping = CreateFileMapping(this->m_file, nullptr, PAGE_READWRITE, fileSize.HighPart, fileSize.LowPart, nullptr);
|
||||||
return false;
|
if (this->m_mapping == nullptr || this->m_mapping == INVALID_HANDLE_VALUE) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto mappingCleanup = SCOPE_GUARD {
|
auto mappingCleanup = SCOPE_GUARD {
|
||||||
this->m_readable = false;
|
this->m_readable = false;
|
||||||
this->m_mapping = nullptr;
|
this->m_mapping = nullptr;
|
||||||
CloseHandle(this->m_mapping);
|
CloseHandle(this->m_mapping);
|
||||||
};
|
};
|
||||||
|
|
||||||
this->m_mappedFile = MapViewOfFile(this->m_mapping, FILE_MAP_ALL_ACCESS, 0, 0, this->m_fileSize);
|
this->m_mappedFile = MapViewOfFile(this->m_mapping, FILE_MAP_ALL_ACCESS, 0, 0, this->m_fileSize);
|
||||||
if (this->m_mappedFile == nullptr) {
|
if (this->m_mappedFile == nullptr) {
|
||||||
this->m_readable = false;
|
this->m_readable = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mappingCleanup.release();
|
||||||
|
|
||||||
|
ProjectFile::setFilePath(this->m_path);
|
||||||
|
} else if (!this->m_emptyFile) {
|
||||||
|
this->m_emptyFile = true;
|
||||||
|
this->resize(1);
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileCleanup.release();
|
fileCleanup.release();
|
||||||
mappingCleanup.release();
|
|
||||||
|
|
||||||
ProjectFile::setFilePath(this->m_path);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
this->m_file = ::open(this->m_path.data(), O_RDWR);
|
this->m_file = ::open(this->m_path.data(), O_RDWR);
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ namespace hex::plugin::builtin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
EventManager::subscribe<EventProjectFileLoad>(this, [this] {
|
EventManager::subscribe<EventProjectFileLoad>(this, [this] {
|
||||||
this->loadNodes(ProjectFile::getDataProcessorContent());
|
try {
|
||||||
|
this->loadNodes(ProjectFile::getDataProcessorContent());
|
||||||
|
} catch (nlohmann::json::exception &e) {
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
EventManager::subscribe<EventFileLoaded>(this, [this](const std::string &path){
|
EventManager::subscribe<EventFileLoaded>(this, [this](const std::string &path){
|
||||||
|
|||||||
@@ -203,16 +203,18 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
context.buffer.resize(std::min<u64>(0xF'FFFF, provider->getSize() - context.currBlock.base));
|
context.buffer.resize(context.currBlock.size);
|
||||||
|
|
||||||
if (context.buffer.empty()) return nullptr;
|
if (context.buffer.empty()) return nullptr;
|
||||||
|
|
||||||
provider->read(context.currBlock.base + provider->getBaseAddress() + provider->getCurrentPageAddress(), context.buffer.data(), context.buffer.size());
|
block->size = context.currBlock.size;
|
||||||
|
|
||||||
|
provider->read(context.currBlock.base + provider->getBaseAddress(), context.buffer.data(), context.buffer.size());
|
||||||
|
|
||||||
return context.buffer.data();
|
return context.buffer.data();
|
||||||
};
|
};
|
||||||
iterator.file_size = [](auto *iterator) -> u64 {
|
iterator.file_size = [](auto *iterator) -> u64 {
|
||||||
return ImHexApi::Provider::get()->getSize();
|
return ImHexApi::Provider::get()->getActualSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
iterator.context = &context;
|
iterator.context = &context;
|
||||||
@@ -233,7 +235,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
iterator->last_error = ERROR_SUCCESS;
|
iterator->last_error = ERROR_SUCCESS;
|
||||||
context.currBlock.base = address;
|
context.currBlock.base = address;
|
||||||
context.currBlock.size = std::min<u64>(0xF'FFFF, ImHexApi::Provider::get()->getSize() - address);
|
context.currBlock.size = ImHexApi::Provider::get()->getActualSize() - address;
|
||||||
context.currBlock.context = &context;
|
context.currBlock.context = &context;
|
||||||
|
|
||||||
if (context.currBlock.size == 0) return nullptr;
|
if (context.currBlock.size == 0) return nullptr;
|
||||||
|
|||||||
@@ -13,8 +13,11 @@ set(CMAKE_USE_MBEDTLS ON)
|
|||||||
set(BUILD_CURL_EXE OFF)
|
set(BUILD_CURL_EXE OFF)
|
||||||
set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
|
set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
|
||||||
|
|
||||||
|
# Find packages
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
if(NOT USE_SYSTEM_NLOHMANN_JSON)
|
if(NOT USE_SYSTEM_NLOHMANN_JSON)
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json EXCLUDE_FROM_ALL)
|
||||||
set(NLOHMANN_JSON_LIBRARIES nlohmann_json)
|
set(NLOHMANN_JSON_LIBRARIES nlohmann_json)
|
||||||
else()
|
else()
|
||||||
find_package(nlohmann_json 3.10.2 REQUIRED)
|
find_package(nlohmann_json 3.10.2 REQUIRED)
|
||||||
@@ -22,7 +25,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT USE_SYSTEM_FMT)
|
if(NOT USE_SYSTEM_FMT)
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt EXCLUDE_FROM_ALL)
|
||||||
set(FMT_LIBRARIES fmt-header-only)
|
set(FMT_LIBRARIES fmt-header-only)
|
||||||
else()
|
else()
|
||||||
find_package(fmt 8.0.0 REQUIRED)
|
find_package(fmt 8.0.0 REQUIRED)
|
||||||
@@ -52,6 +55,31 @@ else()
|
|||||||
pkg_check_modules(YARA REQUIRED IMPORTED_TARGET yara)
|
pkg_check_modules(YARA REQUIRED IMPORTED_TARGET yara)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (NOT USE_SYSTEM_CAPSTONE)
|
||||||
|
set(CAPSTONE_BUILD_STATIC_RUNTIME OFF)
|
||||||
|
set(CAPSTONE_BUILD_SHARED OFF)
|
||||||
|
set(CAPSTONE_BUILD_TESTS OFF)
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/capstone ${CMAKE_CURRENT_BINARY_DIR}/external/capstone EXCLUDE_FROM_ALL)
|
||||||
|
set_target_properties(capstone-static PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
set(CAPSTONE_LIBRARIES "capstone-static")
|
||||||
|
set(CAPSTONE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../external/capstone/include/capstone)
|
||||||
|
else()
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_search_module(CAPSTONE 4.0.2 REQUIRED capstone)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
find_package(mbedTLS 2.26.0 REQUIRED)
|
||||||
|
configurePython()
|
||||||
|
|
||||||
|
pkg_search_module(MAGIC libmagic>=5.39)
|
||||||
|
if(NOT MAGIC_FOUND)
|
||||||
|
find_library(MAGIC 5.39 magic REQUIRED)
|
||||||
|
else()
|
||||||
|
set(MAGIC_INCLUDE_DIRS ${MAGIC_INCLUDEDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
@@ -113,7 +141,7 @@ endif ()
|
|||||||
|
|
||||||
add_library(libimhex SHARED ${LIBIMHEX_SOURCES})
|
add_library(libimhex SHARED ${LIBIMHEX_SOURCES})
|
||||||
|
|
||||||
target_include_directories(libimhex PUBLIC include ${MBEDTLS_INCLUDE_DIR} ${XDGPP_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIRS} ${CAPSTONE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${FMT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${YARA_INCLUDE_DIRS})
|
target_include_directories(libimhex PUBLIC include ${XDGPP_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIRS} ${CAPSTONE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${FMT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${YARA_INCLUDE_DIRS})
|
||||||
target_link_directories(libimhex PUBLIC ${MBEDTLS_LIBRARY_DIR} ${CAPSTONE_LIBRARY_DIRS} ${MAGIC_LIBRARY_DIRS})
|
target_link_directories(libimhex PUBLIC ${MBEDTLS_LIBRARY_DIR} ${CAPSTONE_LIBRARY_DIRS} ${MAGIC_LIBRARY_DIRS})
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
@@ -121,4 +149,4 @@ if (APPLE)
|
|||||||
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
|
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(libimhex PUBLIC imgui nfd magic capstone LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES})
|
target_link_libraries(libimhex PUBLIC imgui nfd magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES})
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ namespace hex {
|
|||||||
TMS320C64X,
|
TMS320C64X,
|
||||||
M680X,
|
M680X,
|
||||||
EVM,
|
EVM,
|
||||||
|
MOS65XX,
|
||||||
|
WASM,
|
||||||
|
BPF,
|
||||||
|
RISCV,
|
||||||
|
|
||||||
MAX,
|
MAX,
|
||||||
MIN = ARM
|
MIN = ARM
|
||||||
@@ -37,7 +41,7 @@ namespace hex {
|
|||||||
return cs_support(toCapstoneArchictecture(architecture));
|
return cs_support(toCapstoneArchictecture(architecture));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr static const char * const ArchitectureNames[] = { "ARM32", "ARM64", "MIPS", "x86", "PowerPC", "Sparc", "SystemZ", "XCore", "68K", "TMS320C64x", "680X", "Ethereum" };
|
constexpr static const char * const ArchitectureNames[] = { "ARM32", "ARM64", "MIPS", "x86", "PowerPC", "Sparc", "SystemZ", "XCore", "68K", "TMS320C64x", "680X", "Ethereum", "MOS65XX", "WebAssembly", "Berkeley Packet Filter", "RISC-V" };
|
||||||
|
|
||||||
static inline s32 getArchitectureSupportedCount() {
|
static inline s32 getArchitectureSupportedCount() {
|
||||||
static s32 supportedCount = -1;
|
static s32 supportedCount = -1;
|
||||||
|
|||||||
@@ -92,14 +92,14 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline std::string s_currProjectFilePath;
|
static std::string s_currProjectFilePath;
|
||||||
static inline bool s_hasUnsavedChanged = false;
|
static bool s_hasUnsavedChanged;
|
||||||
|
|
||||||
static inline std::string s_filePath;
|
static std::string s_filePath;
|
||||||
static inline std::string s_pattern;
|
static std::string s_pattern;
|
||||||
static inline Patches s_patches;
|
static Patches s_patches;
|
||||||
static inline std::list<ImHexApi::Bookmarks::Entry> s_bookmarks;
|
static std::list<ImHexApi::Bookmarks::Entry> s_bookmarks;
|
||||||
static inline std::string s_dataProcessorContent;
|
static std::string s_dataProcessorContent;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,8 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> getPath(ImHexPath path) {
|
std::vector<std::string> getPath(ImHexPath path) {
|
||||||
|
std::vector<std::string> result;
|
||||||
|
|
||||||
#if defined(OS_WINDOWS)
|
#if defined(OS_WINDOWS)
|
||||||
const auto exePath = getExecutablePath();
|
const auto exePath = getExecutablePath();
|
||||||
const auto parentDir = std::filesystem::path(exePath).parent_path();
|
const auto parentDir = std::filesystem::path(exePath).parent_path();
|
||||||
@@ -52,89 +54,91 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::filesystem::path> paths = { parentDir, appDataDir / "imhex" };
|
std::vector<std::filesystem::path> paths = { parentDir, appDataDir / "imhex" };
|
||||||
std::vector<std::string> results;
|
|
||||||
|
|
||||||
switch (path) {
|
switch (path) {
|
||||||
case ImHexPath::Patterns:
|
case ImHexPath::Patterns:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "patterns").string();
|
return (path / "patterns").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::PatternsInclude:
|
case ImHexPath::PatternsInclude:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "includes").string();
|
return (path / "includes").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::Magic:
|
case ImHexPath::Magic:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "magic").string();
|
return (path / "magic").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::Python:
|
case ImHexPath::Python:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "python").string();
|
return (path / "python").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::Plugins:
|
case ImHexPath::Plugins:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "plugins").string();
|
return (path / "plugins").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::Yara:
|
case ImHexPath::Yara:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "yara").string();
|
return (path / "yara").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::Config:
|
case ImHexPath::Config:
|
||||||
return { (appDataDir / "imhex" / "config").string() };
|
return { (appDataDir / "imhex" / "config").string() };
|
||||||
case ImHexPath::Resources:
|
case ImHexPath::Resources:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "resources").string();
|
return (path / "resources").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::Constants:
|
case ImHexPath::Constants:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "constants").string();
|
return (path / "constants").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default: __builtin_unreachable();
|
default: __builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
|
||||||
#elif defined(OS_MACOS)
|
#elif defined(OS_MACOS)
|
||||||
// Get path to special directories
|
// Get path to special directories
|
||||||
const auto exePath = getExecutablePath();
|
const auto exePath = getExecutablePath();
|
||||||
const std::filesystem::path applicationSupportDir(getMacApplicationSupportDirectoryPath());
|
const std::filesystem::path applicationSupportDir(getMacApplicationSupportDirectoryPath());
|
||||||
|
|
||||||
std::vector<std::filesystem::path> paths = { exePath, applicationSupportDir };
|
std::vector<std::filesystem::path> paths = { exePath, applicationSupportDir };
|
||||||
std::vector<std::string> results;
|
|
||||||
|
|
||||||
switch (path) {
|
switch (path) {
|
||||||
case ImHexPath::Patterns:
|
case ImHexPath::Patterns:
|
||||||
return { (applicationSupportDir / "patterns").string() };
|
result.push_back((applicationSupportDir / "patterns").string());
|
||||||
|
break;
|
||||||
case ImHexPath::PatternsInclude:
|
case ImHexPath::PatternsInclude:
|
||||||
return { (applicationSupportDir / "includes").string() };
|
result.push_back((applicationSupportDir / "includes").string());
|
||||||
|
break;
|
||||||
case ImHexPath::Magic:
|
case ImHexPath::Magic:
|
||||||
return { (applicationSupportDir / "magic").string() };
|
result.push_back((applicationSupportDir / "magic").string());
|
||||||
|
break;
|
||||||
case ImHexPath::Python:
|
case ImHexPath::Python:
|
||||||
return { (applicationSupportDir / "python").string() };
|
result.push_back((applicationSupportDir / "python").string());
|
||||||
|
break;
|
||||||
case ImHexPath::Plugins:
|
case ImHexPath::Plugins:
|
||||||
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
std::transform(paths.begin(), paths.end(), std::back_inserter(result), [](auto &path){
|
||||||
return (path / "plugins").string();
|
return (path / "plugins").string();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ImHexPath::Yara:
|
case ImHexPath::Yara:
|
||||||
return { (applicationSupportDir / "yara").string() };
|
result.push_back((applicationSupportDir / "yara").string());
|
||||||
|
break;
|
||||||
case ImHexPath::Config:
|
case ImHexPath::Config:
|
||||||
return { (applicationSupportDir / "config").string() };
|
result.push_back((applicationSupportDir / "config").string());
|
||||||
|
break;
|
||||||
case ImHexPath::Resources:
|
case ImHexPath::Resources:
|
||||||
return { (applicationSupportDir / "resources").string() };
|
result.push_back((applicationSupportDir / "resources").string());
|
||||||
|
break;
|
||||||
case ImHexPath::Constants:
|
case ImHexPath::Constants:
|
||||||
return { (applicationSupportDir / "constants").string() };
|
result.push_back((applicationSupportDir / "constants").string());
|
||||||
|
break;
|
||||||
default: __builtin_unreachable();
|
default: __builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
|
||||||
#else
|
#else
|
||||||
std::vector<std::filesystem::path> configDirs = xdg::ConfigDirs();
|
std::vector<std::filesystem::path> configDirs = xdg::ConfigDirs();
|
||||||
std::vector<std::filesystem::path> dataDirs = xdg::DataDirs();
|
std::vector<std::filesystem::path> dataDirs = xdg::DataDirs();
|
||||||
@@ -150,8 +154,6 @@ namespace hex {
|
|||||||
if (!exePath.empty())
|
if (!exePath.empty())
|
||||||
dataDirs.emplace(dataDirs.begin(), std::filesystem::path(exePath.data()).parent_path());
|
dataDirs.emplace(dataDirs.begin(), std::filesystem::path(exePath.data()).parent_path());
|
||||||
|
|
||||||
std::vector<std::string> result;
|
|
||||||
|
|
||||||
switch (path) {
|
switch (path) {
|
||||||
case ImHexPath::Patterns:
|
case ImHexPath::Patterns:
|
||||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||||
@@ -191,9 +193,13 @@ namespace hex {
|
|||||||
break;
|
break;
|
||||||
default: __builtin_unreachable();
|
default: __builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
result.erase(std::remove_if(result.begin(), result.end(), [](const auto& path){
|
||||||
|
return !std::filesystem::is_directory(path);
|
||||||
|
}), result.end());
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,15 @@ using json = nlohmann::json;
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
|
std::string ProjectFile::s_currProjectFilePath;
|
||||||
|
bool ProjectFile::s_hasUnsavedChanged = false;
|
||||||
|
|
||||||
|
std::string ProjectFile::s_filePath;
|
||||||
|
std::string ProjectFile::s_pattern;
|
||||||
|
Patches ProjectFile::s_patches;
|
||||||
|
std::list<ImHexApi::Bookmarks::Entry> ProjectFile::s_bookmarks;
|
||||||
|
std::string ProjectFile::s_dataProcessorContent;
|
||||||
|
|
||||||
void to_json(json& j, const ImHexApi::Bookmarks::Entry& b) {
|
void to_json(json& j, const ImHexApi::Bookmarks::Entry& b) {
|
||||||
j = json{ { "address", b.region.address }, { "size", b.region.size }, { "name", b.name.data() }, { "comment", b.comment.data() }, { "locked", b.locked }, { "color", b.color } };
|
j = json{ { "address", b.region.address }, { "size", b.region.size }, { "name", b.name.data() }, { "comment", b.comment.data() }, { "locked", b.locked }, { "color", b.color } };
|
||||||
}
|
}
|
||||||
@@ -16,12 +25,12 @@ namespace hex {
|
|||||||
void from_json(const json& j, ImHexApi::Bookmarks::Entry& b) {
|
void from_json(const json& j, ImHexApi::Bookmarks::Entry& b) {
|
||||||
std::string name, comment;
|
std::string name, comment;
|
||||||
|
|
||||||
j.at("address").get_to(b.region.address);
|
if (j.contains("address")) j.at("address").get_to(b.region.address);
|
||||||
j.at("size").get_to(b.region.size);
|
if (j.contains("size")) j.at("size").get_to(b.region.size);
|
||||||
j.at("name").get_to(name);
|
if (j.contains("name")) j.at("name").get_to(name);
|
||||||
j.at("comment").get_to(comment);
|
if (j.contains("comment")) j.at("comment").get_to(comment);
|
||||||
j.at("locked").get_to(b.locked);
|
if (j.contains("locked")) j.at("locked").get_to(b.locked);
|
||||||
j.at("color").get_to(b.color);
|
if (j.contains("color")) j.at("color").get_to(b.color);
|
||||||
|
|
||||||
std::copy(name.begin(), name.end(), std::back_inserter(b.name));
|
std::copy(name.begin(), name.end(), std::back_inserter(b.name));
|
||||||
b.name.push_back('\0');
|
b.name.push_back('\0');
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ namespace hex::init {
|
|||||||
|
|
||||||
SharedData::welcomeScreenEntries.clear();
|
SharedData::welcomeScreenEntries.clear();
|
||||||
SharedData::footerItems.clear();
|
SharedData::footerItems.clear();
|
||||||
|
SharedData::toolbarItems.clear();
|
||||||
|
|
||||||
SharedData::dataProcessorNodes.clear();
|
SharedData::dataProcessorNodes.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -2,3 +2,7 @@ project(unit_tests)
|
|||||||
|
|
||||||
add_subdirectory(pattern_language)
|
add_subdirectory(pattern_language)
|
||||||
add_subdirectory(algorithms)
|
add_subdirectory(algorithms)
|
||||||
|
|
||||||
|
add_custom_target(unit_tests
|
||||||
|
DEPENDS pattern_language_tests algorithms_test
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user