Compare commits

...

57 Commits

Author SHA1 Message Date
WerWolv
bbeb7289c1 build: Bumped version to 1.12.0 2021-12-13 23:24:48 +01:00
WerWolv
51474b2eae ui: Added icon to footer when ImHex has elevated permissions 2021-12-13 22:58:23 +01:00
WerWolv
9bf9788689 fix: Error when opening a file 2021-12-12 21:46:48 +01:00
WerWolv
b372d20ab0 fix: Missing includes on Linux and Mac 2021-12-12 13:42:01 +01:00
WerWolv
d1ce8a5f9b ui: Fix size of settings window 2021-12-12 13:35:23 +01:00
WerWolv
41ce0f57ed ui: Improved About page, removed super outdated cheat sheets 2021-12-12 13:35:07 +01:00
WerWolv
1a0b0e2385 provider: Automatically load available disks on windows 2021-12-12 11:56:26 +01:00
WerWolv
443dedd832 ui/lang: Improved localization and interface glitches of GDB provider ui 2021-12-12 11:55:38 +01:00
WerWolv
caf9ee0c58 ux: Added "Open Other" option to open other providers to File menu 2021-12-12 11:53:56 +01:00
WerWolv
b2a9965617 api: Improved Provider registering api, hide implementation functions better 2021-12-12 11:52:58 +01:00
WerWolv
821eb4568e Revert "git: No need to upload flatpak-builder files into cache on Linux"
This reverts commit 5759f163e3.
2021-12-12 01:16:26 +01:00
WerWolv
883207bc6b fix: Compile on MacOS 2021-12-12 01:06:24 +01:00
WerWolv
15e38e1012 ux: Added save pattern option to File menu 2021-12-12 00:52:54 +01:00
WerWolv
8a36897fd9 provider: Added raw disk provider 2021-12-12 00:42:12 +01:00
WerWolv
3e736b36b6 api: Refactored providers to allow for loading interfaces and config views 2021-12-12 00:41:44 +01:00
WerWolv
2e90abd2c5 patterns: Fix indexing of static arrays 2021-12-10 18:53:19 +01:00
WerWolv
fb99674217 lang: Added missing localization, changed pattern editor lang keys 2021-12-10 18:00:43 +01:00
WerWolv
69def38152 ui: Correctly make window "float" on to the foreground on windows when activating it 2021-12-10 17:28:18 +01:00
WerWolv
5759f163e3 git: No need to upload flatpak-builder files into cache on Linux 2021-12-10 16:42:46 +01:00
WerWolv
e3106eaa2a ux: Use native APIs to open websites to prevent terminal from appearing 2021-12-10 16:10:34 +01:00
WerWolv
edca3bebd7 ui: Make window border and sizing cursors be rendered correctly on Windows 2021-12-10 16:09:55 +01:00
WerWolv
620c68e3f1 ui: Fixed flickering when full screening window on Windows 2021-12-10 13:38:12 +01:00
WerWolv
8f2e382c8a patterns: Added std::env and ability to pass parameters to patterns from the UI 2021-12-10 11:55:27 +01:00
WerWolv
6a0ad22774 fix: Inconsistent provider address reading 2021-12-09 21:10:24 +01:00
WerWolv
2ac6348fbf ui: Welcome screen, GDB Provider and memory editor ui fixes 2021-12-08 22:18:59 +01:00
WerWolv
3086f259ff build: Copy dependencies of all components on install 2021-12-08 14:25:20 +01:00
WerWolv
95556d35c8 ui: Added selection size in hexadecimal to hex editor view 2021-12-08 00:08:57 +01:00
WerWolv
ea4f4c45cb sys: std::jthread -> std::thread to support libc++ 2021-12-07 23:36:28 +01:00
WerWolv
808b051a3e sys: Fixed sockets compiling on MacOS 2021-12-07 23:21:07 +01:00
WerWolv
c55146a78c sys: Fix sockets compiling on Unix 2021-12-07 23:09:30 +01:00
WerWolv
cc5a437573 provider: Added basic GDB Server provider 2021-12-07 22:47:57 +01:00
WerWolv
4a53717676 sys: Moved all views to builtin plugin 2021-12-07 22:47:41 +01:00
WerWolv
8385b88ce8 sys: Clean up properly after file is closed
Addresses another issue in #362
2021-12-05 22:09:43 +01:00
WerWolv
73604e90c8 projects: Save bookmark colors
Fixes #362
2021-12-05 22:09:07 +01:00
WerWolv
c2d1589e74 patterns: Fixed variable access inside pointer pattern yielding invalid results 2021-12-05 21:54:09 +01:00
WerWolv
69973af1ed build: Bumped version to 1.11.2 2021-12-04 23:17:14 +01:00
wardwouts
f0c679fb61 fix: Crash when framerate falls below 5 FPS (#359)
* This could work

* Testing shows this to work fine, with the added benefit of lower CPU usage

* This should do the trick then
2021-12-04 23:16:15 +01:00
WerWolv
5a2e2b1773 ux: Make uncompiled magic files be compiled when analyzing files 2021-12-03 21:07:07 +01:00
WerWolv
e720b61df6 patterns: Fix casts unexpectedly increasing cursor position 2021-12-03 16:06:40 +01:00
WerWolv
44b121e8b0 build: Added AppImage building to CI 2021-12-03 14:38:38 +01:00
WerWolv
6a7c086514 build: Fixed .deb path 2021-12-03 13:49:39 +01:00
WerWolv
3b59868f62 build: Fixed flatpaks, added .deb support 2021-12-03 04:42:15 -08:00
WerWolv
0b77a3f2c1 build: Install imhex to /usr directory on Linux 2021-12-03 11:35:06 +01:00
WerWolv
957dfeed81 build: Make sure libimhex is included in Linux artifacts 2021-12-03 11:26:16 +01:00
wardwouts
451c550b19 build: Simplify appimage build (#356)
* Simplify creating an AppImage

- package.sh packages the build result into an AppImage. It requires
squashfs-tools to work
- runtime-x86_64 is a binary distributed by the AppImage project that takes
care of extracting and running the image

* use AppRun from AppImage project

* clean up no longer needed bits

* Keep docker way of working around

- Docker now also uses `package.sh`, so no more need for FUSE.
- Fetch binaries instead of storing in git.

* Fix details

* wait a little longer for the container to start
2021-12-03 09:53:15 +01:00
WerWolv
21cc8555b5 git: Updated readme with new plugin templates and documentation page 2021-12-03 09:28:40 +01:00
WerWolv
19b80a1c2d build: Who is that? 2021-12-03 09:24:41 +01:00
WerWolv
a000b1a2fe common: Added missing include 2021-12-03 00:00:25 +01:00
WerWolv
856055a04d ui: Fix scrolling in diff view 2021-12-02 22:12:36 +01:00
wardwouts
be1c5f5d1d build: Added AppImage builder (#355)
* Docker files to create an AppImage

* Using ENTRYPOINT is a bit nicer here

* typo

* put with other dist files
2021-12-01 21:35:47 +01:00
Unai Martinez-Corral
278d46ccd7 ci/win: use option 'pacboy' of setup-msys2 to install dependencies (#354) 2021-12-01 20:31:17 +01:00
qdlmcfresh
0da31b6bbb ui: Add result count to string view (#353)
* Add result count to string view

* Localization

* formating and logic fix
2021-11-30 21:02:37 +01:00
David Buchanan
e8bc94a25a ImGui: nearest-neighbor font upscaling (for crisp pixel fonts on hidpi displays) (#352) 2021-11-29 11:09:43 +01:00
WerWolv
d12869dbac git: Added more people to credits 2021-11-29 08:33:15 +01:00
WerWolv
fecd70c9ad build: Bumped version to 1.11.1 2021-11-28 21:34:17 +01:00
WerWolv
4effa999b3 debug: Fixed application crashing on Windows if not console is attached 2021-11-28 21:33:46 +01:00
WerWolv
dd35a717b7 ui: Fixed windows decoration being turned off on all platforms 2021-11-28 21:33:11 +01:00
118 changed files with 3584 additions and 2066 deletions

View File

@@ -19,7 +19,7 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: recursive submodules: recursive
- name: 📜 Restore cache - name: 📜 Restore cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@@ -33,7 +33,7 @@ jobs:
run: | run: |
sudo apt update sudo apt update
sudo bash dist/get_deps_debian.sh sudo bash dist/get_deps_debian.sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none sh rustup-init.sh -y --default-toolchain none
rm rustup-init.sh rm rustup-init.sh
@@ -61,6 +61,16 @@ jobs:
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 --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
run: |
dpkg-deb --build build/install
mv build/install.deb imhex.deb
- name: 📦 Bundle AppImage
run: |
dist/AppImage/package.sh build
mv build/ImHex-x86_64.AppImage imhex.AppImage
- name: ⬆️ Upload ELF - name: ⬆️ Upload ELF
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@@ -74,7 +84,21 @@ jobs:
with: with:
name: Linux Flatpak name: Linux Flatpak
path: | path: |
imhex.flatpak imhex.flatpak
- name: ⬆️ Upload .deb
uses: actions/upload-artifact@v2
with:
name: Linux DEB
path: |
imhex.deb
- name: ⬆️ Upload AppImage
uses: actions/upload-artifact@v2
with:
name: Linux AppImage
path: |
imhex.AppImage
win: win:
runs-on: windows-latest runs-on: windows-latest
@@ -92,14 +116,26 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: recursive submodules: recursive
- name: 🟦 Install msys2 - name: 🟦 Install msys2
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with:
msystem: mingw64
pacboy: >-
gcc:p
cmake:p
make:p
ccache:p
capstone:p
glfw:p
file:p
mbedtls:p
python:p
freetype:p
dlfcn:p
- name: ⬇️ Install dependencies - name: ⬇️ Install dependencies
run: | run: |
bash dist/get_deps_msys2.sh
curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs > rustup-init.exe curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs > rustup-init.exe
./rustup-init.exe -y --default-host=x86_64-pc-windows-gnu --default-toolchain=none ./rustup-init.exe -y --default-host=x86_64-pc-windows-gnu --default-toolchain=none
rm rustup-init.exe rm rustup-init.exe

View File

@@ -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.11.0") set(IMHEX_VERSION "1.12.0")
project(imhex VERSION ${IMHEX_VERSION}) project(imhex VERSION ${IMHEX_VERSION})
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
@@ -46,33 +46,7 @@ add_executable(imhex ${application_type}
source/init/splash_window.cpp source/init/splash_window.cpp
source/init/tasks.cpp source/init/tasks.cpp
source/helpers/patches.cpp
source/helpers/project_file_handler.cpp
source/helpers/loader_script_handler.cpp
source/helpers/plugin_manager.cpp source/helpers/plugin_manager.cpp
source/helpers/encoding_file.cpp
source/providers/file_provider.cpp
source/views/view_hexeditor.cpp
source/views/view_pattern_editor.cpp
source/views/view_pattern_data.cpp
source/views/view_hashes.cpp
source/views/view_information.cpp
source/views/view_help.cpp
source/views/view_tools.cpp
source/views/view_strings.cpp
source/views/view_data_inspector.cpp
source/views/view_disassembler.cpp
source/views/view_bookmarks.cpp
source/views/view_patches.cpp
source/views/view_command_palette.cpp
source/views/view_settings.cpp
source/views/view_data_processor.cpp
source/views/view_yara.cpp
source/views/view_constants.cpp
source/views/view_store.cpp
source/views/view_diff.cpp
${imhex_icon} ${imhex_icon}
) )
@@ -80,9 +54,9 @@ add_executable(imhex ${application_type}
set_target_properties(imhex PROPERTIES CXX_VISIBILITY_PRESET hidden) set_target_properties(imhex PROPERTIES CXX_VISIBILITY_PRESET hidden)
if (WIN32) if (WIN32)
target_link_libraries(imhex dl libimhex wsock32 ws2_32 Dwmapi.lib) target_link_libraries(imhex PUBLIC dl libimhex wsock32 ws2_32 Dwmapi.lib)
else () else ()
target_link_libraries(imhex dl libimhex pthread) target_link_libraries(imhex PUBLIC dl libimhex pthread)
endif () endif ()
createPackage() createPackage()

View File

@@ -100,7 +100,13 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
## Pattern Language ## Pattern Language
The custom C-like Pattern Language developed and used by ImHex is easy to read, understand and learn. A guide with all features of the language can be found [in the wiki](https://github.com/WerWolv/ImHex/wiki/Pattern-Language-Guide) or a simpler version in ImHex under `Help -> Pattern Language Cheat Sheet` The custom C-like Pattern Language developed and used by ImHex is easy to read, understand and learn. A guide with all features of the language can be found [on the docs page](http://imhex.werwolv.net/docs).
## Plugin development
To develop plugins for ImHex, use one of the following two templates projects to get startet. You then have access to the entirety of libimhex as well as the ImHex API and the Content Registry to interact with ImHex or to add new content.
- [C++ Plugin Template](https://github.com/WerWolv/ImHex-Cpp-Plugin-Template)
- [Rust Plugin Template](https://github.com/WerWolv/ImHex-Rust-Plugin-Template)
## Additional Files ## Additional Files
@@ -209,6 +215,15 @@ with the environment variables `XDG_CONFIG_HOME`, `XDG_CONFIG_DIRS`,
## Credits ## Credits
### Contributors
- [Mary](https://github.com/Thog) for her immense help porting ImHex to MacOS and help during development
- [Roblabla](https://github.com/Roblabla) for adding MSI Installer support to ImHex
- [jam1garner](https://github.com/jam1garner) and [raytwo](https://github.com/raytwo) for their help with adding Rust support to plugins
- All other people that have been reporting issues on Discord or GitHub that I had great conversations with :)
### Libraries
- Thanks a lot to ocornut for their amazing [Dear ImGui](https://github.com/ocornut/imgui) which is used for building the entire interface - Thanks a lot to ocornut for their amazing [Dear ImGui](https://github.com/ocornut/imgui) which is used for building the entire interface
- Thanks to ocornut as well for their hex editor view used as base for this project. - Thanks to ocornut as well for their hex editor view used as base for this project.
- Thanks to BalazsJako for their incredible [ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit) used for the pattern language syntax highlighting - Thanks to BalazsJako for their incredible [ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit) used for the pattern language syntax highlighting

View File

@@ -84,10 +84,10 @@ macro(detectOS)
set(MAGIC_INSTALL_LOCATION "magic") set(MAGIC_INSTALL_LOCATION "magic")
elseif(UNIX AND NOT APPLE) elseif(UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_LINUX") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_LINUX")
set(CMAKE_INSTALL_BINDIR "bin") set(CMAKE_INSTALL_BINDIR "usr/bin")
set(CMAKE_INSTALL_LIBDIR "lib") set(CMAKE_INSTALL_LIBDIR "usr/lib")
set(PLUGINS_INSTALL_LOCATION "share/imhex/plugins") set(PLUGINS_INSTALL_LOCATION "usr/share/imhex/plugins")
set(MAGIC_INSTALL_LOCATION "share/imhex/magic") set(MAGIC_INSTALL_LOCATION "usr/share/imhex/magic")
else() else()
message(FATAL_ERROR "Unknown / unsupported system!") message(FATAL_ERROR "Unknown / unsupported system!")
endif() endif()
@@ -186,6 +186,7 @@ macro(createPackage)
endif () endif ()
endforeach() endforeach()
install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}")
set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
if (WIN32) if (WIN32)
@@ -198,7 +199,7 @@ macro(createPackage)
INSTALL(CODE "LIST(APPEND DEP_FOLDERS \${PY_PARENT})") INSTALL(CODE "LIST(APPEND DEP_FOLDERS \${PY_PARENT})")
install(CODE [[ install(CODE [[
file(GET_RUNTIME_DEPENDENCIES file(GET_RUNTIME_DEPENDENCIES
EXECUTABLES $<TARGET_FILE:imhex> EXECUTABLES $<TARGET_FILE:builtin> $<TARGET_FILE:libimhex> $<TARGET_FILE:imhex>
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
@@ -207,10 +208,10 @@ macro(createPackage)
) )
if(_u_deps) if(_u_deps)
message(WARNING "There were unresolved dependencies for binary $<TARGET_FILE:imhex>: \"${_u_deps}\"!") message(WARNING "There were unresolved dependencies for binary: \"${_u_deps}\"!")
endif() endif()
if(_c_deps_FILENAMES) if(_c_deps_FILENAMES)
message(WARNING "There were conflicting dependencies for library $<TARGET_FILE:imhex>: \"${_c_deps}\"!") message(WARNING "There were conflicting dependencies for library: \"${_c_deps}\"!")
endif() endif()
foreach(_file ${_r_deps}) foreach(_file ${_r_deps})
@@ -222,6 +223,11 @@ macro(createPackage)
) )
endforeach() endforeach()
]]) ]])
elseif(UNIX AND NOT APPLE)
configure_file(${CMAKE_SOURCE_DIR}/dist/DEBIAN/control.in ${CMAKE_BINARY_DIR}/DEBIAN/control)
install(FILES ${CMAKE_BINARY_DIR}/DEBIAN/control DESTINATION ${CMAKE_INSTALL_PREFIX}/DEBIAN)
install(FILES ${CMAKE_SOURCE_DIR}/dist/imhex.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/share/applications)
install(FILES ${CMAKE_SOURCE_DIR}/res/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/share/pixmaps RENAME imhex.png)
endif() endif()
if (CREATE_BUNDLE) if (CREATE_BUNDLE)
@@ -266,4 +272,4 @@ macro(setDefaultBuiltTypeIfUnset)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Using Release build type as it was left unset" FORCE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Using Release build type as it was left unset" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif() endif()
endmacro() endmacro()

40
dist/AppImage/Dockerfile vendored Normal file
View File

@@ -0,0 +1,40 @@
FROM debian:bullseye-slim
LABEL maintainer Example <example@example.com>
ARG TAG=master
ARG REPO=https://github.com/WerWolv/ImHex.git
USER root
# Bring packages up to date
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get autoremove -y \
&& apt-get install -y \
git \
cmake \
curl \
squashfs-tools
# Fetch source and dependencies
RUN mkdir -p /source \
&& cd /source \
&& git clone $REPO \
&& cd ImHex \
&& git checkout $TAG \
&& git submodule update --init --recursive \
&& cd /source/ImHex/dist \
&& ./get_deps_debian.sh
ARG CXX=g++-10
# Build ImHex
RUN mkdir -p /source/ImHex/build \
&& cd /source/ImHex/build \
&& cmake --install-prefix /usr -DCMAKE_BUILD_TYPE=Release .. \
&& make -j
# Prepare for AppImage
RUN cd /source/ImHex/dist/AppImage \
&& ./package.sh /source/ImHex/build \
&& mv /source/ImHex/build/ImHex-x86_64.AppImage /

6
dist/AppImage/ImHex.desktop vendored Normal file
View File

@@ -0,0 +1,6 @@
[Desktop Entry]
Name=ImHex
Exec=imhex
Icon=imhex
Type=Application
Categories=Utility;

22
dist/AppImage/README.md vendored Normal file
View File

@@ -0,0 +1,22 @@
# Building an AppImage
There are two ways of building an AppImage for ImHex, using the provided
tools here.
If you want to create an AppImage and do not have a build to work from
already, you can use docker to build ImHex and package an AppImage.
Alternatively you can create an AppImage using an existing build.
## Using docker
First run `build.sh` to create a docker image. Then run `extract.sh` to get the
AppImage out. This needs to be in two steps, as a docker build cannot copy
files out. Nor can docker build use volume mounts.
The environment variable TAG can be set to build for a specific git tag.
Without the master branch is build.
## Using an existing build
Run `package.sh` with the build dir as an argument. E.g.:
```
./package.sh ../../build
```

16
dist/AppImage/build.sh vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Set the TAG environment variable to build a specific tag
# Set the REPO environment variable to point at a different git repository
# Make sure we're in the same directory as this script
pushd $(dirname "$(realpath "$0")")
BUILDARG=""
SUFFIX=""
[ -n "${TAG}" ] && BUILDARG="${BUILDARG} --build-arg=TAG=${TAG}" && SUFFIX=":${TAG}"
[ -n "${REPO}" ] && BUILDARG="${BUILDARG} --build-arg=REPO=${REPO}"
docker build ${BUILDARG} -t imhex-appimage-build${SUFFIX} .
popd

26
dist/AppImage/extract.sh vendored Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Set the TAG environment variable to move to a versioned name while extracting
# Make sure we're in the same directory as this script
pushd $(dirname "$(realpath "$0")")
SUFFIX=""
[ -n "$TAG" ] && SUFFIX=":$TAG"
# Remove old containers
docker rm imhex 2>&1 > /dev/null
docker run -d --name imhex imhex-appimage-build${SUFFIX} sleep 30 &
sleep 15
docker cp imhex:/ImHex-x86_64.AppImage .
# Move to tagged name if $TAG set
if [ -n "$TAG" ]; then
mv ImHex-x86_64.AppImage ImHex-${TAG}-x86_64.AppImage
echo -e "\nThe created AppImage can be found here:\n $(pwd)/ImHex-${TAG}-x86_64.AppImage\n\n"
else
echo -e "\nThe created AppImage can be found here:\n $(pwd)/ImHex-x86_64.AppImage\n\n"
fi
popd

BIN
dist/AppImage/imhex.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

56
dist/AppImage/package.sh vendored Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
set -e # Exit on error
set -o pipefail # Bash specific
usage() {
echo "Tool to package an ImHex build into an AppImage"
echo
echo "Usage:"
echo "$0 <build dir>"
echo
exit
}
MYDIR=$(dirname "$(realpath "$0")")
# Check is a build dir has been specified and it's a dir
[ -z "$1" ] && usage
[ -d "$1" ] || usage
set -u # Throw errors when unset variables are used
BUILDDIR=$1
APPDIR=${BUILDDIR}/ImHex.AppDir
APPIMAGE=${BUILDDIR}/ImHex-x86_64.AppImage
# Prepare for AppImage
## Fetch the needed AppImage binaries
curl -L https://github.com/AppImage/AppImageKit/releases/download/13/AppRun-x86_64 -o ${MYDIR}/AppRun-x86_64
curl -L https://github.com/AppImage/AppImageKit/releases/download/13/runtime-x86_64 -o ${MYDIR}/runtime-x86_64
## Setup directory structure
mkdir -p ${BUILDDIR}/ImHex.AppDir/usr/{bin,lib} ${BUILDDIR}/ImHex.AppDir/usr/share/imhex/plugins
## Add ImHex files to structure
cp ${BUILDDIR}/imhex ${APPDIR}/usr/bin
cp ${BUILDDIR}/plugins/builtin/builtin.hexplug ${APPDIR}/usr/share/imhex/plugins
cp ${MYDIR}/{AppRun-x86_64,ImHex.desktop,imhex.png} ${APPDIR}/
mv ${BUILDDIR}/ImHex.AppDir/AppRun-x86_64 ${APPDIR}/AppRun
chmod a+x ${BUILDDIR}/ImHex.AppDir/AppRun
## Add all dependencies
ldd ${BUILDDIR}/imhex | awk '/ => /{print $3}' | xargs -I '{}' cp '{}' ${APPDIR}/usr/lib
# Package it up as described here:
# https://github.com/AppImage/AppImageKit#appimagetool-usage
# under 'If you want to generate an AppImage manually'
# This builds a v2 AppImage according to
# https://github.com/AppImage/AppImageSpec/blob/master/draft.md#type-2-image-format
mksquashfs ${APPDIR} ${BUILDDIR}/ImHex.squashfs -root-owned -noappend
cat ${MYDIR}/runtime-x86_64 > ${APPIMAGE}
cat ${BUILDDIR}/ImHex.squashfs >> ${APPIMAGE}
chmod a+x ${APPIMAGE}
if [ ! -f /.dockerenv ]; then
echo -e "\nThe created AppImage can be found here:\n ${APPIMAGE}\n\n"
fi

12
dist/DEBIAN/control.in vendored Normal file
View File

@@ -0,0 +1,12 @@
Package: ImHex
Version: ${PROJECT_VERSION}
Section: editors
Priority: optional
Architecture: amd64
License: GNU GPL-2
Depends: libglfw3-dev, libmagic-dev, libmbedtls-dev, libcapstone-dev, python3-dev, libfreetype-dev, libgtk-3-dev, libldap2-dev
Maintainer: WerWolv <hey@werwolv.net>
Description: ImHex Hex Editor
A Hex Editor for Reverse Engineers, Programmers and
people who value their retinas when working at 3 AM.

11
dist/DEBIAN/imhex.desktop vendored Normal file
View File

@@ -0,0 +1,11 @@
[Desktop Entry]
Name=ImHex
Comment=ImHex Hex Editor
GenericName=Hex Editor
Exec=/usr/bin/imhex %U
Icon=/usr/share/pixmaps/imhex.png
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Development;
StartupWMClass=imhex

11
dist/imhex.desktop vendored Normal file
View File

@@ -0,0 +1,11 @@
[Desktop Entry]
Name=ImHex
Comment=ImHex Hex Editor
GenericName=Hex Editor
Exec=/usr/bin/imhex %U
Icon=/usr/share/pixmaps/imhex.png
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Development;
StartupWMClass=imhex

View File

@@ -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: imhex command: /usr/bin/imhex
finish-args: finish-args:
- --share=ipc - --share=ipc
@@ -68,4 +68,4 @@ modules:
sources: sources:
- type: git - type: git
url: https://github.com/WerWolv/ImHex.git url: https://github.com/WerWolv/ImHex.git

View File

@@ -45,6 +45,8 @@ namespace ImGui {
} }
}; };
int UpdateStringSizeCallback(ImGuiInputTextCallbackData *data);
bool IconHyperlink(const char *icon, const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0); bool IconHyperlink(const char *icon, const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
bool Hyperlink(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0); bool Hyperlink(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
bool BulletHyperlink(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0); bool BulletHyperlink(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);

View File

@@ -149,6 +149,7 @@ typedef khronos_uint8_t GLubyte;
#define GL_FILL 0x1B02 #define GL_FILL 0x1B02
#define GL_VERSION 0x1F02 #define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03 #define GL_EXTENSIONS 0x1F03
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601 #define GL_LINEAR 0x2601
#define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_MIN_FILTER 0x2801

View File

@@ -239,7 +239,9 @@ struct MemoryEditor
DataPreviewAddrOld = DataPreviewAddr; DataPreviewAddrOld = DataPreviewAddr;
DataPreviewAddrEndOld = DataPreviewAddrEnd; DataPreviewAddrEndOld = DataPreviewAddrEnd;
DrawContents(mem_data, mem_size, base_display_addr); if (mem_size > 0)
DrawContents(mem_data, mem_size, base_display_addr);
if (ContentsWidthChanged) if (ContentsWidthChanged)
{ {
CalcSizes(s, mem_size, base_display_addr); CalcSizes(s, mem_size, base_display_addr);
@@ -706,8 +708,8 @@ struct MemoryEditor
{ {
IM_UNUSED(mem_data); IM_UNUSED(mem_data);
ImGuiStyle& style = ImGui::GetStyle(); ImGuiStyle& style = ImGui::GetStyle();
const char* format_range = OptUpperCaseHex ? "Range %0*" _PRISizeT "X..%0*" _PRISizeT "X" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x"; const char* format_range = OptUpperCaseHex ? "Range 0x%0*" _PRISizeT "X..0x%0*" _PRISizeT "X" : "Range 0x%0*" _PRISizeT "x..0x%0*" _PRISizeT "x";
const char* format_selection = OptUpperCaseHex ? "Selection %0*" _PRISizeT "X..%0*" _PRISizeT "X (%ld %s)" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x (%ld %s)"; const char* format_selection = OptUpperCaseHex ? "Selection 0x%0*" _PRISizeT "X..0x%0*" _PRISizeT "X (%ld [0x%lX] %s)" : "Range 0x%0*" _PRISizeT "x..0x%0*" _PRISizeT "x (%ld [0x%lX] %s)";
if (this->OptShowExtraInfo) { if (this->OptShowExtraInfo) {
ImGui::Text(format_range, s.AddrDigitsCount, base_display_addr, s.AddrDigitsCount, base_display_addr + mem_size - 1); ImGui::Text(format_range, s.AddrDigitsCount, base_display_addr, s.AddrDigitsCount, base_display_addr + mem_size - 1);
@@ -720,7 +722,7 @@ struct MemoryEditor
auto selectionEnd = std::max(DataPreviewAddr, DataPreviewAddrEnd); auto selectionEnd = std::max(DataPreviewAddr, DataPreviewAddrEnd);
size_t regionSize = (selectionEnd - selectionStart) + 1; size_t regionSize = (selectionEnd - selectionStart) + 1;
ImGui::Text(format_selection, s.AddrDigitsCount, base_display_addr + selectionStart, s.AddrDigitsCount, base_display_addr + selectionEnd, regionSize, regionSize == 1 ? "byte" : "bytes"); ImGui::Text(format_selection, s.AddrDigitsCount, base_display_addr + selectionStart, s.AddrDigitsCount, base_display_addr + selectionEnd, regionSize, regionSize, regionSize == 1 ? "byte" : "bytes");
} }
} }

View File

@@ -15,6 +15,13 @@
namespace ImGui { namespace ImGui {
int UpdateStringSizeCallback(ImGuiInputTextCallbackData *data) {
auto &mathInput = *static_cast<std::string*>(data->UserData);
mathInput.resize(data->BufTextLen);
return 0;
}
bool IconHyperlink(const char *icon, const char* label, const ImVec2& size_arg, ImGuiButtonFlags flags) { bool IconHyperlink(const char *icon, const char* label, const ImVec2& size_arg, ImGuiButtonFlags flags) {
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems) if (window->SkipItems)

View File

@@ -472,10 +472,12 @@ static void ImGui_ImplGlfw_UpdateMouseCursor()
} }
else else
{ {
// Show OS mouse cursor #if !defined(OS_WINDOWS)
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here. // Show OS mouse cursor
glfwSetCursor(window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]); // FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); glfwSetCursor(window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]);
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
#endif
} }
} }
} }

View File

@@ -525,7 +525,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture()
glGenTextures(1, &bd->FontTexture); glGenTextures(1, &bd->FontTexture);
glBindTexture(GL_TEXTURE_2D, bd->FontTexture); glBindTexture(GL_TEXTURE_2D, bd->FontTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
#ifdef GL_UNPACK_ROW_LENGTH // Not on WebGL/ES #ifdef GL_UNPACK_ROW_LENGTH // Not on WebGL/ES
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
#endif #endif

View File

@@ -25,7 +25,8 @@ namespace hex {
private: private:
void setupNativeWindow(); void setupNativeWindow();
void updateNativeWindow(); void beginNativeWindowFrame();
void endNativeWindowFrame();
void drawTitleBar(); void drawTitleBar();
void frameBegin(); void frameBegin();

View File

@@ -13,6 +13,34 @@ add_library(${PROJECT_NAME} SHARED
source/content/tools_entries.cpp source/content/tools_entries.cpp
source/content/data_processor_nodes.cpp source/content/data_processor_nodes.cpp
source/content/ui_items.cpp source/content/ui_items.cpp
source/content/providers.cpp
source/content/views.cpp
source/content/providers/file_provider.cpp
source/content/providers/gdb_provider.cpp
source/content/providers/disk_provider.cpp
source/content/views/view_hexeditor.cpp
source/content/views/view_pattern_editor.cpp
source/content/views/view_pattern_data.cpp
source/content/views/view_hashes.cpp
source/content/views/view_information.cpp
source/content/views/view_help.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
source/content/views/view_patches.cpp
source/content/views/view_command_palette.cpp
source/content/views/view_settings.cpp
source/content/views/view_data_processor.cpp
source/content/views/view_yara.cpp
source/content/views/view_constants.cpp
source/content/views/view_store.cpp
source/content/views/view_diff.cpp
source/content/views/view_provider_settings.cpp
source/math_evaluator.cpp source/math_evaluator.cpp

View File

@@ -0,0 +1,63 @@
#pragma once
#include <hex/providers/provider.hpp>
#include <set>
#include <string>
#include <vector>
#if defined(OS_WINDOWS)
#include <windows.h>
#endif
namespace hex::plugin::builtin::prv {
class DiskProvider : public hex::prv::Provider {
public:
DiskProvider();
~DiskProvider() override;
[[nodiscard]] bool isAvailable() const override;
[[nodiscard]] bool isReadable() const override;
[[nodiscard]] bool isWritable() const override;
[[nodiscard]] bool isResizable() const override;
[[nodiscard]] bool isSavable() const override;
void readRaw(u64 offset, void *buffer, size_t size) override;
void writeRaw(u64 offset, const void *buffer, size_t size) override;
[[nodiscard]] size_t getActualSize() const override;
void setPath(const std::string &path);
[[nodiscard]] bool open() override;
void close() override;
[[nodiscard]] virtual std::string getName() const;
[[nodiscard]] virtual std::vector<std::pair<std::string, std::string>> getDataInformation() const;
[[nodiscard]] bool hasLoadInterface() const override { return true; }
void drawLoadInterface() override;
protected:
void reloadDrives();
std::set<std::string> m_availableDrives;
std::string m_path;
#if defined(OS_WINDOWS)
HANDLE m_diskHandle = INVALID_HANDLE_VALUE;
#else
int m_diskHandle = -1;
#endif
size_t m_diskSize;
size_t m_sectorSize;
u64 m_sectorBufferAddress;
std::vector<u8> m_sectorBuffer;
bool m_readable = false;
bool m_writable = false;
};
}

View File

@@ -14,18 +14,18 @@
#include <sys/fcntl.h> #include <sys/fcntl.h>
#endif #endif
namespace hex::prv { namespace hex::plugin::builtin::prv {
class FileProvider : public Provider { class FileProvider : public hex::prv::Provider {
public: public:
explicit FileProvider(std::string path); explicit FileProvider();
~FileProvider() override; ~FileProvider() override;
bool isAvailable() const override; [[nodiscard]] bool isAvailable() const override;
bool isReadable() const override; [[nodiscard]] bool isReadable() const override;
bool isWritable() const override; [[nodiscard]] bool isWritable() const override;
bool isResizable() const override; [[nodiscard]] bool isResizable() const override;
bool isSavable() const override; [[nodiscard]] bool isSavable() const override;
void read(u64 offset, void *buffer, size_t size, bool overlays) override; void read(u64 offset, void *buffer, size_t size, bool overlays) override;
void write(u64 offset, const void *buffer, size_t size) override; void write(u64 offset, const void *buffer, size_t size) override;
@@ -33,7 +33,7 @@ namespace hex::prv {
void readRaw(u64 offset, void *buffer, size_t size) override; void readRaw(u64 offset, void *buffer, size_t size) override;
void writeRaw(u64 offset, const void *buffer, size_t size) override; void writeRaw(u64 offset, const void *buffer, size_t size) override;
size_t getActualSize() const override; [[nodiscard]] size_t getActualSize() const override;
void save() override; void save() override;
void saveAs(const std::string &path) override; void saveAs(const std::string &path) override;
@@ -41,7 +41,12 @@ namespace hex::prv {
[[nodiscard]] std::string getName() const override; [[nodiscard]] std::string getName() const override;
[[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataInformation() const override; [[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataInformation() const override;
private: void setPath(const std::string &path);
[[nodiscard]] bool open() override;
void close() override;
protected:
#if defined(OS_WINDOWS) #if defined(OS_WINDOWS)
HANDLE m_file = INVALID_HANDLE_VALUE; HANDLE m_file = INVALID_HANDLE_VALUE;
HANDLE m_mapping = INVALID_HANDLE_VALUE; HANDLE m_mapping = INVALID_HANDLE_VALUE;
@@ -57,9 +62,6 @@ namespace hex::prv {
struct stat m_fileStats = { 0 }; struct stat m_fileStats = { 0 };
bool m_readable = false, m_writable = false; bool m_readable = false, m_writable = false;
void open();
void close();
}; };
} }

View File

@@ -0,0 +1,65 @@
#pragma once
#include <hex/helpers/socket.hpp>
#include <hex/providers/provider.hpp>
#include <mutex>
#include <string_view>
#include <thread>
namespace hex::plugin::builtin::prv {
class GDBProvider : public hex::prv::Provider {
public:
explicit GDBProvider();
~GDBProvider() override;
[[nodiscard]] bool isAvailable() const override;
[[nodiscard]] bool isReadable() const override;
[[nodiscard]] bool isWritable() const override;
[[nodiscard]] bool isResizable() const override;
[[nodiscard]] bool isSavable() const override;
void read(u64 offset, void *buffer, size_t size, bool overlays) override;
void write(u64 offset, const void *buffer, size_t size) override;
void resize(ssize_t newSize) override;
void readRaw(u64 offset, void *buffer, size_t size) override;
void writeRaw(u64 offset, const void *buffer, size_t size) override;
[[nodiscard]] size_t getActualSize() const override;
void save() override;
void saveAs(const std::string &path) override;
[[nodiscard]] std::string getName() const override;
[[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataInformation() const override;
[[nodiscard]] bool open() override;
void close() override;
[[nodiscard]] bool isConnected() const;
[[nodiscard]] bool hasLoadInterface() const override { return true; }
void drawLoadInterface() override;
protected:
hex::Socket m_socket;
std::string m_ipAddress;
int m_port;
constexpr static size_t CacheLineSize = 0x1000;
struct CacheLine {
u64 address;
std::array<u8, CacheLineSize> data;
};
std::list<CacheLine> m_cache;
std::thread m_cacheUpdateThread;
std::mutex m_cacheLock;
};
}

View File

@@ -5,7 +5,7 @@
#include <vector> #include <vector>
#include <list> #include <list>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -9,7 +9,7 @@
#include <tuple> #include <tuple>
#include <cstdio> #include <cstdio>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -5,7 +5,7 @@
#include <cstdio> #include <cstdio>
#include <string> #include <string>
namespace hex { namespace hex::plugin::builtin {
enum class ConstantType { enum class ConstantType {
Int10, Int10,

View File

@@ -8,7 +8,7 @@
#include <cstdio> #include <cstdio>
#include <string> #include <string>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }
@@ -23,7 +23,7 @@ namespace hex {
private: private:
struct InspectorCacheEntry { struct InspectorCacheEntry {
std::string unlocalizedName; std::string unlocalizedName;
ContentRegistry::DataInspector::DisplayFunction displayFunction; ContentRegistry::DataInspector::impl::DisplayFunction displayFunction;
}; };
bool m_shouldInvalidate = true; bool m_shouldInvalidate = true;

View File

@@ -10,7 +10,7 @@
#include <array> #include <array>
#include <string> #include <string>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }
@@ -27,7 +27,7 @@ namespace hex {
std::list<dp::Node*> m_nodes; std::list<dp::Node*> m_nodes;
std::list<dp::Link> m_links; std::list<dp::Link> m_links;
std::vector<prv::Overlay*> m_dataOverlays; std::vector<hex::prv::Overlay*> m_dataOverlays;
int m_rightClickedId = -1; int m_rightClickedId = -1;
ImVec2 m_rightClickedCoords; ImVec2 m_rightClickedCoords;

View File

@@ -9,7 +9,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -2,13 +2,13 @@
#include <hex/views/view.hpp> #include <hex/views/view.hpp>
#include "helpers/disassembler.hpp" #include <hex/helpers/disassembler.hpp>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <vector> #include <vector>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -6,7 +6,7 @@
#include <utility> #include <utility>
#include <cstdio> #include <cstdio>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -9,7 +9,7 @@
#include <tuple> #include <tuple>
#include <cstdio> #include <cstdio>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }
@@ -30,12 +30,13 @@ namespace hex {
private: private:
bool m_aboutWindowOpen = false; bool m_aboutWindowOpen = false;
bool m_patternHelpWindowOpen = false;
bool m_mathHelpWindowOpen = false;
void drawAboutPopup(); void drawAboutPopup();
void drawPatternHelpPopup();
void drawMathEvaluatorHelp(); void drawAboutMainPage();
void drawContributorPage();
void drawLibraryCreditsPage();
void drawPathsPage();
}; };
} }

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <hex/views/view.hpp> #include <hex/views/view.hpp>
#include "helpers/encoding_file.hpp" #include <hex/helpers/encoding_file.hpp>
#include <imgui_memory_editor.h> #include <imgui_memory_editor.h>
@@ -10,9 +10,11 @@
#include <random> #include <random>
#include <vector> #include <vector>
namespace hex { namespace hex::prv { class Provider; }
namespace hex::plugin::builtin {
namespace prv { class Provider; }
using SearchFunction = std::vector<std::pair<u64, u64>> (*)(prv::Provider* &provider, std::string string); using SearchFunction = std::vector<std::pair<u64, u64>> (*)(prv::Provider* &provider, std::string string);

View File

@@ -3,11 +3,12 @@
#include <hex/views/view.hpp> #include <hex/views/view.hpp>
#include <array> #include <array>
#include <atomic>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <vector> #include <vector>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }
@@ -30,6 +31,7 @@ namespace hex {
std::array<ImU64, 256> m_valueCounts = { 0 }; std::array<ImU64, 256> m_valueCounts = { 0 };
bool m_analyzing = false; bool m_analyzing = false;
std::atomic<u64> m_bytesAnalyzed;
std::pair<u64, u64> m_analyzedRegion = { 0, 0 }; std::pair<u64, u64> m_analyzedRegion = { 0, 0 };

View File

@@ -7,7 +7,7 @@
#include <optional> #include <optional>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -14,6 +14,11 @@ namespace hex {
namespace prv { class Provider; } namespace prv { class Provider; }
namespace lang { class PatternData; } namespace lang { class PatternData; }
}
namespace hex::plugin::builtin {
class ViewPatternData : public View { class ViewPatternData : public View {
public: public:
ViewPatternData(); ViewPatternData();

View File

@@ -13,7 +13,7 @@
#include <TextEditor.h> #include <TextEditor.h>
namespace hex { namespace hex::plugin::builtin {
class ViewPatternEditor : public View { class ViewPatternEditor : public View {
public: public:
@@ -37,6 +37,21 @@ namespace hex {
TextEditor m_textEditor; TextEditor m_textEditor;
std::vector<std::pair<pl::LogConsole::Level, std::string>> m_console; std::vector<std::pair<pl::LogConsole::Level, std::string>> m_console;
enum class EnvVarType {
Integer,
Float,
String,
Bool
};
struct EnvVar {
std::string name;
pl::Token::Literal value;
EnvVarType type;
};
std::vector<EnvVar> m_envVarEntries;
void loadPatternFile(const std::string &path); void loadPatternFile(const std::string &path);
void clearPatternData(); void clearPatternData();
void parsePattern(char *buffer); void parsePattern(char *buffer);

View File

@@ -0,0 +1,26 @@
#pragma once
#include <hex.hpp>
#include <imgui.h>
#include <hex/views/view.hpp>
#include <array>
#include <string>
namespace hex::plugin::builtin {
class ViewProviderSettings : public hex::View {
public:
ViewProviderSettings();
~ViewProviderSettings();
void drawContent() override;
void drawAlwaysVisible() override;
bool hasViewMenuItemEntry() override;
bool isAvailable();
};
}

View File

@@ -5,7 +5,7 @@
#include <cstdio> #include <cstdio>
#include <string> #include <string>
namespace hex { namespace hex::plugin::builtin {
class ViewSettings : public View { class ViewSettings : public View {
public: public:

View File

@@ -11,7 +11,7 @@
#include <string> #include <string>
#include <filesystem> #include <filesystem>
namespace hex { namespace hex::plugin::builtin {
struct StoreEntry { struct StoreEntry {
std::string name; std::string name;

View File

@@ -5,7 +5,7 @@
#include <cstdio> #include <cstdio>
#include <string> #include <string>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -8,7 +8,7 @@
#include <array> #include <array>
#include <string> #include <string>
namespace hex { namespace hex::plugin::builtin {
namespace prv { class Provider; } namespace prv { class Provider; }

View File

@@ -5,7 +5,7 @@
#include <imgui.h> #include <imgui.h>
#include <hex/views/view.hpp> #include <hex/views/view.hpp>
namespace hex { namespace hex::plugin::builtin {
class ViewYara : public View { class ViewYara : public View {
public: public:

View File

@@ -51,7 +51,7 @@ namespace hex::plugin::builtin {
/* assert(condition, message) */ /* assert(condition, message) */
ContentRegistry::PatternLanguageFunctions::add(nsStd, "assert", 2, [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> { ContentRegistry::PatternLanguageFunctions::add(nsStd, "assert", 2, [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
auto condition = Token::literalToBoolean(params[0]); auto condition = Token::literalToBoolean(params[0]);
auto message = std::get<std::string>(params[1]); auto message = Token::literalToString(params[1], false);
if (!condition) if (!condition)
LogConsole::abortEvaluation(hex::format("assertion failed \"{0}\"", message)); LogConsole::abortEvaluation(hex::format("assertion failed \"{0}\"", message));
@@ -62,7 +62,7 @@ namespace hex::plugin::builtin {
/* assert_warn(condition, message) */ /* assert_warn(condition, message) */
ContentRegistry::PatternLanguageFunctions::add(nsStd, "assert_warn", 2, [](auto *ctx, auto params) -> std::optional<Token::Literal> { ContentRegistry::PatternLanguageFunctions::add(nsStd, "assert_warn", 2, [](auto *ctx, auto params) -> std::optional<Token::Literal> {
auto condition = Token::literalToBoolean(params[0]); auto condition = Token::literalToBoolean(params[0]);
auto message = std::get<std::string>(params[1]); auto message = Token::literalToString(params[1], false);
if (!condition) if (!condition)
ctx->getConsole().log(LogConsole::Level::Warning, hex::format("assertion failed \"{0}\"", message)); ctx->getConsole().log(LogConsole::Level::Warning, hex::format("assertion failed \"{0}\"", message));
@@ -82,6 +82,13 @@ namespace hex::plugin::builtin {
return format(ctx, params); return format(ctx, params);
}); });
/* env(name) */
ContentRegistry::PatternLanguageFunctions::add(nsStd, "env", 1, [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
auto name = Token::literalToString(params[0], false);
return ctx->getEnvVariable(name);
});
} }
ContentRegistry::PatternLanguageFunctions::Namespace nsStdMem = { "std", "mem" }; ContentRegistry::PatternLanguageFunctions::Namespace nsStdMem = { "std", "mem" };

View File

@@ -0,0 +1,17 @@
#include <hex/api/content_registry.hpp>
#include "content/providers/gdb_provider.hpp"
#include "content/providers/file_provider.hpp"
#include "content/providers/disk_provider.hpp"
namespace hex::plugin::builtin {
void registerProviders() {
ContentRegistry::Provider::add<prv::FileProvider>("hex.builtin.provider.file", false);
ContentRegistry::Provider::add<prv::GDBProvider>("hex.builtin.provider.gdb");
ContentRegistry::Provider::add<prv::DiskProvider>("hex.builtin.provider.disk");
}
}

View File

@@ -0,0 +1,322 @@
#include "content/providers/disk_provider.hpp"
#include <hex/helpers/fmt.hpp>
#include <bitset>
#include <filesystem>
#if defined (OS_LINUX)
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#define lseek lseek64
#elif defined (OS_MACOS)
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif
namespace hex::plugin::builtin::prv {
DiskProvider::DiskProvider() : Provider() {
this->reloadDrives();
}
DiskProvider::~DiskProvider() {
this->close();
}
bool DiskProvider::isAvailable() const {
#if defined (OS_WINDOWS)
return this->m_diskHandle != INVALID_HANDLE_VALUE;
#else
return this->m_diskHandle != -1;
#endif
}
bool DiskProvider::isReadable() const {
return this->m_readable;
}
bool DiskProvider::isWritable() const {
return this->m_writable;
}
bool DiskProvider::isResizable() const {
return false;
}
bool DiskProvider::isSavable() const {
return false;
}
void DiskProvider::setPath(const std::string &path) {
this->m_path = path;
}
bool DiskProvider::open() {
this->m_readable = true;
this->m_writable = true;
#if defined (OS_WINDOWS)
std::wstring widePath;
{
auto length = this->m_path.length() + 1;
auto wideLength = MultiByteToWideChar(CP_UTF8, 0, this->m_path.data(), length, 0, 0);
auto buffer = new wchar_t[wideLength];
MultiByteToWideChar(CP_UTF8, 0, this->m_path.data(), length, buffer, wideLength);
widePath = buffer;
delete[] buffer;
}
this->m_diskHandle = reinterpret_cast<HANDLE>(CreateFileW(widePath.data(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr));
if (this->m_diskHandle == INVALID_HANDLE_VALUE) {
this->m_diskHandle = reinterpret_cast<HANDLE>(CreateFileW(widePath.data(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr));
this->m_writable = false;
if (this->m_diskHandle == INVALID_HANDLE_VALUE)
return false;
}
{
DISK_GEOMETRY_EX diskGeometry = { 0 };
DWORD bytesRead = 0;
if (DeviceIoControl(
this->m_diskHandle,
IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
nullptr, 0,
&diskGeometry, sizeof(DISK_GEOMETRY_EX),
&bytesRead,
nullptr))
{
this->m_diskSize = diskGeometry.DiskSize.QuadPart;
this->m_sectorSize = diskGeometry.Geometry.BytesPerSector;
this->m_sectorBuffer.resize(this->m_sectorSize);
}
}
if (this->m_diskHandle == nullptr || this->m_diskHandle == INVALID_HANDLE_VALUE) {
this->m_readable = false;
this->m_diskHandle = nullptr;
CloseHandle(this->m_diskHandle);
return false;
}
#else
struct stat driveStat;
::stat(this->m_path.data(), &driveStat) == 0;
this->m_diskSize = driveStat.st_size;
this->m_sectorSize = 0;
this->m_diskHandle = ::open(this->m_path.data(), O_RDWR);
if (this->m_diskHandle == -1) {
this->m_diskHandle = ::open(this->m_path.data(), O_RDONLY);
this->m_writable = false;
}
if (this->m_diskHandle == -1) {
this->m_readable = false;
return false;
}
#endif
return true;
}
void DiskProvider::close() {
#if defined (OS_WINDOWS)
if (this->m_diskHandle != INVALID_HANDLE_VALUE)
::CloseHandle(this->m_diskHandle);
this->m_diskHandle = INVALID_HANDLE_VALUE;
#else
if (this->m_diskHandle != -1)
::close(this->m_diskHandle);
this->m_diskHandle = -1;
#endif
}
void DiskProvider::readRaw(u64 offset, void *buffer, size_t size) {
#if defined (OS_WINDOWS)
DWORD bytesRead = 0;
u64 startOffset = offset;
while (size > 0) {
LARGE_INTEGER seekPosition;
seekPosition.LowPart = (offset & 0xFFFF'FFFF) - (offset % this->m_sectorSize);
seekPosition.HighPart = offset >> 32;
if (this->m_sectorBufferAddress != seekPosition.QuadPart) {
::SetFilePointer(this->m_diskHandle, seekPosition.LowPart, &seekPosition.HighPart, FILE_BEGIN);
::ReadFile(this->m_diskHandle, this->m_sectorBuffer.data(), this->m_sectorBuffer.size(), &bytesRead, nullptr);
this->m_sectorBufferAddress = seekPosition.QuadPart;
}
std::memcpy(reinterpret_cast<u8*>(buffer) + (offset - startOffset), this->m_sectorBuffer.data() + (offset & (this->m_sectorSize - 1)), std::min(this->m_sectorSize, size));
size = std::max<ssize_t>(static_cast<ssize_t>(size) - this->m_sectorSize, 0);
offset += this->m_sectorSize;
}
#else
u64 startOffset = offset;
while (size > 0) {
u64 seekPosition = offset - (offset % this->m_sectorSize);
if (this->m_sectorBufferAddress != seekPosition) {
::lseek(this->m_diskHandle, seekPosition, SEEK_SET);
::read(this->m_diskHandle, buffer, size);
this->m_sectorBufferAddress = seekPosition;
}
std::memcpy(reinterpret_cast<u8*>(buffer) + (offset - startOffset), this->m_sectorBuffer.data() + (offset & (this->m_sectorSize - 1)), std::min(this->m_sectorSize, size));
size = std::max<ssize_t>(static_cast<ssize_t>(size) - this->m_sectorSize, 0);
offset += this->m_sectorSize;
}
#endif
}
void DiskProvider::writeRaw(u64 offset, const void *buffer, size_t size) {
#if defined (OS_WINDOWS)
DWORD bytesWritten = 0;
u64 startOffset = offset;
std::vector<u8> modifiedSectorBuffer;
modifiedSectorBuffer.resize(this->m_sectorSize);
while (size > 0) {
u64 sectorBase = offset - (offset % this->m_sectorSize);
size_t currSize = std::min(size, this->m_sectorSize);
this->readRaw(sectorBase, modifiedSectorBuffer.data(), modifiedSectorBuffer.size());
std::memcpy(modifiedSectorBuffer.data() + ((offset - sectorBase) % this->m_sectorSize), reinterpret_cast<const u8*>(buffer) + (startOffset - offset), currSize);
LARGE_INTEGER seekPosition;
seekPosition.LowPart = (offset & 0xFFFF'FFFF) - (offset % this->m_sectorSize);
seekPosition.HighPart = offset >> 32;
::SetFilePointer(this->m_diskHandle, seekPosition.LowPart, &seekPosition.HighPart, FILE_BEGIN);
::WriteFile(this->m_diskHandle, modifiedSectorBuffer.data(), modifiedSectorBuffer.size(), &bytesWritten, nullptr);
offset += currSize;
size -= currSize;
}
#else
u64 startOffset = offset;
std::vector<u8> modifiedSectorBuffer;
modifiedSectorBuffer.resize(this->m_sectorSize);
while (size > 0) {
u64 sectorBase = offset - (offset % this->m_sectorSize);
size_t currSize = std::min(size, this->m_sectorSize);
this->readRaw(sectorBase, modifiedSectorBuffer.data(), modifiedSectorBuffer.size());
std::memcpy(modifiedSectorBuffer.data() + ((offset - sectorBase) % this->m_sectorSize), reinterpret_cast<const u8*>(buffer) + (startOffset - offset), currSize);
::lseek(this->m_diskHandle, sectorBase, SEEK_SET);
::write(this->m_diskHandle, modifiedSectorBuffer.data(), modifiedSectorBuffer.size());
offset += currSize;
size -= currSize;
}
#endif
}
size_t DiskProvider::getActualSize() const {
return this->m_diskSize;
}
std::string DiskProvider::getName() const {
return this->m_path;
}
std::vector<std::pair<std::string, std::string>> DiskProvider::getDataInformation() const {
return {
{ "hex.builtin.provider.disk.selected_disk"_lang, this->m_path },
{ "hex.builtin.provider.disk.disk_size"_lang, hex::toByteString(this->m_diskSize) },
{ "hex.builtin.provider.disk.sector_size"_lang, hex::toByteString(this->m_sectorSize) }
};
}
void DiskProvider::reloadDrives() {
#if defined (OS_WINDOWS)
this->m_availableDrives.clear();
std::bitset<32> drives = ::GetLogicalDrives();
for (char i = 0; i < 26; i++) {
if (drives[i])
this->m_availableDrives.insert(hex::format(R"(\\.\{:c}:)", 'A' + i));
}
auto logicalDrives = this->m_availableDrives;
for (const auto &drive : logicalDrives) {
auto handle = reinterpret_cast<HANDLE>(::CreateFile(drive.data(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr));
if (handle == INVALID_HANDLE_VALUE) continue;
VOLUME_DISK_EXTENTS diskExtents = { 0 };
DWORD bytesRead = 0;
auto result = ::DeviceIoControl(
handle,
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
nullptr,
0,
&diskExtents,
sizeof(VOLUME_DISK_EXTENTS),
&bytesRead,
nullptr);
if (result) {
auto diskPath = hex::format(R"(\\.\PhysicalDrive{})", diskExtents.Extents[0].DiskNumber);
this->m_availableDrives.insert(diskPath);
}
::CloseHandle(handle);
}
#endif
}
void DiskProvider::drawLoadInterface() {
#if defined (OS_WINDOWS)
if (ImGui::BeginListBox("hex.builtin.provider.disk.selected_disk"_lang)) {
for (const auto &drive : this->m_availableDrives) {
if (ImGui::Selectable(drive.c_str(), this->m_path == drive))
this->m_path = drive;
}
ImGui::EndListBox();
}
ImGui::SameLine();
if (ImGui::Button("hex.builtin.provider.disk.reload"_lang)) {
this->reloadDrives();
}
#else
ImGui::InputText("hex.builtin.provider.disk.selected_disk"_lang, this->m_path.data(), this->m_path.capacity(), ImGuiInputTextFlags_CallbackResize, ImGui::UpdateStringSizeCallback, &this->m_path);
#endif
}
}

View File

@@ -1,16 +1,16 @@
#include "providers/file_provider.hpp" #include "content/providers/file_provider.hpp"
#include <ctime> #include <ctime>
#include <cstring> #include <cstring>
#include <hex/helpers/utils.hpp> #include <hex/helpers/utils.hpp>
#include <hex/helpers/file.hpp> #include <hex/helpers/file.hpp>
#include "helpers/project_file_handler.hpp" #include <hex/helpers/project_file_handler.hpp>
namespace hex::prv { namespace hex::plugin::builtin::prv {
FileProvider::FileProvider() : Provider() {
FileProvider::FileProvider(std::string path) : Provider(), m_path(std::move(path)) {
this->open();
} }
FileProvider::~FileProvider() { FileProvider::~FileProvider() {
@@ -20,7 +20,7 @@ namespace hex::prv {
bool FileProvider::isAvailable() const { bool FileProvider::isAvailable() const {
#if defined(OS_WINDOWS) #if defined(OS_WINDOWS)
return this->m_file != nullptr && this->m_mapping != nullptr && this->m_mappedFile != nullptr; return this->m_file != INVALID_HANDLE_VALUE && this->m_mapping != INVALID_HANDLE_VALUE && this->m_mappedFile != nullptr;
#else #else
return this->m_file != -1 && this->m_mappedFile != nullptr; return this->m_file != -1 && this->m_mappedFile != nullptr;
#endif #endif
@@ -44,11 +44,10 @@ namespace hex::prv {
void FileProvider::read(u64 offset, void *buffer, size_t size, bool overlays) { void FileProvider::read(u64 offset, void *buffer, size_t size, bool overlays) {
if ((offset - this->getBaseAddress()) > (this->getActualSize() - size) || buffer == nullptr || size == 0)
if ((offset - this->getBaseAddress()) > (this->getSize() - size) || buffer == nullptr || size == 0)
return; return;
std::memcpy(buffer, reinterpret_cast<u8*>(this->m_mappedFile) + PageSize * this->m_currPage + offset - this->getBaseAddress(), size); this->readRaw(offset - this->getBaseAddress(), buffer, size);
for (u64 i = 0; i < size; i++) for (u64 i = 0; i < size; i++)
if (getPatches().contains(offset + i)) if (getPatches().contains(offset + i))
@@ -59,25 +58,21 @@ namespace hex::prv {
} }
void FileProvider::write(u64 offset, const void *buffer, size_t size) { void FileProvider::write(u64 offset, const void *buffer, size_t size) {
if (((offset - this->getBaseAddress()) + size) > this->getSize() || buffer == nullptr || size == 0) if ((offset - this->getBaseAddress()) > (this->getActualSize() - size) || buffer == nullptr || size == 0)
return; return;
addPatch(offset, buffer, size); addPatch(offset, buffer, size);
} }
void FileProvider::readRaw(u64 offset, void *buffer, size_t size) { void FileProvider::readRaw(u64 offset, void *buffer, size_t size) {
offset -= this->getBaseAddress(); if ((offset + size) > this->getActualSize() || buffer == nullptr || size == 0)
if ((offset + size) > this->getSize() || buffer == nullptr || size == 0)
return; return;
std::memcpy(buffer, reinterpret_cast<u8*>(this->m_mappedFile) + PageSize * this->m_currPage + offset, size); std::memcpy(buffer, reinterpret_cast<u8*>(this->m_mappedFile) + PageSize * this->m_currPage + offset, size);
} }
void FileProvider::writeRaw(u64 offset, const void *buffer, size_t size) { void FileProvider::writeRaw(u64 offset, const void *buffer, size_t size) {
offset -= this->getBaseAddress(); if ((offset + size) > this->getActualSize() || buffer == nullptr || size == 0)
if ((offset + size) > this->getSize() || buffer == nullptr || size == 0)
return; return;
std::memcpy(reinterpret_cast<u8*>(this->m_mappedFile) + PageSize * this->m_currPage + offset, buffer, size); std::memcpy(reinterpret_cast<u8*>(this->m_mappedFile) + PageSize * this->m_currPage + offset, buffer, size);
@@ -100,7 +95,7 @@ namespace hex::prv {
if (bufferSize > provider->getActualSize() - offset) if (bufferSize > provider->getActualSize() - offset)
bufferSize = provider->getActualSize() - offset; bufferSize = provider->getActualSize() - offset;
provider->readRelative(offset, buffer.data(), bufferSize); provider->read(offset + this->getBaseAddress(), buffer.data(), bufferSize);
file.write(buffer); file.write(buffer);
} }
} }
@@ -161,7 +156,11 @@ namespace hex::prv {
return result; return result;
} }
void FileProvider::open() { void FileProvider::setPath(const std::string &path) {
this->m_path = path;
}
bool FileProvider::open() {
this->m_fileStatsValid = stat(this->m_path.data(), &this->m_fileStats) == 0; this->m_fileStatsValid = stat(this->m_path.data(), &this->m_fileStats) == 0;
this->m_readable = true; this->m_readable = true;
@@ -198,12 +197,12 @@ namespace hex::prv {
}; };
if (this->m_file == nullptr || this->m_file == INVALID_HANDLE_VALUE) { if (this->m_file == nullptr || this->m_file == INVALID_HANDLE_VALUE) {
return; return false;
} }
this->m_mapping = CreateFileMapping(this->m_file, nullptr, PAGE_READWRITE, fileSize.HighPart, fileSize.LowPart, nullptr); this->m_mapping = CreateFileMapping(this->m_file, nullptr, PAGE_READWRITE, fileSize.HighPart, fileSize.LowPart, nullptr);
if (this->m_mapping == nullptr || this->m_mapping == INVALID_HANDLE_VALUE) { if (this->m_mapping == nullptr || this->m_mapping == INVALID_HANDLE_VALUE) {
return; return false;
} }
auto mappingCleanup = SCOPE_GUARD { auto mappingCleanup = SCOPE_GUARD {
@@ -215,7 +214,7 @@ namespace hex::prv {
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; return false;
} }
fileCleanup.release(); fileCleanup.release();
@@ -224,7 +223,7 @@ namespace hex::prv {
ProjectFile::setFilePath(this->m_path); 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);
if (this->m_file == -1) { if (this->m_file == -1) {
this->m_file = ::open(this->m_path.data(), O_RDONLY); this->m_file = ::open(this->m_path.data(), O_RDONLY);
this->m_writable = false; this->m_writable = false;
@@ -232,14 +231,21 @@ namespace hex::prv {
if (this->m_file == -1) { if (this->m_file == -1) {
this->m_readable = false; this->m_readable = false;
return; return false;
} }
this->m_fileSize = this->m_fileStats.st_size; this->m_fileSize = this->m_fileStats.st_size;
this->m_mappedFile = mmap(nullptr, this->m_fileSize, PROT_READ | PROT_WRITE, MAP_PRIVATE, this->m_file, 0); this->m_mappedFile = ::mmap(nullptr, this->m_fileSize, PROT_READ | PROT_WRITE, MAP_PRIVATE, this->m_file, 0);
if (this->m_mappedFile == nullptr) {
::close(this->m_file);
this->m_file = -1;
#endif return false;
}
#endif
return true;
} }
void FileProvider::close() { void FileProvider::close() {

View File

@@ -0,0 +1,312 @@
#include "content/providers/gdb_provider.hpp"
#include <cstring>
#include <thread>
#include <chrono>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/crypto.hpp>
namespace hex::plugin::builtin::prv {
using namespace std::chrono_literals;
namespace gdb {
namespace {
u8 calculateChecksum(const std::string &data) {
u64 checksum = 0;
for (const auto &c : data)
checksum += c;
return checksum & 0xFF;
}
std::string createPacket(const std::string &data) {
return hex::format("${}#{:02x}", data, calculateChecksum(data));
}
std::optional<std::string> parsePacket(const std::string &packet) {
if (packet.length() < 4)
return std::nullopt;
if (!packet.starts_with('$'))
return std::nullopt;
if (packet[packet.length() - 3] != '#')
return std::nullopt;
std::string data = packet.substr(1, packet.length() - 4);
std::string checksum = packet.substr(packet.length() - 2, 2);
if (checksum.length() != 2 || crypt::decode16(checksum)[0] != calculateChecksum(data))
return std::nullopt;
return data;
}
}
void sendAck(Socket &socket) {
socket.writeString("+");
}
std::vector<u8> readMemory(Socket &socket, u64 address, size_t size) {
std::string packet = createPacket(hex::format("m{:X},{:X}", address, size));
socket.writeString(packet);
auto receivedPacket = socket.readString(size * 2 + 4);
if (receivedPacket.empty())
return { };
auto receivedData = parsePacket(receivedPacket);
if (!receivedData.has_value())
return { };
if (receivedData->size() == 3 && receivedData->starts_with("E"))
return { };
auto data = crypt::decode16(receivedData.value());
data.resize(size);
return data;
}
void writeMemory(Socket &socket, u64 address, const void *buffer, size_t size) {
std::vector<u8> bytes(size);
std::memcpy(bytes.data(), buffer, size);
std::string byteString = crypt::encode16(bytes);
std::string packet = createPacket(hex::format("M{:X},{:X}:{}", address, size, byteString));
socket.writeString(packet);
auto receivedPacket = socket.readString(3);
}
bool enableNoAckMode(Socket &socket) {
socket.writeString(createPacket("QStartNoAckMode"));
auto ack = socket.readString(1);
if (ack.empty() || ack[0] != '+')
return {};
auto receivedPacket = socket.readString(6);
auto receivedData = parsePacket(receivedPacket);
if (receivedData && *receivedData == "OK") {
sendAck(socket);
return true;
} else {
return false;
}
}
}
GDBProvider::GDBProvider() : Provider() {
}
GDBProvider::~GDBProvider() {
this->close();
}
bool GDBProvider::isAvailable() const {
return this->m_socket.isConnected();
}
bool GDBProvider::isReadable() const {
return this->m_socket.isConnected();
}
bool GDBProvider::isWritable() const {
return false;
}
bool GDBProvider::isResizable() const {
return false;
}
bool GDBProvider::isSavable() const {
return false;
}
void GDBProvider::read(u64 offset, void *buffer, size_t size, bool overlays) {
if ((offset - this->getBaseAddress()) > (this->getActualSize() - size) || buffer == nullptr || size == 0)
return;
offset -= this->getBaseAddress();
u64 alignedOffset = offset - (offset % CacheLineSize);
if (size <= CacheLineSize) {
std::scoped_lock lock(this->m_cacheLock);
const auto &cacheLine = std::find_if(this->m_cache.begin(), this->m_cache.end(), [&](auto &line){
return line.address == alignedOffset;
});
if (cacheLine != this->m_cache.end()) {
// Cache hit
} else {
// Cache miss
this->m_cache.push_back({ alignedOffset, { 0 } });
}
if (cacheLine != this->m_cache.end())
std::memcpy(buffer, &cacheLine->data[0] + (offset % CacheLineSize), size);
} else {
while (size > 0) {
size_t readSize = std::min(size, CacheLineSize);
this->readRaw(offset, buffer, readSize);
size -= readSize;
offset += readSize;
}
}
for (u64 i = 0; i < size; i++)
if (getPatches().contains(offset + i))
reinterpret_cast<u8*>(buffer)[i] = getPatches()[offset + PageSize * this->m_currPage + i];
if (overlays)
this->applyOverlays(offset, buffer, size);
}
void GDBProvider::write(u64 offset, const void *buffer, size_t size) {
if ((offset - this->getBaseAddress()) > (this->getActualSize() - size) || buffer == nullptr || size == 0)
return;
offset -= this->getBaseAddress();
gdb::writeMemory(this->m_socket, offset, buffer, size);
}
void GDBProvider::readRaw(u64 offset, void *buffer, size_t size) {
if ((offset - this->getBaseAddress()) > (this->getActualSize() - size) || buffer == nullptr || size == 0)
return;
auto data = gdb::readMemory(this->m_socket, offset, size);
std::memcpy(buffer, &data[0], data.size());
}
void GDBProvider::writeRaw(u64 offset, const void *buffer, size_t size) {
if ((offset - this->getBaseAddress()) > (this->getActualSize() - size) || buffer == nullptr || size == 0)
return;
gdb::writeMemory(this->m_socket, offset, buffer, size);
}
void GDBProvider::save() {
this->applyPatches();
}
void GDBProvider::saveAs(const std::string &path) {
}
void GDBProvider::resize(ssize_t newSize) {
}
size_t GDBProvider::getActualSize() const {
return 0xFFFF'FFFF;
}
std::string GDBProvider::getName() const {
std::string address, port;
if (!this->isConnected()) {
address = "-";
port = "-";
} else {
address = this->m_ipAddress;
port = std::to_string(this->m_port);
}
return hex::format("hex.builtin.provider.gdb.name"_lang, address, port);
}
std::vector<std::pair<std::string, std::string>> GDBProvider::getDataInformation() const {
return {
{ "hex.builtin.provider.gdb.server"_lang, hex::format("{}:{}", this->m_ipAddress, this->m_port) },
};
}
bool GDBProvider::open() {
this->m_socket.connect(this->m_ipAddress, this->m_port);
if (!gdb::enableNoAckMode(this->m_socket)) {
this->m_socket.disconnect();
return false;
}
if (this->m_socket.isConnected()) {
this->m_cacheUpdateThread = std::thread([this]() {
auto cacheLine = this->m_cache.begin();
while (this->isConnected()) {
{
std::scoped_lock lock(this->m_cacheLock);
if (cacheLine != this->m_cache.end()) {
auto data = gdb::readMemory(this->m_socket, cacheLine->address, 0x1000);
while (this->m_cache.size() > 10) {
this->m_cache.pop_front();
cacheLine = this->m_cache.begin();
}
std::memcpy(cacheLine->data.data(), data.data(), data.size());
}
cacheLine++;
if (cacheLine == this->m_cache.end())
cacheLine = this->m_cache.begin();
}
std::this_thread::sleep_for(100ms);
}
});
return true;
} else {
return false;
}
}
void GDBProvider::close() {
this->m_socket.disconnect();
if (this->m_cacheUpdateThread.joinable()) {
this->m_cacheUpdateThread.join();
}
}
bool GDBProvider::isConnected() const {
return this->m_socket.isConnected();
}
void GDBProvider::drawLoadInterface() {
ImGui::InputText("hex.builtin.provider.gdb.ip"_lang, this->m_ipAddress.data(), this->m_ipAddress.capacity(), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &this->m_ipAddress);
ImGui::InputInt("hex.builtin.provider.gdb.port"_lang, &this->m_port, 0, 0);
if (this->m_port < 0)
this->m_port = 0;
else if (this->m_port > 0xFFFF)
this->m_port = 0xFFFF;
}
}

View File

@@ -30,13 +30,6 @@ namespace hex::plugin::builtin {
using namespace std::literals::chrono_literals; using namespace std::literals::chrono_literals;
using namespace hex::literals; using namespace hex::literals;
int updateStringSizeCallback(ImGuiInputTextCallbackData *data) {
auto &mathInput = *static_cast<std::string*>(data->UserData);
mathInput.resize(data->BufTextLen);
return 0;
}
void drawDemangler() { void drawDemangler() {
static std::vector<char> mangledBuffer(0xF'FFFF, 0x00); static std::vector<char> mangledBuffer(0xF'FFFF, 0x00);
static std::string demangledName; static std::string demangledName;
@@ -108,9 +101,9 @@ namespace hex::plugin::builtin {
static auto replacePattern = []{ std::string s; s.reserve(0xFFF); return s; }(); static auto replacePattern = []{ std::string s; s.reserve(0xFFF); return s; }();
static auto regexOutput = []{ std::string s; s.reserve(0xFFF); return s; }(); static auto regexOutput = []{ std::string s; s.reserve(0xFFF); return s; }();
bool changed1 = ImGui::InputText("hex.builtin.tools.regex_replacer.pattern"_lang, regexPattern.data(), regexPattern.capacity(), ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &regexPattern); bool changed1 = ImGui::InputText("hex.builtin.tools.regex_replacer.pattern"_lang, regexPattern.data(), regexPattern.capacity(), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &regexPattern);
bool changed2 = ImGui::InputText("hex.builtin.tools.regex_replacer.replace"_lang, replacePattern.data(), replacePattern.capacity(), ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &replacePattern); bool changed2 = ImGui::InputText("hex.builtin.tools.regex_replacer.replace"_lang, replacePattern.data(), replacePattern.capacity(), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &replacePattern);
bool changed3 = ImGui::InputTextMultiline("hex.builtin.tools.regex_replacer.input"_lang, regexInput.data(), regexInput.capacity(), ImVec2(0, 0), ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &regexInput); bool changed3 = ImGui::InputTextMultiline("hex.builtin.tools.regex_replacer.input"_lang, regexInput.data(), regexInput.capacity(), ImVec2(0, 0), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &regexInput);
if (changed1 || changed2 || changed3) { if (changed1 || changed2 || changed3) {
try { try {
@@ -363,7 +356,7 @@ namespace hex::plugin::builtin {
} }
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth()); ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth());
if (ImGui::InputText("##input", mathInput.data(), mathInput.capacity(), ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &mathInput)) { if (ImGui::InputText("##input", mathInput.data(), mathInput.capacity(), ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &mathInput)) {
ImGui::SetKeyboardFocusHere(); ImGui::SetKeyboardFocusHere();
evaluate = true; evaluate = true;
} }
@@ -619,7 +612,7 @@ namespace hex::plugin::builtin {
bool startSearch; bool startSearch;
startSearch = ImGui::InputText("##search", searchString.data(), searchString.capacity(), ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &searchString); startSearch = ImGui::InputText("##search", searchString.data(), searchString.capacity(), ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &searchString);
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginDisabled(searchProcess.valid() && searchProcess.wait_for(0s) != std::future_status::ready || searchString.empty()); ImGui::BeginDisabled(searchProcess.valid() && searchProcess.wait_for(0s) != std::future_status::ready || searchString.empty());
@@ -685,7 +678,7 @@ namespace hex::plugin::builtin {
{ {
ImGui::TextUnformatted("hex.builtin.tools.file_tools.shredder.input"_lang); ImGui::TextUnformatted("hex.builtin.tools.file_tools.shredder.input"_lang);
ImGui::SameLine(); ImGui::SameLine();
ImGui::InputText("##path", selectedFile.data(), selectedFile.capacity(), ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &selectedFile); ImGui::InputText("##path", selectedFile.data(), selectedFile.capacity(), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &selectedFile);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("...")) { if (ImGui::Button("...")) {
hex::openFileBrowser("hex.builtin.tools.file_tools.shredder.picker"_lang, DialogMode::Open, {}, [](const std::string &path) { hex::openFileBrowser("hex.builtin.tools.file_tools.shredder.picker"_lang, DialogMode::Open, {}, [](const std::string &path) {
@@ -800,7 +793,7 @@ namespace hex::plugin::builtin {
{ {
ImGui::TextUnformatted("hex.builtin.tools.file_tools.splitter.input"_lang); ImGui::TextUnformatted("hex.builtin.tools.file_tools.splitter.input"_lang);
ImGui::SameLine(); ImGui::SameLine();
ImGui::InputText("##path", selectedFile.data(), selectedFile.capacity(), ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &selectedFile); ImGui::InputText("##path", selectedFile.data(), selectedFile.capacity(), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &selectedFile);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("...##input")) { if (ImGui::Button("...##input")) {
hex::openFileBrowser("hex.builtin.tools.file_tools.splitter.picker.input"_lang, DialogMode::Open, {}, [](const std::string &path) { hex::openFileBrowser("hex.builtin.tools.file_tools.splitter.picker.input"_lang, DialogMode::Open, {}, [](const std::string &path) {
@@ -810,7 +803,7 @@ namespace hex::plugin::builtin {
ImGui::TextUnformatted("hex.builtin.tools.file_tools.splitter.output"_lang); ImGui::TextUnformatted("hex.builtin.tools.file_tools.splitter.output"_lang);
ImGui::SameLine(); ImGui::SameLine();
ImGui::InputText("##base_path", baseOutputPath.data(), baseOutputPath.capacity(), ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &baseOutputPath); ImGui::InputText("##base_path", baseOutputPath.data(), baseOutputPath.capacity(), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &baseOutputPath);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("...##output")) { if (ImGui::Button("...##output")) {
hex::openFileBrowser("hex.builtin.tools.file_tools.splitter.picker.output"_lang, DialogMode::Save, {}, [](const std::string &path) { hex::openFileBrowser("hex.builtin.tools.file_tools.splitter.picker.output"_lang, DialogMode::Save, {}, [](const std::string &path) {
@@ -957,7 +950,7 @@ namespace hex::plugin::builtin {
{ {
ImGui::TextUnformatted("hex.builtin.tools.file_tools.combiner.output"_lang); ImGui::TextUnformatted("hex.builtin.tools.file_tools.combiner.output"_lang);
ImGui::SameLine(); ImGui::SameLine();
ImGui::InputText("##output_path", outputPath.data(), outputPath.capacity(), ImGuiInputTextFlags_CallbackEdit, updateStringSizeCallback, &outputPath); ImGui::InputText("##output_path", outputPath.data(), outputPath.capacity(), ImGuiInputTextFlags_CallbackEdit, ImGui::UpdateStringSizeCallback, &outputPath);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("...")) { if (ImGui::Button("...")) {
hex::openFileBrowser("hex.builtin.tools.file_tools.combiner.output.picker"_lang, DialogMode::Save, {}, [](const std::string &path) { hex::openFileBrowser("hex.builtin.tools.file_tools.combiner.output.picker"_lang, DialogMode::Save, {}, [](const std::string &path) {

View File

@@ -13,6 +13,12 @@ namespace hex::plugin::builtin {
void addFooterItems() { void addFooterItems() {
if (hex::isProcessElevated()) {
ContentRegistry::Interface::addFooterItem([] {
ImGui::TextUnformatted(ICON_VS_SHIELD);
});
}
ContentRegistry::Interface::addFooterItem([] { ContentRegistry::Interface::addFooterItem([] {
static float framerate = 0; static float framerate = 0;
if (ImGui::HasSecondPassed()) { if (ImGui::HasSecondPassed()) {
@@ -63,7 +69,7 @@ namespace hex::plugin::builtin {
// Save file as // Save file as
ImGui::Disabled([&provider] { ImGui::Disabled([&provider] {
if (ImGui::ToolBarButton(ICON_VS_SAVE_AS, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue))) if (ImGui::ToolBarButton(ICON_VS_SAVE_AS, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
hex::openFileBrowser("hex.view.hexeditor.save_as"_lang, DialogMode::Save, { }, [&provider](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.save_as"_lang, DialogMode::Save, { }, [&provider](auto path) {
provider->saveAs(path); provider->saveAs(path);
}); });
}, !ImHexApi::Provider::isValid() || !provider->isSavable()); }, !ImHexApi::Provider::isValid() || !provider->isSavable());

View File

@@ -0,0 +1,47 @@
#include "content/views/view_hexeditor.hpp"
#include "content/views/view_pattern_editor.hpp"
#include "content/views/view_pattern_data.hpp"
#include "content/views/view_hashes.hpp"
#include "content/views/view_information.hpp"
#include "content/views/view_help.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"
#include "content/views/view_patches.hpp"
#include "content/views/view_command_palette.hpp"
#include "content/views/view_settings.hpp"
#include "content/views/view_data_processor.hpp"
#include "content/views/view_yara.hpp"
#include "content/views/view_constants.hpp"
#include "content/views/view_store.hpp"
#include "content/views/view_diff.hpp"
#include "content/views/view_provider_settings.hpp"
namespace hex::plugin::builtin {
void registerViews() {
ContentRegistry::Views::add<ViewHexEditor>();
ContentRegistry::Views::add<ViewPatternEditor>();
ContentRegistry::Views::add<ViewPatternData>();
ContentRegistry::Views::add<ViewDataInspector>();
ContentRegistry::Views::add<ViewHashes>();
ContentRegistry::Views::add<ViewInformation>();
ContentRegistry::Views::add<ViewStrings>();
ContentRegistry::Views::add<ViewDisassembler>();
ContentRegistry::Views::add<ViewBookmarks>();
ContentRegistry::Views::add<ViewPatches>();
ContentRegistry::Views::add<ViewTools>();
ContentRegistry::Views::add<ViewCommandPalette>();
ContentRegistry::Views::add<ViewHelp>();
ContentRegistry::Views::add<ViewSettings>();
ContentRegistry::Views::add<ViewDataProcessor>();
ContentRegistry::Views::add<ViewYara>();
ContentRegistry::Views::add<ViewConstants>();
ContentRegistry::Views::add<ViewStore>();
ContentRegistry::Views::add<ViewDiff>();
ContentRegistry::Views::add<ViewProviderSettings>();
}
}

View File

@@ -1,22 +1,22 @@
#include "views/view_bookmarks.hpp" #include "content/views/view_bookmarks.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/fmt.hpp> #include <hex/helpers/fmt.hpp>
#include "helpers/project_file_handler.hpp" #include <hex/helpers/project_file_handler.hpp>
#include <cstring> #include <cstring>
namespace hex { namespace hex::plugin::builtin {
ViewBookmarks::ViewBookmarks() : View("hex.view.bookmarks.name") { ViewBookmarks::ViewBookmarks() : View("hex.builtin.view.bookmarks.name") {
EventManager::subscribe<RequestAddBookmark>(this, [](ImHexApi::Bookmarks::Entry bookmark) { EventManager::subscribe<RequestAddBookmark>(this, [](ImHexApi::Bookmarks::Entry bookmark) {
bookmark.comment.resize(0xF'FFFF); bookmark.comment.resize(0xF'FFFF);
if (bookmark.name.empty()) { if (bookmark.name.empty()) {
bookmark.name.resize(64); bookmark.name.resize(64);
std::memset(bookmark.name.data(), 0x00, 64); std::memset(bookmark.name.data(), 0x00, 64);
std::strcpy(bookmark.name.data(), hex::format("hex.view.bookmarks.default_title"_lang, std::strcpy(bookmark.name.data(), hex::format("hex.builtin.view.bookmarks.default_title"_lang,
bookmark.region.address, bookmark.region.address,
bookmark.region.address + bookmark.region.size - 1).c_str()); bookmark.region.address + bookmark.region.size - 1).c_str());
} }
@@ -37,22 +37,27 @@ namespace hex {
EventManager::subscribe<EventProjectFileStore>(this, []{ EventManager::subscribe<EventProjectFileStore>(this, []{
ProjectFile::setBookmarks(SharedData::bookmarkEntries); ProjectFile::setBookmarks(SharedData::bookmarkEntries);
}); });
EventManager::subscribe<EventFileUnloaded>(this, []{
ImHexApi::Bookmarks::getEntries().clear();
});
} }
ViewBookmarks::~ViewBookmarks() { ViewBookmarks::~ViewBookmarks() {
EventManager::unsubscribe<RequestAddBookmark>(this); EventManager::unsubscribe<RequestAddBookmark>(this);
EventManager::unsubscribe<EventProjectFileLoad>(this); EventManager::unsubscribe<EventProjectFileLoad>(this);
EventManager::unsubscribe<EventProjectFileStore>(this); EventManager::unsubscribe<EventProjectFileStore>(this);
EventManager::unsubscribe<EventFileUnloaded>(this);
} }
void ViewBookmarks::drawContent() { void ViewBookmarks::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.bookmarks.name").c_str(), &this->getWindowOpenState())) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.bookmarks.name").c_str(), &this->getWindowOpenState())) {
if (ImGui::BeginChild("##scrolling")) { if (ImGui::BeginChild("##scrolling")) {
auto &bookmarks = ImHexApi::Bookmarks::getEntries(); auto &bookmarks = ImHexApi::Bookmarks::getEntries();
if (bookmarks.empty()) { if (bookmarks.empty()) {
std::string text = "hex.view.bookmarks.no_bookmarks"_lang; std::string text = "hex.builtin.view.bookmarks.no_bookmarks"_lang;
auto textSize = ImGui::CalcTextSize(text.c_str()); auto textSize = ImGui::CalcTextSize(text.c_str());
auto availableSpace = ImGui::GetContentRegionAvail(); auto availableSpace = ImGui::GetContentRegionAvail();
@@ -74,9 +79,9 @@ namespace hex {
ImGui::PushStyleColor(ImGuiCol_HeaderActive, color); ImGui::PushStyleColor(ImGuiCol_HeaderActive, color);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, u32(hoverColor)); ImGui::PushStyleColor(ImGuiCol_HeaderHovered, u32(hoverColor));
if (ImGui::CollapsingHeader((std::string(name.data()) + "###bookmark").c_str())) { if (ImGui::CollapsingHeader((std::string(name.data()) + "###bookmark").c_str())) {
ImGui::TextUnformatted("hex.view.bookmarks.title.info"_lang); ImGui::TextUnformatted("hex.builtin.view.bookmarks.title.info"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::TextUnformatted(hex::format("hex.view.bookmarks.address"_lang, region.address, region.address + region.size - 1, region.size).c_str()); ImGui::TextUnformatted(hex::format("hex.builtin.view.bookmarks.address"_lang, region.address, region.address + region.size - 1, region.size).c_str());
if (ImGui::BeginChild("hexData", ImVec2(0, ImGui::GetTextLineHeight() * 8), true)) { if (ImGui::BeginChild("hexData", ImVec2(0, ImGui::GetTextLineHeight() * 8), true)) {
size_t offset = region.address % 0x10; size_t offset = region.address % 0x10;
@@ -123,11 +128,11 @@ namespace hex {
} }
ImGui::EndChild(); ImGui::EndChild();
if (ImGui::Button("hex.view.bookmarks.button.jump"_lang)) if (ImGui::Button("hex.builtin.view.bookmarks.button.jump"_lang))
EventManager::post<RequestSelectionChange>(region); EventManager::post<RequestSelectionChange>(region);
ImGui::SameLine(0, 15); ImGui::SameLine(0, 15);
if (ImGui::Button("hex.view.bookmarks.button.remove"_lang)) if (ImGui::Button("hex.builtin.view.bookmarks.button.remove"_lang))
bookmarkToRemove = iter; bookmarkToRemove = iter;
ImGui::SameLine(0, 15); ImGui::SameLine(0, 15);
@@ -138,10 +143,10 @@ namespace hex {
} }
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.bookmarks.header.name"_lang); ImGui::TextUnformatted("hex.builtin.view.bookmarks.header.name"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::ColorEdit4("hex.view.bookmarks.header.color"_lang, (float*)&headerColor.Value, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoAlpha | (locked ? ImGuiColorEditFlags_NoPicker : ImGuiColorEditFlags_None)); ImGui::ColorEdit4("hex.builtin.view.bookmarks.header.color"_lang, (float*)&headerColor.Value, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoAlpha | (locked ? ImGuiColorEditFlags_NoPicker : ImGuiColorEditFlags_None));
color = headerColor; color = headerColor;
ImGui::SameLine(); ImGui::SameLine();
@@ -151,7 +156,7 @@ namespace hex {
ImGui::InputText("##nameInput", name.data(), 64); ImGui::InputText("##nameInput", name.data(), 64);
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.bookmarks.header.comment"_lang); ImGui::TextUnformatted("hex.builtin.view.bookmarks.header.comment"_lang);
ImGui::Separator(); ImGui::Separator();
if (locked) if (locked)

View File

@@ -1,10 +1,10 @@
#include "views/view_command_palette.hpp" #include "content/views/view_command_palette.hpp"
#include <cstring> #include <cstring>
namespace hex { namespace hex::plugin::builtin {
ViewCommandPalette::ViewCommandPalette() : View("hex.view.command_palette.name") { ViewCommandPalette::ViewCommandPalette() : View("hex.builtin.view.command_palette.name") {
this->m_commandBuffer.resize(1024, 0x00); this->m_commandBuffer.resize(1024, 0x00);
} }
@@ -17,7 +17,7 @@ namespace hex {
if (!this->m_commandPaletteOpen) return; if (!this->m_commandPaletteOpen) return;
ImGui::SetNextWindowPos(ImVec2(SharedData::windowPos.x + SharedData::windowSize.x * 0.5F, SharedData::windowPos.y), ImGuiCond_Always, ImVec2(0.5F,0.0F)); ImGui::SetNextWindowPos(ImVec2(SharedData::windowPos.x + SharedData::windowSize.x * 0.5F, SharedData::windowPos.y), ImGuiCond_Always, ImVec2(0.5F,0.0F));
if (ImGui::BeginPopup("hex.view.command_palette.name"_lang)) { if (ImGui::BeginPopup("hex.builtin.view.command_palette.name"_lang)) {
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape))) if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
@@ -75,7 +75,7 @@ namespace hex {
bool ViewCommandPalette::handleShortcut(bool keys[512], bool ctrl, bool shift, bool alt) { bool ViewCommandPalette::handleShortcut(bool keys[512], bool ctrl, bool shift, bool alt) {
if (ctrl && shift && keys['P']) { if (ctrl && shift && keys['P']) {
View::doLater([this] { View::doLater([this] {
ImGui::OpenPopup("hex.view.command_palette.name"_lang); ImGui::OpenPopup("hex.builtin.view.command_palette.name"_lang);
this->m_commandPaletteOpen = true; this->m_commandPaletteOpen = true;
this->m_justOpened = true; this->m_justOpened = true;
}); });

View File

@@ -1,4 +1,4 @@
#include "views/view_constants.hpp" #include "content/views/view_constants.hpp"
#include <hex/helpers/paths.hpp> #include <hex/helpers/paths.hpp>
#include <hex/helpers/logger.hpp> #include <hex/helpers/logger.hpp>
@@ -8,9 +8,9 @@
#include <filesystem> #include <filesystem>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace hex { namespace hex::plugin::builtin {
ViewConstants::ViewConstants() : View("hex.view.constants.name") { ViewConstants::ViewConstants() : View("hex.builtin.view.constants.name") {
this->reloadConstants(); this->reloadConstants();
this->m_filter.reserve(0xFFFF); this->m_filter.reserve(0xFFFF);
@@ -65,7 +65,7 @@ namespace hex {
} }
void ViewConstants::drawContent() { void ViewConstants::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.constants.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.constants.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
ImGui::InputText("##search", this->m_filter.data(), this->m_filter.capacity(), ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) { ImGui::InputText("##search", this->m_filter.data(), this->m_filter.capacity(), ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) {
auto &view = *static_cast<ViewConstants*>(data->UserData); auto &view = *static_cast<ViewConstants*>(data->UserData);
@@ -88,10 +88,10 @@ namespace hex {
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable |
ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.constants.row.category"_lang, 0, -1, ImGui::GetID("category")); ImGui::TableSetupColumn("hex.builtin.view.constants.row.category"_lang, 0, -1, ImGui::GetID("category"));
ImGui::TableSetupColumn("hex.view.constants.row.name"_lang, 0, -1, ImGui::GetID("name")); ImGui::TableSetupColumn("hex.builtin.view.constants.row.name"_lang, 0, -1, ImGui::GetID("name"));
ImGui::TableSetupColumn("hex.view.constants.row.desc"_lang, 0, -1, ImGui::GetID("desc")); ImGui::TableSetupColumn("hex.builtin.view.constants.row.desc"_lang, 0, -1, ImGui::GetID("desc"));
ImGui::TableSetupColumn("hex.view.constants.row.value"_lang, 0, -1, ImGui::GetID("value")); ImGui::TableSetupColumn("hex.builtin.view.constants.row.value"_lang, 0, -1, ImGui::GetID("value"));
auto sortSpecs = ImGui::TableGetSortSpecs(); auto sortSpecs = ImGui::TableGetSortSpecs();

View File

@@ -1,4 +1,4 @@
#include "views/view_data_inspector.hpp" #include "content/views/view_data_inspector.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
@@ -6,11 +6,11 @@
extern int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end); extern int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end);
namespace hex { namespace hex::plugin::builtin {
using NumberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle; using NumberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle;
ViewDataInspector::ViewDataInspector() : View("hex.view.data_inspector.name") { ViewDataInspector::ViewDataInspector() : View("hex.builtin.view.data_inspector.name") {
EventManager::subscribe<EventRegionSelected>(this, [this](Region region) { EventManager::subscribe<EventRegionSelected>(this, [this](Region region) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
@@ -47,7 +47,7 @@ namespace hex {
} }
if (ImGui::Begin(View::toWindowName("hex.view.data_inspector.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.data_inspector.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImHexApi::Provider::isValid() && provider->isReadable() && this->m_validBytes > 0) { if (ImHexApi::Provider::isValid() && provider->isReadable() && this->m_validBytes > 0) {
@@ -55,8 +55,8 @@ namespace hex {
ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg,
ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * (this->m_cachedData.size() + 1)))) { ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * (this->m_cachedData.size() + 1)))) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.data_inspector.table.name"_lang); ImGui::TableSetupColumn("hex.builtin.view.data_inspector.table.name"_lang);
ImGui::TableSetupColumn("hex.view.data_inspector.table.value"_lang); ImGui::TableSetupColumn("hex.builtin.view.data_inspector.table.value"_lang);
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
@@ -107,7 +107,7 @@ namespace hex {
this->m_shouldInvalidate = true; this->m_shouldInvalidate = true;
} }
} else { } else {
std::string text = "hex.view.data_inspector.no_data"_lang; std::string text = "hex.builtin.view.data_inspector.no_data"_lang;
auto textSize = ImGui::CalcTextSize(text.c_str()); auto textSize = ImGui::CalcTextSize(text.c_str());
auto availableSpace = ImGui::GetContentRegionAvail(); auto availableSpace = ImGui::GetContentRegionAvail();

View File

@@ -1,14 +1,14 @@
#include "views/view_data_processor.hpp" #include "content/views/view_data_processor.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <helpers/project_file_handler.hpp> #include <hex/helpers/project_file_handler.hpp>
#include <imnodes.h> #include <imnodes.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace hex { namespace hex::plugin::builtin {
ViewDataProcessor::ViewDataProcessor() : View("hex.view.data_processor.name") { ViewDataProcessor::ViewDataProcessor() : View("hex.builtin.view.data_processor.name") {
EventManager::subscribe<RequestChangeTheme>(this, [](u32 theme) { EventManager::subscribe<RequestChangeTheme>(this, [](u32 theme) {
switch (theme) { switch (theme) {
default: default:
@@ -138,7 +138,7 @@ namespace hex {
} }
void ViewDataProcessor::drawContent() { void ViewDataProcessor::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.data_processor.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.data_processor.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) { if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) {
ImNodes::ClearNodeSelection(); ImNodes::ClearNodeSelection();
@@ -158,7 +158,7 @@ namespace hex {
dp::Node *node = nullptr; dp::Node *node = nullptr;
if (ImNodes::NumSelectedNodes() > 0 || ImNodes::NumSelectedLinks() > 0) { if (ImNodes::NumSelectedNodes() > 0 || ImNodes::NumSelectedLinks() > 0) {
if (ImGui::MenuItem("hex.view.data_processor.name"_lang)) { if (ImGui::MenuItem("hex.builtin.view.data_processor.name"_lang)) {
std::vector<int> ids; std::vector<int> ids;
ids.resize(ImNodes::NumSelectedNodes()); ids.resize(ImNodes::NumSelectedNodes());
ImNodes::GetSelectedNodes(ids.data()); ImNodes::GetSelectedNodes(ids.data());
@@ -217,14 +217,14 @@ namespace hex {
} }
if (ImGui::BeginPopup("Node Menu")) { if (ImGui::BeginPopup("Node Menu")) {
if (ImGui::MenuItem("hex.view.data_processor.menu.remove_node"_lang)) if (ImGui::MenuItem("hex.builtin.view.data_processor.menu.remove_node"_lang))
this->eraseNodes({ this->m_rightClickedId }); this->eraseNodes({ this->m_rightClickedId });
ImGui::EndPopup(); ImGui::EndPopup();
} }
if (ImGui::BeginPopup("Link Menu")) { if (ImGui::BeginPopup("Link Menu")) {
if (ImGui::MenuItem("hex.view.data_processor.menu.remove_link"_lang)) if (ImGui::MenuItem("hex.builtin.view.data_processor.menu.remove_link"_lang))
this->eraseLink(this->m_rightClickedId); this->eraseLink(this->m_rightClickedId);
ImGui::EndPopup(); ImGui::EndPopup();

View File

@@ -1,4 +1,4 @@
#include "views/view_diff.hpp" #include "content/views/view_diff.hpp"
#include <hex/api/imhex_api.hpp> #include <hex/api/imhex_api.hpp>
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
@@ -8,9 +8,9 @@
#include <hex/api/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace hex { namespace hex::plugin::builtin {
ViewDiff::ViewDiff() : View("hex.view.diff.name") { ViewDiff::ViewDiff() : View("hex.builtin.view.diff.name") {
EventManager::subscribe<EventSettingsChanged>(this, [this]{ EventManager::subscribe<EventSettingsChanged>(this, [this]{
{ {
@@ -161,7 +161,7 @@ namespace hex {
lastHighlightEnd.reset(); lastHighlightEnd.reset();
} }
ImGui::SameLine(0.0F, col % 8 == 7 ? glyphWidth * 2.5F : glyphWidth * 0.25F); ImGui::SameLine(0.0F, col % 8 == 7 ? glyphWidth * 2.5F : glyphWidth * 0.5F);
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
} }
@@ -169,7 +169,7 @@ namespace hex {
} }
void ViewDiff::drawContent() { void ViewDiff::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.diff.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.diff.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushID(1); ImGui::PushID(1);
@@ -201,7 +201,7 @@ namespace hex {
for (u8 i = 0; i < 2; i++) { for (u8 i = 0; i < 2; i++) {
for (u8 col = 0; col < this->m_columnCount; col++) { for (u8 col = 0; col < this->m_columnCount; col++) {
ImGui::TextUnformatted(hex::format(this->m_upperCaseHex ? "{:02X}" : "{:02x}", col).c_str()); ImGui::TextUnformatted(hex::format(this->m_upperCaseHex ? "{:02X}" : "{:02x}", col).c_str());
ImGui::SameLine(0.0F, col % 8 == 7 ? glyphWidth * 2.5F : glyphWidth * 0.25F); ImGui::SameLine(0.0F, col % 8 == 7 ? glyphWidth * 2.5F : glyphWidth * 0.5F);
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
} }
@@ -211,7 +211,7 @@ namespace hex {
if (this->m_providerA >= 0 && this->m_providerB >= 0) { if (this->m_providerA >= 0 && this->m_providerB >= 0) {
auto &providers = ImHexApi::Provider::getProviders(); auto &providers = ImHexApi::Provider::getProviders();
ImGuiListClipper clipper; ImGuiListClipper clipper;
clipper.Begin(std::max(providers[this->m_providerA]->getSize() / this->m_columnCount, providers[this->m_providerB]->getSize() / this->m_columnCount)); clipper.Begin(std::max(providers[this->m_providerA]->getSize() / this->m_columnCount, providers[this->m_providerB]->getSize() / this->m_columnCount) + 1, ImGui::GetTextLineHeightWithSpacing());
// Draw diff lines // Draw diff lines
while (clipper.Step()) { while (clipper.Step()) {

View File

@@ -1,4 +1,4 @@
#include "views/view_disassembler.hpp" #include "content/views/view_disassembler.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/fmt.hpp> #include <hex/helpers/fmt.hpp>
@@ -10,9 +10,9 @@
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
namespace hex { namespace hex::plugin::builtin {
ViewDisassembler::ViewDisassembler() : View("hex.view.disassembler.name") { ViewDisassembler::ViewDisassembler() : View("hex.builtin.view.disassembler.name") {
EventManager::subscribe<EventDataChanged>(this, [this]() { EventManager::subscribe<EventDataChanged>(this, [this]() {
this->disassemble(); this->disassemble();
}); });
@@ -27,11 +27,16 @@ namespace hex {
} }
} }
}); });
EventManager::subscribe<EventFileUnloaded>(this, [this]{
this->m_disassembly.clear();
});
} }
ViewDisassembler::~ViewDisassembler() { ViewDisassembler::~ViewDisassembler() {
EventManager::unsubscribe<EventDataChanged>(this); EventManager::unsubscribe<EventDataChanged>(this);
EventManager::unsubscribe<EventRegionSelected>(this); EventManager::unsubscribe<EventRegionSelected>(this);
EventManager::unsubscribe<EventFileUnloaded>(this);
} }
void ViewDisassembler::disassemble() { void ViewDisassembler::disassemble() {
@@ -104,15 +109,15 @@ namespace hex {
void ViewDisassembler::drawContent() { void ViewDisassembler::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.disassembler.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.disassembler.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImHexApi::Provider::isValid() && provider->isReadable()) { if (ImHexApi::Provider::isValid() && provider->isReadable()) {
ImGui::TextUnformatted("hex.view.disassembler.position"_lang); ImGui::TextUnformatted("hex.builtin.view.disassembler.position"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputScalar("hex.view.disassembler.base"_lang, ImGuiDataType_U64, &this->m_baseAddress, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalar("hex.builtin.view.disassembler.base"_lang, ImGuiDataType_U64, &this->m_baseAddress, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal);
ImGui::InputScalarN("hex.view.disassembler.region"_lang, ImGuiDataType_U64, this->m_codeRegion, 2, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalarN("hex.builtin.view.disassembler.region"_lang, ImGuiDataType_U64, this->m_codeRegion, 2, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal);
ImGui::Checkbox("hex.common.match_selection"_lang, &this->m_shouldMatchSelection); ImGui::Checkbox("hex.common.match_selection"_lang, &this->m_shouldMatchSelection);
if (ImGui::IsItemEdited()) { if (ImGui::IsItemEdited()) {
@@ -121,10 +126,10 @@ namespace hex {
} }
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.disassembler.settings.header"_lang); ImGui::TextUnformatted("hex.builtin.view.disassembler.settings.header"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::Combo("hex.view.disassembler.arch"_lang, reinterpret_cast<int*>(&this->m_architecture), Disassembler::ArchitectureNames, Disassembler::getArchitectureSupportedCount()); ImGui::Combo("hex.builtin.view.disassembler.arch"_lang, reinterpret_cast<int*>(&this->m_architecture), Disassembler::ArchitectureNames, Disassembler::getArchitectureSupportedCount());
if (ImGui::BeginChild("modes", ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), true, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginChild("modes", ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), true, ImGuiWindowFlags_AlwaysAutoResize)) {
@@ -148,19 +153,19 @@ namespace hex {
if (this->m_modeBasicARM == cs_mode(0)) if (this->m_modeBasicARM == cs_mode(0))
this->m_modeBasicARM = CS_MODE_ARM; this->m_modeBasicARM = CS_MODE_ARM;
if (ImGui::RadioButton("hex.view.disassembler.arm.arm"_lang, this->m_modeBasicARM == CS_MODE_ARM)) if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.arm"_lang, this->m_modeBasicARM == CS_MODE_ARM))
this->m_modeBasicARM = CS_MODE_ARM; this->m_modeBasicARM = CS_MODE_ARM;
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.arm.thumb"_lang, this->m_modeBasicARM == CS_MODE_THUMB)) if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.thumb"_lang, this->m_modeBasicARM == CS_MODE_THUMB))
this->m_modeBasicARM = CS_MODE_THUMB; this->m_modeBasicARM = CS_MODE_THUMB;
if (ImGui::RadioButton("hex.view.disassembler.arm.default"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == 0)) if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.default"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == 0))
this->m_modeExtraARM = cs_mode(0); this->m_modeExtraARM = cs_mode(0);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.arm.cortex_m"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == CS_MODE_MCLASS)) if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.cortex_m"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == CS_MODE_MCLASS))
this->m_modeExtraARM = CS_MODE_MCLASS; this->m_modeExtraARM = CS_MODE_MCLASS;
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.arm.armv8"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == CS_MODE_V8)) if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.armv8"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == CS_MODE_V8))
this->m_modeExtraARM = CS_MODE_V8; this->m_modeExtraARM = CS_MODE_V8;
break; break;
case Architecture::MIPS: case Architecture::MIPS:
@@ -173,16 +178,16 @@ namespace hex {
if (this->m_modeBasicMIPS == cs_mode(0)) if (this->m_modeBasicMIPS == cs_mode(0))
this->m_modeBasicMIPS = CS_MODE_MIPS32; this->m_modeBasicMIPS = CS_MODE_MIPS32;
if (ImGui::RadioButton("hex.view.disassembler.mips.mips32"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS32)) if (ImGui::RadioButton("hex.builtin.view.disassembler.mips.mips32"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS32))
this->m_modeBasicMIPS = CS_MODE_MIPS32; this->m_modeBasicMIPS = CS_MODE_MIPS32;
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.mips.mips64"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS64)) if (ImGui::RadioButton("hex.builtin.view.disassembler.mips.mips64"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS64))
this->m_modeBasicMIPS = CS_MODE_MIPS64; this->m_modeBasicMIPS = CS_MODE_MIPS64;
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.mips.mips32R6"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS32R6)) if (ImGui::RadioButton("hex.builtin.view.disassembler.mips.mips32R6"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS32R6))
this->m_modeBasicMIPS = CS_MODE_MIPS32R6; this->m_modeBasicMIPS = CS_MODE_MIPS32R6;
ImGui::Checkbox("hex.view.disassembler.mips.micro"_lang, &this->m_micoMode); ImGui::Checkbox("hex.builtin.view.disassembler.mips.micro"_lang, &this->m_micoMode);
break; break;
case Architecture::X86: case Architecture::X86:
this->m_modeBasicARM = cs_mode(0); this->m_modeBasicARM = cs_mode(0);
@@ -195,13 +200,13 @@ namespace hex {
if (this->m_modeBasicX86 == cs_mode(0)) if (this->m_modeBasicX86 == cs_mode(0))
this->m_modeBasicX86 = CS_MODE_16; this->m_modeBasicX86 = CS_MODE_16;
if (ImGui::RadioButton("hex.view.disassembler.x86.16bit"_lang, this->m_modeBasicX86 == CS_MODE_16)) if (ImGui::RadioButton("hex.builtin.view.disassembler.x86.16bit"_lang, this->m_modeBasicX86 == CS_MODE_16))
this->m_modeBasicX86 = CS_MODE_16; this->m_modeBasicX86 = CS_MODE_16;
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.x86.32bit"_lang, this->m_modeBasicX86 == CS_MODE_32)) if (ImGui::RadioButton("hex.builtin.view.disassembler.x86.32bit"_lang, this->m_modeBasicX86 == CS_MODE_32))
this->m_modeBasicX86 = CS_MODE_32; this->m_modeBasicX86 = CS_MODE_32;
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.x86.64bit"_lang, this->m_modeBasicX86 == CS_MODE_64)) if (ImGui::RadioButton("hex.builtin.view.disassembler.x86.64bit"_lang, this->m_modeBasicX86 == CS_MODE_64))
this->m_modeBasicX86 = CS_MODE_64; this->m_modeBasicX86 = CS_MODE_64;
break; break;
case Architecture::PPC: case Architecture::PPC:
@@ -215,10 +220,10 @@ namespace hex {
if (m_modeBasicPPC == cs_mode(0)) if (m_modeBasicPPC == cs_mode(0))
this->m_modeBasicPPC = CS_MODE_32; this->m_modeBasicPPC = CS_MODE_32;
if (ImGui::RadioButton("hex.view.disassembler.ppc.32bit"_lang, this->m_modeBasicPPC == CS_MODE_32)) if (ImGui::RadioButton("hex.builtin.view.disassembler.ppc.32bit"_lang, this->m_modeBasicPPC == CS_MODE_32))
this->m_modeBasicPPC = CS_MODE_32; this->m_modeBasicPPC = CS_MODE_32;
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton("hex.view.disassembler.ppc.64bit"_lang, this->m_modeBasicPPC == CS_MODE_64)) if (ImGui::RadioButton("hex.builtin.view.disassembler.ppc.64bit"_lang, this->m_modeBasicPPC == CS_MODE_64))
this->m_modeBasicPPC = CS_MODE_64; this->m_modeBasicPPC = CS_MODE_64;
break; break;
case Architecture::SPARC: case Architecture::SPARC:
@@ -229,7 +234,7 @@ namespace hex {
this->m_modeBasicPPC = cs_mode(0); this->m_modeBasicPPC = cs_mode(0);
this->m_micoMode = false; this->m_micoMode = false;
ImGui::Checkbox("hex.view.disassembler.sparc.v9"_lang, &this->m_sparcV9Mode); ImGui::Checkbox("hex.builtin.view.disassembler.sparc.v9"_lang, &this->m_sparcV9Mode);
break; break;
case Architecture::ARM64: case Architecture::ARM64:
case Architecture::SYSZ: case Architecture::SYSZ:
@@ -252,26 +257,26 @@ namespace hex {
ImGui::EndChild(); ImGui::EndChild();
ImGui::Disabled([this] { ImGui::Disabled([this] {
if (ImGui::Button("hex.view.disassembler.disassemble"_lang)) if (ImGui::Button("hex.builtin.view.disassembler.disassemble"_lang))
this->disassemble(); this->disassemble();
}, this->m_disassembling); }, this->m_disassembling);
if (this->m_disassembling) { if (this->m_disassembling) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextSpinner("hex.view.disassembler.disassembling"_lang); ImGui::TextSpinner("hex.builtin.view.disassembler.disassembling"_lang);
} }
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.disassembler.disassembly.title"_lang); ImGui::TextUnformatted("hex.builtin.view.disassembler.disassembly.title"_lang);
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginTable("##disassembly", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_Reorderable)) { if (ImGui::BeginTable("##disassembly", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_Reorderable)) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.disassembler.disassembly.address"_lang); ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.address"_lang);
ImGui::TableSetupColumn("hex.view.disassembler.disassembly.offset"_lang); ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.offset"_lang);
ImGui::TableSetupColumn("hex.view.disassembler.disassembly.bytes"_lang); ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.bytes"_lang);
ImGui::TableSetupColumn("hex.view.disassembler.disassembly.title"_lang); ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.title"_lang);
ImGuiListClipper clipper; ImGuiListClipper clipper;
clipper.Begin(this->m_disassembly.size()); clipper.Begin(this->m_disassembly.size());

View File

@@ -1,4 +1,4 @@
#include "views/view_hashes.hpp" #include "content/views/view_hashes.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/crypto.hpp> #include <hex/helpers/crypto.hpp>
@@ -6,9 +6,9 @@
#include <vector> #include <vector>
namespace hex { namespace hex::plugin::builtin {
ViewHashes::ViewHashes() : View("hex.view.hashes.name") { ViewHashes::ViewHashes() : View("hex.builtin.view.hashes.name") {
EventManager::subscribe<EventDataChanged>(this, [this]() { EventManager::subscribe<EventDataChanged>(this, [this]() {
this->m_shouldInvalidate = true; this->m_shouldInvalidate = true;
}); });
@@ -39,7 +39,7 @@ namespace hex {
} }
void ViewHashes::drawContent() { void ViewHashes::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.hashes.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.hashes.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
if (ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav)) { if (ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav)) {
@@ -60,10 +60,10 @@ namespace hex {
} }
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.settings"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.settings"_lang);
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginCombo("hex.view.hashes.function"_lang, hashFunctionNames[this->m_currHashFunction].second, 0)) if (ImGui::BeginCombo("hex.builtin.view.hashes.function"_lang, hashFunctionNames[this->m_currHashFunction].second, 0))
{ {
for (int i = 0; i < hashFunctionNames.size(); i++) for (int i = 0; i < hashFunctionNames.size(); i++)
{ {
@@ -88,10 +88,10 @@ namespace hex {
static int polynomial = 0x07, init = 0x0000, xorout = 0x0000; static int polynomial = 0x07, init = 0x0000, xorout = 0x0000;
static bool reflectIn = false, reflectOut = false; static bool reflectIn = false, reflectOut = false;
ImGui::InputInt("hex.view.hashes.iv"_lang, &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.iv"_lang, &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::InputInt("hex.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn); ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn);
@@ -100,7 +100,7 @@ namespace hex {
ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut); ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::InputInt("hex.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::NewLine(); ImGui::NewLine();
@@ -114,7 +114,7 @@ namespace hex {
char buffer[sizeof(result) * 2 + 1]; char buffer[sizeof(result) * 2 + 1];
snprintf(buffer, sizeof(buffer), "%02X", result); snprintf(buffer, sizeof(buffer), "%02X", result);
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -124,10 +124,10 @@ namespace hex {
static int polynomial = 0x8005, init = 0x0000, xorout = 0x0000; static int polynomial = 0x8005, init = 0x0000, xorout = 0x0000;
static bool reflectIn = false, reflectOut = false; static bool reflectIn = false, reflectOut = false;
ImGui::InputInt("hex.view.hashes.iv"_lang, &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.iv"_lang, &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::InputInt("hex.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn); ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn);
@@ -136,7 +136,7 @@ namespace hex {
ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut); ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::InputInt("hex.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::NewLine(); ImGui::NewLine();
@@ -150,7 +150,7 @@ namespace hex {
char buffer[sizeof(result) * 2 + 1]; char buffer[sizeof(result) * 2 + 1];
snprintf(buffer, sizeof(buffer), "%04X", result); snprintf(buffer, sizeof(buffer), "%04X", result);
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -162,10 +162,10 @@ namespace hex {
ImGui::InputInt("hex.view.hashes.iv"_lang, &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.iv"_lang, &init, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::InputInt("hex.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.xorout"_lang, &xorout, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn); ImGui::Checkbox("hex.common.reflectIn"_lang, &reflectIn);
@@ -174,7 +174,7 @@ namespace hex {
ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut); ImGui::Checkbox("hex.common.reflectOut"_lang, &reflectOut);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::InputInt("hex.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputInt("hex.builtin.view.hashes.poly"_lang, &polynomial, 0, 0, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true;
ImGui::NewLine(); ImGui::NewLine();
@@ -188,7 +188,7 @@ namespace hex {
char buffer[sizeof(result) * 2 + 1]; char buffer[sizeof(result) * 2 + 1];
snprintf(buffer, sizeof(buffer), "%08X", result); snprintf(buffer, sizeof(buffer), "%08X", result);
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -204,7 +204,7 @@ namespace hex {
formatBigHexInt(result, buffer, sizeof(buffer)); formatBigHexInt(result, buffer, sizeof(buffer));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -220,7 +220,7 @@ namespace hex {
formatBigHexInt(result, buffer, sizeof(buffer)); formatBigHexInt(result, buffer, sizeof(buffer));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -236,7 +236,7 @@ namespace hex {
formatBigHexInt(result, buffer, sizeof(buffer)); formatBigHexInt(result, buffer, sizeof(buffer));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -252,7 +252,7 @@ namespace hex {
formatBigHexInt(result, buffer, sizeof(buffer)); formatBigHexInt(result, buffer, sizeof(buffer));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -268,7 +268,7 @@ namespace hex {
formatBigHexInt(result, buffer, sizeof(buffer)); formatBigHexInt(result, buffer, sizeof(buffer));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }
@@ -284,7 +284,7 @@ namespace hex {
formatBigHexInt(result, buffer, sizeof(buffer)); formatBigHexInt(result, buffer, sizeof(buffer));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.result"_lang); ImGui::TextUnformatted("hex.builtin.view.hashes.result"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", buffer, ImGuiInputTextFlags_ReadOnly);
} }

View File

@@ -0,0 +1,178 @@
#include "content/views/view_help.hpp"
#include <hex/helpers/paths.hpp>
#include <imgui_imhex_extensions.h>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/utils.hpp>
namespace hex::plugin::builtin {
ViewHelp::ViewHelp() : View("hex.builtin.view.help.about.name") {
}
ViewHelp::~ViewHelp() {
}
static void link(const std::string &label, const std::string &url) {
if (ImGui::BulletHyperlink(label.data()))
hex::openWebpage(url.data());
}
void ViewHelp::drawAboutMainPage() {
ImGui::Text("ImHex Hex Editor v%s by WerWolv - " ICON_FA_CODE_BRANCH, IMHEX_VERSION);
#if defined(GIT_BRANCH) && defined(GIT_COMMIT_HASH)
ImGui::SameLine();
if (ImGui::Hyperlink(hex::format("{0}@{1}", GIT_BRANCH, GIT_COMMIT_HASH).c_str()))
hex::openWebpage("https://github.com/WerWolv/ImHex/commit/" GIT_COMMIT_HASH);
#endif
ImGui::TextUnformatted("hex.builtin.view.help.about.translator"_lang);
ImGui::TextUnformatted("hex.builtin.view.help.about.source"_lang); ImGui::SameLine();
if (ImGui::Hyperlink("WerWolv/ImHex"))
hex::openWebpage("https://github.com/WerWolv/ImHex");
ImGui::NewLine();
ImGui::TextUnformatted("hex.builtin.view.help.about.donations"_lang);
ImGui::Separator();
constexpr const char* Links[] = { "https://werwolv.net/donate", "https://www.patreon.com/werwolv", "https://github.com/sponsors/WerWolv" };
ImGui::TextWrapped("%s", static_cast<const char *>("hex.builtin.view.help.about.thanks"_lang));
ImGui::NewLine();
for (auto &link : Links) {
if (ImGui::Hyperlink(link))
hex::openWebpage(link);
}
}
void ViewHelp::drawContributorPage() {
link("Mary for porting ImHex to MacOS", "https://github.com/Thog");
link("Roblabla for adding the MSI Windows installer", "https://github.com/roblabla");
link("jam1garner for adding support for Rust plugins", "https://github.com/jam1garner");
}
void ViewHelp::drawLibraryCreditsPage() {
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.2F, 0.2F, 0.2F, 0.3F));
link("ImGui by ocornut", "https://github.com/ocornut/imgui");
link("imgui_club by ocornut", "https://github.com/ocornut/imgui_club");
link("imnodes by Nelarius", "https://github.com/Nelarius/imnodes");
link("ImGuiColorTextEdit by BalazsJako", "https://github.com/BalazsJako/ImGuiColorTextEdit");
link("ImPlot by epezent", "https://github.com/epezent/implot");
link("capstone by aquynh", "https://github.com/aquynh/capstone");
link("JSON for Modern C++ by nlohmann", "https://github.com/nlohmann/json");
link("YARA by VirusTotal", "https://github.com/VirusTotal/yara");
link("Native File Dialog Extended by btzy and mlabbe", "https://github.com/btzy/nativefiledialog-extended");
link("Native File Dialog Extended by btzy and mlabbe", "https://github.com/btzy/nativefiledialog-extended");
ImGui::NewLine();
link("GNU libmagic", "http://www.darwinsys.com/file/");
link("GLFW3", "https://github.com/glfw/glfw");
link("LLVM", "https://github.com/llvm/llvm-project");
link("Python 3", "https://github.com/python/cpython");
link("FreeType", "https://gitlab.freedesktop.org/freetype/freetype");
link("Mbed TLS", "https://github.com/ARMmbed/mbedtls");
ImGui::PopStyleColor();
}
void ViewHelp::drawPathsPage() {
if (ImGui::BeginTable("##imhex_paths", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit)) {
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("Type");
ImGui::TableSetupColumn("Paths");
constexpr std::array<std::pair<const char*, ImHexPath>, 8> PathTypes = {{
{ "Resources", ImHexPath::Resources },
{ "Config", ImHexPath::Config },
{ "Magic", ImHexPath::Magic },
{ "Patterns", ImHexPath::Patterns },
{ "Patterns Includes", ImHexPath::PatternsInclude },
{ "Plugins", ImHexPath::Plugins },
{ "Python Scripts", ImHexPath::Python },
{ "Yara Patterns", ImHexPath::Yara }
}};
ImGui::TableHeadersRow();
for (const auto &[name, type] : PathTypes) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextUnformatted(name);
ImGui::TableNextColumn();
for (auto &path : hex::getPath(type))
ImGui::TextUnformatted(path.c_str());
}
ImGui::EndTable();
}
}
void ViewHelp::drawAboutPopup() {
ImGui::SetNextWindowSize(ImVec2(600, 350) * SharedData::globalScale, ImGuiCond_Always);
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.help.about.name").c_str(), &this->m_aboutWindowOpen, ImGuiWindowFlags_NoResize)) {
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))
ImGui::CloseCurrentPopup();
if (ImGui::BeginTabBar("about_tab_bar")) {
if (ImGui::BeginTabItem("ImHex")) {
ImGui::NewLine();
this->drawAboutMainPage();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("hex.builtin.view.help.about.contributor"_lang)) {
ImGui::NewLine();
this->drawContributorPage();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("hex.builtin.view.help.about.libs"_lang)) {
ImGui::NewLine();
this->drawLibraryCreditsPage();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("hex.builtin.view.help.about.paths"_lang)) {
ImGui::NewLine();
this->drawPathsPage();
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
ImGui::EndPopup();
}
}
void ViewHelp::drawContent() {
if (!this->m_aboutWindowOpen)
this->getWindowOpenState() = false;
this->drawAboutPopup();
}
void ViewHelp::drawMenu() {
if (ImGui::BeginMenu("hex.menu.help"_lang)) {
if (ImGui::MenuItem("hex.builtin.view.help.about.name"_lang, "")) {
View::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.help.about.name").c_str()); });
this->m_aboutWindowOpen = true;
this->getWindowOpenState() = true;
}
if (ImGui::MenuItem("hex.builtin.view.help.documentation"_lang, "")) {
hex::openWebpage("https://imhex.werwolv.net/docs");
}
ImGui::EndMenu();
}
}
}

View File

@@ -1,4 +1,4 @@
#include "views/view_hexeditor.hpp" #include "content/views/view_hexeditor.hpp"
#include <hex/api/imhex_api.hpp> #include <hex/api/imhex_api.hpp>
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
@@ -6,10 +6,11 @@
#include <hex/helpers/file.hpp> #include <hex/helpers/file.hpp>
#include <hex/pattern_language/pattern_data.hpp> #include <hex/pattern_language/pattern_data.hpp>
#include "providers/file_provider.hpp" #include "content/providers/file_provider.hpp"
#include "helpers/patches.hpp"
#include "helpers/project_file_handler.hpp" #include <hex/helpers/patches.hpp>
#include "helpers/loader_script_handler.hpp" #include <hex/helpers/project_file_handler.hpp>
#include <hex/helpers/loader_script_handler.hpp>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
@@ -27,9 +28,9 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
namespace hex { namespace hex::plugin::builtin {
ViewHexEditor::ViewHexEditor() : View("hex.view.hexeditor.name"_lang) { ViewHexEditor::ViewHexEditor() : View("hex.builtin.view.hexeditor.name"_lang) {
this->m_searchStringBuffer.resize(0xFFF, 0x00); this->m_searchStringBuffer.resize(0xFFF, 0x00);
this->m_searchHexBuffer.resize(0xFFF, 0x00); this->m_searchHexBuffer.resize(0xFFF, 0x00);
@@ -40,7 +41,7 @@ namespace hex {
return 0x00; return 0x00;
ImU8 byte; ImU8 byte;
provider->readRelative(off, &byte, sizeof(ImU8)); provider->read(off + provider->getBaseAddress() + provider->getCurrentPageAddress(), &byte, sizeof(ImU8));
return byte; return byte;
}; };
@@ -50,7 +51,7 @@ namespace hex {
if (!provider->isAvailable() || !provider->isWritable()) if (!provider->isAvailable() || !provider->isWritable())
return; return;
provider->writeRelative(off, &d, sizeof(ImU8)); provider->write(off + provider->getBaseAddress() + provider->getCurrentPageAddress(), &d, sizeof(ImU8));
EventManager::post<EventDataChanged>(); EventManager::post<EventDataChanged>();
ProjectFile::markDirty(); ProjectFile::markDirty();
}; };
@@ -60,7 +61,9 @@ namespace hex {
std::optional<u32> currColor, prevColor; std::optional<u32> currColor, prevColor;
off += ImHexApi::Provider::get()->getBaseAddress(); auto provider = ImHexApi::Provider::get();
off += provider->getBaseAddress() + provider->getCurrentPageAddress();
u32 alpha = static_cast<u32>(_this->m_highlightAlpha) << 24; u32 alpha = static_cast<u32>(_this->m_highlightAlpha) << 24;
@@ -124,7 +127,7 @@ namespace hex {
size_t size = std::min<size_t>(_this->m_currEncodingFile.getLongestSequence(), provider->getActualSize() - addr); size_t size = std::min<size_t>(_this->m_currEncodingFile.getLongestSequence(), provider->getActualSize() - addr);
std::vector<u8> buffer(size); std::vector<u8> buffer(size);
provider->readRelative(addr, buffer.data(), size); provider->read(addr + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), size);
auto [decoded, advance] = _this->m_currEncodingFile.getEncodingFor(buffer); auto [decoded, advance] = _this->m_currEncodingFile.getEncodingFor(buffer);
@@ -152,8 +155,8 @@ namespace hex {
if (region.size != 0) { if (region.size != 0) {
provider->setCurrentPage(page.value()); provider->setCurrentPage(page.value());
u64 start = region.address; u64 start = region.address - provider->getBaseAddress() - provider->getCurrentPageAddress();
this->m_memoryEditor.GotoAddrAndSelect(start - provider->getBaseAddress(), start + region.size - provider->getBaseAddress() - 1); this->m_memoryEditor.GotoAddrAndSelect(start, start + region.size - 1);
} }
EventManager::post<EventRegionSelected>(Region { this->m_memoryEditor.DataPreviewAddr, (this->m_memoryEditor.DataPreviewAddrEnd - this->m_memoryEditor.DataPreviewAddr) + 1}); EventManager::post<EventRegionSelected>(Region { this->m_memoryEditor.DataPreviewAddr, (this->m_memoryEditor.DataPreviewAddrEnd - this->m_memoryEditor.DataPreviewAddr) + 1});
@@ -166,7 +169,7 @@ namespace hex {
EventManager::subscribe<EventWindowClosing>(this, [](GLFWwindow *window) { EventManager::subscribe<EventWindowClosing>(this, [](GLFWwindow *window) {
if (ProjectFile::hasUnsavedChanges()) { if (ProjectFile::hasUnsavedChanges()) {
glfwSetWindowShouldClose(window, GLFW_FALSE); glfwSetWindowShouldClose(window, GLFW_FALSE);
View::doLater([] { ImGui::OpenPopup("hex.view.hexeditor.exit_application.title"_lang); }); View::doLater([] { ImGui::OpenPopup("hex.builtin.view.hexeditor.exit_application.title"_lang); });
} }
}); });
@@ -180,9 +183,9 @@ namespace hex {
EventManager::subscribe<RequestOpenWindow>(this, [this](std::string name) { EventManager::subscribe<RequestOpenWindow>(this, [this](std::string name) {
if (name == "Create File") { if (name == "Create File") {
hex::openFileBrowser("hex.view.hexeditor.create_file"_lang, DialogMode::Save, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.create_file"_lang, DialogMode::Save, { }, [this](auto path) {
if (!this->createFile(path)) { if (!this->createFile(path)) {
View::showErrorPopup("hex.view.hexeditor.error.create"_lang); View::showErrorPopup("hex.builtin.view.hexeditor.error.create"_lang);
return; return;
} }
@@ -190,12 +193,12 @@ namespace hex {
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
}); });
} else if (name == "Open File") { } else if (name == "Open File") {
hex::openFileBrowser("hex.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) {
EventManager::post<RequestOpenFile>(path); EventManager::post<RequestOpenFile>(path);
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
}); });
} else if (name == "Open Project") { } else if (name == "Open Project") {
hex::openFileBrowser("hex.view.hexeditor.open_project"_lang, DialogMode::Open, { { "Project File", "hexproj" } }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.open_project"_lang, DialogMode::Open, { { "Project File", "hexproj" } }, [this](auto path) {
ProjectFile::load(path); ProjectFile::load(path);
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
}); });
@@ -283,10 +286,10 @@ namespace hex {
size_t dataSize = (!ImHexApi::Provider::isValid() || !provider->isReadable()) ? 0x00 : provider->getSize(); size_t dataSize = (!ImHexApi::Provider::isValid() || !provider->isReadable()) ? 0x00 : provider->getSize();
this->m_memoryEditor.DrawWindow(View::toWindowName("hex.view.hexeditor.name").c_str(), &this->getWindowOpenState(), this, dataSize, dataSize == 0 ? 0x00 : provider->getBaseAddress()); this->m_memoryEditor.DrawWindow(View::toWindowName("hex.builtin.view.hexeditor.name").c_str(), &this->getWindowOpenState(), this, dataSize, dataSize == 0 ? 0x00 : provider->getBaseAddress() + provider->getCurrentPageAddress());
if (dataSize != 0x00) { if (dataSize != 0x00) {
if (ImGui::Begin(View::toWindowName("hex.view.hexeditor.name").c_str())) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.hexeditor.name").c_str())) {
if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows))
ImGui::OpenPopup("hex.menu.edit"_lang); ImGui::OpenPopup("hex.menu.edit"_lang);
@@ -297,7 +300,9 @@ namespace hex {
} }
if (provider->getPageCount() > 1) { if (provider->getPageCount() > 1) {
ImGui::TextUnformatted(hex::format("hex.view.hexeditor.page"_lang, provider->getCurrentPage() + 1, provider->getPageCount()).c_str()); ImGui::SameLine();
ImGui::TextUnformatted(hex::format("hex.builtin.view.hexeditor.page"_lang, provider->getCurrentPage() + 1, provider->getPageCount()).c_str());
ImGui::SameLine(); ImGui::SameLine();
@@ -329,7 +334,7 @@ namespace hex {
} }
static void saveAs() { static void saveAs() {
hex::openFileBrowser("hex.view.hexeditor.save_as"_lang, DialogMode::Save, { }, [](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.save_as"_lang, DialogMode::Save, { }, [](auto path) {
ImHexApi::Provider::get()->saveAs(path); ImHexApi::Provider::get()->saveAs(path);
}); });
} }
@@ -337,9 +342,9 @@ namespace hex {
void ViewHexEditor::drawAlwaysVisible() { void ViewHexEditor::drawAlwaysVisible() {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImGui::BeginPopupModal("hex.view.hexeditor.exit_application.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal("hex.builtin.view.hexeditor.exit_application.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hexeditor.exit_application.desc"_lang); ImGui::TextUnformatted("hex.builtin.view.hexeditor.exit_application.desc"_lang);
ImGui::NewLine(); ImGui::NewLine();
confirmButtons("hex.common.yes"_lang, "hex.common.no"_lang, [] { confirmButtons("hex.common.yes"_lang, "hex.common.no"_lang, [] {
@@ -355,22 +360,22 @@ namespace hex {
ImGui::EndPopup(); ImGui::EndPopup();
} }
if (ImGui::BeginPopupModal("hex.view.hexeditor.script.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal("hex.builtin.view.hexeditor.script.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::SetCursorPosX(10); ImGui::SetCursorPosX(10);
ImGui::TextWrapped("%s", static_cast<const char *>("hex.view.hexeditor.script.desc"_lang)); ImGui::TextWrapped("%s", static_cast<const char *>("hex.builtin.view.hexeditor.script.desc"_lang));
ImGui::NewLine(); ImGui::NewLine();
ImGui::InputText("##nolabel", this->m_loaderScriptScriptPath.data(), this->m_loaderScriptScriptPath.length(), ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", this->m_loaderScriptScriptPath.data(), this->m_loaderScriptScriptPath.length(), ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("hex.view.hexeditor.script.script"_lang)) { if (ImGui::Button("hex.builtin.view.hexeditor.script.script"_lang)) {
hex::openFileBrowser("hex.view.hexeditor.script.script.title"_lang, DialogMode::Open, { { "Python Script", "py" } }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.script.script.title"_lang, DialogMode::Open, { { "Python Script", "py" } }, [this](auto path) {
this->m_loaderScriptScriptPath = path; this->m_loaderScriptScriptPath = path;
}); });
} }
ImGui::InputText("##nolabel", this->m_loaderScriptFilePath.data(), this->m_loaderScriptFilePath.length(), ImGuiInputTextFlags_ReadOnly); ImGui::InputText("##nolabel", this->m_loaderScriptFilePath.data(), this->m_loaderScriptFilePath.length(), ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("hex.view.hexeditor.script.file"_lang)) { if (ImGui::Button("hex.builtin.view.hexeditor.script.file"_lang)) {
hex::openFileBrowser("hex.view.hexeditor.script.file.title"_lang, DialogMode::Open, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.script.file.title"_lang, DialogMode::Open, { }, [this](auto path) {
this->m_loaderScriptFilePath = path; this->m_loaderScriptFilePath = path;
}); });
} }
@@ -398,7 +403,7 @@ namespace hex {
} }
if (ImGui::BeginPopupModal("hex.view.hexeditor.menu.edit.set_base"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal("hex.builtin.view.hexeditor.menu.edit.set_base"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::InputText("hex.common.address"_lang, this->m_baseAddressBuffer, 16, ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputText("hex.common.address"_lang, this->m_baseAddressBuffer, 16, ImGuiInputTextFlags_CharsHexadecimal);
ImGui::NewLine(); ImGui::NewLine();
@@ -416,7 +421,7 @@ namespace hex {
ImGui::EndPopup(); ImGui::EndPopup();
} }
if (ImGui::BeginPopupModal("hex.view.hexeditor.menu.edit.resize"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal("hex.builtin.view.hexeditor.menu.edit.resize"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::InputScalar("hex.common.size"_lang, ImGuiDataType_U64, &this->m_resizeSize, nullptr, nullptr, "0x%016llx", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalar("hex.common.size"_lang, ImGuiDataType_U64, &this->m_resizeSize, nullptr, nullptr, "0x%016llx", ImGuiInputTextFlags_CharsHexadecimal);
ImGui::NewLine(); ImGui::NewLine();
@@ -440,14 +445,14 @@ namespace hex {
bool providerValid = ImHexApi::Provider::isValid(); bool providerValid = ImHexApi::Provider::isValid();
if (ImGui::BeginMenu("hex.menu.file"_lang)) { if (ImGui::BeginMenu("hex.menu.file"_lang)) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.open_file"_lang, "CTRL + O")) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.open_file"_lang, "CTRL + O")) {
hex::openFileBrowser("hex.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) {
EventManager::post<RequestOpenFile>(path); EventManager::post<RequestOpenFile>(path);
}); });
} }
if (ImGui::BeginMenu("hex.view.hexeditor.menu.file.open_recent"_lang, !SharedData::recentFilePaths.empty())) { if (ImGui::BeginMenu("hex.builtin.view.hexeditor.menu.file.open_recent"_lang, !SharedData::recentFilePaths.empty())) {
for (auto &path : SharedData::recentFilePaths) { for (auto &path : SharedData::recentFilePaths) {
if (ImGui::MenuItem(std::filesystem::path(path).filename().string().c_str())) { if (ImGui::MenuItem(std::filesystem::path(path).filename().string().c_str())) {
EventManager::post<RequestOpenFile>(path); EventManager::post<RequestOpenFile>(path);
@@ -457,35 +462,46 @@ namespace hex {
ImGui::EndMenu(); ImGui::EndMenu();
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.save"_lang, "CTRL + S", false, providerValid && provider->isWritable())) { if (ImGui::BeginMenu("hex.builtin.view.hexeditor.menu.file.open_other"_lang)) {
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::getEntries()) {
if (ImGui::MenuItem(LangEntry(unlocalizedProviderName))) {
EventManager::post<RequestCreateProvider>(unlocalizedProviderName, nullptr);
}
}
ImGui::EndMenu();
}
if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.save"_lang, "CTRL + S", false, providerValid && provider->isWritable())) {
save(); save();
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.save_as"_lang, "CTRL + SHIFT + S", false, providerValid && provider->isWritable())) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.save_as"_lang, "CTRL + SHIFT + S", false, providerValid && provider->isWritable())) {
saveAs(); saveAs();
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.close"_lang, "", false, providerValid && provider->isAvailable())) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.close"_lang, "", false, providerValid)) {
EventManager::post<EventFileUnloaded>(); EventManager::post<EventFileUnloaded>();
ImHexApi::Provider::remove(ImHexApi::Provider::get()); ImHexApi::Provider::remove(ImHexApi::Provider::get());
providerValid = false; providerValid = false;
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.quit"_lang, "", false)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.quit"_lang, "", false)) {
ImHexApi::Common::closeImHex(); ImHexApi::Common::closeImHex();
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.open_project"_lang, "")) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.open_project"_lang, "")) {
hex::openFileBrowser("hex.view.hexeditor.menu.file.open_project"_lang, DialogMode::Open, { { "Project File", "hexproj" } }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.menu.file.open_project"_lang, DialogMode::Open, { { "Project File", "hexproj" } }, [this](auto path) {
ProjectFile::load(path); ProjectFile::load(path);
}); });
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.save_project"_lang, "", false, providerValid && provider->isWritable())) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.save_project"_lang, "", false, providerValid && provider->isWritable())) {
if (ProjectFile::getProjectFilePath() == "") { if (ProjectFile::getProjectFilePath() == "") {
hex::openFileBrowser("hex.view.hexeditor.save_project"_lang, DialogMode::Save, { { "Project File", "hexproj" } }, [](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.save_project"_lang, DialogMode::Save, { { "Project File", "hexproj" } }, [](auto path) {
if (path.ends_with(".hexproj")) { if (path.ends_with(".hexproj")) {
ProjectFile::store(path); ProjectFile::store(path);
} }
@@ -498,18 +514,18 @@ namespace hex {
ProjectFile::store(); ProjectFile::store();
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.load_encoding_file"_lang)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.load_encoding_file"_lang)) {
hex::openFileBrowser("hex.view.hexeditor.load_enconding_file"_lang, DialogMode::Open, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.load_enconding_file"_lang, DialogMode::Open, { }, [this](auto path) {
this->m_currEncodingFile = EncodingFile(EncodingFile::Type::Thingy, path); this->m_currEncodingFile = EncodingFile(EncodingFile::Type::Thingy, path);
}); });
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginMenu("hex.view.hexeditor.menu.file.import"_lang)) { if (ImGui::BeginMenu("hex.builtin.view.hexeditor.menu.file.import"_lang)) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.base64"_lang)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.import.base64"_lang)) {
hex::openFileBrowser("hex.view.hexeditor.menu.file.import.base64"_lang, DialogMode::Open, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.menu.file.import.base64"_lang, DialogMode::Open, { }, [this](auto path) {
std::vector<u8> base64; std::vector<u8> base64;
this->loadFromFile(path, base64); this->loadFromFile(path, base64);
@@ -517,19 +533,19 @@ namespace hex {
this->m_dataToSave = crypt::decode64(base64); this->m_dataToSave = crypt::decode64(base64);
if (this->m_dataToSave.empty()) if (this->m_dataToSave.empty())
View::showErrorPopup("hex.view.hexeditor.base64.import_error"_lang); View::showErrorPopup("hex.builtin.view.hexeditor.base64.import_error"_lang);
else else
ImGui::OpenPopup("hex.view.hexeditor.save_data"_lang); ImGui::OpenPopup("hex.builtin.view.hexeditor.save_data"_lang);
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
} else View::showErrorPopup("hex.view.hexeditor.file_open_error"_lang); } else View::showErrorPopup("hex.builtin.view.hexeditor.file_open_error"_lang);
}); });
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.ips"_lang)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.import.ips"_lang)) {
hex::openFileBrowser("hex.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) {
auto patchData = File(path, File::Mode::Read).readBytes(); auto patchData = File(path, File::Mode::Read).readBytes();
auto patch = hex::loadIPSPatch(patchData); auto patch = hex::loadIPSPatch(patchData);
@@ -543,8 +559,8 @@ namespace hex {
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.ips32"_lang)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.import.ips32"_lang)) {
hex::openFileBrowser("hex.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [this](auto path) {
auto patchData = File(path, File::Mode::Read).readBytes(); auto patchData = File(path, File::Mode::Read).readBytes();
auto patch = hex::loadIPS32Patch(patchData); auto patch = hex::loadIPS32Patch(patchData);
@@ -556,17 +572,17 @@ namespace hex {
}); });
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.script"_lang)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.import.script"_lang)) {
this->m_loaderScriptFilePath.clear(); this->m_loaderScriptFilePath.clear();
this->m_loaderScriptScriptPath.clear(); this->m_loaderScriptScriptPath.clear();
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.script.title"_lang); }); View::doLater([]{ ImGui::OpenPopup("hex.builtin.view.hexeditor.script.title"_lang); });
} }
ImGui::EndMenu(); ImGui::EndMenu();
} }
if (ImGui::BeginMenu("hex.view.hexeditor.menu.file.export"_lang, providerValid && provider->isWritable())) { if (ImGui::BeginMenu("hex.builtin.view.hexeditor.menu.file.export"_lang, providerValid && provider->isWritable())) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.export.ips"_lang)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.export.ips"_lang)) {
Patches patches = provider->getPatches(); Patches patches = provider->getPatches();
if (!patches.contains(0x00454F45) && patches.contains(0x00454F46)) { if (!patches.contains(0x00454F45) && patches.contains(0x00454F46)) {
u8 value = 0; u8 value = 0;
@@ -575,11 +591,11 @@ namespace hex {
} }
this->m_dataToSave = generateIPSPatch(patches); this->m_dataToSave = generateIPSPatch(patches);
hex::openFileBrowser("hex.view.hexeditor.menu.file.export.title"_lang, DialogMode::Save, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.menu.file.export.title"_lang, DialogMode::Save, { }, [this](auto path) {
this->saveToFile(path, this->m_dataToSave); this->saveToFile(path, this->m_dataToSave);
}); });
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.export.ips32"_lang)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.export.ips32"_lang)) {
Patches patches = provider->getPatches(); Patches patches = provider->getPatches();
if (!patches.contains(0x00454F45) && patches.contains(0x45454F46)) { if (!patches.contains(0x00454F45) && patches.contains(0x45454F46)) {
u8 value = 0; u8 value = 0;
@@ -588,7 +604,7 @@ namespace hex {
} }
this->m_dataToSave = generateIPS32Patch(patches); this->m_dataToSave = generateIPS32Patch(patches);
hex::openFileBrowser("hex.view.hexeditor.menu.file.export.title"_lang, DialogMode::Save, { }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.menu.file.export.title"_lang, DialogMode::Save, { }, [this](auto path) {
this->saveToFile(path, this->m_dataToSave); this->saveToFile(path, this->m_dataToSave);
}); });
} }
@@ -600,14 +616,14 @@ namespace hex {
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.search"_lang, "CTRL + F")) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.search"_lang, "CTRL + F")) {
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
ImGui::OpenPopupInWindow(View::toWindowName("hex.view.hexeditor.name").c_str(), "hex.view.hexeditor.menu.file.search"_lang); ImGui::OpenPopupInWindow(View::toWindowName("hex.builtin.view.hexeditor.name").c_str(), "hex.builtin.view.hexeditor.menu.file.search"_lang);
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.goto"_lang, "CTRL + G")) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.goto"_lang, "CTRL + G")) {
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
ImGui::OpenPopupInWindow(View::toWindowName("hex.view.hexeditor.name").c_str(), "hex.view.hexeditor.menu.file.goto"_lang); ImGui::OpenPopupInWindow(View::toWindowName("hex.builtin.view.hexeditor.name").c_str(), "hex.builtin.view.hexeditor.menu.file.goto"_lang);
} }
ImGui::EndMenu(); ImGui::EndMenu();
@@ -629,7 +645,7 @@ namespace hex {
} }
ON_SCOPE_EXIT { ImGui::End(); }; ON_SCOPE_EXIT { ImGui::End(); };
if (ImGui::Begin(View::toWindowName("hex.view.hexeditor.name").c_str())) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.hexeditor.name").c_str())) {
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) { if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) {
if (ctrl && keys['Z']) { if (ctrl && keys['Z']) {
@@ -640,13 +656,13 @@ namespace hex {
if (ImHexApi::Provider::isValid()) if (ImHexApi::Provider::isValid())
ImHexApi::Provider::get()->redo(); ImHexApi::Provider::get()->redo();
} else if (ctrl && keys['F']) { } else if (ctrl && keys['F']) {
ImGui::OpenPopupInWindow(View::toWindowName("hex.view.hexeditor.name").c_str(), "hex.view.hexeditor.menu.file.search"_lang); ImGui::OpenPopupInWindow(View::toWindowName("hex.builtin.view.hexeditor.name").c_str(), "hex.builtin.view.hexeditor.menu.file.search"_lang);
return true; return true;
} else if (ctrl && keys['G']) { } else if (ctrl && keys['G']) {
ImGui::OpenPopupInWindow(View::toWindowName("hex.view.hexeditor.name").c_str(), "hex.view.hexeditor.menu.file.goto"_lang); ImGui::OpenPopupInWindow(View::toWindowName("hex.builtin.view.hexeditor.name").c_str(), "hex.builtin.view.hexeditor.menu.file.goto"_lang);
return true; return true;
} else if (ctrl && keys['O']) { } else if (ctrl && keys['O']) {
hex::openFileBrowser("hex.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [](auto path) { hex::openFileBrowser("hex.builtin.view.hexeditor.open_file"_lang, DialogMode::Open, { }, [](auto path) {
EventManager::post<RequestOpenFile>(path); EventManager::post<RequestOpenFile>(path);
}); });
return true; return true;
@@ -705,18 +721,28 @@ namespace hex {
} }
void ViewHexEditor::openFile(const std::string &path) { void ViewHexEditor::openFile(const std::string &path) {
ImHexApi::Provider::add<prv::FileProvider>(path); hex::prv::Provider *provider = nullptr;
auto provider = ImHexApi::Provider::get(); EventManager::post<RequestCreateProvider>("hex.builtin.provider.file", &provider);
if (auto fileProvider = dynamic_cast<prv::FileProvider*>(provider)) {
fileProvider->setPath(path);
if (!fileProvider->open()) {
View::showErrorPopup("hex.builtin.view.hexeditor.error.open"_lang);
ImHexApi::Provider::remove(provider);
return;
}
}
if (!provider->isWritable()) { if (!provider->isWritable()) {
this->m_memoryEditor.ReadOnly = true; this->m_memoryEditor.ReadOnly = true;
View::showErrorPopup("hex.view.hexeditor.error.read_only"_lang); View::showErrorPopup("hex.builtin.view.hexeditor.error.read_only"_lang);
} else { } else {
this->m_memoryEditor.ReadOnly = false; this->m_memoryEditor.ReadOnly = false;
} }
if (!provider->isAvailable()) { if (!provider->isAvailable()) {
View::showErrorPopup("hex.view.hexeditor.error.open"_lang); View::showErrorPopup("hex.builtin.view.hexeditor.error.open"_lang);
ImHexApi::Provider::remove(provider); ImHexApi::Provider::remove(provider);
return; return;
@@ -752,7 +778,7 @@ namespace hex {
size_t copySize = (end - start) + 1; size_t copySize = (end - start) + 1;
std::vector<u8> buffer(copySize, 0x00); std::vector<u8> buffer(copySize, 0x00);
provider->readRelative(start, buffer.data(), buffer.size()); provider->read(start + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), buffer.size());
std::string str; std::string str;
for (const auto &byte : buffer) for (const auto &byte : buffer)
@@ -801,7 +827,7 @@ namespace hex {
} }
// Write bytes // Write bytes
provider->writeRelative(start, buffer.data(), std::min(end - start + 1, buffer.size())); provider->read(start + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), std::min(end - start + 1, buffer.size()));
} }
void ViewHexEditor::copyString() const { void ViewHexEditor::copyString() const {
@@ -814,7 +840,7 @@ namespace hex {
std::string buffer(copySize, 0x00); std::string buffer(copySize, 0x00);
buffer.reserve(copySize + 1); buffer.reserve(copySize + 1);
provider->readRelative(start, buffer.data(), copySize); provider->read(start + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), copySize);
ImGui::SetClipboardText(buffer.c_str()); ImGui::SetClipboardText(buffer.c_str());
} }
@@ -828,7 +854,7 @@ namespace hex {
size_t copySize = (end - start) + 1; size_t copySize = (end - start) + 1;
std::vector<u8> buffer(copySize, 0x00); std::vector<u8> buffer(copySize, 0x00);
provider->readRelative(start, buffer.data(), buffer.size()); provider->read(start + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), buffer.size());
std::string str; std::string str;
switch (language) { switch (language) {
@@ -930,7 +956,7 @@ namespace hex {
size_t copySize = (end - start) + 1; size_t copySize = (end - start) + 1;
std::vector<u8> buffer(copySize, 0x00); std::vector<u8> buffer(copySize, 0x00);
provider->readRelative(start, buffer.data(), buffer.size()); provider->read(start + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), buffer.size());
std::string str = "Hex View 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n\n"; std::string str = "Hex View 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n\n";
@@ -977,7 +1003,7 @@ namespace hex {
size_t copySize = (end - start) + 1; size_t copySize = (end - start) + 1;
std::vector<u8> buffer(copySize, 0x00); std::vector<u8> buffer(copySize, 0x00);
provider->readRelative(start, buffer.data(), buffer.size()); provider->read(start + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), buffer.size());
std::string str = std::string str =
R"( R"(
@@ -1033,7 +1059,7 @@ R"(
ImGui::SetClipboardText(str.c_str()); ImGui::SetClipboardText(str.c_str());
} }
static std::vector<std::pair<u64, u64>> findString(prv::Provider* &provider, std::string string) { static std::vector<std::pair<u64, u64>> findString(hex::prv::Provider* &provider, std::string string) {
std::vector<std::pair<u64, u64>> results; std::vector<std::pair<u64, u64>> results;
u32 foundCharacters = 0; u32 foundCharacters = 0;
@@ -1042,7 +1068,7 @@ R"(
size_t dataSize = provider->getSize(); size_t dataSize = provider->getSize();
for (u64 offset = 0; offset < dataSize; offset += 1024) { for (u64 offset = 0; offset < dataSize; offset += 1024) {
size_t usedBufferSize = std::min(u64(buffer.size()), dataSize - offset); size_t usedBufferSize = std::min(u64(buffer.size()), dataSize - offset);
provider->readRelative(offset, buffer.data(), usedBufferSize); provider->read(offset + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), usedBufferSize);
for (u64 i = 0; i < usedBufferSize; i++) { for (u64 i = 0; i < usedBufferSize; i++) {
if (buffer[i] == string[foundCharacters]) if (buffer[i] == string[foundCharacters])
@@ -1060,7 +1086,7 @@ R"(
return results; return results;
} }
static std::vector<std::pair<u64, u64>> findHex(prv::Provider* &provider, std::string string) { static std::vector<std::pair<u64, u64>> findHex(hex::prv::Provider* &provider, std::string string) {
std::vector<std::pair<u64, u64>> results; std::vector<std::pair<u64, u64>> results;
if ((string.size() % 2) == 1) if ((string.size() % 2) == 1)
@@ -1080,7 +1106,7 @@ R"(
size_t dataSize = provider->getSize(); size_t dataSize = provider->getSize();
for (u64 offset = 0; offset < dataSize; offset += 1024) { for (u64 offset = 0; offset < dataSize; offset += 1024) {
size_t usedBufferSize = std::min(u64(buffer.size()), dataSize - offset); size_t usedBufferSize = std::min(u64(buffer.size()), dataSize - offset);
provider->readRelative(offset, buffer.data(), usedBufferSize); provider->read(offset + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), usedBufferSize);
for (u64 i = 0; i < usedBufferSize; i++) { for (u64 i = 0; i < usedBufferSize; i++) {
if (buffer[i] == hex[foundCharacters]) if (buffer[i] == hex[foundCharacters])
@@ -1147,10 +1173,10 @@ R"(
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin() - ImGui::GetStyle().WindowPadding); ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin() - ImGui::GetStyle().WindowPadding);
if (ImGui::BeginPopup("hex.view.hexeditor.menu.file.search"_lang)) { if (ImGui::BeginPopup("hex.builtin.view.hexeditor.menu.file.search"_lang)) {
if (ImGui::BeginTabBar("searchTabs")) { if (ImGui::BeginTabBar("searchTabs")) {
std::vector<char> *currBuffer = nullptr; std::vector<char> *currBuffer = nullptr;
if (ImGui::BeginTabItem("hex.view.hexeditor.search.string"_lang)) { if (ImGui::BeginTabItem("hex.builtin.view.hexeditor.search.string"_lang)) {
this->m_searchFunction = findString; this->m_searchFunction = findString;
this->m_lastSearchBuffer = &this->m_lastStringSearch; this->m_lastSearchBuffer = &this->m_lastStringSearch;
currBuffer = &this->m_searchStringBuffer; currBuffer = &this->m_searchStringBuffer;
@@ -1160,7 +1186,7 @@ R"(
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("hex.view.hexeditor.search.hex"_lang)) { if (ImGui::BeginTabItem("hex.builtin.view.hexeditor.search.hex"_lang)) {
this->m_searchFunction = findHex; this->m_searchFunction = findHex;
this->m_lastSearchBuffer = &this->m_lastHexSearch; this->m_lastSearchBuffer = &this->m_lastHexSearch;
currBuffer = &this->m_searchHexBuffer; currBuffer = &this->m_searchHexBuffer;
@@ -1172,16 +1198,16 @@ R"(
} }
if (currBuffer != nullptr) { if (currBuffer != nullptr) {
if (ImGui::Button("hex.view.hexeditor.search.find"_lang)) if (ImGui::Button("hex.builtin.view.hexeditor.search.find"_lang))
Find(currBuffer->data()); Find(currBuffer->data());
if (!this->m_lastSearchBuffer->empty()) { if (!this->m_lastSearchBuffer->empty()) {
if ((ImGui::Button("hex.view.hexeditor.search.find_next"_lang))) if ((ImGui::Button("hex.builtin.view.hexeditor.search.find_next"_lang)))
FindNext(); FindNext();
ImGui::SameLine(); ImGui::SameLine();
if ((ImGui::Button("hex.view.hexeditor.search.find_prev"_lang))) if ((ImGui::Button("hex.builtin.view.hexeditor.search.find_prev"_lang)))
FindPrevious(); FindPrevious();
} }
} }
@@ -1199,10 +1225,10 @@ R"(
auto dataSize = provider->getActualSize(); auto dataSize = provider->getActualSize();
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin() - ImGui::GetStyle().WindowPadding); ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin() - ImGui::GetStyle().WindowPadding);
if (ImGui::BeginPopup("hex.view.hexeditor.menu.file.goto"_lang)) { if (ImGui::BeginPopup("hex.builtin.view.hexeditor.menu.file.goto"_lang)) {
if (ImGui::BeginTabBar("gotoTabs")) { if (ImGui::BeginTabBar("gotoTabs")) {
u64 newOffset = 0; u64 newOffset = 0;
if (ImGui::BeginTabItem("hex.view.hexeditor.goto.offset.absolute"_lang)) { if (ImGui::BeginTabItem("hex.builtin.view.hexeditor.goto.offset.absolute"_lang)) {
ImGui::InputScalar("hex", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalar("hex", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
if (this->m_gotoAddress < baseAddress || this->m_gotoAddress > baseAddress + dataSize) if (this->m_gotoAddress < baseAddress || this->m_gotoAddress > baseAddress + dataSize)
@@ -1212,7 +1238,7 @@ R"(
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("hex.view.hexeditor.goto.offset.begin"_lang)) { if (ImGui::BeginTabItem("hex.builtin.view.hexeditor.goto.offset.begin"_lang)) {
ImGui::InputScalar("hex", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalar("hex", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
if (this->m_gotoAddress < 0 || this->m_gotoAddress > dataSize) if (this->m_gotoAddress < 0 || this->m_gotoAddress > dataSize)
@@ -1222,7 +1248,7 @@ R"(
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("hex.view.hexeditor.goto.offset.current"_lang)) { if (ImGui::BeginTabItem("hex.builtin.view.hexeditor.goto.offset.current"_lang)) {
ImGui::InputScalar("dec", ImGuiDataType_S64, &this->m_gotoAddress, nullptr, nullptr, "%lld", ImGuiInputTextFlags_CharsDecimal); ImGui::InputScalar("dec", ImGuiDataType_S64, &this->m_gotoAddress, nullptr, nullptr, "%lld", ImGuiInputTextFlags_CharsDecimal);
s64 currSelectionOffset = std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd); s64 currSelectionOffset = std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd);
@@ -1236,7 +1262,7 @@ R"(
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("hex.view.hexeditor.goto.offset.end"_lang)) { if (ImGui::BeginTabItem("hex.builtin.view.hexeditor.goto.offset.end"_lang)) {
ImGui::InputScalar("hex", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalar("hex", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
if (this->m_gotoAddress < 0 || this->m_gotoAddress > dataSize) if (this->m_gotoAddress < 0 || this->m_gotoAddress > dataSize)
@@ -1247,8 +1273,8 @@ R"(
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::Button("hex.view.hexeditor.menu.file.goto"_lang)) { if (ImGui::Button("hex.builtin.view.hexeditor.menu.file.goto"_lang)) {
provider->setCurrentPage(std::floor(double(newOffset - baseAddress) / prv::Provider::PageSize)); provider->setCurrentPage(std::floor(double(newOffset - baseAddress) / hex::prv::Provider::PageSize));
EventManager::post<RequestSelectionChange>(Region { newOffset, 1 }); EventManager::post<RequestSelectionChange>(Region { newOffset, 1 });
} }
@@ -1262,58 +1288,58 @@ R"(
void ViewHexEditor::drawEditPopup() { void ViewHexEditor::drawEditPopup() {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
bool providerValid = ImHexApi::Provider::isValid(); bool providerValid = ImHexApi::Provider::isValid();
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.undo"_lang, "CTRL + Z", false, providerValid)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.undo"_lang, "CTRL + Z", false, providerValid))
provider->undo(); provider->undo();
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.redo"_lang, "CTRL + Y", false, providerValid)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.redo"_lang, "CTRL + Y", false, providerValid))
provider->redo(); provider->redo();
ImGui::Separator(); ImGui::Separator();
bool bytesSelected = this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1; bool bytesSelected = this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1;
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.copy"_lang, "CTRL + C", false, bytesSelected)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.copy"_lang, "CTRL + C", false, bytesSelected))
this->copyBytes(); this->copyBytes();
if (ImGui::BeginMenu("hex.view.hexeditor.menu.edit.copy_as"_lang, bytesSelected)) { if (ImGui::BeginMenu("hex.builtin.view.hexeditor.menu.edit.copy_as"_lang, bytesSelected)) {
if (ImGui::MenuItem("hex.view.hexeditor.copy.hex"_lang, "CTRL + SHIFT + C")) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.hex"_lang, "CTRL + SHIFT + C"))
this->copyString(); this->copyString();
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("hex.view.hexeditor.copy.c"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.c"_lang))
this->copyLanguageArray(Language::C); this->copyLanguageArray(Language::C);
if (ImGui::MenuItem("hex.view.hexeditor.copy.cpp"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.cpp"_lang))
this->copyLanguageArray(Language::Cpp); this->copyLanguageArray(Language::Cpp);
if (ImGui::MenuItem("hex.view.hexeditor.copy.csharp"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.csharp"_lang))
this->copyLanguageArray(Language::CSharp); this->copyLanguageArray(Language::CSharp);
if (ImGui::MenuItem("hex.view.hexeditor.copy.rust"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.rust"_lang))
this->copyLanguageArray(Language::Rust); this->copyLanguageArray(Language::Rust);
if (ImGui::MenuItem("hex.view.hexeditor.copy.python"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.python"_lang))
this->copyLanguageArray(Language::Python); this->copyLanguageArray(Language::Python);
if (ImGui::MenuItem("hex.view.hexeditor.copy.java"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.java"_lang))
this->copyLanguageArray(Language::Java); this->copyLanguageArray(Language::Java);
if (ImGui::MenuItem("hex.view.hexeditor.copy.js"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.js"_lang))
this->copyLanguageArray(Language::JavaScript); this->copyLanguageArray(Language::JavaScript);
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("hex.view.hexeditor.copy.ascii"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.ascii"_lang))
this->copyHexView(); this->copyHexView();
if (ImGui::MenuItem("hex.view.hexeditor.copy.html"_lang)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.copy.html"_lang))
this->copyHexViewHTML(); this->copyHexViewHTML();
ImGui::EndMenu(); ImGui::EndMenu();
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.paste"_lang, "CTRL + V", false, bytesSelected)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.paste"_lang, "CTRL + V", false, bytesSelected))
this->pasteBytes(); this->pasteBytes();
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.select_all"_lang, "CTRL + A", false, providerValid)) if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.select_all"_lang, "CTRL + A", false, providerValid))
EventManager::post<RequestSelectionChange>(Region { provider->getBaseAddress(), provider->getActualSize() }); EventManager::post<RequestSelectionChange>(Region { provider->getBaseAddress(), provider->getActualSize() });
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.bookmark"_lang, nullptr, false, this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.bookmark"_lang, nullptr, false, this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) {
auto base = ImHexApi::Provider::get()->getBaseAddress(); auto base = ImHexApi::Provider::get()->getBaseAddress();
size_t start = base + std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd); size_t start = base + std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd);
@@ -1322,15 +1348,15 @@ R"(
ImHexApi::Bookmarks::add(start, end - start + 1, { }, { }); ImHexApi::Bookmarks::add(start, end - start + 1, { }, { });
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.set_base"_lang, nullptr, false, providerValid && provider->isReadable())) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.set_base"_lang, nullptr, false, providerValid && provider->isReadable())) {
std::memset(this->m_baseAddressBuffer, 0x00, sizeof(this->m_baseAddressBuffer)); std::memset(this->m_baseAddressBuffer, 0x00, sizeof(this->m_baseAddressBuffer));
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.menu.edit.set_base"_lang); }); View::doLater([]{ ImGui::OpenPopup("hex.builtin.view.hexeditor.menu.edit.set_base"_lang); });
} }
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.resize"_lang, nullptr, false, providerValid && provider->isResizable())) { if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.edit.resize"_lang, nullptr, false, providerValid && provider->isResizable())) {
View::doLater([this]{ View::doLater([this]{
this->m_resizeSize = ImHexApi::Provider::get()->getActualSize(); this->m_resizeSize = ImHexApi::Provider::get()->getActualSize();
ImGui::OpenPopup("hex.view.hexeditor.menu.edit.resize"_lang); ImGui::OpenPopup("hex.builtin.view.hexeditor.menu.edit.resize"_lang);
}); });
} }
} }

View File

@@ -1,4 +1,4 @@
#include "views/view_information.hpp" #include "content/views/view_information.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/paths.hpp> #include <hex/helpers/paths.hpp>
@@ -18,11 +18,11 @@
#include <imgui_imhex_extensions.h> #include <imgui_imhex_extensions.h>
#include <implot.h> #include <implot.h>
namespace hex { namespace hex::plugin::builtin {
using namespace hex::literals; using namespace hex::literals;
ViewInformation::ViewInformation() : View("hex.view.information.name") { ViewInformation::ViewInformation() : View("hex.builtin.view.information.name") {
EventManager::subscribe<EventDataChanged>(this, [this]() { EventManager::subscribe<EventDataChanged>(this, [this]() {
this->m_dataValid = false; this->m_dataValid = false;
this->m_highestBlockEntropy = 0; this->m_highestBlockEntropy = 0;
@@ -39,30 +39,30 @@ namespace hex {
if (this->m_blockSize != 0) if (this->m_blockSize != 0)
this->m_entropyHandlePosition = region.address / this->m_blockSize; this->m_entropyHandlePosition = region.address / this->m_blockSize;
}); });
EventManager::subscribe<EventFileUnloaded>(this, [this]{
this->m_dataValid = false;
});
} }
ViewInformation::~ViewInformation() { ViewInformation::~ViewInformation() {
EventManager::unsubscribe<EventDataChanged>(this); EventManager::unsubscribe<EventDataChanged>(this);
EventManager::unsubscribe<EventRegionSelected>(this); EventManager::unsubscribe<EventRegionSelected>(this);
EventManager::unsubscribe<EventFileUnloaded>(this);
} }
static float calculateEntropy(std::array<ImU64, 256> &valueCounts, size_t numBytes) { static float calculateEntropy(std::array<ImU64, 256> &valueCounts, size_t blockSize) {
float entropy = 0; float entropy = 0;
if (numBytes == 0) for (auto count : valueCounts) {
return 0.0F; if (count == 0) continue;
std::array<float, 256> floatValueCounts{ 0 }; float probability = static_cast<float>(count) / blockSize;
std::copy(valueCounts.begin(), valueCounts.end(), floatValueCounts.begin());
for (u16 i = 0; i < 256; i++) { entropy += probability * std::log2(probability);
floatValueCounts[i] /= float(numBytes);
if (floatValueCounts[i] > 0)
entropy -= (floatValueCounts[i] * std::log2(floatValueCounts[i]));
} }
return entropy / 8; return (-entropy) / 8; // log2(256) = 8
} }
void ViewInformation::analyze() { void ViewInformation::analyze() {
@@ -82,13 +82,16 @@ namespace hex {
for (u64 i = 0; i < provider->getSize(); i += this->m_blockSize) { for (u64 i = 0; i < provider->getSize(); i += this->m_blockSize) {
std::array<ImU64, 256> blockValueCounts = { 0 }; std::array<ImU64, 256> blockValueCounts = { 0 };
provider->readRelative(i, buffer.data(), std::min(u64(this->m_blockSize), provider->getSize() - i)); provider->read(i + provider->getBaseAddress(), buffer.data(), std::min(u64(this->m_blockSize), provider->getSize() - i));
for (size_t j = 0; j < this->m_blockSize; j++) { for (size_t j = 0; j < this->m_blockSize; j++) {
blockValueCounts[buffer[j]]++; blockValueCounts[buffer[j]]++;
this->m_valueCounts[buffer[j]]++; this->m_valueCounts[buffer[j]]++;
} }
this->m_blockEntropy.push_back(calculateEntropy(blockValueCounts, this->m_blockSize)); this->m_blockEntropy.push_back(calculateEntropy(blockValueCounts, this->m_blockSize));
this->m_bytesAnalyzed = i;
} }
this->m_averageEntropy = calculateEntropy(this->m_valueCounts, provider->getSize()); this->m_averageEntropy = calculateEntropy(this->m_valueCounts, provider->getSize());
@@ -96,6 +99,8 @@ namespace hex {
} }
{ {
magic::compile();
this->m_fileDescription = magic::getDescription(provider); this->m_fileDescription = magic::getDescription(provider);
this->m_mimeType = magic::getMIMEType(provider); this->m_mimeType = magic::getMIMEType(provider);
this->m_dataValid = true; this->m_dataValid = true;
@@ -106,64 +111,67 @@ namespace hex {
} }
void ViewInformation::drawContent() { void ViewInformation::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.information.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.information.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
if (ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav)) { if (ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav)) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImHexApi::Provider::isValid() && provider->isReadable()) { if (ImHexApi::Provider::isValid() && provider->isReadable()) {
ImGui::TextUnformatted("hex.view.information.control"_lang); ImGui::TextUnformatted("hex.builtin.view.information.control"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::Disabled([this] { ImGui::Disabled([this] {
if (ImGui::Button("hex.view.information.analyze"_lang)) if (ImGui::Button("hex.builtin.view.information.analyze"_lang))
this->analyze(); this->analyze();
}, this->m_analyzing); }, this->m_analyzing);
if (this->m_analyzing) { if (this->m_analyzing) {
ImGui::SameLine(); ImGui::TextSpinner("hex.builtin.view.information.analyzing"_lang);
ImGui::TextSpinner("hex.view.information.analyzing"_lang); ImGui::ProgressBar(this->m_bytesAnalyzed / static_cast<double>(provider->getSize()));
} else {
ImGui::NewLine();
ImGui::NewLine();
}
ImGui::NewLine();
ImGui::TextUnformatted("hex.builtin.view.information.region"_lang);
ImGui::Separator();
for (auto &[name, value] : provider->getDataInformation()) {
ImGui::LabelText(name.c_str(), "%s", value.c_str());
} }
if (this->m_dataValid) { if (this->m_dataValid) {
ImGui::NewLine(); ImGui::LabelText("hex.builtin.view.information.region"_lang, "0x%llx - 0x%llx", this->m_analyzedRegion.first, this->m_analyzedRegion.second);
ImGui::TextUnformatted("hex.view.information.region"_lang);
ImGui::Separator();
for (auto &[name, value] : provider->getDataInformation()) {
ImGui::LabelText(name.c_str(), "%s", value.c_str());
}
ImGui::LabelText("hex.view.information.region"_lang, "0x%llx - 0x%llx", this->m_analyzedRegion.first, this->m_analyzedRegion.second);
ImGui::NewLine(); ImGui::NewLine();
if (!this->m_fileDescription.empty() || !this->m_mimeType.empty()) { if (!this->m_fileDescription.empty() || !this->m_mimeType.empty()) {
ImGui::TextUnformatted("hex.view.information.magic"_lang); ImGui::TextUnformatted("hex.builtin.view.information.magic"_lang);
ImGui::Separator(); ImGui::Separator();
} }
if (!this->m_fileDescription.empty()) { if (!this->m_fileDescription.empty()) {
ImGui::TextUnformatted("hex.view.information.description"_lang); ImGui::TextUnformatted("hex.builtin.view.information.description"_lang);
ImGui::TextWrapped("%s", this->m_fileDescription.c_str()); ImGui::TextWrapped("%s", this->m_fileDescription.c_str());
ImGui::NewLine(); ImGui::NewLine();
} }
if (!this->m_mimeType.empty()) { if (!this->m_mimeType.empty()) {
ImGui::TextUnformatted("hex.view.information.mime"_lang); ImGui::TextUnformatted("hex.builtin.view.information.mime"_lang);
ImGui::TextWrapped("%s", this->m_mimeType.c_str()); ImGui::TextWrapped("%s", this->m_mimeType.c_str());
ImGui::NewLine(); ImGui::NewLine();
} }
ImGui::TextUnformatted("hex.view.information.info_analysis"_lang); ImGui::TextUnformatted("hex.builtin.view.information.info_analysis"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGui::GetColorU32(ImGuiCol_WindowBg)); ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGui::GetColorU32(ImGuiCol_WindowBg));
ImGui::TextUnformatted("hex.view.information.distribution"_lang); ImGui::TextUnformatted("hex.builtin.view.information.distribution"_lang);
ImPlot::SetNextPlotLimits(0, 256, 0, float(*std::max_element(this->m_valueCounts.begin(), this->m_valueCounts.end())) * 1.1F, ImGuiCond_Always); ImPlot::SetNextPlotLimits(0, 256, 0.5, float(*std::max_element(this->m_valueCounts.begin(), this->m_valueCounts.end())) * 1.1F, ImGuiCond_Always);
if (ImPlot::BeginPlot("##distribution", "Address", "Count", ImVec2(-1,0), ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect, ImPlotAxisFlags_Lock, ImPlotAxisFlags_Lock)) { if (ImPlot::BeginPlot("##distribution", "Address", "Count", ImVec2(-1,0), ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect, ImPlotAxisFlags_Lock, ImPlotAxisFlags_Lock | ImPlotAxisFlags_LogScale)) {
static auto x = []{ static auto x = []{
std::array<ImU64, 256> result{ 0 }; std::array<ImU64, 256> result{ 0 };
std::iota(result.begin(), result.end(), 0); std::iota(result.begin(), result.end(), 0);
@@ -178,10 +186,10 @@ namespace hex {
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.information.entropy"_lang); ImGui::TextUnformatted("hex.builtin.view.information.entropy"_lang);
ImPlot::SetNextPlotLimits(0, this->m_blockEntropy.size(), -0.1, 1.1, ImGuiCond_Always); ImPlot::SetNextPlotLimits(0, this->m_blockEntropy.size(), -0.1, 1.1, ImGuiCond_Always);
if (ImPlot::BeginPlot("##entropy", "Address", "Entropy", ImVec2(-1,0), ImPlotFlags_CanvasOnly, ImPlotAxisFlags_Lock | ImPlotAxisFlags_NoTickLabels, ImPlotAxisFlags_Lock)) { if (ImPlot::BeginPlot("##entropy", "Address", "Entropy", ImVec2(-1,0), ImPlotFlags_CanvasOnly | ImPlotFlags_AntiAliased, ImPlotAxisFlags_Lock | ImPlotAxisFlags_NoTickLabels, ImPlotAxisFlags_Lock)) {
ImPlot::PlotLine("##entropy_line", this->m_blockEntropy.data(), this->m_blockEntropy.size()); ImPlot::PlotLine("##entropy_line", this->m_blockEntropy.data(), this->m_blockEntropy.size());
if (ImPlot::DragLineX("Position", &this->m_entropyHandlePosition, false)) { if (ImPlot::DragLineX("Position", &this->m_entropyHandlePosition, false)) {
@@ -197,13 +205,13 @@ namespace hex {
ImGui::NewLine(); ImGui::NewLine();
ImGui::LabelText("hex.view.information.block_size"_lang, "%s", hex::format("hex.view.information.block_size.desc"_lang, this->m_blockEntropy.size(), this->m_blockSize).c_str()); ImGui::LabelText("hex.builtin.view.information.block_size"_lang, "%s", hex::format("hex.builtin.view.information.block_size.desc"_lang, this->m_blockEntropy.size(), this->m_blockSize).c_str());
ImGui::LabelText("hex.view.information.file_entropy"_lang, "%.8f", this->m_averageEntropy); ImGui::LabelText("hex.builtin.view.information.file_entropy"_lang, "%.8f", this->m_averageEntropy);
ImGui::LabelText("hex.view.information.highest_entropy"_lang, "%.8f", this->m_highestBlockEntropy); ImGui::LabelText("hex.builtin.view.information.highest_entropy"_lang, "%.8f", this->m_highestBlockEntropy);
if (this->m_averageEntropy > 0.83 && this->m_highestBlockEntropy > 0.9) { if (this->m_averageEntropy > 0.83 && this->m_highestBlockEntropy > 0.9) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "%s", static_cast<const char*>("hex.view.information.encrypted"_lang)); ImGui::TextColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "%s", static_cast<const char*>("hex.builtin.view.information.encrypted"_lang));
} }
} }

View File

@@ -1,16 +1,16 @@
#include "views/view_patches.hpp" #include "content/views/view_patches.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include "helpers/project_file_handler.hpp" #include <hex/helpers/project_file_handler.hpp>
#include <string> #include <string>
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
namespace hex { namespace hex::plugin::builtin {
ViewPatches::ViewPatches() : View("hex.view.patches.name") { ViewPatches::ViewPatches() : View("hex.builtin.view.patches.name") {
EventManager::subscribe<EventProjectFileStore>(this, []{ EventManager::subscribe<EventProjectFileStore>(this, []{
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImHexApi::Provider::isValid()) if (ImHexApi::Provider::isValid())
@@ -30,7 +30,7 @@ namespace hex {
} }
void ViewPatches::drawContent() { void ViewPatches::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.patches.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.patches.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImHexApi::Provider::isValid() && provider->isReadable()) { if (ImHexApi::Provider::isValid() && provider->isReadable()) {
@@ -38,9 +38,9 @@ namespace hex {
if (ImGui::BeginTable("##patchesTable", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | if (ImGui::BeginTable("##patchesTable", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable |
ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.patches.offset"_lang); ImGui::TableSetupColumn("hex.builtin.view.patches.offset"_lang);
ImGui::TableSetupColumn("hex.view.patches.orig"_lang); ImGui::TableSetupColumn("hex.builtin.view.patches.orig"_lang);
ImGui::TableSetupColumn("hex.view.patches.patch"_lang); ImGui::TableSetupColumn("hex.builtin.view.patches.patch"_lang);
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
@@ -71,7 +71,7 @@ namespace hex {
} }
if (ImGui::BeginPopup("PatchContextMenu")) { if (ImGui::BeginPopup("PatchContextMenu")) {
if (ImGui::MenuItem("hex.view.patches.remove"_lang)) { if (ImGui::MenuItem("hex.builtin.view.patches.remove"_lang)) {
patches.erase(this->m_selectedPatch); patches.erase(this->m_selectedPatch);
ProjectFile::markDirty(); ProjectFile::markDirty();
} }

View File

@@ -1,11 +1,11 @@
#include "views/view_pattern_data.hpp" #include "content/views/view_pattern_data.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/pattern_language/pattern_data.hpp> #include <hex/pattern_language/pattern_data.hpp>
namespace hex { namespace hex::plugin::builtin {
ViewPatternData::ViewPatternData() : View("hex.view.pattern_data.name") { ViewPatternData::ViewPatternData() : View("hex.builtin.view.pattern_data.name") {
EventManager::subscribe<EventPatternChanged>(this, [this]() { EventManager::subscribe<EventPatternChanged>(this, [this]() {
this->m_sortedPatternData.clear(); this->m_sortedPatternData.clear();
@@ -19,12 +19,12 @@ namespace hex {
static bool beginPatternDataTable(prv::Provider* &provider, const std::vector<pl::PatternData*> &patterns, std::vector<pl::PatternData*> &sortedPatterns) { static bool beginPatternDataTable(prv::Provider* &provider, const std::vector<pl::PatternData*> &patterns, std::vector<pl::PatternData*> &sortedPatterns) {
if (ImGui::BeginTable("##patterndatatable", 6, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { if (ImGui::BeginTable("##patterndatatable", 6, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.pattern_data.var_name"_lang, 0, -1, ImGui::GetID("name")); ImGui::TableSetupColumn("hex.builtin.view.pattern_data.var_name"_lang, 0, -1, ImGui::GetID("name"));
ImGui::TableSetupColumn("hex.view.pattern_data.color"_lang, 0, -1, ImGui::GetID("color")); ImGui::TableSetupColumn("hex.builtin.view.pattern_data.color"_lang, 0, -1, ImGui::GetID("color"));
ImGui::TableSetupColumn("hex.view.pattern_data.offset"_lang, 0, -1, ImGui::GetID("offset")); ImGui::TableSetupColumn("hex.builtin.view.pattern_data.offset"_lang, 0, -1, ImGui::GetID("offset"));
ImGui::TableSetupColumn("hex.view.pattern_data.size"_lang, 0, -1, ImGui::GetID("size")); ImGui::TableSetupColumn("hex.builtin.view.pattern_data.size"_lang, 0, -1, ImGui::GetID("size"));
ImGui::TableSetupColumn("hex.view.pattern_data.type"_lang, 0, -1, ImGui::GetID("type")); ImGui::TableSetupColumn("hex.builtin.view.pattern_data.type"_lang, 0, -1, ImGui::GetID("type"));
ImGui::TableSetupColumn("hex.view.pattern_data.value"_lang, 0, -1, ImGui::GetID("value")); ImGui::TableSetupColumn("hex.builtin.view.pattern_data.value"_lang, 0, -1, ImGui::GetID("value"));
auto sortSpecs = ImGui::TableGetSortSpecs(); auto sortSpecs = ImGui::TableGetSortSpecs();
@@ -48,7 +48,7 @@ namespace hex {
} }
void ViewPatternData::drawContent() { void ViewPatternData::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.pattern_data.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.pattern_data.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImHexApi::Provider::isValid() && provider->isReadable()) { if (ImHexApi::Provider::isValid() && provider->isReadable()) {

View File

@@ -1,6 +1,6 @@
#include "views/view_pattern_editor.hpp" #include "content/views/view_pattern_editor.hpp"
#include "helpers/project_file_handler.hpp" #include <hex/helpers/project_file_handler.hpp>
#include <hex/pattern_language/preprocessor.hpp> #include <hex/pattern_language/preprocessor.hpp>
#include <hex/pattern_language/pattern_data.hpp> #include <hex/pattern_language/pattern_data.hpp>
#include <hex/helpers/paths.hpp> #include <hex/helpers/paths.hpp>
@@ -14,7 +14,7 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace hex { namespace hex::plugin::builtin {
using namespace hex::literals; using namespace hex::literals;
namespace fs = std::filesystem; namespace fs = std::filesystem;
@@ -82,12 +82,14 @@ namespace hex {
} }
ViewPatternEditor::ViewPatternEditor() : View("hex.view.pattern.name") { ViewPatternEditor::ViewPatternEditor() : View("hex.builtin.view.pattern_editor.name") {
this->m_patternLanguageRuntime = new pl::PatternLanguage(); this->m_patternLanguageRuntime = new pl::PatternLanguage();
this->m_textEditor.SetLanguageDefinition(PatternLanguage()); this->m_textEditor.SetLanguageDefinition(PatternLanguage());
this->m_textEditor.SetShowWhitespaces(false); this->m_textEditor.SetShowWhitespaces(false);
this->m_envVarEntries = { { "", s128(0), EnvVarType::Integer } };
EventManager::subscribe<EventProjectFileStore>(this, [this]() { EventManager::subscribe<EventProjectFileStore>(this, [this]() {
ProjectFile::setPattern(this->m_textEditor.GetText()); ProjectFile::setPattern(this->m_textEditor.GetText());
}); });
@@ -147,11 +149,16 @@ namespace hex {
if (!this->m_possiblePatternFiles.empty()) { if (!this->m_possiblePatternFiles.empty()) {
this->m_selectedPatternFile = 0; this->m_selectedPatternFile = 0;
EventManager::post<RequestOpenPopup>("hex.view.pattern.accept_pattern"_lang); EventManager::post<RequestOpenPopup>("hex.builtin.view.pattern_editor.accept_pattern"_lang);
this->m_acceptPatternWindowOpen = true; this->m_acceptPatternWindowOpen = true;
} }
}); });
EventManager::subscribe<EventFileUnloaded>(this, [this]{
this->m_textEditor.SetText("");
this->m_patternLanguageRuntime->abort();
});
/* Settings */ /* Settings */
{ {
@@ -181,11 +188,15 @@ namespace hex {
EventManager::unsubscribe<RequestSetPatternLanguageCode>(this); EventManager::unsubscribe<RequestSetPatternLanguageCode>(this);
EventManager::unsubscribe<EventFileLoaded>(this); EventManager::unsubscribe<EventFileLoaded>(this);
EventManager::unsubscribe<RequestChangeTheme>(this); EventManager::unsubscribe<RequestChangeTheme>(this);
EventManager::unsubscribe<EventFileUnloaded>(this);
} }
void ViewPatternEditor::drawMenu() { void ViewPatternEditor::drawMenu() {
if (ImGui::BeginMenu("hex.menu.file"_lang)) { if (ImGui::BeginMenu("hex.menu.file"_lang)) {
if (ImGui::MenuItem("hex.view.pattern.menu.file.load_pattern"_lang)) {
ImGui::Separator();
if (ImGui::MenuItem("hex.builtin.view.pattern_editor.menu.file.load_pattern"_lang)) {
this->m_selectedPatternFile = 0; this->m_selectedPatternFile = 0;
this->m_possiblePatternFiles.clear(); this->m_possiblePatternFiles.clear();
@@ -200,21 +211,30 @@ namespace hex {
} }
} }
View::doLater([]{ ImGui::OpenPopup("hex.view.pattern.menu.file.load_pattern"_lang); }); View::doLater([]{ ImGui::OpenPopup("hex.builtin.view.pattern_editor.menu.file.load_pattern"_lang); });
} }
if (ImGui::MenuItem("hex.builtin.view.pattern_editor.menu.file.save_pattern"_lang)) {
hex::openFileBrowser("hex.builtin.view.pattern_editor.menu.file.save_pattern"_lang, DialogMode::Save, { { "Pattern", "hexpat" }}, [this](const std::string &path) {
File file(path, File::Mode::Create);
file.write(this->m_textEditor.GetText());
});
}
ImGui::EndMenu(); ImGui::EndMenu();
} }
} }
void ViewPatternEditor::drawContent() { void ViewPatternEditor::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.pattern.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_None | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.pattern_editor.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_None | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImHexApi::Provider::isValid() && provider->isAvailable()) { if (ImHexApi::Provider::isValid() && provider->isAvailable()) {
auto textEditorSize = ImGui::GetContentRegionAvail(); auto textEditorSize = ImGui::GetContentRegionAvail();
textEditorSize.y *= 4.0/5.0; textEditorSize.y *= 4.0/5.0;
textEditorSize.y -= ImGui::GetTextLineHeightWithSpacing(); textEditorSize.y -= ImGui::GetTextLineHeightWithSpacing();
this->m_textEditor.Render("hex.view.pattern.name"_lang, textEditorSize, true); this->m_textEditor.Render("hex.builtin.view.pattern_editor.name"_lang, textEditorSize, true);
auto consoleSize = ImGui::GetContentRegionAvail(); auto consoleSize = ImGui::GetContentRegionAvail();
consoleSize.y -= ImGui::GetTextLineHeightWithSpacing(); consoleSize.y -= ImGui::GetTextLineHeightWithSpacing();
@@ -262,9 +282,9 @@ namespace hex {
ImGui::SameLine(); ImGui::SameLine();
if (this->m_evaluatorRunning) if (this->m_evaluatorRunning)
ImGui::TextSpinner("hex.view.pattern.evaluating"_lang); ImGui::TextSpinner("hex.builtin.view.pattern_editor.evaluating"_lang);
else { else {
if (ImGui::Checkbox("hex.view.pattern.auto"_lang, &this->m_runAutomatically)) { if (ImGui::Checkbox("hex.builtin.view.pattern_editor.auto"_lang, &this->m_runAutomatically)) {
if (this->m_runAutomatically) if (this->m_runAutomatically)
this->m_hasUnevaluatedChanges = true; this->m_hasUnevaluatedChanges = true;
} }
@@ -278,6 +298,71 @@ namespace hex {
this->m_patternLanguageRuntime->getMaximumPatternCount() this->m_patternLanguageRuntime->getMaximumPatternCount()
).c_str() ).c_str()
); );
ImGui::SameLine();
if (ImGui::IconButton(ICON_VS_GLOBE, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
ImGui::OpenPopup("env_vars");
if (ImGui::BeginPopup("env_vars")) {
ImGui::TextUnformatted("hex.builtin.view.pattern_editor.env_vars"_lang);
ImGui::SameLine();
if (ImGui::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) this->m_envVarEntries.push_back({ "", s128(0), EnvVarType::Integer });
ImGui::Separator();
int index = 0;
for (auto &[name, value, type] : this->m_envVarEntries) {
ImGui::PushID(index++);
ImGui::PushItemWidth(ImGui::GetTextLineHeightWithSpacing() * 2);
constexpr const char* Types[] = { "I", "F", "S", "B" };
if (ImGui::BeginCombo("", Types[static_cast<int>(type)])) {
for (auto i = 0; i < IM_ARRAYSIZE(Types); i++) {
if (ImGui::Selectable(Types[i]))
type = static_cast<EnvVarType>(i);
}
ImGui::EndCombo();
}
ImGui::PopItemWidth();
ImGui::SameLine();
ImGui::InputText("###name", name.data(), name.capacity(), ImGuiInputTextFlags_CallbackResize, ImGui::UpdateStringSizeCallback, &name);
ImGui::SameLine();
switch (type) {
case EnvVarType::Integer: {
s64 displayValue = hex::get_or<s128>(value, 0);
ImGui::InputScalar("###value", ImGuiDataType_S64, &displayValue);
value = s128(displayValue);
break;
}
case EnvVarType::Float: {
auto displayValue = hex::get_or<double>(value, 0.0);
ImGui::InputDouble("###value", &displayValue);
value = displayValue;
break;
}
case EnvVarType::Bool: {
auto displayValue = hex::get_or<bool>(value, false);
ImGui::Checkbox("###value", &displayValue);
value = displayValue;
break;
}
case EnvVarType::String: {
auto displayValue = hex::get_or<std::string>(value, "");
ImGui::InputText("###value", displayValue.data(), displayValue.capacity(), ImGuiInputTextFlags_CallbackResize, ImGui::UpdateStringSizeCallback, &displayValue);
value = displayValue;
break;
}
}
ImGui::PopID();
}
ImGui::EndPopup();
}
} }
if (this->m_textEditor.IsTextChanged()) { if (this->m_textEditor.IsTextChanged()) {
@@ -299,8 +384,8 @@ namespace hex {
} }
void ViewPatternEditor::drawAlwaysVisible() { void ViewPatternEditor::drawAlwaysVisible() {
if (ImGui::BeginPopupModal("hex.view.pattern.accept_pattern"_lang, &this->m_acceptPatternWindowOpen, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal("hex.builtin.view.pattern_editor.accept_pattern"_lang, &this->m_acceptPatternWindowOpen, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::TextWrapped("%s", static_cast<const char *>("hex.view.pattern.accept_pattern.desc"_lang)); ImGui::TextWrapped("%s", static_cast<const char *>("hex.builtin.view.pattern_editor.accept_pattern.desc"_lang));
std::vector<std::string> entries; std::vector<std::string> entries;
entries.resize(this->m_possiblePatternFiles.size()); entries.resize(this->m_possiblePatternFiles.size());
@@ -322,7 +407,7 @@ namespace hex {
} }
ImGui::NewLine(); ImGui::NewLine();
ImGui::Text("%s", static_cast<const char *>("hex.view.pattern.accept_pattern.question"_lang)); ImGui::Text("%s", static_cast<const char *>("hex.builtin.view.pattern_editor.accept_pattern.question"_lang));
confirmButtons("hex.common.yes"_lang, "hex.common.no"_lang, [this]{ confirmButtons("hex.common.yes"_lang, "hex.common.no"_lang, [this]{
this->loadPatternFile(this->m_possiblePatternFiles[this->m_selectedPatternFile].string()); this->loadPatternFile(this->m_possiblePatternFiles[this->m_selectedPatternFile].string());
@@ -338,7 +423,7 @@ namespace hex {
} }
bool opened = true; bool opened = true;
if (ImGui::BeginPopupModal("hex.view.pattern.menu.file.load_pattern"_lang, &opened, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal("hex.builtin.view.pattern_editor.menu.file.load_pattern"_lang, &opened, ImGuiWindowFlags_AlwaysAutoResize)) {
if (ImGui::BeginListBox("##patterns", ImVec2(-FLT_MIN, 0))) { if (ImGui::BeginListBox("##patterns", ImVec2(-FLT_MIN, 0))) {
@@ -360,7 +445,7 @@ namespace hex {
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("hex.common.browse"_lang)) { if (ImGui::Button("hex.common.browse"_lang)) {
hex::openFileBrowser("hex.view.pattern.open_pattern"_lang, DialogMode::Open, { { "Pattern File", "hexpat" } }, [this](auto path) { hex::openFileBrowser("hex.builtin.view.pattern_editor.open_pattern"_lang, DialogMode::Open, { { "Pattern File", "hexpat" } }, [this](auto path) {
this->loadPatternFile(path); this->loadPatternFile(path);
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
}); });
@@ -412,7 +497,11 @@ namespace hex {
EventManager::post<EventPatternChanged>(); EventManager::post<EventPatternChanged>();
std::thread([this, buffer = std::string(buffer)] { std::thread([this, buffer = std::string(buffer)] {
auto result = this->m_patternLanguageRuntime->executeString(ImHexApi::Provider::get(), buffer); std::map<std::string, pl::Token::Literal> envVars;
for (const auto &[name, value, type] : this->m_envVarEntries)
envVars.insert({ name, value });
auto result = this->m_patternLanguageRuntime->executeString(ImHexApi::Provider::get(), buffer, envVars);
auto error = this->m_patternLanguageRuntime->getError(); auto error = this->m_patternLanguageRuntime->getError();
if (error.has_value()) { if (error.has_value()) {

View File

@@ -0,0 +1,65 @@
#include "content/views/view_provider_settings.hpp"
namespace hex::plugin::builtin {
ViewProviderSettings::ViewProviderSettings() : hex::View("hex.builtin.view.provider_settings.name") {
EventManager::subscribe<EventProviderCreated>(this, [](hex::prv::Provider *provider){
if (provider->hasLoadInterface())
EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup"));
});
}
ViewProviderSettings::~ViewProviderSettings() {
EventManager::unsubscribe<EventProviderCreated>(this);
}
void ViewProviderSettings::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.builtin.view.provider_settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
auto provider = hex::ImHexApi::Provider::get();
if (provider != nullptr)
provider->drawInterface();
}
ImGui::End();
}
void ViewProviderSettings::drawAlwaysVisible() {
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F));
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.provider_settings.load_popup").c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
auto provider = hex::ImHexApi::Provider::get();
if (provider != nullptr) {
provider->drawLoadInterface();
ImGui::NewLine();
ImGui::Separator();
if (ImGui::Button("hex.common.open"_lang)) {
if (provider->open())
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();
if (ImGui::Button("hex.common.cancel"_lang)) {
ImHexApi::Provider::remove(provider);
ImGui::CloseCurrentPopup();
}
}
ImGui::EndPopup();
}
}
bool ViewProviderSettings::hasViewMenuItemEntry() {
return this->isAvailable();
}
bool ViewProviderSettings::isAvailable() {
auto provider = hex::ImHexApi::Provider::get();
return provider != nullptr && provider->hasInterface();
}
}

View File

@@ -1,15 +1,15 @@
#include "views/view_settings.hpp" #include "content/views/view_settings.hpp"
#include <hex/api/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace hex { namespace hex::plugin::builtin {
ViewSettings::ViewSettings() : View("hex.view.settings.name") { ViewSettings::ViewSettings() : View("hex.builtin.view.settings.name") {
EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) { EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) {
if (name == "Settings") { if (name == "Settings") {
View::doLater([]{ ImGui::OpenPopup(View::toWindowName("hex.view.settings.name").c_str()); }); View::doLater([]{ ImGui::OpenPopup(View::toWindowName("hex.builtin.view.settings.name").c_str()); });
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
} }
}); });
@@ -21,9 +21,8 @@ namespace hex {
void ViewSettings::drawContent() { void ViewSettings::drawContent() {
ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX)); ImGui::SetNextWindowSize(ImVec2(500, 300) * SharedData::globalScale, ImGuiCond_Always);
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoResize)) {
if (ImGui::BeginPopupModal(View::toWindowName("hex.view.settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
if (ImGui::BeginTabBar("settings")) { if (ImGui::BeginTabBar("settings")) {
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) { for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
if (ImGui::BeginTabItem(LangEntry(category))) { if (ImGui::BeginTabItem(LangEntry(category))) {
@@ -49,8 +48,11 @@ namespace hex {
void ViewSettings::drawMenu() { void ViewSettings::drawMenu() {
if (ImGui::BeginMenu("hex.menu.help"_lang)) { if (ImGui::BeginMenu("hex.menu.help"_lang)) {
if (ImGui::MenuItem("hex.view.settings.name"_lang)) {
View::doLater([]{ ImGui::OpenPopup(View::toWindowName("hex.view.settings.name").c_str()); }); ImGui::Separator();
if (ImGui::MenuItem("hex.builtin.view.settings.name"_lang)) {
View::doLater([]{ ImGui::OpenPopup(View::toWindowName("hex.builtin.view.settings.name").c_str()); });
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
} }

View File

@@ -1,4 +1,4 @@
#include "views/view_store.hpp" #include "content/views/view_store.hpp"
#include <imgui.h> #include <imgui.h>
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
@@ -16,23 +16,23 @@
#include <microtar.h> #include <microtar.h>
#include <hex/helpers/file.hpp> #include <hex/helpers/file.hpp>
namespace hex { namespace hex::plugin::builtin {
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
using namespace std::literals::chrono_literals; using namespace std::literals::chrono_literals;
namespace fs = std::filesystem; namespace fs = std::filesystem;
ViewStore::ViewStore() : View("hex.view.store.name") { ViewStore::ViewStore() : View("hex.builtin.view.store.name") {
this->refresh(); this->refresh();
} }
ViewStore::~ViewStore() { } ViewStore::~ViewStore() { }
void ViewStore::drawStore() { void ViewStore::drawStore() {
ImGui::Header("hex.view.store.desc"_lang, true); ImGui::Header("hex.builtin.view.store.desc"_lang, true);
if (ImGui::Button("hex.view.store.reload"_lang)) { if (ImGui::Button("hex.builtin.view.store.reload"_lang)) {
this->refresh(); this->refresh();
} }
@@ -40,8 +40,8 @@ namespace hex {
if (ImGui::BeginTabItem(title)) { if (ImGui::BeginTabItem(title)) {
if (ImGui::BeginTable("##pattern_language", 3, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_RowBg)) { if (ImGui::BeginTable("##pattern_language", 3, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_RowBg)) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.store.row.name"_lang, ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("hex.builtin.view.store.row.name"_lang, ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("hex.view.store.row.description"_lang, ImGuiTableColumnFlags_None); ImGui::TableSetupColumn("hex.builtin.view.store.row.description"_lang, ImGuiTableColumnFlags_None);
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
@@ -109,17 +109,17 @@ namespace hex {
} }
} else if (entry.hasUpdate) { } else if (entry.hasUpdate) {
if (ImGui::Button("hex.view.store.update"_lang)) { if (ImGui::Button("hex.builtin.view.store.update"_lang)) {
this->download(pathType, entry.fileName, entry.link, true); this->download(pathType, entry.fileName, entry.link, true);
entry.downloading = true; entry.downloading = true;
} }
} else if (!entry.installed) { } else if (!entry.installed) {
if (ImGui::Button("hex.view.store.download"_lang)) { if (ImGui::Button("hex.builtin.view.store.download"_lang)) {
this->download(pathType, entry.fileName, entry.link, false); this->download(pathType, entry.fileName, entry.link, false);
entry.downloading = true; entry.downloading = true;
} }
} else { } else {
if (ImGui::Button("hex.view.store.remove"_lang)) { if (ImGui::Button("hex.builtin.view.store.remove"_lang)) {
this->remove(pathType, entry.fileName); this->remove(pathType, entry.fileName);
entry.installed = false; entry.installed = false;
} }
@@ -141,13 +141,13 @@ namespace hex {
}; };
drawTab("hex.view.store.tab.patterns"_lang, ImHexPath::Patterns, this->m_patterns, [](auto){}); drawTab("hex.builtin.view.store.tab.patterns"_lang, ImHexPath::Patterns, this->m_patterns, [](auto){});
drawTab("hex.view.store.tab.libraries"_lang, ImHexPath::PatternsInclude, this->m_includes, [](auto){}); drawTab("hex.builtin.view.store.tab.libraries"_lang, ImHexPath::PatternsInclude, this->m_includes, [](auto){});
drawTab("hex.view.store.tab.magics"_lang, ImHexPath::Magic, this->m_magics, [](auto){ drawTab("hex.builtin.view.store.tab.magics"_lang, ImHexPath::Magic, this->m_magics, [](auto){
magic::compile(); magic::compile();
}); });
drawTab("hex.view.store.tab.constants"_lang, ImHexPath::Constants, this->m_constants, [](auto){}); drawTab("hex.builtin.view.store.tab.constants"_lang, ImHexPath::Constants, this->m_constants, [](auto){});
drawTab("hex.view.store.tab.yara"_lang, ImHexPath::Yara, this->m_yara, [](auto){}); drawTab("hex.builtin.view.store.tab.yara"_lang, ImHexPath::Yara, this->m_yara, [](auto){});
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
@@ -219,10 +219,10 @@ namespace hex {
void ViewStore::drawContent() { void ViewStore::drawContent() {
ImGui::SetNextWindowSizeConstraints(ImVec2(600, 400) * SharedData::globalScale, ImVec2(FLT_MAX, FLT_MAX)); ImGui::SetNextWindowSizeConstraints(ImVec2(600, 400) * SharedData::globalScale, ImVec2(FLT_MAX, FLT_MAX));
if (ImGui::BeginPopupModal(View::toWindowName("hex.view.store.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.store.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
if (this->m_apiRequest.valid()) { if (this->m_apiRequest.valid()) {
if (this->m_apiRequest.wait_for(0s) != std::future_status::ready) if (this->m_apiRequest.wait_for(0s) != std::future_status::ready)
ImGui::TextSpinner("hex.view.store.loading"_lang); ImGui::TextSpinner("hex.builtin.view.store.loading"_lang);
else else
this->parseResponse(); this->parseResponse();
} }
@@ -237,8 +237,8 @@ namespace hex {
void ViewStore::drawMenu() { void ViewStore::drawMenu() {
if (ImGui::BeginMenu("hex.menu.help"_lang)) { if (ImGui::BeginMenu("hex.menu.help"_lang)) {
if (ImGui::MenuItem("hex.view.store.name"_lang)) { if (ImGui::MenuItem("hex.builtin.view.store.name"_lang)) {
View::doLater([]{ ImGui::OpenPopup(View::toWindowName("hex.view.store.name").c_str()); }); View::doLater([]{ ImGui::OpenPopup(View::toWindowName("hex.builtin.view.store.name").c_str()); });
this->getWindowOpenState() = true; this->getWindowOpenState() = true;
} }

View File

@@ -1,6 +1,7 @@
#include "views/view_strings.hpp" #include "content/views/view_strings.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/fmt.hpp>
#include <cstring> #include <cstring>
#include <thread> #include <thread>
@@ -11,19 +12,24 @@
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
namespace hex { namespace hex::plugin::builtin {
ViewStrings::ViewStrings() : View("hex.view.strings.name") { ViewStrings::ViewStrings() : View("hex.builtin.view.strings.name") {
EventManager::subscribe<EventDataChanged>(this, [this]() { EventManager::subscribe<EventDataChanged>(this, [this]() {
this->m_foundStrings.clear(); this->m_foundStrings.clear();
}); });
this->m_filter.reserve(0xFFFF); this->m_filter.reserve(0xFFFF);
std::memset(this->m_filter.data(), 0x00, this->m_filter.capacity()); std::memset(this->m_filter.data(), 0x00, this->m_filter.capacity());
EventManager::subscribe<EventFileUnloaded>(this, [this]{
this->m_foundStrings.clear();
});
} }
ViewStrings::~ViewStrings() { ViewStrings::~ViewStrings() {
EventManager::unsubscribe<EventDataChanged>(this); EventManager::unsubscribe<EventDataChanged>(this);
EventManager::unsubscribe<EventFileUnloaded>(this);
} }
std::string readString(const FoundString &foundString) { std::string readString(const FoundString &foundString) {
@@ -39,14 +45,14 @@ namespace hex {
this->m_selectedString = readString(foundString); this->m_selectedString = readString(foundString);
} }
if (ImGui::BeginPopup("StringContextMenu")) { if (ImGui::BeginPopup("StringContextMenu")) {
if (ImGui::MenuItem("hex.view.strings.copy"_lang)) { if (ImGui::MenuItem("hex.builtin.view.strings.copy"_lang)) {
ImGui::SetClipboardText(this->m_selectedString.c_str()); ImGui::SetClipboardText(this->m_selectedString.c_str());
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("hex.view.strings.demangle"_lang)) { if (ImGui::MenuItem("hex.builtin.view.strings.demangle"_lang)) {
this->m_demangledName = llvm::demangle(this->m_selectedString); this->m_demangledName = llvm::demangle(this->m_selectedString);
if (!this->m_demangledName.empty()) if (!this->m_demangledName.empty())
View::doLater([]{ ImGui::OpenPopup("hex.view.strings.demangle.name"_lang); }); View::doLater([]{ ImGui::OpenPopup("hex.builtin.view.strings.demangle.name"_lang); });
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }
@@ -65,7 +71,7 @@ namespace hex {
for (u64 offset = 0; offset < provider->getSize(); offset += buffer.size()) { for (u64 offset = 0; offset < provider->getSize(); offset += buffer.size()) {
size_t readSize = std::min(u64(buffer.size()), provider->getSize() - offset); size_t readSize = std::min(u64(buffer.size()), provider->getSize() - offset);
provider->readRelative(offset, buffer.data(), readSize); provider->read(offset + provider->getBaseAddress(), buffer.data(), readSize);
for (u32 i = 0; i < readSize; i++) { for (u32 i = 0; i < readSize; i++) {
if (buffer[i] >= ' ' && buffer[i] <= '~' && offset < provider->getSize() - 1) if (buffer[i] >= ' ' && buffer[i] <= '~' && offset < provider->getSize() - 1)
@@ -94,15 +100,15 @@ namespace hex {
void ViewStrings::drawContent() { void ViewStrings::drawContent() {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
if (ImGui::Begin(View::toWindowName("hex.view.strings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.strings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
if (ImHexApi::Provider::isValid() && provider->isReadable()) { if (ImHexApi::Provider::isValid() && provider->isReadable()) {
ImGui::Disabled([this]{ ImGui::Disabled([this]{
if (ImGui::InputInt("hex.view.strings.min_length"_lang, &this->m_minimumLength, 1, 0)) if (ImGui::InputInt("hex.builtin.view.strings.min_length"_lang, &this->m_minimumLength, 1, 0))
this->m_foundStrings.clear(); this->m_foundStrings.clear();
ImGui::Checkbox("Regex", &this->m_regex); ImGui::Checkbox("Regex", &this->m_regex);
ImGui::InputText("hex.view.strings.filter"_lang, this->m_filter.data(), this->m_filter.capacity(), ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) { ImGui::InputText("hex.builtin.view.strings.filter"_lang, this->m_filter.data(), this->m_filter.capacity(), ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) {
auto &view = *static_cast<ViewStrings*>(data->UserData); auto &view = *static_cast<ViewStrings*>(data->UserData);
view.m_filter.resize(data->BufTextLen); view.m_filter.resize(data->BufTextLen);
view.m_filterIndices.clear(); view.m_filterIndices.clear();
@@ -116,27 +122,31 @@ namespace hex {
} }
} }
for (u64 i = 0; i < view.m_foundStrings.size(); i++) { for (u64 i = 0; i < view.m_foundStrings.size(); i++) {
if(view.m_regex){ if (view.m_regex) {
if(view.m_pattern_parsed && std::regex_search(readString(view.m_foundStrings[i]), pattern)) if(view.m_pattern_parsed && std::regex_search(readString(view.m_foundStrings[i]), pattern))
view.m_filterIndices.push_back(i); view.m_filterIndices.push_back(i);
} }
else if(readString(view.m_foundStrings[i]).find(data->Buf) != std::string::npos) { else if (readString(view.m_foundStrings[i]).find(data->Buf) != std::string::npos) {
view.m_filterIndices.push_back(i); view.m_filterIndices.push_back(i);
} }
} }
return 0; return 0;
}, this); }, this);
if(this->m_regex && !this->m_pattern_parsed){ if (this->m_regex && !this->m_pattern_parsed) {
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "hex.view.strings.regex_error"_lang); ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "hex.builtin.view.strings.regex_error"_lang);
} }
if (ImGui::Button("hex.view.strings.extract"_lang)) if (ImGui::Button("hex.builtin.view.strings.extract"_lang))
this->searchStrings(); this->searchStrings();
}, this->m_searching); }, this->m_searching);
if (this->m_searching) { if (this->m_searching) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextSpinner("hex.view.strings.searching"_lang); ImGui::TextSpinner("hex.builtin.view.strings.searching"_lang);
}
else if (this->m_foundStrings.size() > 0) {
ImGui::SameLine();
ImGui::TextUnformatted(hex::format("hex.builtin.view.strings.results"_lang, this->m_filterIndices.size()).c_str());
} }
@@ -147,9 +157,9 @@ namespace hex {
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable |
ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.strings.offset"_lang, 0, -1, ImGui::GetID("offset")); ImGui::TableSetupColumn("hex.builtin.view.strings.offset"_lang, 0, -1, ImGui::GetID("offset"));
ImGui::TableSetupColumn("hex.view.strings.size"_lang, 0, -1, ImGui::GetID("size")); ImGui::TableSetupColumn("hex.builtin.view.strings.size"_lang, 0, -1, ImGui::GetID("size"));
ImGui::TableSetupColumn("hex.view.strings.string"_lang, 0, -1, ImGui::GetID("string")); ImGui::TableSetupColumn("hex.builtin.view.strings.string"_lang, 0, -1, ImGui::GetID("string"));
auto sortSpecs = ImGui::TableGetSortSpecs(); auto sortSpecs = ImGui::TableGetSortSpecs();
@@ -214,13 +224,13 @@ namespace hex {
} }
ImGui::End(); ImGui::End();
if (ImGui::BeginPopup("hex.view.strings.demangle.title"_lang)) { if (ImGui::BeginPopup("hex.builtin.view.strings.demangle.title"_lang)) {
if (ImGui::BeginChild("##scrolling", ImVec2(500, 150))) { if (ImGui::BeginChild("##scrolling", ImVec2(500, 150))) {
ImGui::TextUnformatted("hex.view.strings.demangle.title"_lang); ImGui::TextUnformatted("hex.builtin.view.strings.demangle.title"_lang);
ImGui::Separator(); ImGui::Separator();
ImGui::TextWrapped("%s", this->m_demangledName.c_str()); ImGui::TextWrapped("%s", this->m_demangledName.c_str());
ImGui::NewLine(); ImGui::NewLine();
if (ImGui::Button("hex.view.strings.demangle.copy"_lang)) if (ImGui::Button("hex.builtin.view.strings.demangle.copy"_lang))
ImGui::SetClipboardText(this->m_demangledName.c_str()); ImGui::SetClipboardText(this->m_demangledName.c_str());
} }

View File

@@ -1,15 +1,15 @@
#include "views/view_tools.hpp" #include "content/views/view_tools.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
namespace hex { namespace hex::plugin::builtin {
ViewTools::ViewTools() : View("hex.view.tools.name") { } ViewTools::ViewTools() : View("hex.builtin.view.tools.name") { }
ViewTools::~ViewTools() { } ViewTools::~ViewTools() { }
void ViewTools::drawContent() { void ViewTools::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.tools.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.tools.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
for (const auto& [name, function] : ContentRegistry::Tools::getEntries()) { for (const auto& [name, function] : ContentRegistry::Tools::getEntries()) {
if (ImGui::CollapsingHeader(LangEntry(name))) { if (ImGui::CollapsingHeader(LangEntry(name))) {
function(); function();

View File

@@ -1,4 +1,4 @@
#include "views/view_yara.hpp" #include "content/views/view_yara.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/utils.hpp> #include <hex/helpers/utils.hpp>
@@ -12,11 +12,11 @@
#include <imgui_imhex_extensions.h> #include <imgui_imhex_extensions.h>
#include <hex/helpers/paths.hpp> #include <hex/helpers/paths.hpp>
namespace hex { namespace hex::plugin::builtin {
namespace fs = std::filesystem; namespace fs = std::filesystem;
ViewYara::ViewYara() : View("hex.view.yara.name") { ViewYara::ViewYara() : View("hex.builtin.view.yara.name") {
yr_initialize(); yr_initialize();
this->reloadRules(); this->reloadRules();
@@ -27,23 +27,23 @@ namespace hex {
} }
void ViewYara::drawContent() { void ViewYara::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.view.yara.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) { if (ImGui::Begin(View::toWindowName("hex.builtin.view.yara.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
if (!this->m_matching && !this->m_errorMessage.empty()) { if (!this->m_matching && !this->m_errorMessage.empty()) {
View::showErrorPopup("hex.view.yara.error"_lang + this->m_errorMessage.data()); View::showErrorPopup("hex.builtin.view.yara.error"_lang + this->m_errorMessage.data());
this->m_errorMessage.clear(); this->m_errorMessage.clear();
} }
ImGui::TextUnformatted("hex.view.yara.header.rules"_lang); ImGui::TextUnformatted("hex.builtin.view.yara.header.rules"_lang);
ImGui::Separator(); ImGui::Separator();
if (this->m_rules.empty()) { if (this->m_rules.empty()) {
ImGui::TextColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "%s", static_cast<const char*>("hex.view.yara.no_rules"_lang)); ImGui::TextColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "%s", static_cast<const char*>("hex.builtin.view.yara.no_rules"_lang));
if (ImGui::Button("hex.view.yara.reload"_lang)) this->reloadRules(); if (ImGui::Button("hex.builtin.view.yara.reload"_lang)) this->reloadRules();
} else { } else {
ImGui::Disabled([this]{ ImGui::Disabled([this]{
if (ImGui::BeginCombo("hex.view.yara.header.rules"_lang, this->m_rules[this->m_selectedRule].first.c_str())) { if (ImGui::BeginCombo("hex.builtin.view.yara.header.rules"_lang, this->m_rules[this->m_selectedRule].first.c_str())) {
for (u32 i = 0; i < this->m_rules.size(); i++) { for (u32 i = 0; i < this->m_rules.size(); i++) {
const bool selected = (this->m_selectedRule == i); const bool selected = (this->m_selectedRule == i);
if (ImGui::Selectable(this->m_rules[i].first.c_str(), selected)) if (ImGui::Selectable(this->m_rules[i].first.c_str(), selected))
@@ -55,24 +55,24 @@ namespace hex {
ImGui::EndCombo(); ImGui::EndCombo();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("hex.view.yara.reload"_lang)) this->reloadRules(); if (ImGui::Button("hex.builtin.view.yara.reload"_lang)) this->reloadRules();
if (ImGui::Button("hex.view.yara.match"_lang)) this->applyRules(); if (ImGui::Button("hex.builtin.view.yara.match"_lang)) this->applyRules();
}, this->m_matching); }, this->m_matching);
if (this->m_matching) { if (this->m_matching) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextSpinner("hex.view.yara.matching"_lang); ImGui::TextSpinner("hex.builtin.view.yara.matching"_lang);
} }
} }
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextUnformatted("hex.view.yara.header.matches"_lang); ImGui::TextUnformatted("hex.builtin.view.yara.header.matches"_lang);
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginTable("matches", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { if (ImGui::BeginTable("matches", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("hex.view.yara.matches.identifier"_lang); ImGui::TableSetupColumn("hex.builtin.view.yara.matches.identifier"_lang);
ImGui::TableSetupColumn("hex.view.yara.matches.variable"_lang); ImGui::TableSetupColumn("hex.builtin.view.yara.matches.variable"_lang);
ImGui::TableSetupColumn("hex.common.address"_lang); ImGui::TableSetupColumn("hex.common.address"_lang);
ImGui::TableSetupColumn("hex.common.size"_lang); ImGui::TableSetupColumn("hex.common.size"_lang);
@@ -103,7 +103,7 @@ namespace hex {
ImGui::Text("0x%lX", size); ImGui::Text("0x%lX", size);
} else { } else {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "%s", static_cast<const char*>("hex.view.yara.whole_data"_lang)); ImGui::TextColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "%s", static_cast<const char*>("hex.builtin.view.yara.whole_data"_lang));
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextUnformatted(""); ImGui::TextUnformatted("");
} }
@@ -207,7 +207,7 @@ namespace hex {
if (context.buffer.empty()) return nullptr; if (context.buffer.empty()) return nullptr;
provider->readRelative(context.currBlock.base, context.buffer.data(), context.buffer.size()); provider->read(context.currBlock.base + provider->getBaseAddress() + provider->getCurrentPageAddress(), context.buffer.data(), context.buffer.size());
return context.buffer.data(); return context.buffer.data();
}; };

View File

@@ -23,6 +23,7 @@ namespace hex::plugin::builtin {
{ "hex.welcome.start.open_file", "Datei Öffnen" }, { "hex.welcome.start.open_file", "Datei Öffnen" },
{ "hex.welcome.start.open_project", "Projekt Öffnen" }, { "hex.welcome.start.open_project", "Projekt Öffnen" },
{ "hex.welcome.start.recent", "Kürzlich geöffnet" }, { "hex.welcome.start.recent", "Kürzlich geöffnet" },
{ "hex.welcome.start.open_other", "Andere Provider" },
{ "hex.welcome.header.help", "Hilfe" }, { "hex.welcome.header.help", "Hilfe" },
{ "hex.welcome.help.repo", "GitHub Repository" }, { "hex.welcome.help.repo", "GitHub Repository" },
{ "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" }, { "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" },
@@ -86,249 +87,257 @@ namespace hex::plugin::builtin {
{ "hex.message.yara_rule_added", "Yara Regel hinzugefügt!" }, { "hex.message.yara_rule_added", "Yara Regel hinzugefügt!" },
{ "hex.message.magic_db_added", "Magic Datenbank hinzugefügt!" }, { "hex.message.magic_db_added", "Magic Datenbank hinzugefügt!" },
{ "hex.view.bookmarks.name", "Lesezeichen" }, /* Builtin plugin features */
{ "hex.view.bookmarks.default_title", "Lesezeichen [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "Noch kein Lesezeichen erstellt. Füge eines hinzu mit Bearbeiten -> Lesezeichen erstellen" },
{ "hex.view.bookmarks.title.info", "Informationen" },
{ "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" },
{ "hex.view.bookmarks.button.jump", "Springen" },
{ "hex.view.bookmarks.button.remove", "Entfernen" },
{ "hex.view.bookmarks.header.name", "Name" },
{ "hex.view.bookmarks.header.color", "Farbe" },
{ "hex.view.bookmarks.header.comment", "Kommentar" },
{ "hex.view.command_palette.name", "Befehlspalette" }, { "hex.builtin.view.bookmarks.name", "Lesezeichen" },
{ "hex.builtin.view.bookmarks.default_title", "Lesezeichen [0x{0:X} - 0x{1:X}]" },
{ "hex.builtin.view.bookmarks.no_bookmarks", "Noch kein Lesezeichen erstellt. Füge eines hinzu mit Bearbeiten -> Lesezeichen erstellen" },
{ "hex.builtin.view.bookmarks.title.info", "Informationen" },
{ "hex.builtin.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" },
{ "hex.builtin.view.bookmarks.button.jump", "Springen" },
{ "hex.builtin.view.bookmarks.button.remove", "Entfernen" },
{ "hex.builtin.view.bookmarks.header.name", "Name" },
{ "hex.builtin.view.bookmarks.header.color", "Farbe" },
{ "hex.builtin.view.bookmarks.header.comment", "Kommentar" },
{ "hex.view.data_inspector.name", "Dateninspektor" }, { "hex.builtin.view.command_palette.name", "Befehlspalette" },
{ "hex.view.data_inspector.table.name", "Name" },
{ "hex.view.data_inspector.table.value", "Wert" },
{ "hex.view.data_inspector.no_data", "Keine bytes angewählt"},
{ "hex.view.data_processor.name", "Datenprozessor" }, { "hex.builtin.view.data_inspector.name", "Dateninspektor" },
{ "hex.view.data_processor.menu.remove_selection", "Auswahl entfernen" }, { "hex.builtin.view.data_inspector.table.name", "Name" },
{ "hex.view.data_processor.menu.remove_node", "Knoten entfernen" }, { "hex.builtin.view.data_inspector.table.value", "Wert" },
{ "hex.view.data_processor.menu.remove_link", "Link entfernen" }, { "hex.builtin.view.data_inspector.no_data", "Keine bytes angewählt"},
{ "hex.view.disassembler.name", "Disassembler" }, { "hex.builtin.view.data_processor.name", "Datenprozessor" },
{ "hex.view.disassembler.position", "Position" }, { "hex.builtin.view.data_processor.menu.remove_selection", "Auswahl entfernen" },
{ "hex.view.disassembler.base", "Basisadresse" }, { "hex.builtin.view.data_processor.menu.remove_node", "Knoten entfernen" },
{ "hex.view.disassembler.region", "Code Region" }, { "hex.builtin.view.data_processor.menu.remove_link", "Link entfernen" },
{ "hex.view.disassembler.settings.header", "Einstellungen" },
{ "hex.view.disassembler.arch", "Architektur" },
{ "hex.view.disassembler.arm.arm", "ARM Modus" },
{ "hex.view.disassembler.arm.thumb", "Thumb Modus" },
{ "hex.view.disassembler.arm.default", "Standard Modus" },
{ "hex.view.disassembler.arm.cortex_m", "Cortex-M Modus" },
{ "hex.view.disassembler.arm.armv8", "ARMv8 Modus" },
{ "hex.view.disassembler.mips.mips32", "MIPS32 Modus" }, { "hex.builtin.view.disassembler.name", "Disassembler" },
{ "hex.view.disassembler.mips.mips64", "MIPS64 Modus" }, { "hex.builtin.view.disassembler.position", "Position" },
{ "hex.view.disassembler.mips.mips32R6", "MIPS32R6 Modus" }, { "hex.builtin.view.disassembler.base", "Basisadresse" },
{ "hex.view.disassembler.mips.micro", "Micro Modus" }, { "hex.builtin.view.disassembler.region", "Code Region" },
{ "hex.builtin.view.disassembler.settings.header", "Einstellungen" },
{ "hex.builtin.view.disassembler.arch", "Architektur" },
{ "hex.builtin.view.disassembler.arm.arm", "ARM Modus" },
{ "hex.builtin.view.disassembler.arm.thumb", "Thumb Modus" },
{ "hex.builtin.view.disassembler.arm.default", "Standard Modus" },
{ "hex.builtin.view.disassembler.arm.cortex_m", "Cortex-M Modus" },
{ "hex.builtin.view.disassembler.arm.armv8", "ARMv8 Modus" },
{ "hex.view.disassembler.x86.16bit", "16-bit Modus" }, { "hex.builtin.view.disassembler.mips.mips32", "MIPS32 Modus" },
{ "hex.view.disassembler.x86.32bit", "32-bit Modus" }, { "hex.builtin.view.disassembler.mips.mips64", "MIPS64 Modus" },
{ "hex.view.disassembler.x86.64bit", "64-bit Modus" }, { "hex.builtin.view.disassembler.mips.mips32R6", "MIPS32R6 Modus" },
{ "hex.builtin.view.disassembler.mips.micro", "Micro Modus" },
{ "hex.view.disassembler.ppc.32bit", "32-bit Modus" }, { "hex.builtin.view.disassembler.x86.16bit", "16-bit Modus" },
{ "hex.view.disassembler.ppc.64bit", "64-bit Modus" }, { "hex.builtin.view.disassembler.x86.32bit", "32-bit Modus" },
{ "hex.builtin.view.disassembler.x86.64bit", "64-bit Modus" },
{ "hex.view.disassembler.sparc.v9", "Sparc V9 Modus" }, { "hex.builtin.view.disassembler.ppc.32bit", "32-bit Modus" },
{ "hex.builtin.view.disassembler.ppc.64bit", "64-bit Modus" },
{ "hex.view.disassembler.disassemble", "Disassemble" }, { "hex.builtin.view.disassembler.sparc.v9", "Sparc V9 Modus" },
{ "hex.view.disassembler.disassembling", "Disassemblen..." },
{ "hex.view.disassembler.disassembly.title", "Disassembly" },
{ "hex.view.disassembler.disassembly.address", "Adresse" },
{ "hex.view.disassembler.disassembly.offset", "Offset" },
{ "hex.view.disassembler.disassembly.bytes", "Byte" },
{ "hex.view.hashes.name", "Hashes" }, { "hex.builtin.view.disassembler.disassemble", "Disassemble" },
{ "hex.view.hashes.settings", "Einstellungen" }, { "hex.builtin.view.disassembler.disassembling", "Disassemblen..." },
{ "hex.view.hashes.function", "Hash Funktion" }, { "hex.builtin.view.disassembler.disassembly.title", "Disassembly" },
{ "hex.view.hashes.iv", "Startwert" }, { "hex.builtin.view.disassembler.disassembly.address", "Adresse" },
{ "hex.view.hashes.poly", "Polynomial" }, { "hex.builtin.view.disassembler.disassembly.offset", "Offset" },
{ "hex.view.hashes.result", "Resultat" }, { "hex.builtin.view.disassembler.disassembly.bytes", "Byte" },
{ "hex.view.help.name", "Hilfe" }, { "hex.builtin.view.hashes.name", "Hashes" },
{ "hex.view.help.about.name", "Über ImHex" }, { "hex.builtin.view.hashes.settings", "Einstellungen" },
{ "hex.view.help.about.translator", "Von WerWolv übersetzt" }, { "hex.builtin.view.hashes.function", "Hash Funktion" },
{ "hex.view.help.about.source", "Quellcode auf GitHub verfügbar:" }, { "hex.builtin.view.hashes.iv", "Startwert" },
{ "hex.view.help.about.donations", "Spenden" }, { "hex.builtin.view.hashes.poly", "Polynomial" },
{ "hex.view.help.about.thanks", "Wenn dir meine Arbeit gefällt, bitte ziehe eine Spende in Betracht, um das Projekt am Laufen zu halten. Vielen Dank <3" }, { "hex.builtin.view.hashes.result", "Resultat" },
{ "hex.view.help.about.libs", "Benutzte Libraries" },
{ "hex.view.help.about.paths", "ImHex Ordner" },
{ "hex.view.help.documentation", "ImHex Dokumentation" },
{ "hex.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
{ "hex.view.help.calc_cheat_sheet", "Rechner Cheat Sheet" },
{ "hex.view.hexeditor.name", "Hex editor" }, { "hex.builtin.view.help.name", "Hilfe" },
{ "hex.view.hexeditor.create_file", "Neu" }, { "hex.builtin.view.help.about.name", "Über ImHex" },
{ "hex.view.hexeditor.open_file", "Öffnen" }, { "hex.builtin.view.help.about.translator", "Von WerWolv übersetzt" },
{ "hex.view.hexeditor.open_project", "Projekt öffnen" }, { "hex.builtin.view.help.about.source", "Quellcode auf GitHub verfügbar:" },
{ "hex.view.hexeditor.save_project", "Projekt speichern" }, { "hex.builtin.view.help.about.donations", "Spenden" },
{ "hex.view.hexeditor.save_data", "Daten speichern" }, { "hex.builtin.view.help.about.thanks", "Wenn dir meine Arbeit gefällt, bitte ziehe eine Spende in Betracht, um das Projekt am Laufen zu halten. Vielen Dank <3" },
{ "hex.view.hexeditor.open_base64", "Base64 Datei öffnen" }, { "hex.builtin.view.help.about.contributor", "Mitwirkende" },
{ "hex.view.hexeditor.load_enconding_file", "Custom encoding Datei laden" }, { "hex.builtin.view.help.about.libs", "Benutzte Libraries" },
{ "hex.view.hexeditor.page", "Seite {0} / {1}" }, { "hex.builtin.view.help.about.paths", "ImHex Ordner" },
{ "hex.view.hexeditor.save_as", "Speichern unter" }, { "hex.builtin.view.help.documentation", "ImHex Dokumentation" },
{ "hex.view.hexeditor.exit_application.title", "Applikation verlassen?" }, { "hex.builtin.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
{ "hex.view.hexeditor.exit_application.desc", "Es wurden ungespeicherte Änderungen an diesem Projekt vorgenommen\nBist du sicher, dass du ImHex schliessen willst?" }, { "hex.builtin.view.help.calc_cheat_sheet", "Rechner Cheat Sheet" },
{ "hex.view.hexeditor.script.title", "Datei mit Loader Skript laden" },
{ "hex.view.hexeditor.script.desc", "Lade eine Datei mit Hilfe eines Python Skriptes" },
{ "hex.view.hexeditor.script.script", "Skript" },
{ "hex.view.hexeditor.script.script.title", "Loader Script: Skript öffnen" },
{ "hex.view.hexeditor.script.file", "Datei" },
{ "hex.view.hexeditor.script.file.title", "Loader Script: Datei öffnen" },
{ "hex.view.hexeditor.menu.file.open_file", "Datei öffnen..." }, { "hex.builtin.view.hexeditor.name", "Hex editor" },
{ "hex.view.hexeditor.menu.file.open_recent", "Kürzlich geöffnete Dateien"}, { "hex.builtin.view.hexeditor.create_file", "Neu" },
{ "hex.view.hexeditor.menu.file.save", "Speichern" }, { "hex.builtin.view.hexeditor.open_file", "Öffnen" },
{ "hex.view.hexeditor.menu.file.save_as", "Speichern unter..." }, { "hex.builtin.view.hexeditor.open_project", "Projekt öffnen" },
{ "hex.view.hexeditor.menu.file.close", "Schliessen" }, { "hex.builtin.view.hexeditor.save_project", "Projekt speichern" },
{ "hex.view.hexeditor.menu.file.quit", "ImHex Beenden" }, { "hex.builtin.view.hexeditor.save_data", "Daten speichern" },
{ "hex.view.hexeditor.menu.file.open_project", "Projekt öffnen..." }, { "hex.builtin.view.hexeditor.open_base64", "Base64 Datei öffnen" },
{ "hex.view.hexeditor.menu.file.save_project", "Projekt speichern..." }, { "hex.builtin.view.hexeditor.load_enconding_file", "Custom encoding Datei laden" },
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Custom encoding laden..." }, { "hex.builtin.view.hexeditor.page", "Seite {0} / {1}" },
{ "hex.view.hexeditor.menu.file.import", "Importieren..." }, { "hex.builtin.view.hexeditor.save_as", "Speichern unter" },
{ "hex.view.hexeditor.menu.file.import.base64", "Base64 Datei" }, { "hex.builtin.view.hexeditor.exit_application.title", "Applikation verlassen?" },
{ "hex.view.hexeditor.base64.import_error", "Datei ist nicht in einem korrekten Base64 Format!" }, { "hex.builtin.view.hexeditor.exit_application.desc", "Es wurden ungespeicherte Änderungen an diesem Projekt vorgenommen\nBist du sicher, dass du ImHex schliessen willst?" },
{ "hex.view.hexeditor.file_open_error", "Öffnen der Datei fehlgeschlagen!" }, { "hex.builtin.view.hexeditor.script.title", "Datei mit Loader Skript laden" },
{ "hex.view.hexeditor.menu.file.import.ips", "IPS Patch" }, { "hex.builtin.view.hexeditor.script.desc", "Lade eine Datei mit Hilfe eines Python Skriptes" },
{ "hex.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" }, { "hex.builtin.view.hexeditor.script.script", "Skript" },
{ "hex.view.hexeditor.menu.file.import.script", "Datei mit Loader Script" }, { "hex.builtin.view.hexeditor.script.script.title", "Loader Script: Skript öffnen" },
{ "hex.builtin.view.hexeditor.script.file", "Datei" },
{ "hex.builtin.view.hexeditor.script.file.title", "Loader Script: Datei öffnen" },
{ "hex.view.hexeditor.menu.file.export", "Exportieren..." }, { "hex.builtin.view.hexeditor.menu.file.open_file", "Datei öffnen..." },
{ "hex.view.hexeditor.menu.file.export.title", "Datei exportieren" }, { "hex.builtin.view.hexeditor.menu.file.open_recent", "Kürzlich geöffnete Dateien" },
{ "hex.view.hexeditor.menu.file.export.ips", "IPS Patch" }, { "hex.builtin.view.hexeditor.menu.file.open_other", "Provider öffnen..." },
{ "hex.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" }, { "hex.builtin.view.hexeditor.menu.file.save", "Speichern" },
{ "hex.view.hexeditor.menu.file.search", "Suchen" }, { "hex.builtin.view.hexeditor.menu.file.save_as", "Speichern unter..." },
{ "hex.view.hexeditor.search.string", "String" }, { "hex.builtin.view.hexeditor.menu.file.close", "Schliessen" },
{ "hex.view.hexeditor.search.hex", "Hex" }, { "hex.builtin.view.hexeditor.menu.file.quit", "ImHex Beenden" },
{ "hex.view.hexeditor.search.find", "Suchen" }, { "hex.builtin.view.hexeditor.menu.file.open_project", "Projekt öffnen..." },
{ "hex.view.hexeditor.search.find_next", "Nächstes" }, { "hex.builtin.view.hexeditor.menu.file.save_project", "Projekt speichern..." },
{ "hex.view.hexeditor.search.find_prev", "Vorheriges" }, { "hex.builtin.view.hexeditor.menu.file.load_encoding_file", "Custom encoding laden..." },
{ "hex.view.hexeditor.menu.file.goto", "Sprung" }, { "hex.builtin.view.hexeditor.menu.file.import", "Importieren..." },
{ "hex.view.hexeditor.goto.offset.absolute", "Absolut" }, { "hex.builtin.view.hexeditor.menu.file.import.base64", "Base64 Datei" },
{ "hex.view.hexeditor.goto.offset.current", "Momentan" }, { "hex.builtin.view.hexeditor.base64.import_error", "Datei ist nicht in einem korrekten Base64 Format!" },
{ "hex.view.hexeditor.goto.offset.begin", "Beginn" }, { "hex.builtin.view.hexeditor.file_open_error", "Öffnen der Datei fehlgeschlagen!" },
{ "hex.view.hexeditor.goto.offset.end", "Ende" }, { "hex.builtin.view.hexeditor.menu.file.import.ips", "IPS Patch" },
{ "hex.view.hexeditor.error.read_only", "Schreibzugriff konnte nicht erlangt werden. Datei wurde im Lesemodus geöffnet." }, { "hex.builtin.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" },
{ "hex.view.hexeditor.error.open", "Öffnen der Datei fehlgeschlagen!" }, { "hex.builtin.view.hexeditor.menu.file.import.script", "Datei mit Loader Script" },
{ "hex.view.hexeditor.error.create", "Erstellen der neuen Datei fehlgeschlagen!" },
{ "hex.view.hexeditor.menu.edit.undo", "Rückgängig" },
{ "hex.view.hexeditor.menu.edit.redo", "Wiederholen" },
{ "hex.view.hexeditor.menu.edit.copy", "Kopieren" },
{ "hex.view.hexeditor.menu.edit.copy_as", "Kopieren als..." },
{ "hex.view.hexeditor.copy.hex", "String" },
{ "hex.view.hexeditor.copy.c", "C Array" },
{ "hex.view.hexeditor.copy.cpp", "C++ Array" },
{ "hex.view.hexeditor.copy.csharp", "C# Array" },
{ "hex.view.hexeditor.copy.rust", "Rust Array" },
{ "hex.view.hexeditor.copy.python", "Python Array" },
{ "hex.view.hexeditor.copy.java", "Java Array" },
{ "hex.view.hexeditor.copy.js", "JavaScript Array" },
{ "hex.view.hexeditor.copy.ascii", "ASCII Art" },
{ "hex.view.hexeditor.copy.html", "HTML" },
{ "hex.view.hexeditor.menu.edit.paste", "Einfügen" },
{ "hex.view.hexeditor.menu.edit.select_all", "Alles auswählen" },
{ "hex.view.hexeditor.menu.edit.bookmark", "Lesezeichen erstellen" },
{ "hex.view.hexeditor.menu.edit.set_base", "Basisadresse setzen" },
{ "hex.view.hexeditor.menu.edit.resize", "Grösse ändern" },
{ "hex.view.information.name", "Dateninformationen" }, { "hex.builtin.view.hexeditor.menu.file.export", "Exportieren..." },
{ "hex.view.information.control", "Einstellungen" }, { "hex.builtin.view.hexeditor.menu.file.export.title", "Datei exportieren" },
{ "hex.view.information.analyze", "Seite analysieren" }, { "hex.builtin.view.hexeditor.menu.file.export.ips", "IPS Patch" },
{ "hex.view.information.analyzing", "Analysieren..." }, { "hex.builtin.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" },
{ "hex.view.information.region", "Analysierte Region" }, { "hex.builtin.view.hexeditor.menu.file.search", "Suchen" },
{ "hex.view.information.magic", "Magic Informationen" }, { "hex.builtin.view.hexeditor.search.string", "String" },
{ "hex.view.information.description", "Beschreibung:" }, { "hex.builtin.view.hexeditor.search.hex", "Hex" },
{ "hex.view.information.mime", "MIME Typ:" }, { "hex.builtin.view.hexeditor.search.find", "Suchen" },
{ "hex.view.information.info_analysis", "Informationsanalysis" }, { "hex.builtin.view.hexeditor.search.find_next", "Nächstes" },
{ "hex.view.information.distribution", "Byte Verteilung" }, { "hex.builtin.view.hexeditor.search.find_prev", "Vorheriges" },
{ "hex.view.information.entropy", "Entropie" }, { "hex.builtin.view.hexeditor.menu.file.goto", "Sprung" },
{ "hex.view.information.block_size", "Blockgrösse" }, { "hex.builtin.view.hexeditor.goto.offset.absolute", "Absolut" },
{ "hex.view.information.block_size.desc", "{0} Blöcke min {1} bytes" }, { "hex.builtin.view.hexeditor.goto.offset.current", "Momentan" },
{ "hex.view.information.file_entropy", "Dateientropie" }, { "hex.builtin.view.hexeditor.goto.offset.begin", "Beginn" },
{ "hex.view.information.highest_entropy", "Höchste Blockentropie" }, { "hex.builtin.view.hexeditor.goto.offset.end", "Ende" },
{ "hex.view.information.encrypted", "Diese Daten sind vermutlich verschlüsselt oder komprimiert!" }, { "hex.builtin.view.hexeditor.error.read_only", "Schreibzugriff konnte nicht erlangt werden. Datei wurde im Lesemodus geöffnet." },
{ "hex.builtin.view.hexeditor.error.open", "Öffnen der Datei fehlgeschlagen!" },
{ "hex.builtin.view.hexeditor.error.create", "Erstellen der neuen Datei fehlgeschlagen!" },
{ "hex.builtin.view.hexeditor.menu.edit.undo", "Rückgängig" },
{ "hex.builtin.view.hexeditor.menu.edit.redo", "Wiederholen" },
{ "hex.builtin.view.hexeditor.menu.edit.copy", "Kopieren" },
{ "hex.builtin.view.hexeditor.menu.edit.copy_as", "Kopieren als..." },
{ "hex.builtin.view.hexeditor.copy.hex", "String" },
{ "hex.builtin.view.hexeditor.copy.c", "C Array" },
{ "hex.builtin.view.hexeditor.copy.cpp", "C++ Array" },
{ "hex.builtin.view.hexeditor.copy.csharp", "C# Array" },
{ "hex.builtin.view.hexeditor.copy.rust", "Rust Array" },
{ "hex.builtin.view.hexeditor.copy.python", "Python Array" },
{ "hex.builtin.view.hexeditor.copy.java", "Java Array" },
{ "hex.builtin.view.hexeditor.copy.js", "JavaScript Array" },
{ "hex.builtin.view.hexeditor.copy.ascii", "ASCII Art" },
{ "hex.builtin.view.hexeditor.copy.html", "HTML" },
{ "hex.builtin.view.hexeditor.menu.edit.paste", "Einfügen" },
{ "hex.builtin.view.hexeditor.menu.edit.select_all", "Alles auswählen" },
{ "hex.builtin.view.hexeditor.menu.edit.bookmark", "Lesezeichen erstellen" },
{ "hex.builtin.view.hexeditor.menu.edit.set_base", "Basisadresse setzen" },
{ "hex.builtin.view.hexeditor.menu.edit.resize", "Grösse ändern" },
{ "hex.view.patches.name", "Patches" }, { "hex.builtin.view.information.name", "Dateninformationen" },
{ "hex.view.patches.offset", "Offset" }, { "hex.builtin.view.information.control", "Einstellungen" },
{ "hex.view.patches.orig", "Originalwert" }, { "hex.builtin.view.information.analyze", "Seite analysieren" },
{ "hex.view.patches.patch", "Patchwert"}, { "hex.builtin.view.information.analyzing", "Analysieren..." },
{ "hex.view.patches.remove", "Patch entfernen" }, { "hex.builtin.view.information.region", "Analysierte Region" },
{ "hex.builtin.view.information.magic", "Magic Informationen" },
{ "hex.builtin.view.information.description", "Beschreibung:" },
{ "hex.builtin.view.information.mime", "MIME Typ:" },
{ "hex.builtin.view.information.info_analysis", "Informationsanalysis" },
{ "hex.builtin.view.information.distribution", "Byte Verteilung" },
{ "hex.builtin.view.information.entropy", "Entropie" },
{ "hex.builtin.view.information.block_size", "Blockgrösse" },
{ "hex.builtin.view.information.block_size.desc", "{0} Blöcke min {1} bytes" },
{ "hex.builtin.view.information.file_entropy", "Dateientropie" },
{ "hex.builtin.view.information.highest_entropy", "Höchste Blockentropie" },
{ "hex.builtin.view.information.encrypted", "Diese Daten sind vermutlich verschlüsselt oder komprimiert!" },
{ "hex.view.pattern.name", "Pattern Editor" }, { "hex.builtin.view.patches.name", "Patches" },
{ "hex.view.pattern.accept_pattern", "Pattern akzeptieren" }, { "hex.builtin.view.patches.offset", "Offset" },
{ "hex.view.pattern.accept_pattern.desc", "Ein oder mehrere kompatible Pattern wurden für diesen Dateityp gefunden" }, { "hex.builtin.view.patches.orig", "Originalwert" },
{ "hex.view.pattern.accept_pattern.pattern_language", "Pattern" }, { "hex.builtin.view.patches.patch", "Patchwert"},
{ "hex.view.pattern.accept_pattern.question", "Ausgewähltes Pattern anwenden?" }, { "hex.builtin.view.patches.remove", "Patch entfernen" },
{ "hex.view.pattern.menu.file.load_pattern", "Pattern laden..." },
{ "hex.view.pattern.open_pattern", "Pattern öffnen" },
{ "hex.view.pattern.evaluating", "Evaluieren..." },
{ "hex.view.pattern.auto", "Auto evaluieren" },
{ "hex.view.pattern_data.name", "Pattern Daten" }, { "hex.builtin.view.pattern_editor.name", "Pattern Editor" },
{ "hex.view.pattern_data.var_name", "Name" }, { "hex.builtin.view.pattern_editor.accept_pattern", "Pattern akzeptieren" },
{ "hex.view.pattern_data.color", "Farbe" }, { "hex.builtin.view.pattern_editor.accept_pattern.desc", "Ein oder mehrere kompatible Pattern wurden für diesen Dateityp gefunden" },
{ "hex.view.pattern_data.offset", "Offset" }, { "hex.builtin.view.pattern_editor.accept_pattern.pattern_language", "Pattern" },
{ "hex.view.pattern_data.size", "Grösse" }, { "hex.builtin.view.pattern_editor.accept_pattern.question", "Ausgewähltes Pattern anwenden?" },
{ "hex.view.pattern_data.type", "Typ" }, { "hex.builtin.view.pattern_editor.menu.file.load_pattern", "Pattern laden..." },
{ "hex.view.pattern_data.value", "Wert" }, { "hex.builtin.view.pattern_editor.menu.file.save_pattern", "Pattern speichern..." },
{ "hex.builtin.view.pattern_editor.open_pattern", "Pattern öffnen" },
{ "hex.builtin.view.pattern_editor.evaluating", "Evaluieren..." },
{ "hex.builtin.view.pattern_editor.auto", "Auto evaluieren" },
{ "hex.builtin.view.pattern_editor.env_vars", "Umgebungsvariablen" },
{ "hex.view.settings.name", "Einstellungen" }, { "hex.builtin.view.pattern_data.name", "Pattern Daten" },
{ "hex.builtin.view.pattern_data.var_name", "Name" },
{ "hex.builtin.view.pattern_data.color", "Farbe" },
{ "hex.builtin.view.pattern_data.offset", "Offset" },
{ "hex.builtin.view.pattern_data.size", "Grösse" },
{ "hex.builtin.view.pattern_data.type", "Typ" },
{ "hex.builtin.view.pattern_data.value", "Wert" },
{ "hex.view.strings.name", "Strings" }, { "hex.builtin.view.settings.name", "Einstellungen" },
{ "hex.view.strings.copy", "String kopieren" },
{ "hex.view.strings.demangle", "Demangle" },
{ "hex.view.strings.min_length", "Minimallänge" },
{ "hex.view.strings.filter", "Filter" },
{ "hex.view.strings.extract", "Extrahieren" },
{ "hex.view.strings.regex_error", "Ungültiges Regex" },
{ "hex.view.strings.searching", "Suchen..." },
{ "hex.view.strings.offset", "Offset" },
{ "hex.view.strings.size", "Grösse" },
{ "hex.view.strings.string", "String" },
{ "hex.view.strings.demangle.title", "Demangled Namen" },
{ "hex.view.strings.demangle.copy", "Kopieren" },
{ "hex.view.tools.name", "Werkzeuge" }, { "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.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.view.yara.name", "Yara Regeln" }, { "hex.builtin.view.tools.name", "Werkzeuge" },
{ "hex.view.yara.header.rules", "Regeln" },
{ "hex.view.yara.reload", "Neu laden" },
{ "hex.view.yara.match", "Regeln anwenden" },
{ "hex.view.yara.matching", "Anwenden..." },
{ "hex.view.yara.error", "Yara Kompilerfehler: " },
{ "hex.view.yara.header.matches", "Funde" },
{ "hex.view.yara.matches.identifier", "Kennung" },
{ "hex.view.yara.matches.variable", "Variabel" },
{ "hex.view.yara.whole_data", "Gesammte Daten Übereinstimmung!" },
{ "hex.view.yara.no_rules", "Keine Yara Regeln gefunden. Platziere sie in ImHex's 'yara' Ordner" },
{ "hex.view.constants.name", "Konstanten" }, { "hex.builtin.view.yara.name", "Yara Regeln" },
{ "hex.view.constants.row.category", "Kategorie" }, { "hex.builtin.view.yara.header.rules", "Regeln" },
{ "hex.view.constants.row.name", "Name" }, { "hex.builtin.view.yara.reload", "Neu laden" },
{ "hex.view.constants.row.desc", "Beschreibung" }, { "hex.builtin.view.yara.match", "Regeln anwenden" },
{ "hex.view.constants.row.value", "Wert" }, { "hex.builtin.view.yara.matching", "Anwenden..." },
{ "hex.builtin.view.yara.error", "Yara Kompilerfehler: " },
{ "hex.builtin.view.yara.header.matches", "Funde" },
{ "hex.builtin.view.yara.matches.identifier", "Kennung" },
{ "hex.builtin.view.yara.matches.variable", "Variable" },
{ "hex.builtin.view.yara.whole_data", "Gesammte Daten Übereinstimmung!" },
{ "hex.builtin.view.yara.no_rules", "Keine Yara Regeln gefunden. Platziere sie in ImHex's 'yara' Ordner" },
{ "hex.view.store.name", "Content Store" }, { "hex.builtin.view.constants.name", "Konstanten" },
{ "hex.view.store.desc", "Downloade zusätzlichen Content von ImHex's online Datenbank" }, { "hex.builtin.view.constants.row.category", "Kategorie" },
{ "hex.view.store.reload", "Neu laden" }, { "hex.builtin.view.constants.row.name", "Name" },
{ "hex.view.store.row.name", "Name" }, { "hex.builtin.view.constants.row.desc", "Beschreibung" },
{ "hex.view.store.row.description", "Beschreibung" }, { "hex.builtin.view.constants.row.value", "Wert" },
{ "hex.view.store.download", "Download" },
{ "hex.view.store.update", "Update" },
{ "hex.view.store.remove", "Entfernen" },
{ "hex.view.store.tab.patterns", "Patterns" },
{ "hex.view.store.tab.libraries", "Libraries" },
{ "hex.view.store.tab.magics", "Magic Files" },
{ "hex.view.store.tab.constants", "Konstanten" },
{ "hex.view.store.tab.yara", "Yara Rules" },
{ "hex.view.store.loading", "Store inhalt wird geladen..." },
{ "hex.view.diff.name", "Diffing" },
/* Builtin plugin features */ { "hex.builtin.view.store.name", "Content Store" },
{ "hex.builtin.view.store.desc", "Downloade zusätzlichen Content von ImHex's online Datenbank" },
{ "hex.builtin.view.store.reload", "Neu laden" },
{ "hex.builtin.view.store.row.name", "Name" },
{ "hex.builtin.view.store.row.description", "Beschreibung" },
{ "hex.builtin.view.store.download", "Download" },
{ "hex.builtin.view.store.update", "Update" },
{ "hex.builtin.view.store.remove", "Entfernen" },
{ "hex.builtin.view.store.tab.patterns", "Patterns" },
{ "hex.builtin.view.store.tab.libraries", "Libraries" },
{ "hex.builtin.view.store.tab.magics", "Magic Files" },
{ "hex.builtin.view.store.tab.constants", "Konstanten" },
{ "hex.builtin.view.store.tab.yara", "Yara Rules" },
{ "hex.builtin.view.store.loading", "Store inhalt wird geladen..." },
{ "hex.builtin.view.diff.name", "Diffing" },
{ "hex.builtin.view.provider_settings.name", "Provider Einstellungen" },
{ "hex.builtin.view.provider_settings.load_popup", "Provider öffnen" },
{ "hex.builtin.command.calc.desc", "Rechner" }, { "hex.builtin.command.calc.desc", "Rechner" },
{ "hex.builtin.command.cmd.desc", "Command" }, { "hex.builtin.command.cmd.desc", "Command" },
@@ -664,6 +673,18 @@ namespace hex::plugin::builtin {
{ "hex.builtin.provider.file.creation", "Erstellungszeit" }, { "hex.builtin.provider.file.creation", "Erstellungszeit" },
{ "hex.builtin.provider.file.access", "Letzte Zugriffszeit" }, { "hex.builtin.provider.file.access", "Letzte Zugriffszeit" },
{ "hex.builtin.provider.file.modification", "Letzte Modifikationszeit" }, { "hex.builtin.provider.file.modification", "Letzte Modifikationszeit" },
{ "hex.builtin.provider.file", "Datei Provider" },
{ "hex.builtin.provider.gdb", "GDB Server Provider" },
{ "hex.builtin.provider.gdb.name", "GDB Server <{0}:{1}>" },
{ "hex.builtin.provider.gdb.server", "Server" },
{ "hex.builtin.provider.gdb.ip", "IP Adresse" },
{ "hex.builtin.provider.gdb.port", "Port" },
{ "hex.builtin.provider.disk", "Datenträger Provider" },
{ "hex.builtin.provider.disk.selected_disk", "Datenträger" },
{ "hex.builtin.provider.disk.disk_size", "Datenträgergrösse" },
{ "hex.builtin.provider.disk.sector_size", "Sektorgrösse" },
{ "hex.builtin.provider.disk.reload", "Neu laden" },
}); });
} }

View File

@@ -23,6 +23,7 @@ namespace hex::plugin::builtin {
{ "hex.welcome.start.open_file", "Open File" }, { "hex.welcome.start.open_file", "Open File" },
{ "hex.welcome.start.open_project", "Open Project" }, { "hex.welcome.start.open_project", "Open Project" },
{ "hex.welcome.start.recent", "Recent Files" }, { "hex.welcome.start.recent", "Recent Files" },
{ "hex.welcome.start.open_other", "Other Providers" },
{ "hex.welcome.header.help", "Help" }, { "hex.welcome.header.help", "Help" },
{ "hex.welcome.help.repo", "GitHub Repository" }, { "hex.welcome.help.repo", "GitHub Repository" },
{ "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" }, { "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" },
@@ -86,253 +87,260 @@ namespace hex::plugin::builtin {
{ "hex.message.yara_rule_added", "Yara rule added!" }, { "hex.message.yara_rule_added", "Yara rule added!" },
{ "hex.message.magic_db_added", "Magic database added!" }, { "hex.message.magic_db_added", "Magic database added!" },
{ "hex.view.bookmarks.name", "Bookmarks" }, /* Builtin plugin features */
{ "hex.view.bookmarks.default_title", "Bookmark [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "No bookmarks created yet. Add one with Edit -> Create Bookmark" },
{ "hex.view.bookmarks.title.info", "Information" },
{ "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" },
{ "hex.view.bookmarks.button.jump", "Jump to" },
{ "hex.view.bookmarks.button.remove", "Remove" },
{ "hex.view.bookmarks.header.name", "Name" },
{ "hex.view.bookmarks.header.color", "Color" },
{ "hex.view.bookmarks.header.comment", "Comment" },
{ "hex.view.command_palette.name", "Command Palette" }, { "hex.builtin.view.bookmarks.name", "Bookmarks" },
{ "hex.builtin.view.bookmarks.default_title", "Bookmark [0x{0:X} - 0x{1:X}]" },
{ "hex.builtin.view.bookmarks.no_bookmarks", "No bookmarks created yet. Add one with Edit -> Create Bookmark" },
{ "hex.builtin.view.bookmarks.title.info", "Information" },
{ "hex.builtin.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" },
{ "hex.builtin.view.bookmarks.button.jump", "Jump to" },
{ "hex.builtin.view.bookmarks.button.remove", "Remove" },
{ "hex.builtin.view.bookmarks.header.name", "Name" },
{ "hex.builtin.view.bookmarks.header.color", "Color" },
{ "hex.builtin.view.bookmarks.header.comment", "Comment" },
{ "hex.view.data_inspector.name", "Data Inspector" }, { "hex.builtin.view.command_palette.name", "Command Palette" },
{ "hex.view.data_inspector.table.name", "Name" },
{ "hex.view.data_inspector.table.value", "Value" },
{ "hex.view.data_inspector.no_data", "No bytes selected"},
{ "hex.view.data_processor.name", "Data Processor" }, { "hex.builtin.view.data_inspector.name", "Data Inspector" },
{ "hex.view.data_processor.menu.remove_selection", "Remove Selected" }, { "hex.builtin.view.data_inspector.table.name", "Name" },
{ "hex.view.data_processor.menu.remove_node", "Remove Node" }, { "hex.builtin.view.data_inspector.table.value", "Value" },
{ "hex.view.data_processor.menu.remove_link", "Remove Link" }, { "hex.builtin.view.data_inspector.no_data", "No bytes selected"},
{ "hex.view.disassembler.name", "Disassembler" }, { "hex.builtin.view.data_processor.name", "Data Processor" },
{ "hex.view.disassembler.position", "Position" }, { "hex.builtin.view.data_processor.menu.remove_selection", "Remove Selected" },
{ "hex.view.disassembler.base", "Base address" }, { "hex.builtin.view.data_processor.menu.remove_node", "Remove Node" },
{ "hex.view.disassembler.region", "Code region" }, { "hex.builtin.view.data_processor.menu.remove_link", "Remove Link" },
{ "hex.view.disassembler.settings.header", "Settings" },
{ "hex.view.disassembler.arch", "Architecture" },
{ "hex.view.disassembler.arm.arm", "ARM mode" },
{ "hex.view.disassembler.arm.thumb", "Thumb mode" },
{ "hex.view.disassembler.arm.default", "Default mode" },
{ "hex.view.disassembler.arm.cortex_m", "Cortex-M mode" },
{ "hex.view.disassembler.arm.armv8", "ARMv8 mode" },
{ "hex.view.disassembler.mips.mips32", "MIPS32 mode" }, { "hex.builtin.view.disassembler.name", "Disassembler" },
{ "hex.view.disassembler.mips.mips64", "MIPS64 mode" }, { "hex.builtin.view.disassembler.position", "Position" },
{ "hex.view.disassembler.mips.mips32R6", "MIPS32R6 mode" }, { "hex.builtin.view.disassembler.base", "Base address" },
{ "hex.view.disassembler.mips.micro", "Micro mode" }, { "hex.builtin.view.disassembler.region", "Code region" },
{ "hex.builtin.view.disassembler.settings.header", "Settings" },
{ "hex.builtin.view.disassembler.arch", "Architecture" },
{ "hex.builtin.view.disassembler.arm.arm", "ARM mode" },
{ "hex.builtin.view.disassembler.arm.thumb", "Thumb mode" },
{ "hex.builtin.view.disassembler.arm.default", "Default mode" },
{ "hex.builtin.view.disassembler.arm.cortex_m", "Cortex-M mode" },
{ "hex.builtin.view.disassembler.arm.armv8", "ARMv8 mode" },
{ "hex.view.disassembler.x86.16bit", "16-bit mode" }, { "hex.builtin.view.disassembler.mips.mips32", "MIPS32 mode" },
{ "hex.view.disassembler.x86.32bit", "32-bit mode" }, { "hex.builtin.view.disassembler.mips.mips64", "MIPS64 mode" },
{ "hex.view.disassembler.x86.64bit", "64-bit mode" }, { "hex.builtin.view.disassembler.mips.mips32R6", "MIPS32R6 mode" },
{ "hex.builtin.view.disassembler.mips.micro", "Micro mode" },
{ "hex.view.disassembler.ppc.32bit", "32-bit mode" }, { "hex.builtin.view.disassembler.x86.16bit", "16-bit mode" },
{ "hex.view.disassembler.ppc.64bit", "64-bit mode" }, { "hex.builtin.view.disassembler.x86.32bit", "32-bit mode" },
{ "hex.builtin.view.disassembler.x86.64bit", "64-bit mode" },
{ "hex.view.disassembler.sparc.v9", "Sparc V9 mode" }, { "hex.builtin.view.disassembler.ppc.32bit", "32-bit mode" },
{ "hex.builtin.view.disassembler.ppc.64bit", "64-bit mode" },
{ "hex.view.disassembler.disassemble", "Disassemble" }, { "hex.builtin.view.disassembler.sparc.v9", "Sparc V9 mode" },
{ "hex.view.disassembler.disassembling", "Disassembling..." },
{ "hex.view.disassembler.disassembly.title", "Disassembly" },
{ "hex.view.disassembler.disassembly.address", "Address" },
{ "hex.view.disassembler.disassembly.offset", "Offset" },
{ "hex.view.disassembler.disassembly.bytes", "Byte" },
{ "hex.view.hashes.name", "Hashes" }, { "hex.builtin.view.disassembler.disassemble", "Disassemble" },
{ "hex.view.hashes.settings", "Settings" }, { "hex.builtin.view.disassembler.disassembling", "Disassembling..." },
{ "hex.view.hashes.function", "Hash function" }, { "hex.builtin.view.disassembler.disassembly.title", "Disassembly" },
{ "hex.view.hashes.iv", "Initial value" }, { "hex.builtin.view.disassembler.disassembly.address", "Address" },
{ "hex.view.hashes.xorout", "Final XOR value" }, { "hex.builtin.view.disassembler.disassembly.offset", "Offset" },
{ "hex.builtin.view.disassembler.disassembly.bytes", "Byte" },
{ "hex.builtin.view.hashes.name", "Hashes" },
{ "hex.builtin.view.hashes.settings", "Settings" },
{ "hex.builtin.view.hashes.function", "Hash function" },
{ "hex.builtin.view.hashes.iv", "Initial value" },
{ "hex.builtin.view.hashes.xorout", "Final XOR value" },
{ "hex.common.reflectIn", "Reflect input" }, { "hex.common.reflectIn", "Reflect input" },
{ "hex.common.reflectOut", "Reflect output" }, { "hex.common.reflectOut", "Reflect output" },
{ "hex.view.hashes.poly", "Polynomial" }, { "hex.builtin.view.hashes.poly", "Polynomial" },
{ "hex.view.hashes.result", "Result" }, { "hex.builtin.view.hashes.result", "Result" },
{ "hex.view.help.name", "Help" }, { "hex.builtin.view.help.name", "Help" },
{ "hex.view.help.about.name", "About" }, { "hex.builtin.view.help.about.name", "About" },
{ "hex.view.help.about.translator", "Translated by WerWolv" }, { "hex.builtin.view.help.about.translator", "Translated by WerWolv" },
{ "hex.view.help.about.source", "Source code available on GitHub:" }, { "hex.builtin.view.help.about.source", "Source code available on GitHub:" },
{ "hex.view.help.about.donations", "Donations" }, { "hex.builtin.view.help.about.donations", "Donations" },
{ "hex.view.help.about.thanks", "If you like my work, please consider donating to keep the project going. Thanks a lot <3" }, { "hex.builtin.view.help.about.thanks", "If you like my work, please consider donating to keep the project going. Thanks a lot <3" },
{ "hex.view.help.about.libs", "Libraries used" }, { "hex.builtin.view.help.about.contributor", "Contributors" },
{ "hex.view.help.about.paths", "ImHex Directories" }, { "hex.builtin.view.help.about.libs", "Libraries used" },
{ "hex.view.help.documentation", "ImHex Documentation" }, { "hex.builtin.view.help.about.paths", "ImHex Directories" },
{ "hex.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"}, { "hex.builtin.view.help.documentation", "ImHex Documentation" },
{ "hex.view.help.calc_cheat_sheet", "Calculator Cheat Sheet" }, { "hex.builtin.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
{ "hex.builtin.view.help.calc_cheat_sheet", "Calculator Cheat Sheet" },
{ "hex.view.hexeditor.name", "Hex editor" }, { "hex.builtin.view.hexeditor.name", "Hex editor" },
{ "hex.view.hexeditor.create_file", "New" }, { "hex.builtin.view.hexeditor.create_file", "New" },
{ "hex.view.hexeditor.open_file", "Open" }, { "hex.builtin.view.hexeditor.open_file", "Open" },
{ "hex.view.hexeditor.open_project", "Open Project" }, { "hex.builtin.view.hexeditor.open_project", "Open Project" },
{ "hex.view.hexeditor.save_project", "Save Project" }, { "hex.builtin.view.hexeditor.save_project", "Save Project" },
{ "hex.view.hexeditor.save_data", "Save Data" }, { "hex.builtin.view.hexeditor.save_data", "Save Data" },
{ "hex.view.hexeditor.open_base64", "Open Base64 File" }, { "hex.builtin.view.hexeditor.open_base64", "Open Base64 File" },
{ "hex.view.hexeditor.load_enconding_file", "Load custom encoding File" }, { "hex.builtin.view.hexeditor.load_enconding_file", "Load custom encoding File" },
{ "hex.view.hexeditor.page", "Page {0} / {1}" }, { "hex.builtin.view.hexeditor.page", "Page {0} / {1}" },
{ "hex.view.hexeditor.save_as", "Save As" }, { "hex.builtin.view.hexeditor.save_as", "Save As" },
{ "hex.view.hexeditor.exit_application.title", "Exit Application?" }, { "hex.builtin.view.hexeditor.exit_application.title", "Exit Application?" },
{ "hex.view.hexeditor.exit_application.desc", "You have unsaved changes made to your Project.\nAre you sure you want to exit?" }, { "hex.builtin.view.hexeditor.exit_application.desc", "You have unsaved changes made to your Project.\nAre you sure you want to exit?" },
{ "hex.view.hexeditor.script.title", "Load File with Loader Script" }, { "hex.builtin.view.hexeditor.script.title", "Load File with Loader Script" },
{ "hex.view.hexeditor.script.desc", "Load a file using a Python loader script." }, { "hex.builtin.view.hexeditor.script.desc", "Load a file using a Python loader script." },
{ "hex.view.hexeditor.script.script", "Script" }, { "hex.builtin.view.hexeditor.script.script", "Script" },
{ "hex.view.hexeditor.script.script.title", "Loader Script: Open Script" }, { "hex.builtin.view.hexeditor.script.script.title", "Loader Script: Open Script" },
{ "hex.view.hexeditor.script.file", "File" }, { "hex.builtin.view.hexeditor.script.file", "File" },
{ "hex.view.hexeditor.script.file.title", "Loader Script: Open File" }, { "hex.builtin.view.hexeditor.script.file.title", "Loader Script: Open File" },
{ "hex.view.hexeditor.menu.file.open_file", "Open File..." }, { "hex.builtin.view.hexeditor.menu.file.open_file", "Open File..." },
{ "hex.view.hexeditor.menu.file.open_recent", "Open Recent"}, { "hex.builtin.view.hexeditor.menu.file.open_recent", "Open Recent" },
{ "hex.view.hexeditor.menu.file.save", "Save" }, { "hex.builtin.view.hexeditor.menu.file.open_other", "Open Other..." },
{ "hex.view.hexeditor.menu.file.save_as", "Save As..." }, { "hex.builtin.view.hexeditor.menu.file.save", "Save" },
{ "hex.view.hexeditor.menu.file.close", "Close" }, { "hex.builtin.view.hexeditor.menu.file.save_as", "Save As..." },
{ "hex.view.hexeditor.menu.file.quit", "Quit ImHex" }, { "hex.builtin.view.hexeditor.menu.file.close", "Close" },
{ "hex.view.hexeditor.menu.file.open_project", "Open Project..." }, { "hex.builtin.view.hexeditor.menu.file.quit", "Quit ImHex" },
{ "hex.view.hexeditor.menu.file.save_project", "Save Project..." }, { "hex.builtin.view.hexeditor.menu.file.open_project", "Open Project..." },
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Load custom encoding..." }, { "hex.builtin.view.hexeditor.menu.file.save_project", "Save Project..." },
{ "hex.view.hexeditor.menu.file.import", "Import..." }, { "hex.builtin.view.hexeditor.menu.file.load_encoding_file", "Load custom encoding..." },
{ "hex.view.hexeditor.menu.file.import.base64", "Base64 File" }, { "hex.builtin.view.hexeditor.menu.file.import", "Import..." },
{ "hex.view.hexeditor.base64.import_error", "File is not in a valid Base64 format!" }, { "hex.builtin.view.hexeditor.menu.file.import.base64", "Base64 File" },
{ "hex.view.hexeditor.file_open_error", "Failed to open file!" }, { "hex.builtin.view.hexeditor.base64.import_error", "File is not in a valid Base64 format!" },
{ "hex.view.hexeditor.menu.file.import.ips", "IPS Patch" }, { "hex.builtin.view.hexeditor.file_open_error", "Failed to open file!" },
{ "hex.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" }, { "hex.builtin.view.hexeditor.menu.file.import.ips", "IPS Patch" },
{ "hex.view.hexeditor.menu.file.import.script", "File with Loader Script" }, { "hex.builtin.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" },
{ "hex.builtin.view.hexeditor.menu.file.import.script", "File with Loader Script" },
{ "hex.view.hexeditor.menu.file.export", "Export..." }, { "hex.builtin.view.hexeditor.menu.file.export", "Export..." },
{ "hex.view.hexeditor.menu.file.export.title", "Export File" }, { "hex.builtin.view.hexeditor.menu.file.export.title", "Export File" },
{ "hex.view.hexeditor.menu.file.export.ips", "IPS Patch" }, { "hex.builtin.view.hexeditor.menu.file.export.ips", "IPS Patch" },
{ "hex.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" }, { "hex.builtin.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" },
{ "hex.view.hexeditor.menu.file.search", "Search" }, { "hex.builtin.view.hexeditor.menu.file.search", "Search" },
{ "hex.view.hexeditor.search.string", "String" }, { "hex.builtin.view.hexeditor.search.string", "String" },
{ "hex.view.hexeditor.search.hex", "Hex" }, { "hex.builtin.view.hexeditor.search.hex", "Hex" },
{ "hex.view.hexeditor.search.find", "Find" }, { "hex.builtin.view.hexeditor.search.find", "Find" },
{ "hex.view.hexeditor.search.find_next", "Find next" }, { "hex.builtin.view.hexeditor.search.find_next", "Find next" },
{ "hex.view.hexeditor.search.find_prev", "Find previous" }, { "hex.builtin.view.hexeditor.search.find_prev", "Find previous" },
{ "hex.view.hexeditor.menu.file.goto", "Goto" }, { "hex.builtin.view.hexeditor.menu.file.goto", "Goto" },
{ "hex.view.hexeditor.goto.offset.absolute", "Absolute" }, { "hex.builtin.view.hexeditor.goto.offset.absolute", "Absolute" },
{ "hex.view.hexeditor.goto.offset.current", "Current" }, { "hex.builtin.view.hexeditor.goto.offset.current", "Current" },
{ "hex.view.hexeditor.goto.offset.begin", "Begin" }, { "hex.builtin.view.hexeditor.goto.offset.begin", "Begin" },
{ "hex.view.hexeditor.goto.offset.end", "End" }, { "hex.builtin.view.hexeditor.goto.offset.end", "End" },
{ "hex.view.hexeditor.error.read_only", "Couldn't get write access. File opened in read-only mode." }, { "hex.builtin.view.hexeditor.error.read_only", "Couldn't get write access. File opened in read-only mode." },
{ "hex.view.hexeditor.error.open", "Failed to open file!" }, { "hex.builtin.view.hexeditor.error.open", "Failed to open file!" },
{ "hex.view.hexeditor.error.create", "Failed to create new file!" }, { "hex.builtin.view.hexeditor.error.create", "Failed to create new file!" },
{ "hex.view.hexeditor.menu.edit.undo", "Undo" }, { "hex.builtin.view.hexeditor.menu.edit.undo", "Undo" },
{ "hex.view.hexeditor.menu.edit.redo", "Redo" }, { "hex.builtin.view.hexeditor.menu.edit.redo", "Redo" },
{ "hex.view.hexeditor.menu.edit.copy", "Copy" }, { "hex.builtin.view.hexeditor.menu.edit.copy", "Copy" },
{ "hex.view.hexeditor.menu.edit.copy_as", "Copy as..." }, { "hex.builtin.view.hexeditor.menu.edit.copy_as", "Copy as..." },
{ "hex.view.hexeditor.copy.hex", "String" }, { "hex.builtin.view.hexeditor.copy.hex", "String" },
{ "hex.view.hexeditor.copy.c", "C Array" }, { "hex.builtin.view.hexeditor.copy.c", "C Array" },
{ "hex.view.hexeditor.copy.cpp", "C++ Array" }, { "hex.builtin.view.hexeditor.copy.cpp", "C++ Array" },
{ "hex.view.hexeditor.copy.csharp", "C# Array" }, { "hex.builtin.view.hexeditor.copy.csharp", "C# Array" },
{ "hex.view.hexeditor.copy.rust", "Rust Array" }, { "hex.builtin.view.hexeditor.copy.rust", "Rust Array" },
{ "hex.view.hexeditor.copy.python", "Python Array" }, { "hex.builtin.view.hexeditor.copy.python", "Python Array" },
{ "hex.view.hexeditor.copy.java", "Java Array" }, { "hex.builtin.view.hexeditor.copy.java", "Java Array" },
{ "hex.view.hexeditor.copy.js", "JavaScript Array" }, { "hex.builtin.view.hexeditor.copy.js", "JavaScript Array" },
{ "hex.view.hexeditor.copy.ascii", "ASCII Art" }, { "hex.builtin.view.hexeditor.copy.ascii", "ASCII Art" },
{ "hex.view.hexeditor.copy.html", "HTML" }, { "hex.builtin.view.hexeditor.copy.html", "HTML" },
{ "hex.view.hexeditor.menu.edit.paste", "Paste" }, { "hex.builtin.view.hexeditor.menu.edit.paste", "Paste" },
{ "hex.view.hexeditor.menu.edit.select_all", "Select all" }, { "hex.builtin.view.hexeditor.menu.edit.select_all", "Select all" },
{ "hex.view.hexeditor.menu.edit.bookmark", "Create bookmark" }, { "hex.builtin.view.hexeditor.menu.edit.bookmark", "Create bookmark" },
{ "hex.view.hexeditor.menu.edit.set_base", "Set base address" }, { "hex.builtin.view.hexeditor.menu.edit.set_base", "Set base address" },
{ "hex.view.hexeditor.menu.edit.resize", "Resize" }, { "hex.builtin.view.hexeditor.menu.edit.resize", "Resize" },
{ "hex.view.information.name", "Data Information" }, { "hex.builtin.view.information.name", "Data Information" },
{ "hex.view.information.control", "Control" }, { "hex.builtin.view.information.control", "Control" },
{ "hex.view.information.analyze", "Analyze page" }, { "hex.builtin.view.information.analyze", "Analyze page" },
{ "hex.view.information.analyzing", "Analyzing..." }, { "hex.builtin.view.information.analyzing", "Analyzing..." },
{ "hex.view.information.region", "Analyzed region" }, { "hex.builtin.view.information.region", "Analyzed region" },
{ "hex.view.information.magic", "Magic information" }, { "hex.builtin.view.information.magic", "Magic information" },
{ "hex.view.information.description", "Description:" }, { "hex.builtin.view.information.description", "Description:" },
{ "hex.view.information.mime", "MIME Type:" }, { "hex.builtin.view.information.mime", "MIME Type:" },
{ "hex.view.information.info_analysis", "Information analysis" }, { "hex.builtin.view.information.info_analysis", "Information analysis" },
{ "hex.view.information.distribution", "Byte distribution" }, { "hex.builtin.view.information.distribution", "Byte distribution" },
{ "hex.view.information.entropy", "Entropy" }, { "hex.builtin.view.information.entropy", "Entropy" },
{ "hex.view.information.block_size", "Block size" }, { "hex.builtin.view.information.block_size", "Block size" },
{ "hex.view.information.block_size.desc", "{0} blocks of {1} bytes" }, { "hex.builtin.view.information.block_size.desc", "{0} blocks of {1} bytes" },
{ "hex.view.information.file_entropy", "File entropy" }, { "hex.builtin.view.information.file_entropy", "File entropy" },
{ "hex.view.information.highest_entropy", "Highest entropy block" }, { "hex.builtin.view.information.highest_entropy", "Highest entropy block" },
{ "hex.view.information.encrypted", "This data is most likely encrypted or compressed!" }, { "hex.builtin.view.information.encrypted", "This data is most likely encrypted or compressed!" },
{ "hex.view.patches.name", "Patches" }, { "hex.builtin.view.patches.name", "Patches" },
{ "hex.view.patches.offset", "Offset" }, { "hex.builtin.view.patches.offset", "Offset" },
{ "hex.view.patches.orig", "Original value" }, { "hex.builtin.view.patches.orig", "Original value" },
{ "hex.view.patches.patch", "Patched value"}, { "hex.builtin.view.patches.patch", "Patched value"},
{ "hex.view.patches.remove", "Remove patch" }, { "hex.builtin.view.patches.remove", "Remove patch" },
{ "hex.view.pattern.name", "Pattern editor" }, { "hex.builtin.view.pattern_editor.name", "Pattern editor" },
{ "hex.view.pattern.accept_pattern", "Accept pattern" }, { "hex.builtin.view.pattern_editor.accept_pattern", "Accept pattern" },
{ "hex.view.pattern.accept_pattern.desc", "One or more pattern_language compatible with this data type has been found" }, { "hex.builtin.view.pattern_editor.accept_pattern.desc", "One or more pattern_language compatible with this data type has been found" },
{ "hex.view.pattern.accept_pattern.pattern_language", "Patterns" }, { "hex.builtin.view.pattern_editor.accept_pattern.pattern_language", "Patterns" },
{ "hex.view.pattern.accept_pattern.question", "Do you want to apply the selected pattern?" }, { "hex.builtin.view.pattern_editor.accept_pattern.question", "Do you want to apply the selected pattern?" },
{ "hex.view.pattern.menu.file.load_pattern", "Load pattern..." }, { "hex.builtin.view.pattern_editor.menu.file.load_pattern", "Load pattern..." },
{ "hex.view.pattern.open_pattern", "Open pattern" }, { "hex.builtin.view.pattern_editor.menu.file.save_pattern", "Save pattern..." },
{ "hex.view.pattern.evaluating", "Evaluating..." }, { "hex.builtin.view.pattern_editor.open_pattern", "Open pattern" },
{ "hex.view.pattern.auto", "Auto evaluate" }, { "hex.builtin.view.pattern_editor.evaluating", "Evaluating..." },
{ "hex.builtin.view.pattern_editor.auto", "Auto evaluate" },
{ "hex.builtin.view.pattern_editor.env_vars", "Environment Variables" },
{ "hex.view.pattern_data.name", "Pattern Data" }, { "hex.builtin.view.pattern_data.name", "Pattern Data" },
{ "hex.view.pattern_data.var_name", "Name" }, { "hex.builtin.view.pattern_data.var_name", "Name" },
{ "hex.view.pattern_data.color", "Color" }, { "hex.builtin.view.pattern_data.color", "Color" },
{ "hex.view.pattern_data.offset", "Offset" }, { "hex.builtin.view.pattern_data.offset", "Offset" },
{ "hex.view.pattern_data.size", "Size" }, { "hex.builtin.view.pattern_data.size", "Size" },
{ "hex.view.pattern_data.type", "Type" }, { "hex.builtin.view.pattern_data.type", "Type" },
{ "hex.view.pattern_data.value", "Value" }, { "hex.builtin.view.pattern_data.value", "Value" },
{ "hex.view.settings.name", "Settings" }, { "hex.builtin.view.settings.name", "Settings" },
{ "hex.view.strings.name", "Strings" }, { "hex.builtin.view.strings.name", "Strings" },
{ "hex.view.strings.copy", "Copy string" }, { "hex.builtin.view.strings.copy", "Copy string" },
{ "hex.view.strings.demangle", "Demangle" }, { "hex.builtin.view.strings.demangle", "Demangle" },
{ "hex.view.strings.min_length", "Minimum length" }, { "hex.builtin.view.strings.min_length", "Minimum length" },
{ "hex.view.strings.filter", "Filter" }, { "hex.builtin.view.strings.filter", "Filter" },
{ "hex.view.strings.extract", "Extract" }, { "hex.builtin.view.strings.extract", "Extract" },
{ "hex.view.strings.regex_error", "Invalid regex" }, { "hex.builtin.view.strings.regex_error", "Invalid regex" },
{ "hex.view.strings.searching", "Searching..." }, { "hex.builtin.view.strings.results", "Found {0} occurrences" },
{ "hex.view.strings.offset", "Offset" }, { "hex.builtin.view.strings.searching", "Searching..." },
{ "hex.view.strings.size", "Size" }, { "hex.builtin.view.strings.offset", "Offset" },
{ "hex.view.strings.string", "String" }, { "hex.builtin.view.strings.size", "Size" },
{ "hex.view.strings.demangle.title", "Demangled name" }, { "hex.builtin.view.strings.string", "String" },
{ "hex.view.strings.demangle.copy", "Copy" }, { "hex.builtin.view.strings.demangle.title", "Demangled name" },
{ "hex.builtin.view.strings.demangle.copy", "Copy" },
{ "hex.view.tools.name", "Tools" }, { "hex.builtin.view.tools.name", "Tools" },
{ "hex.view.yara.name", "Yara Rules" }, { "hex.builtin.view.yara.name", "Yara Rules" },
{ "hex.view.yara.header.rules", "Rules" }, { "hex.builtin.view.yara.header.rules", "Rules" },
{ "hex.view.yara.reload", "Reload" }, { "hex.builtin.view.yara.reload", "Reload" },
{ "hex.view.yara.match", "Match Rules" }, { "hex.builtin.view.yara.match", "Match Rules" },
{ "hex.view.yara.matching", "Matching..." }, { "hex.builtin.view.yara.matching", "Matching..." },
{ "hex.view.yara.error", "Yara Compiler error: " }, { "hex.builtin.view.yara.error", "Yara Compiler error: " },
{ "hex.view.yara.header.matches", "Matches" }, { "hex.builtin.view.yara.header.matches", "Matches" },
{ "hex.view.yara.matches.identifier", "Identifier" }, { "hex.builtin.view.yara.matches.identifier", "Identifier" },
{ "hex.view.yara.matches.variable", "Variable" }, { "hex.builtin.view.yara.matches.variable", "Variable" },
{ "hex.view.yara.whole_data", "Whole file matches!" }, { "hex.builtin.view.yara.whole_data", "Whole file matches!" },
{ "hex.view.yara.no_rules", "No YARA rules found. Put them in ImHex's 'yara' folder" }, { "hex.builtin.view.yara.no_rules", "No YARA rules found. Put them in ImHex's 'yara' folder" },
{ "hex.view.constants.name", "Constants" }, { "hex.builtin.view.constants.name", "Constants" },
{ "hex.view.constants.row.category", "Category" }, { "hex.builtin.view.constants.row.category", "Category" },
{ "hex.view.constants.row.name", "Name" }, { "hex.builtin.view.constants.row.name", "Name" },
{ "hex.view.constants.row.desc", "Description" }, { "hex.builtin.view.constants.row.desc", "Description" },
{ "hex.view.constants.row.value", "Value" }, { "hex.builtin.view.constants.row.value", "Value" },
{ "hex.view.store.name", "Content Store" }, { "hex.builtin.view.store.name", "Content Store" },
{ "hex.view.store.desc", "Download new content from ImHex's online database" }, { "hex.builtin.view.store.desc", "Download new content from ImHex's online database" },
{ "hex.view.store.reload", "Reload" }, { "hex.builtin.view.store.reload", "Reload" },
{ "hex.view.store.row.name", "Name" }, { "hex.builtin.view.store.row.name", "Name" },
{ "hex.view.store.row.description", "Description" }, { "hex.builtin.view.store.row.description", "Description" },
{ "hex.view.store.download", "Download" }, { "hex.builtin.view.store.download", "Download" },
{ "hex.view.store.update", "Update" }, { "hex.builtin.view.store.update", "Update" },
{ "hex.view.store.remove", "Remove" }, { "hex.builtin.view.store.remove", "Remove" },
{ "hex.view.store.tab.patterns", "Patterns" }, { "hex.builtin.view.store.tab.patterns", "Patterns" },
{ "hex.view.store.tab.libraries", "Libraries" }, { "hex.builtin.view.store.tab.libraries", "Libraries" },
{ "hex.view.store.tab.magics", "Magic Files" }, { "hex.builtin.view.store.tab.magics", "Magic Files" },
{ "hex.view.store.tab.constants", "Constants" }, { "hex.builtin.view.store.tab.constants", "Constants" },
{ "hex.view.store.tab.yara", "Yara Rules" }, { "hex.builtin.view.store.tab.yara", "Yara Rules" },
{ "hex.view.store.loading", "Loading store content..." }, { "hex.builtin.view.store.loading", "Loading store content..." },
{ "hex.view.diff.name", "Diffing" }, { "hex.builtin.view.diff.name", "Diffing" },
{ "hex.builtin.view.provider_settings.name", "Provider Settings" },
/* Builtin plugin features */ { "hex.builtin.view.provider_settings.load_popup", "Open Provider" },
{ "hex.builtin.command.calc.desc", "Calculator" }, { "hex.builtin.command.calc.desc", "Calculator" },
{ "hex.builtin.command.cmd.desc", "Command" }, { "hex.builtin.command.cmd.desc", "Command" },
@@ -668,6 +676,18 @@ namespace hex::plugin::builtin {
{ "hex.builtin.provider.file.creation", "Creation time" }, { "hex.builtin.provider.file.creation", "Creation time" },
{ "hex.builtin.provider.file.access", "Last access time" }, { "hex.builtin.provider.file.access", "Last access time" },
{ "hex.builtin.provider.file.modification", "Last modification time" }, { "hex.builtin.provider.file.modification", "Last modification time" },
{ "hex.builtin.provider.file", "File Provider" },
{ "hex.builtin.provider.gdb", "GDB Server Provider" },
{ "hex.builtin.provider.gdb.name", "GDB Server <{0}:{1}>" },
{ "hex.builtin.provider.gdb.server", "Server" },
{ "hex.builtin.provider.gdb.ip", "IP Address" },
{ "hex.builtin.provider.gdb.port", "Port" },
{ "hex.builtin.provider.disk", "Raw Disk Provider" },
{ "hex.builtin.provider.disk.selected_disk", "Disk" },
{ "hex.builtin.provider.disk.disk_size", "Disk Size" },
{ "hex.builtin.provider.disk.sector_size", "Sector Size" },
{ "hex.builtin.provider.disk.reload", "Reload" },
}); });
} }

View File

@@ -23,6 +23,7 @@ namespace hex::plugin::builtin {
{ "hex.welcome.start.open_file", "Apri un File" }, { "hex.welcome.start.open_file", "Apri un File" },
{ "hex.welcome.start.open_project", "Apri un Progetto" }, { "hex.welcome.start.open_project", "Apri un Progetto" },
{ "hex.welcome.start.recent", "File recenti" }, { "hex.welcome.start.recent", "File recenti" },
//{ "hex.welcome.start.open_other", "Other Providers" },
{ "hex.welcome.header.help", "Aiuto" }, { "hex.welcome.header.help", "Aiuto" },
{ "hex.welcome.help.repo", "Repo GitHub" }, { "hex.welcome.help.repo", "Repo GitHub" },
{ "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" }, { "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" },
@@ -85,248 +86,255 @@ namespace hex::plugin::builtin {
//{ "hex.message.yara_rule_added", "Yara rule added!" }, //{ "hex.message.yara_rule_added", "Yara rule added!" },
//{ "hex.message.magic_db_added", "Magic database added!" }, //{ "hex.message.magic_db_added", "Magic database added!" },
{ "hex.view.bookmarks.name", "Segnalibri" }, /* Builtin plugin features */
{ "hex.view.bookmarks.default_title", "Segnalibro [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "Non è stato creato alcun segnalibro. Aggiungine uno andando su Modifica -> Crea Segnalibro" },
{ "hex.view.bookmarks.title.info", "Informazioni" },
{ "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" },
{ "hex.view.bookmarks.button.jump", "Vai a" },
{ "hex.view.bookmarks.button.remove", "Rimuovi" },
{ "hex.view.bookmarks.header.name", "Nome" },
{ "hex.view.bookmarks.header.color", "Colore" },
{ "hex.view.bookmarks.header.comment", "Commento" },
{ "hex.view.command_palette.name", "Tavola dei Comandi" }, { "hex.builtin.view.bookmarks.name", "Segnalibri" },
{ "hex.builtin.view.bookmarks.default_title", "Segnalibro [0x{0:X} - 0x{1:X}]" },
{ "hex.builtin.view.bookmarks.no_bookmarks", "Non è stato creato alcun segnalibro. Aggiungine uno andando su Modifica -> Crea Segnalibro" },
{ "hex.builtin.view.bookmarks.title.info", "Informazioni" },
{ "hex.builtin.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" },
{ "hex.builtin.view.bookmarks.button.jump", "Vai a" },
{ "hex.builtin.view.bookmarks.button.remove", "Rimuovi" },
{ "hex.builtin.view.bookmarks.header.name", "Nome" },
{ "hex.builtin.view.bookmarks.header.color", "Colore" },
{ "hex.builtin.view.bookmarks.header.comment", "Commento" },
{ "hex.view.data_inspector.name", "Ispezione Dati" }, { "hex.builtin.view.command_palette.name", "Tavola dei Comandi" },
{ "hex.view.data_inspector.table.name", "Nome" },
{ "hex.view.data_inspector.table.value", "Valore" }, { "hex.builtin.view.data_inspector.name", "Ispezione Dati" },
//{ "hex.view.data_inspector.no_data", "No bytes selected"}, { "hex.builtin.view.data_inspector.table.name", "Nome" },
{ "hex.builtin.view.data_inspector.table.value", "Valore" },
//{ "hex.builtin.view.data_inspector.no_data", "No bytes selected"},
{ "hex.view.data_processor.name", "Processa Dati" }, { "hex.builtin.view.data_processor.name", "Processa Dati" },
{ "hex.view.data_processor.menu.remove_selection", "Rimuovi i selezionati" }, { "hex.builtin.view.data_processor.menu.remove_selection", "Rimuovi i selezionati" },
{ "hex.view.data_processor.menu.remove_node", "Rimuovi Nodo" }, { "hex.builtin.view.data_processor.menu.remove_node", "Rimuovi Nodo" },
{ "hex.view.data_processor.menu.remove_link", "Rimuovi Link" }, { "hex.builtin.view.data_processor.menu.remove_link", "Rimuovi Link" },
{ "hex.view.disassembler.name", "Disassembla" }, { "hex.builtin.view.disassembler.name", "Disassembla" },
{ "hex.view.disassembler.position", "Posiziona" }, { "hex.builtin.view.disassembler.position", "Posiziona" },
{ "hex.view.disassembler.base", "Indirizzo di base" }, { "hex.builtin.view.disassembler.base", "Indirizzo di base" },
{ "hex.view.disassembler.region", "Regione del Codice" }, { "hex.builtin.view.disassembler.region", "Regione del Codice" },
{ "hex.view.disassembler.settings.header", "Impostazioni" }, { "hex.builtin.view.disassembler.settings.header", "Impostazioni" },
{ "hex.view.disassembler.arch", "Architettura" }, { "hex.builtin.view.disassembler.arch", "Architettura" },
{ "hex.view.disassembler.arm.arm", "Modalità ARM" }, { "hex.builtin.view.disassembler.arm.arm", "Modalità ARM" },
{ "hex.view.disassembler.arm.thumb", "Modalità Thumb" }, { "hex.builtin.view.disassembler.arm.thumb", "Modalità Thumb" },
{ "hex.view.disassembler.arm.default", "Modalità di Default" }, { "hex.builtin.view.disassembler.arm.default", "Modalità di Default" },
{ "hex.view.disassembler.arm.cortex_m", "Modalità Cortex-M" }, { "hex.builtin.view.disassembler.arm.cortex_m", "Modalità Cortex-M" },
{ "hex.view.disassembler.arm.armv8", "Modalità ARMv8" }, { "hex.builtin.view.disassembler.arm.armv8", "Modalità ARMv8" },
{ "hex.view.disassembler.mips.mips32", "Modalità MIPS32" }, { "hex.builtin.view.disassembler.mips.mips32", "Modalità MIPS32" },
{ "hex.view.disassembler.mips.mips64", "Modalità MIPS64" }, { "hex.builtin.view.disassembler.mips.mips64", "Modalità MIPS64" },
{ "hex.view.disassembler.mips.mips32R6", "Modalità MIPS32R6" }, { "hex.builtin.view.disassembler.mips.mips32R6", "Modalità MIPS32R6" },
{ "hex.view.disassembler.mips.micro", "Modalità Micro" }, { "hex.builtin.view.disassembler.mips.micro", "Modalità Micro" },
{ "hex.view.disassembler.x86.16bit", "Modalità 16-bit" }, { "hex.builtin.view.disassembler.x86.16bit", "Modalità 16-bit" },
{ "hex.view.disassembler.x86.32bit", "Modalità 32-bit" }, { "hex.builtin.view.disassembler.x86.32bit", "Modalità 32-bit" },
{ "hex.view.disassembler.x86.64bit", "Modalità 64-bit" }, { "hex.builtin.view.disassembler.x86.64bit", "Modalità 64-bit" },
{ "hex.view.disassembler.ppc.32bit", "Modalità 32-bit" }, { "hex.builtin.view.disassembler.ppc.32bit", "Modalità 32-bit" },
{ "hex.view.disassembler.ppc.64bit", "Modalità 64-bit" }, { "hex.builtin.view.disassembler.ppc.64bit", "Modalità 64-bit" },
{ "hex.view.disassembler.sparc.v9", "Modalità Sparc V9" }, { "hex.builtin.view.disassembler.sparc.v9", "Modalità Sparc V9" },
{ "hex.view.disassembler.disassemble", "Disassembla" }, { "hex.builtin.view.disassembler.disassemble", "Disassembla" },
{ "hex.view.disassembler.disassembling", "Disassemblaggio..." }, { "hex.builtin.view.disassembler.disassembling", "Disassemblaggio..." },
{ "hex.view.disassembler.disassembly.title", "Disassembla" }, { "hex.builtin.view.disassembler.disassembly.title", "Disassembla" },
{ "hex.view.disassembler.disassembly.address", "Indirizzo" }, { "hex.builtin.view.disassembler.disassembly.address", "Indirizzo" },
{ "hex.view.disassembler.disassembly.offset", "Offset" }, { "hex.builtin.view.disassembler.disassembly.offset", "Offset" },
{ "hex.view.disassembler.disassembly.bytes", "Byte" }, { "hex.builtin.view.disassembler.disassembly.bytes", "Byte" },
{ "hex.view.hashes.name", "Hash" }, { "hex.builtin.view.hashes.name", "Hash" },
{ "hex.view.hashes.settings", "Impostazioni" }, { "hex.builtin.view.hashes.settings", "Impostazioni" },
{ "hex.view.hashes.function", "Funzioni di Hash" }, { "hex.builtin.view.hashes.function", "Funzioni di Hash" },
{ "hex.view.hashes.iv", "Valore Iniziale" }, { "hex.builtin.view.hashes.iv", "Valore Iniziale" },
{ "hex.view.hashes.poly", "Polinomio" }, { "hex.builtin.view.hashes.poly", "Polinomio" },
{ "hex.view.hashes.result", "Risultato" }, { "hex.builtin.view.hashes.result", "Risultato" },
{ "hex.view.help.name", "Aiuto" }, { "hex.builtin.view.help.name", "Aiuto" },
{ "hex.view.help.about.name", "Riguardo ImHex" }, { "hex.builtin.view.help.about.name", "Riguardo ImHex" },
{ "hex.view.help.about.translator", "Tradotto da CrustySeanPro" }, { "hex.builtin.view.help.about.translator", "Tradotto da CrustySeanPro" },
{ "hex.view.help.about.source", "Codice Sorgente disponibile su GitHub:" }, { "hex.builtin.view.help.about.source", "Codice Sorgente disponibile su GitHub:" },
{ "hex.view.help.about.donations", "Donazioni" }, { "hex.builtin.view.help.about.donations", "Donazioni" },
{ "hex.view.help.about.thanks", "Se ti piace il mio lavoro, per favore considera di fare una donazione. Grazie mille <3" }, { "hex.builtin.view.help.about.thanks", "Se ti piace il mio lavoro, per favore considera di fare una donazione. Grazie mille <3" },
{ "hex.view.help.about.libs", "Librerie usate" }, //{ "hex.builtin.view.help.about.contributor", "Contributors" },
{ "hex.view.help.about.paths", "ImHex cartelle" }, { "hex.builtin.view.help.about.libs", "Librerie usate" },
{ "hex.view.help.documentation", "Documentazione di ImHex" }, { "hex.builtin.view.help.about.paths", "ImHex cartelle" },
{ "hex.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"}, { "hex.builtin.view.help.documentation", "Documentazione di ImHex" },
{ "hex.view.help.calc_cheat_sheet", "Calcolatrice Cheat Sheet" }, { "hex.builtin.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
{ "hex.builtin.view.help.calc_cheat_sheet", "Calcolatrice Cheat Sheet" },
{ "hex.view.hexeditor.name", "Hex editor" }, { "hex.builtin.view.hexeditor.name", "Hex editor" },
{ "hex.view.hexeditor.create_file", "Nuovo" }, { "hex.builtin.view.hexeditor.create_file", "Nuovo" },
{ "hex.view.hexeditor.open_file", "Apri" }, { "hex.builtin.view.hexeditor.open_file", "Apri" },
{ "hex.view.hexeditor.menu.file.open_recent", "File recenti" }, { "hex.builtin.view.hexeditor.menu.file.open_recent", "File recenti" },
{ "hex.view.hexeditor.open_project", "Apri i Progetti" }, //{ "hex.builtin.view.hexeditor.menu.file.open_other", "Open Other..." },
{ "hex.view.hexeditor.save_project", "Salva i Progetti" }, { "hex.builtin.view.hexeditor.open_project", "Apri i Progetti" },
{ "hex.view.hexeditor.save_data", "Salva i Dati" }, { "hex.builtin.view.hexeditor.save_project", "Salva i Progetti" },
{ "hex.view.hexeditor.open_base64", "Apri Base64 File" }, { "hex.builtin.view.hexeditor.save_data", "Salva i Dati" },
{ "hex.view.hexeditor.load_enconding_file", "Carica un File di codfica personalizzato" }, { "hex.builtin.view.hexeditor.open_base64", "Apri Base64 File" },
{ "hex.view.hexeditor.page", "Pagina {0} / {1}" }, { "hex.builtin.view.hexeditor.load_enconding_file", "Carica un File di codfica personalizzato" },
{ "hex.view.hexeditor.save_as", "Salva come" }, { "hex.builtin.view.hexeditor.page", "Pagina {0} / {1}" },
{ "hex.view.hexeditor.exit_application.title", "Uscire dall'applicazione?" }, { "hex.builtin.view.hexeditor.save_as", "Salva come" },
{ "hex.view.hexeditor.exit_application.desc", "Hai delle modifiche non salvate nel tuo progetto.\nSei sicuro di voler uscire?" }, { "hex.builtin.view.hexeditor.exit_application.title", "Uscire dall'applicazione?" },
{ "hex.view.hexeditor.script.title", "Carica un File tramite il Caricatore di Script" }, { "hex.builtin.view.hexeditor.exit_application.desc", "Hai delle modifiche non salvate nel tuo progetto.\nSei sicuro di voler uscire?" },
{ "hex.view.hexeditor.script.desc", "Carica un file tramite il Caricatore di Script di Python." }, { "hex.builtin.view.hexeditor.script.title", "Carica un File tramite il Caricatore di Script" },
{ "hex.view.hexeditor.script.script", "Script" }, { "hex.builtin.view.hexeditor.script.desc", "Carica un file tramite il Caricatore di Script di Python." },
{ "hex.view.hexeditor.script.script.title", "Caricatore Script: Apri Script" }, { "hex.builtin.view.hexeditor.script.script", "Script" },
{ "hex.view.hexeditor.script.file", "File" }, { "hex.builtin.view.hexeditor.script.script.title", "Caricatore Script: Apri Script" },
{ "hex.view.hexeditor.script.file.title", "Caricatore Script: Apri File" }, { "hex.builtin.view.hexeditor.script.file", "File" },
{ "hex.builtin.view.hexeditor.script.file.title", "Caricatore Script: Apri File" },
{ "hex.view.hexeditor.menu.file.open_file", "Apri File..." }, { "hex.builtin.view.hexeditor.menu.file.open_file", "Apri File..." },
{ "hex.view.hexeditor.menu.file.save", "Salva" }, { "hex.builtin.view.hexeditor.menu.file.save", "Salva" },
{ "hex.view.hexeditor.menu.file.save_as", "Salva come..." }, { "hex.builtin.view.hexeditor.menu.file.save_as", "Salva come..." },
{ "hex.view.hexeditor.menu.file.close", "Chiudi" }, { "hex.builtin.view.hexeditor.menu.file.close", "Chiudi" },
{ "hex.view.hexeditor.menu.file.quit", "Uscita ImHex" }, { "hex.builtin.view.hexeditor.menu.file.quit", "Uscita ImHex" },
{ "hex.view.hexeditor.menu.file.open_project", "Apri un Progetto..." }, { "hex.builtin.view.hexeditor.menu.file.open_project", "Apri un Progetto..." },
{ "hex.view.hexeditor.menu.file.save_project", "Salva Progetto..." }, { "hex.builtin.view.hexeditor.menu.file.save_project", "Salva Progetto..." },
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Carica una codifica personalizzata..." }, { "hex.builtin.view.hexeditor.menu.file.load_encoding_file", "Carica una codifica personalizzata..." },
{ "hex.view.hexeditor.menu.file.import", "Importa..." }, { "hex.builtin.view.hexeditor.menu.file.import", "Importa..." },
{ "hex.view.hexeditor.menu.file.import.base64", "Base64 File" }, { "hex.builtin.view.hexeditor.menu.file.import.base64", "Base64 File" },
{ "hex.view.hexeditor.base64.import_error", "Il file non è in un formato bas64 corretto!" }, { "hex.builtin.view.hexeditor.base64.import_error", "Il file non è in un formato bas64 corretto!" },
{ "hex.view.hexeditor.file_open_error", "Impossibile aprire il File!" }, { "hex.builtin.view.hexeditor.file_open_error", "Impossibile aprire il File!" },
{ "hex.view.hexeditor.menu.file.import.ips", "IPS Patch" }, { "hex.builtin.view.hexeditor.menu.file.import.ips", "IPS Patch" },
{ "hex.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" }, { "hex.builtin.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" },
{ "hex.view.hexeditor.menu.file.import.script", "File con il Caricatore di Script" }, { "hex.builtin.view.hexeditor.menu.file.import.script", "File con il Caricatore di Script" },
{ "hex.view.hexeditor.menu.file.export", "Esporta..." }, { "hex.builtin.view.hexeditor.menu.file.export", "Esporta..." },
{ "hex.view.hexeditor.menu.file.export.title", "Esporta File" }, { "hex.builtin.view.hexeditor.menu.file.export.title", "Esporta File" },
{ "hex.view.hexeditor.menu.file.export.ips", "IPS Patch" }, { "hex.builtin.view.hexeditor.menu.file.export.ips", "IPS Patch" },
{ "hex.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" }, { "hex.builtin.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" },
{ "hex.view.hexeditor.menu.file.search", "Cerca" }, { "hex.builtin.view.hexeditor.menu.file.search", "Cerca" },
{ "hex.view.hexeditor.search.string", "Stringa" }, { "hex.builtin.view.hexeditor.search.string", "Stringa" },
{ "hex.view.hexeditor.search.hex", "Hex" }, { "hex.builtin.view.hexeditor.search.hex", "Hex" },
{ "hex.view.hexeditor.search.find", "Cerca" }, { "hex.builtin.view.hexeditor.search.find", "Cerca" },
{ "hex.view.hexeditor.search.find_next", "Cerca il prossimo" }, { "hex.builtin.view.hexeditor.search.find_next", "Cerca il prossimo" },
{ "hex.view.hexeditor.search.find_prev", "Cerca il precedente" }, { "hex.builtin.view.hexeditor.search.find_prev", "Cerca il precedente" },
{ "hex.view.hexeditor.menu.file.goto", "Vai a" }, { "hex.builtin.view.hexeditor.menu.file.goto", "Vai a" },
{ "hex.view.hexeditor.goto.offset.absolute", "Assoluto" }, { "hex.builtin.view.hexeditor.goto.offset.absolute", "Assoluto" },
{ "hex.view.hexeditor.goto.offset.current", "Corrente" }, { "hex.builtin.view.hexeditor.goto.offset.current", "Corrente" },
{ "hex.view.hexeditor.goto.offset.begin", "Inizo" }, { "hex.builtin.view.hexeditor.goto.offset.begin", "Inizo" },
{ "hex.view.hexeditor.goto.offset.end", "Fine" }, { "hex.builtin.view.hexeditor.goto.offset.end", "Fine" },
{ "hex.view.hexeditor.error.read_only", "Impossibile scrivere sul File. File aperto solo in modalità lettura" }, { "hex.builtin.view.hexeditor.error.read_only", "Impossibile scrivere sul File. File aperto solo in modalità lettura" },
{ "hex.view.hexeditor.error.open", "Impossibile aprire il File!" }, { "hex.builtin.view.hexeditor.error.open", "Impossibile aprire il File!" },
{ "hex.view.hexeditor.error.create", "Impossibile creare il nuovo File!" }, { "hex.builtin.view.hexeditor.error.create", "Impossibile creare il nuovo File!" },
{ "hex.view.hexeditor.menu.edit.undo", "Annulla" }, { "hex.builtin.view.hexeditor.menu.edit.undo", "Annulla" },
{ "hex.view.hexeditor.menu.edit.redo", "Ripeti" }, { "hex.builtin.view.hexeditor.menu.edit.redo", "Ripeti" },
{ "hex.view.hexeditor.menu.edit.copy", "Copia" }, { "hex.builtin.view.hexeditor.menu.edit.copy", "Copia" },
{ "hex.view.hexeditor.menu.edit.copy_as", "Copia come..." }, { "hex.builtin.view.hexeditor.menu.edit.copy_as", "Copia come..." },
{ "hex.view.hexeditor.copy.hex", "Stringa" }, { "hex.builtin.view.hexeditor.copy.hex", "Stringa" },
{ "hex.view.hexeditor.copy.c", "C Array" }, { "hex.builtin.view.hexeditor.copy.c", "C Array" },
{ "hex.view.hexeditor.copy.cpp", "C++ Array" }, { "hex.builtin.view.hexeditor.copy.cpp", "C++ Array" },
{ "hex.view.hexeditor.copy.csharp", "C# Array" }, { "hex.builtin.view.hexeditor.copy.csharp", "C# Array" },
{ "hex.view.hexeditor.copy.rust", "Rust Array" }, { "hex.builtin.view.hexeditor.copy.rust", "Rust Array" },
{ "hex.view.hexeditor.copy.python", "Python Array" }, { "hex.builtin.view.hexeditor.copy.python", "Python Array" },
{ "hex.view.hexeditor.copy.java", "Java Array" }, { "hex.builtin.view.hexeditor.copy.java", "Java Array" },
{ "hex.view.hexeditor.copy.js", "JavaScript Array" }, { "hex.builtin.view.hexeditor.copy.js", "JavaScript Array" },
{ "hex.view.hexeditor.copy.ascii", "ASCII Art" }, { "hex.builtin.view.hexeditor.copy.ascii", "ASCII Art" },
{ "hex.view.hexeditor.copy.html", "HTML" }, { "hex.builtin.view.hexeditor.copy.html", "HTML" },
{ "hex.view.hexeditor.menu.edit.paste", "Incolla" }, { "hex.builtin.view.hexeditor.menu.edit.paste", "Incolla" },
{ "hex.view.hexeditor.menu.edit.select_all", "Seleziona tutti" }, { "hex.builtin.view.hexeditor.menu.edit.select_all", "Seleziona tutti" },
{ "hex.view.hexeditor.menu.edit.bookmark", "Crea segnalibro" }, { "hex.builtin.view.hexeditor.menu.edit.bookmark", "Crea segnalibro" },
{ "hex.view.hexeditor.menu.edit.set_base", "Imposta indirizzo di base" }, { "hex.builtin.view.hexeditor.menu.edit.set_base", "Imposta indirizzo di base" },
{ "hex.view.hexeditor.menu.edit.resize", "Ridimensiona" }, { "hex.builtin.view.hexeditor.menu.edit.resize", "Ridimensiona" },
{ "hex.view.information.name", "Informazione sui Dati" }, { "hex.builtin.view.information.name", "Informazione sui Dati" },
{ "hex.view.information.control", "Controllo" }, { "hex.builtin.view.information.control", "Controllo" },
{ "hex.view.information.analyze", "Analizza Pagina" }, { "hex.builtin.view.information.analyze", "Analizza Pagina" },
{ "hex.view.information.analyzing", "Sto analizzando..." }, { "hex.builtin.view.information.analyzing", "Sto analizzando..." },
{ "hex.view.information.region", "Regione Analizzata" }, { "hex.builtin.view.information.region", "Regione Analizzata" },
{ "hex.view.information.magic", "Informazione Magica" }, { "hex.builtin.view.information.magic", "Informazione Magica" },
{ "hex.view.information.description", "Descrizione:" }, { "hex.builtin.view.information.description", "Descrizione:" },
{ "hex.view.information.mime", "Tipo di MIME:" }, { "hex.builtin.view.information.mime", "Tipo di MIME:" },
{ "hex.view.information.info_analysis", "Informazioni dell'analisi" }, { "hex.builtin.view.information.info_analysis", "Informazioni dell'analisi" },
{ "hex.view.information.distribution", "Distribuzione dei Byte" }, { "hex.builtin.view.information.distribution", "Distribuzione dei Byte" },
{ "hex.view.information.entropy", "Entropia" }, { "hex.builtin.view.information.entropy", "Entropia" },
{ "hex.view.information.block_size", "Dimensione del Blocco" }, { "hex.builtin.view.information.block_size", "Dimensione del Blocco" },
{ "hex.view.information.block_size.desc", "{0} blocchi di {1} bytes" }, { "hex.builtin.view.information.block_size.desc", "{0} blocchi di {1} bytes" },
{ "hex.view.information.file_entropy", "Entropia dei File" }, { "hex.builtin.view.information.file_entropy", "Entropia dei File" },
{ "hex.view.information.highest_entropy", "Highest entropy block" }, { "hex.builtin.view.information.highest_entropy", "Highest entropy block" },
{ "hex.view.information.encrypted", "Questi dati sono probabilmente codificati o compressi!" }, { "hex.builtin.view.information.encrypted", "Questi dati sono probabilmente codificati o compressi!" },
{ "hex.view.patches.name", "Patches" }, { "hex.builtin.view.patches.name", "Patches" },
{ "hex.view.patches.offset", "Offset" }, { "hex.builtin.view.patches.offset", "Offset" },
{ "hex.view.patches.orig", "Valore Originale" }, { "hex.builtin.view.patches.orig", "Valore Originale" },
{ "hex.view.patches.patch", "Valore patchato"}, { "hex.builtin.view.patches.patch", "Valore patchato"},
{ "hex.view.patches.remove", "Rimuovi patch" }, { "hex.builtin.view.patches.remove", "Rimuovi patch" },
{ "hex.view.pattern.name", "Editor dei Pattern" }, { "hex.builtin.view.pattern_editor.name", "Editor dei Pattern" },
{ "hex.view.pattern.accept_pattern", "Accetta pattern" }, { "hex.builtin.view.pattern_editor.accept_pattern", "Accetta pattern" },
{ "hex.view.pattern.accept_pattern.desc", "Uno o più pattern compatibili con questo tipo di dati sono stati trovati!" }, { "hex.builtin.view.pattern_editor.accept_pattern.desc", "Uno o più pattern compatibili con questo tipo di dati sono stati trovati!" },
{ "hex.view.pattern.accept_pattern.pattern_language", "Pattern" }, { "hex.builtin.view.pattern_editor.accept_pattern.pattern_language", "Pattern" },
{ "hex.view.pattern.accept_pattern.question", "Vuoi applicare i patter selezionati" }, { "hex.builtin.view.pattern_editor.accept_pattern.question", "Vuoi applicare i patter selezionati" },
{ "hex.view.pattern.menu.file.load_pattern", "Caricamento dei pattern..." }, { "hex.builtin.view.pattern_editor.menu.file.load_pattern", "Caricamento dei pattern..." },
{ "hex.view.pattern.open_pattern", "Apri pattern" }, //{ "hex.builtin.view.pattern_editor.menu.file.save_pattern", "Save pattern..." },
{ "hex.view.pattern.evaluating", "Valutazione..." }, { "hex.builtin.view.pattern_editor.open_pattern", "Apri pattern" },
{ "hex.view.pattern.auto", "Auto valutazione" }, { "hex.builtin.view.pattern_editor.evaluating", "Valutazione..." },
{ "hex.builtin.view.pattern_editor.auto", "Auto valutazione" },
//{ "hex.builtin.view.pattern_editor.env_vars", "Environment Variables" },
{ "hex.view.pattern_data.name", "Dati dei Pattern" }, { "hex.builtin.view.pattern_data.name", "Dati dei Pattern" },
{ "hex.view.pattern_data.var_name", "Nome" }, { "hex.builtin.view.pattern_data.var_name", "Nome" },
{ "hex.view.pattern_data.color", "Colore" }, { "hex.builtin.view.pattern_data.color", "Colore" },
{ "hex.view.pattern_data.offset", "Offset" }, { "hex.builtin.view.pattern_data.offset", "Offset" },
{ "hex.view.pattern_data.size", "Dimensione" }, { "hex.builtin.view.pattern_data.size", "Dimensione" },
{ "hex.view.pattern_data.type", "Tipo" }, { "hex.builtin.view.pattern_data.type", "Tipo" },
{ "hex.view.pattern_data.value", "Valore" }, { "hex.builtin.view.pattern_data.value", "Valore" },
{ "hex.view.settings.name", "Impostazioni" }, { "hex.builtin.view.settings.name", "Impostazioni" },
{ "hex.view.strings.name", "Stringhe" }, { "hex.builtin.view.strings.name", "Stringhe" },
{ "hex.view.strings.copy", "Copia stringa" }, { "hex.builtin.view.strings.copy", "Copia stringa" },
{ "hex.view.strings.demangle", "Demangle" }, { "hex.builtin.view.strings.demangle", "Demangle" },
{ "hex.view.strings.min_length", "Lunghezza minima" }, { "hex.builtin.view.strings.min_length", "Lunghezza minima" },
{ "hex.view.strings.filter", "Filtro" }, { "hex.builtin.view.strings.filter", "Filtro" },
{ "hex.view.strings.extract", "Estrai" }, { "hex.builtin.view.strings.extract", "Estrai" },
{ "hex.view.strings.searching", "Sto cercando..." }, { "hex.builtin.view.strings.searching", "Sto cercando..." },
{ "hex.view.strings.offset", "Offset" }, { "hex.builtin.view.strings.offset", "Offset" },
{ "hex.view.strings.size", "Dimensione" }, { "hex.builtin.view.strings.size", "Dimensione" },
{ "hex.view.strings.string", "Stringa" }, { "hex.builtin.view.strings.string", "Stringa" },
{ "hex.view.strings.demangle.title", "Nome Demangled" }, { "hex.builtin.view.strings.demangle.title", "Nome Demangled" },
{ "hex.view.strings.demangle.copy", "Copia" }, { "hex.builtin.view.strings.demangle.copy", "Copia" },
{ "hex.view.tools.name", "Strumenti" }, { "hex.builtin.view.tools.name", "Strumenti" },
{ "hex.view.yara.name", "Regole di Yara" }, { "hex.builtin.view.yara.name", "Regole di Yara" },
{ "hex.view.yara.header.rules", "Regola" }, { "hex.builtin.view.yara.header.rules", "Regola" },
{ "hex.view.yara.reload", "Ricarica" }, { "hex.builtin.view.yara.reload", "Ricarica" },
{ "hex.view.yara.match", "Abbina Regole" }, { "hex.builtin.view.yara.match", "Abbina Regole" },
{ "hex.view.yara.matching", "Abbinamento..." }, { "hex.builtin.view.yara.matching", "Abbinamento..." },
{ "hex.view.yara.error", "Errore compilazione Yara: " }, { "hex.builtin.view.yara.error", "Errore compilazione Yara: " },
{ "hex.view.yara.header.matches", "Abbinamenti" }, { "hex.builtin.view.yara.header.matches", "Abbinamenti" },
{ "hex.view.yara.matches.identifier", "Identificatore" }, { "hex.builtin.view.yara.matches.identifier", "Identificatore" },
//{ "hex.view.yara.matches.variable", "Variable" }, //{ "hex.builtin.view.yara.matches.variable", "Variable" },
{ "hex.view.yara.whole_data", "Tutti i file combaciano!" }, { "hex.builtin.view.yara.whole_data", "Tutti i file combaciano!" },
{ "hex.view.yara.no_rules", "Nessuna regola di YARA. Aggiungile in nella cartella 'yara' di 'ImHex'" }, { "hex.builtin.view.yara.no_rules", "Nessuna regola di YARA. Aggiungile in nella cartella 'yara' di 'ImHex'" },
{ "hex.view.constants.name", "Costanti" }, { "hex.builtin.view.constants.name", "Costanti" },
{ "hex.view.constants.row.category", "Categoria" }, { "hex.builtin.view.constants.row.category", "Categoria" },
{ "hex.view.constants.row.name", "Nome" }, { "hex.builtin.view.constants.row.name", "Nome" },
{ "hex.view.constants.row.desc", "Descrizione" }, { "hex.builtin.view.constants.row.desc", "Descrizione" },
{ "hex.view.constants.row.value", "Valore" }, { "hex.builtin.view.constants.row.value", "Valore" },
{ "hex.view.store.name", "Content Store" }, { "hex.builtin.view.store.name", "Content Store" },
{ "hex.view.store.desc", "Scarica nuovi contenuti dal database online di ImHex" }, { "hex.builtin.view.store.desc", "Scarica nuovi contenuti dal database online di ImHex" },
{ "hex.view.store.reload", "Ricarica" }, { "hex.builtin.view.store.reload", "Ricarica" },
{ "hex.view.store.row.name", "Nome" }, { "hex.builtin.view.store.row.name", "Nome" },
{ "hex.view.store.row.description", "Descrizione" }, { "hex.builtin.view.store.row.description", "Descrizione" },
{ "hex.view.store.download", "Download" }, { "hex.builtin.view.store.download", "Download" },
{ "hex.view.store.update", "Aggiorna" }, { "hex.builtin.view.store.update", "Aggiorna" },
{ "hex.view.store.remove", "Rimuovi" }, { "hex.builtin.view.store.remove", "Rimuovi" },
{ "hex.view.store.tab.patterns", "Modelli" }, { "hex.builtin.view.store.tab.patterns", "Modelli" },
{ "hex.view.store.tab.libraries", "Librerie" }, { "hex.builtin.view.store.tab.libraries", "Librerie" },
{ "hex.view.store.tab.magics", "File Magici" }, { "hex.builtin.view.store.tab.magics", "File Magici" },
{ "hex.view.store.tab.constants", "Costanti" }, { "hex.builtin.view.store.tab.constants", "Costanti" },
{ "hex.view.store.tab.yara", "Regole di Yara" }, { "hex.builtin.view.store.tab.yara", "Regole di Yara" },
{ "hex.view.store.loading", "Caricamento del content store..." }, { "hex.builtin.view.store.loading", "Caricamento del content store..." },
//{ "hex.view.diff.name", "Diffing" }, //{ "hex.builtin.view.diff.name", "Diffing" },
/* Builtin plugin features */ //{ "hex.builtin.view.provider_settings.name", "Provider Settings" },
//{ "hex.builtin.view.provider_settings.load_popup", "Open Provider" },
{ "hex.builtin.command.calc.desc", "Calcolatrice" }, { "hex.builtin.command.calc.desc", "Calcolatrice" },
{ "hex.builtin.command.cmd.desc", "Comando" }, { "hex.builtin.command.cmd.desc", "Comando" },
@@ -662,6 +670,18 @@ namespace hex::plugin::builtin {
{ "hex.builtin.provider.file.creation", "Data di creazione" }, { "hex.builtin.provider.file.creation", "Data di creazione" },
{ "hex.builtin.provider.file.access", "Data dell'ultimo accesso" }, { "hex.builtin.provider.file.access", "Data dell'ultimo accesso" },
{ "hex.builtin.provider.file.modification", "Data dell'ultima modifica" }, { "hex.builtin.provider.file.modification", "Data dell'ultima modifica" },
//{ "hex.builtin.provider.file", "File Provider" },
//{ "hex.builtin.provider.gdb", "GDB Server Provider" },
//{ "hex.builtin.provider.gdb.name", "GDB Server <{0}:{1}>" },
//{ "hex.builtin.provider.gdb.server", "Server" },
//{ "hex.builtin.provider.gdb.ip", "IP Address" },
//{ "hex.builtin.provider.gdb.port", "Port" },
//{ "hex.builtin.provider.disk", "Raw Disk Provider" },
//{ "hex.builtin.provider.disk.selected_disk", "Disk" },
//{ "hex.builtin.provider.disk.disk_size", "Disk Size" },
//{ "hex.builtin.provider.disk.sector_size", "Sector Size" },
//{ "hex.builtin.provider.disk.reload", "Reload" },
}); });
} }

View File

@@ -23,6 +23,7 @@ namespace hex::plugin::builtin {
{ "hex.welcome.start.open_file", "打开文件" }, { "hex.welcome.start.open_file", "打开文件" },
{ "hex.welcome.start.open_project", "打开工程" }, { "hex.welcome.start.open_project", "打开工程" },
{ "hex.welcome.start.recent", "最近文件" }, { "hex.welcome.start.recent", "最近文件" },
//{ "hex.welcome.start.open_other", "Other Providers" },
{ "hex.welcome.header.help", "帮助" }, { "hex.welcome.header.help", "帮助" },
{ "hex.welcome.help.repo", "GitHub仓库" }, { "hex.welcome.help.repo", "GitHub仓库" },
{ "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" }, { "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" },
@@ -86,248 +87,255 @@ namespace hex::plugin::builtin {
{ "hex.message.yara_rule_added", "Yara规则已添加" }, { "hex.message.yara_rule_added", "Yara规则已添加" },
{ "hex.message.magic_db_added", "魔术数据库已添加!" }, { "hex.message.magic_db_added", "魔术数据库已添加!" },
{ "hex.view.bookmarks.name", "书签" }, /* Builtin plugin features */
{ "hex.view.bookmarks.default_title", "书签 [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "空空如也。通过 编辑->添加书签" },
{ "hex.view.bookmarks.title.info", "信息" },
{ "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} 字节)" },
{ "hex.view.bookmarks.button.jump", "转到" },
{ "hex.view.bookmarks.button.remove", "移除" },
{ "hex.view.bookmarks.header.name", "名称" },
{ "hex.view.bookmarks.header.color", "颜色" },
{ "hex.view.bookmarks.header.comment", "注释" },
{ "hex.view.command_palette.name", "命令栏" }, { "hex.builtin.view.bookmarks.name", "书签" },
{ "hex.builtin.view.bookmarks.default_title", "书签 [0x{0:X} - 0x{1:X}]" },
{ "hex.builtin.view.bookmarks.no_bookmarks", "空空如也。通过 编辑->添加书签" },
{ "hex.builtin.view.bookmarks.title.info", "信息" },
{ "hex.builtin.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} 字节)" },
{ "hex.builtin.view.bookmarks.button.jump", "转到" },
{ "hex.builtin.view.bookmarks.button.remove", "移除" },
{ "hex.builtin.view.bookmarks.header.name", "名称" },
{ "hex.builtin.view.bookmarks.header.color", "颜色" },
{ "hex.builtin.view.bookmarks.header.comment", "注释" },
{ "hex.view.data_inspector.name", "数据分析器" }, { "hex.builtin.view.command_palette.name", "命令栏" },
{ "hex.view.data_inspector.table.name", "名称" },
{ "hex.view.data_inspector.table.value", "" },
{ "hex.view.data_inspector.no_data", "没有选中字节"},
{ "hex.view.data_processor.name", "数据处理" }, { "hex.builtin.view.data_inspector.name", "数据分析" },
{ "hex.view.data_processor.menu.remove_selection", "移除已选" }, { "hex.builtin.view.data_inspector.table.name", "名称" },
{ "hex.view.data_processor.menu.remove_node", "移除节点" }, { "hex.builtin.view.data_inspector.table.value", "" },
{ "hex.view.data_processor.menu.remove_link", "移除链接" }, { "hex.builtin.view.data_inspector.no_data", "没有选中字节"},
{ "hex.view.disassembler.name", "反汇编" }, { "hex.builtin.view.data_processor.name", "数据处理器" },
{ "hex.view.disassembler.position", "位置" }, { "hex.builtin.view.data_processor.menu.remove_selection", "移除已选" },
{ "hex.view.disassembler.base", "基地址" }, { "hex.builtin.view.data_processor.menu.remove_node", "移除节点" },
{ "hex.view.disassembler.region", "代码范围" }, { "hex.builtin.view.data_processor.menu.remove_link", "移除链接" },
{ "hex.view.disassembler.settings.header", "设置" },
{ "hex.view.disassembler.arch", "架构" },
{ "hex.view.disassembler.arm.arm", "ARM" },
{ "hex.view.disassembler.arm.thumb", "Thumb" },
{ "hex.view.disassembler.arm.default", "默认" },
{ "hex.view.disassembler.arm.cortex_m", "Cortex-M" },
{ "hex.view.disassembler.arm.armv8", "ARMv8" },
{ "hex.view.disassembler.mips.mips32", "MIPS32" }, { "hex.builtin.view.disassembler.name", "反汇编" },
{ "hex.view.disassembler.mips.mips64", "MIPS64" }, { "hex.builtin.view.disassembler.position", "位置" },
{ "hex.view.disassembler.mips.mips32R6", "MIPS32R6" }, { "hex.builtin.view.disassembler.base", "基地址" },
{ "hex.view.disassembler.mips.micro", "Micro MIPS" }, { "hex.builtin.view.disassembler.region", "代码范围" },
{ "hex.builtin.view.disassembler.settings.header", "设置" },
{ "hex.builtin.view.disassembler.arch", "架构" },
{ "hex.builtin.view.disassembler.arm.arm", "ARM" },
{ "hex.builtin.view.disassembler.arm.thumb", "Thumb" },
{ "hex.builtin.view.disassembler.arm.default", "默认" },
{ "hex.builtin.view.disassembler.arm.cortex_m", "Cortex-M" },
{ "hex.builtin.view.disassembler.arm.armv8", "ARMv8" },
{ "hex.view.disassembler.x86.16bit", "16位" }, { "hex.builtin.view.disassembler.mips.mips32", "MIPS32" },
{ "hex.view.disassembler.x86.32bit", "32位" }, { "hex.builtin.view.disassembler.mips.mips64", "MIPS64" },
{ "hex.view.disassembler.x86.64bit", "64位" }, { "hex.builtin.view.disassembler.mips.mips32R6", "MIPS32R6" },
{ "hex.builtin.view.disassembler.mips.micro", "Micro MIPS" },
{ "hex.view.disassembler.ppc.32bit", "32" }, { "hex.builtin.view.disassembler.x86.16bit", "16" },
{ "hex.view.disassembler.ppc.64bit", "64" }, { "hex.builtin.view.disassembler.x86.32bit", "32" },
{ "hex.builtin.view.disassembler.x86.64bit", "64位" },
{ "hex.view.disassembler.sparc.v9", "Sparc V9" }, { "hex.builtin.view.disassembler.ppc.32bit", "32位" },
{ "hex.builtin.view.disassembler.ppc.64bit", "64位" },
{ "hex.view.disassembler.disassemble", "反汇编" }, { "hex.builtin.view.disassembler.sparc.v9", "Sparc V9" },
{ "hex.view.disassembler.disassembling", "反汇编中..." },
{ "hex.view.disassembler.disassembly.title", "反汇编" },
{ "hex.view.disassembler.disassembly.address", "地址" },
{ "hex.view.disassembler.disassembly.offset", "偏移" },
{ "hex.view.disassembler.disassembly.bytes", "字节" },
{ "hex.view.hashes.name", "哈希" }, { "hex.builtin.view.disassembler.disassemble", "反汇编" },
{ "hex.view.hashes.settings", "设置" }, { "hex.builtin.view.disassembler.disassembling", "反汇编中..." },
{ "hex.view.hashes.function", "哈希函数" }, { "hex.builtin.view.disassembler.disassembly.title", "反汇编" },
{ "hex.view.hashes.iv", "初始值" }, { "hex.builtin.view.disassembler.disassembly.address", "地址" },
{ "hex.view.hashes.poly", "多项式" }, { "hex.builtin.view.disassembler.disassembly.offset", "偏移" },
{ "hex.view.hashes.result", "结果" }, { "hex.builtin.view.disassembler.disassembly.bytes", "字节" },
{ "hex.view.help.name", "帮助" }, { "hex.builtin.view.hashes.name", "哈希" },
{ "hex.view.help.about.name", "关于" }, { "hex.builtin.view.hashes.settings", "设置" },
{ "hex.view.help.about.translator", "由xtexChooser翻译" }, { "hex.builtin.view.hashes.function", "哈希函数" },
{ "hex.view.help.about.source", "源代码位于GitHub:" }, { "hex.builtin.view.hashes.iv", "初始值" },
{ "hex.view.help.about.donations", "赞助" }, { "hex.builtin.view.hashes.poly", "多项式" },
{ "hex.view.help.about.thanks", "如果你喜欢我的工作,请赞助以帮助此项目继续前进。非常感谢 <3" }, { "hex.builtin.view.hashes.result", "结果" },
{ "hex.view.help.about.libs", "使用的库" },
{ "hex.view.help.about.paths", "ImHex目录" },
{ "hex.view.help.documentation", "ImHex文档" },
{ "hex.view.help.pattern_cheat_sheet", "模式语言帮助"},
{ "hex.view.help.calc_cheat_sheet", "计算器帮助" },
{ "hex.view.hexeditor.name", "Hex编辑器" }, { "hex.builtin.view.help.name", "帮助" },
{ "hex.view.hexeditor.create_file", "新建" }, { "hex.builtin.view.help.about.name", "关于" },
{ "hex.view.hexeditor.open_file", "打开" }, { "hex.builtin.view.help.about.translator", "由xtexChooser翻译" },
{ "hex.view.hexeditor.open_project", "打开项目" }, { "hex.builtin.view.help.about.source", "源代码位于GitHub:" },
{ "hex.view.hexeditor.save_project", "保存项目" }, { "hex.builtin.view.help.about.donations", "赞助" },
{ "hex.view.hexeditor.save_data", "保存数据" }, { "hex.builtin.view.help.about.thanks", "如果你喜欢我的工作,请赞助以帮助此项目继续前进。非常感谢 <3" },
{ "hex.view.hexeditor.open_base64", "打开Base64文件" }, //{ "hex.builtin.view.help.about.contributor", "Contributors" },
{ "hex.view.hexeditor.load_enconding_file", "加载自定义编码定义文件" }, { "hex.builtin.view.help.about.libs", "使用的库" },
{ "hex.view.hexeditor.page", "页 {0} / {1}" }, { "hex.builtin.view.help.about.paths", "ImHex目录" },
{ "hex.view.hexeditor.save_as", "另存为" }, { "hex.builtin.view.help.documentation", "ImHex文档" },
{ "hex.view.hexeditor.exit_application.title", "退出?" }, { "hex.builtin.view.help.pattern_cheat_sheet", "模式语言帮助"},
{ "hex.view.hexeditor.exit_application.desc", "工程还有为保存的更改。\n确定要退出吗?" }, { "hex.builtin.view.help.calc_cheat_sheet", "计算器帮助" },
{ "hex.view.hexeditor.script.title", "通过加载器脚本加载文件" },
{ "hex.view.hexeditor.script.desc", "通过Python加载器脚本加载文件。" },
{ "hex.view.hexeditor.script.script", "脚本" },
{ "hex.view.hexeditor.script.script.title", "加载器脚本:打开脚本" },
{ "hex.view.hexeditor.script.file", "文件" },
{ "hex.view.hexeditor.script.file.title", "加载器脚本:打开文件" },
{ "hex.view.hexeditor.menu.file.open_file", "打开文件..." }, { "hex.builtin.view.hexeditor.name", "Hex编辑器" },
{ "hex.view.hexeditor.menu.file.open_recent", "打开最近"}, { "hex.builtin.view.hexeditor.create_file", "新建" },
{ "hex.view.hexeditor.menu.file.save", "保存" }, { "hex.builtin.view.hexeditor.open_file", "打开" },
{ "hex.view.hexeditor.menu.file.save_as", "另存为..." }, { "hex.builtin.view.hexeditor.open_project", "打开项目" },
{ "hex.view.hexeditor.menu.file.close", "关闭" }, { "hex.builtin.view.hexeditor.save_project", "保存项目" },
{ "hex.view.hexeditor.menu.file.quit", "退出ImHex" }, { "hex.builtin.view.hexeditor.save_data", "保存数据" },
{ "hex.view.hexeditor.menu.file.open_project", "打开项目..." }, { "hex.builtin.view.hexeditor.open_base64", "打开Base64文件" },
{ "hex.view.hexeditor.menu.file.save_project", "保存项目..." }, { "hex.builtin.view.hexeditor.load_enconding_file", "加载自定义编码定义文件" },
{ "hex.view.hexeditor.menu.file.load_encoding_file", "加载自定义编码..." }, { "hex.builtin.view.hexeditor.page", "页 {0} / {1}" },
{ "hex.view.hexeditor.menu.file.import", "导入..." }, { "hex.builtin.view.hexeditor.save_as", "另存为" },
{ "hex.view.hexeditor.menu.file.import.base64", "Base64文件" }, { "hex.builtin.view.hexeditor.exit_application.title", "退出?" },
{ "hex.view.hexeditor.base64.import_error", "文件不是有效的Base64格式" }, { "hex.builtin.view.hexeditor.exit_application.desc", "工程还有为保存的更改。\n确定要退出吗?" },
{ "hex.view.hexeditor.file_open_error", "打开文件失败!" }, { "hex.builtin.view.hexeditor.script.title", "通过加载器脚本加载文件" },
{ "hex.view.hexeditor.menu.file.import.ips", "IPS补丁" }, { "hex.builtin.view.hexeditor.script.desc", "通过Python加载器脚本加载文件。" },
{ "hex.view.hexeditor.menu.file.import.ips32", "IPS32补丁" }, { "hex.builtin.view.hexeditor.script.script", "脚本" },
{ "hex.view.hexeditor.menu.file.import.script", "带有加载器脚本的文件" }, { "hex.builtin.view.hexeditor.script.script.title", "加载器脚本:打开脚本" },
{ "hex.builtin.view.hexeditor.script.file", "文件" },
{ "hex.builtin.view.hexeditor.script.file.title", "加载器脚本:打开文件" },
{ "hex.view.hexeditor.menu.file.export", "导出..." }, { "hex.builtin.view.hexeditor.menu.file.open_file", "打开文件..." },
{ "hex.view.hexeditor.menu.file.export.title", "导出文件" }, { "hex.builtin.view.hexeditor.menu.file.open_recent", "打开最近" },
{ "hex.view.hexeditor.menu.file.export.ips", "IPS补丁" }, //{ "hex.builtin.view.hexeditor.menu.file.open_other", "Open Other..." },
{ "hex.view.hexeditor.menu.file.export.ips32", "IPS32补丁" }, { "hex.builtin.view.hexeditor.menu.file.save", "保存" },
{ "hex.view.hexeditor.menu.file.search", "搜索" }, { "hex.builtin.view.hexeditor.menu.file.save_as", "另存为..." },
{ "hex.view.hexeditor.search.string", "字符串" }, { "hex.builtin.view.hexeditor.menu.file.close", "关闭" },
{ "hex.view.hexeditor.search.hex", "Hex" }, { "hex.builtin.view.hexeditor.menu.file.quit", "退出ImHex" },
{ "hex.view.hexeditor.search.find", "查找" }, { "hex.builtin.view.hexeditor.menu.file.open_project", "打开项目..." },
{ "hex.view.hexeditor.search.find_next", "查找下一个" }, { "hex.builtin.view.hexeditor.menu.file.save_project", "保存项目..." },
{ "hex.view.hexeditor.search.find_prev", "查找上一个" }, { "hex.builtin.view.hexeditor.menu.file.load_encoding_file", "加载自定义编码..." },
{ "hex.view.hexeditor.menu.file.goto", "转到" }, { "hex.builtin.view.hexeditor.menu.file.import", "导入..." },
{ "hex.view.hexeditor.goto.offset.absolute", "绝对" }, { "hex.builtin.view.hexeditor.menu.file.import.base64", "Base64文件" },
{ "hex.view.hexeditor.goto.offset.current", "当前" }, { "hex.builtin.view.hexeditor.base64.import_error", "文件不是有效的Base64格式" },
{ "hex.view.hexeditor.goto.offset.begin", "起始" }, { "hex.builtin.view.hexeditor.file_open_error", "打开文件失败!" },
{ "hex.view.hexeditor.goto.offset.end", "末尾" }, { "hex.builtin.view.hexeditor.menu.file.import.ips", "IPS补丁" },
{ "hex.view.hexeditor.error.read_only", "无法获得写权限,文件以只读方式打开。" }, { "hex.builtin.view.hexeditor.menu.file.import.ips32", "IPS32补丁" },
{ "hex.view.hexeditor.error.open", "打开文件失败!" }, { "hex.builtin.view.hexeditor.menu.file.import.script", "带有加载器脚本的文件" },
{ "hex.view.hexeditor.error.create", "创建新文件失败!" },
{ "hex.view.hexeditor.menu.edit.undo", "撤销" },
{ "hex.view.hexeditor.menu.edit.redo", "重做" },
{ "hex.view.hexeditor.menu.edit.copy", "复制" },
{ "hex.view.hexeditor.menu.edit.copy_as", "复制为..." },
{ "hex.view.hexeditor.copy.hex", "字符串" },
{ "hex.view.hexeditor.copy.c", "C数组" },
{ "hex.view.hexeditor.copy.cpp", "C++数组" },
{ "hex.view.hexeditor.copy.csharp", "C#数组" },
{ "hex.view.hexeditor.copy.rust", "Rust数组" },
{ "hex.view.hexeditor.copy.python", "Python数组" },
{ "hex.view.hexeditor.copy.java", "Java数组" },
{ "hex.view.hexeditor.copy.js", "JavaScript数组" },
{ "hex.view.hexeditor.copy.ascii", "ASCII Art" },
{ "hex.view.hexeditor.copy.html", "HTML" },
{ "hex.view.hexeditor.menu.edit.paste", "粘贴" },
{ "hex.view.hexeditor.menu.edit.select_all", "全选" },
{ "hex.view.hexeditor.menu.edit.bookmark", "添加书签" },
{ "hex.view.hexeditor.menu.edit.set_base", "设置基地址" },
{ "hex.view.hexeditor.menu.edit.resize", "修改大小" },
{ "hex.view.information.name", "数据信息" }, { "hex.builtin.view.hexeditor.menu.file.export", "导出..." },
{ "hex.view.information.control", "控制" }, { "hex.builtin.view.hexeditor.menu.file.export.title", "导出文件" },
{ "hex.view.information.analyze", "分析" }, { "hex.builtin.view.hexeditor.menu.file.export.ips", "IPS补丁" },
{ "hex.view.information.analyzing", "分析中..." }, { "hex.builtin.view.hexeditor.menu.file.export.ips32", "IPS32补丁" },
{ "hex.view.information.region", "已分析区域" }, { "hex.builtin.view.hexeditor.menu.file.search", "搜索" },
{ "hex.view.information.magic", "魔术信息" }, { "hex.builtin.view.hexeditor.search.string", "字符串" },
{ "hex.view.information.description", "描述:" }, { "hex.builtin.view.hexeditor.search.hex", "Hex" },
{ "hex.view.information.mime", "MIME类型:" }, { "hex.builtin.view.hexeditor.search.find", "查找" },
{ "hex.view.information.info_analysis", "信息分析" }, { "hex.builtin.view.hexeditor.search.find_next", "查找下一个" },
{ "hex.view.information.distribution", "字节分布" }, { "hex.builtin.view.hexeditor.search.find_prev", "查找上一个" },
{ "hex.view.information.entropy", "" }, { "hex.builtin.view.hexeditor.menu.file.goto", "转到" },
{ "hex.view.information.block_size", "块大小" }, { "hex.builtin.view.hexeditor.goto.offset.absolute", "绝对" },
{ "hex.view.information.block_size.desc", "{0} 块 × {1} 字节" }, { "hex.builtin.view.hexeditor.goto.offset.current", "当前" },
{ "hex.view.information.file_entropy", "文件熵" }, { "hex.builtin.view.hexeditor.goto.offset.begin", "起始" },
{ "hex.view.information.highest_entropy", "最高熵" }, { "hex.builtin.view.hexeditor.goto.offset.end", "末尾" },
{ "hex.view.information.encrypted", "此数据似乎经过了加密或压缩!" }, { "hex.builtin.view.hexeditor.error.read_only", "无法获得写权限,文件以只读方式打开。" },
{ "hex.builtin.view.hexeditor.error.open", "打开文件失败!" },
{ "hex.builtin.view.hexeditor.error.create", "创建新文件失败!" },
{ "hex.builtin.view.hexeditor.menu.edit.undo", "撤销" },
{ "hex.builtin.view.hexeditor.menu.edit.redo", "重做" },
{ "hex.builtin.view.hexeditor.menu.edit.copy", "复制" },
{ "hex.builtin.view.hexeditor.menu.edit.copy_as", "复制为..." },
{ "hex.builtin.view.hexeditor.copy.hex", "字符串" },
{ "hex.builtin.view.hexeditor.copy.c", "C数组" },
{ "hex.builtin.view.hexeditor.copy.cpp", "C++数组" },
{ "hex.builtin.view.hexeditor.copy.csharp", "C#数组" },
{ "hex.builtin.view.hexeditor.copy.rust", "Rust数组" },
{ "hex.builtin.view.hexeditor.copy.python", "Python数组" },
{ "hex.builtin.view.hexeditor.copy.java", "Java数组" },
{ "hex.builtin.view.hexeditor.copy.js", "JavaScript数组" },
{ "hex.builtin.view.hexeditor.copy.ascii", "ASCII Art" },
{ "hex.builtin.view.hexeditor.copy.html", "HTML" },
{ "hex.builtin.view.hexeditor.menu.edit.paste", "粘贴" },
{ "hex.builtin.view.hexeditor.menu.edit.select_all", "全选" },
{ "hex.builtin.view.hexeditor.menu.edit.bookmark", "添加书签" },
{ "hex.builtin.view.hexeditor.menu.edit.set_base", "设置基地址" },
{ "hex.builtin.view.hexeditor.menu.edit.resize", "修改大小" },
{ "hex.view.patches.name", "补丁" }, { "hex.builtin.view.information.name", "数据信息" },
{ "hex.view.patches.offset", "偏移" }, { "hex.builtin.view.information.control", "控制" },
{ "hex.view.patches.orig", "原始值" }, { "hex.builtin.view.information.analyze", "分析" },
{ "hex.view.patches.patch", "修改值"}, { "hex.builtin.view.information.analyzing", "分析中..." },
{ "hex.view.patches.remove", "移除补丁" }, { "hex.builtin.view.information.region", "已分析区域" },
{ "hex.builtin.view.information.magic", "魔术信息" },
{ "hex.builtin.view.information.description", "描述:" },
{ "hex.builtin.view.information.mime", "MIME类型:" },
{ "hex.builtin.view.information.info_analysis", "信息分析" },
{ "hex.builtin.view.information.distribution", "字节分布" },
{ "hex.builtin.view.information.entropy", "" },
{ "hex.builtin.view.information.block_size", "块大小" },
{ "hex.builtin.view.information.block_size.desc", "{0} 块 × {1} 字节" },
{ "hex.builtin.view.information.file_entropy", "文件熵" },
{ "hex.builtin.view.information.highest_entropy", "最高熵" },
{ "hex.builtin.view.information.encrypted", "此数据似乎经过了加密或压缩!" },
{ "hex.view.pattern.name", "模式编辑器" }, { "hex.builtin.view.patches.name", "补丁" },
{ "hex.view.pattern.accept_pattern", "接受模式" }, { "hex.builtin.view.patches.offset", "偏移" },
{ "hex.view.pattern.accept_pattern.desc", "一个或多个模式与所找到的数据类型兼容" }, { "hex.builtin.view.patches.orig", "原始值" },
{ "hex.view.pattern.accept_pattern.pattern_language", "模式" }, { "hex.builtin.view.patches.patch", "修改值"},
{ "hex.view.pattern.accept_pattern.question", "是否应用找到的模式?" }, { "hex.builtin.view.patches.remove", "移除补丁" },
{ "hex.view.pattern.menu.file.load_pattern", "加载模式文件..." },
{ "hex.view.pattern.open_pattern", "打开模式" },
{ "hex.view.pattern.evaluating", "计算中..." },
{ "hex.view.pattern.auto", "自动计算" },
{ "hex.view.pattern_data.name", "模式数据" }, { "hex.builtin.view.pattern_editor.name", "模式编辑器" },
{ "hex.view.pattern_data.var_name", "名称" }, { "hex.builtin.view.pattern_editor.accept_pattern", "接受模式" },
{ "hex.view.pattern_data.color", "颜色" }, { "hex.builtin.view.pattern_editor.accept_pattern.desc", "一个或多个模式与所找到的数据类型兼容" },
{ "hex.view.pattern_data.offset", "偏移" }, { "hex.builtin.view.pattern_editor.accept_pattern.pattern_language", "模式" },
{ "hex.view.pattern_data.size", "大小" }, { "hex.builtin.view.pattern_editor.accept_pattern.question", "是否应用找到的模式?" },
{ "hex.view.pattern_data.type", "类型" }, { "hex.builtin.view.pattern_editor.menu.file.load_pattern", "加载模式文件..." },
{ "hex.view.pattern_data.value", "" }, //{ "hex.builtin.view.pattern_editor.menu.file.save_pattern", "Save pattern..." },
{ "hex.builtin.view.pattern_editor.open_pattern", "打开模式" },
{ "hex.builtin.view.pattern_editor.evaluating", "计算中..." },
{ "hex.builtin.view.pattern_editor.auto", "自动计算" },
//{ "hex.builtin.view.pattern_editor.env_vars", "Environment Variables" },
{ "hex.view.settings.name", "设置" }, { "hex.builtin.view.pattern_data.name", "模式数据" },
{ "hex.builtin.view.pattern_data.var_name", "名称" },
{ "hex.builtin.view.pattern_data.color", "颜色" },
{ "hex.builtin.view.pattern_data.offset", "偏移" },
{ "hex.builtin.view.pattern_data.size", "大小" },
{ "hex.builtin.view.pattern_data.type", "类型" },
{ "hex.builtin.view.pattern_data.value", "" },
{ "hex.view.strings.name", "字符串" }, { "hex.builtin.view.settings.name", "设置" },
{ "hex.view.strings.copy", "复制字符串" },
{ "hex.view.strings.demangle", "还原" },
{ "hex.view.strings.min_length", "最小长度" },
{ "hex.view.strings.filter", "过滤" },
{ "hex.view.strings.extract", "提取" },
{ "hex.view.strings.searching", "搜索中..." },
{ "hex.view.strings.offset", "偏移" },
{ "hex.view.strings.size", "大小" },
{ "hex.view.strings.string", "字符串" },
{ "hex.view.strings.demangle.title", "还原名" },
{ "hex.view.strings.demangle.copy", "复制" },
{ "hex.view.tools.name", "工具" }, { "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.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.view.yara.name", "Yara规则" }, { "hex.builtin.view.tools.name", "工具" },
{ "hex.view.yara.header.rules", "规则" },
{ "hex.view.yara.reload", "重新加载" },
{ "hex.view.yara.match", "匹配规则" },
{ "hex.view.yara.matching", "匹配中..." },
{ "hex.view.yara.error", "Yara编译器错误: " },
{ "hex.view.yara.header.matches", "匹配" },
{ "hex.view.yara.matches.identifier", "标识符" },
//{ "hex.view.yara.matches.variable", "Variable" },
{ "hex.view.yara.whole_data", "全文件匹配!" },
{ "hex.view.yara.no_rules", "没有找到YARA规则。请将规则放到ImHex的'yara'目录下。" },
{ "hex.view.constants.name", "常量" }, { "hex.builtin.view.yara.name", "Yara规则" },
{ "hex.view.constants.row.category", "分类" }, { "hex.builtin.view.yara.header.rules", "规则" },
{ "hex.view.constants.row.name", "名称" }, { "hex.builtin.view.yara.reload", "重新加载" },
{ "hex.view.constants.row.desc", "描述" }, { "hex.builtin.view.yara.match", "匹配规则" },
{ "hex.view.constants.row.value", "" }, { "hex.builtin.view.yara.matching", "匹配中..." },
{ "hex.builtin.view.yara.error", "Yara编译器错误: " },
{ "hex.builtin.view.yara.header.matches", "匹配" },
{ "hex.builtin.view.yara.matches.identifier", "标识符" },
//{ "hex.builtin.view.yara.matches.variable", "Variable" },
{ "hex.builtin.view.yara.whole_data", "全文件匹配!" },
{ "hex.builtin.view.yara.no_rules", "没有找到YARA规则。请将规则放到ImHex的'yara'目录下。" },
{ "hex.view.store.name", "内容仓库" }, { "hex.builtin.view.constants.name", "常量" },
{ "hex.view.store.desc", "从ImHex在线数据库下载新内容" }, { "hex.builtin.view.constants.row.category", "分类" },
{ "hex.view.store.reload", "刷新" }, { "hex.builtin.view.constants.row.name", "名称" },
{ "hex.view.store.row.name", "名称" }, { "hex.builtin.view.constants.row.desc", "描述" },
{ "hex.view.store.row.description", "描述" }, { "hex.builtin.view.constants.row.value", "" },
{ "hex.view.store.download", "下载" },
{ "hex.view.store.update", "更新" },
{ "hex.view.store.remove", "移除" },
{ "hex.view.store.tab.patterns", "模式" },
{ "hex.view.store.tab.libraries", "" },
{ "hex.view.store.tab.magics", "魔术数据库" },
{ "hex.view.store.tab.constants", "常量" },
{ "hex.view.store.tab.yara", "Yara规则" },
{ "hex.view.store.loading", "正在加载仓库内容..." },
{ "hex.view.diff.name", "差异" },
/* Builtin plugin features */ { "hex.builtin.view.store.name", "内容仓库" },
{ "hex.builtin.view.store.desc", "从ImHex在线数据库下载新内容" },
{ "hex.builtin.view.store.reload", "刷新" },
{ "hex.builtin.view.store.row.name", "名称" },
{ "hex.builtin.view.store.row.description", "描述" },
{ "hex.builtin.view.store.download", "下载" },
{ "hex.builtin.view.store.update", "更新" },
{ "hex.builtin.view.store.remove", "移除" },
{ "hex.builtin.view.store.tab.patterns", "模式" },
{ "hex.builtin.view.store.tab.libraries", "" },
{ "hex.builtin.view.store.tab.magics", "魔术数据库" },
{ "hex.builtin.view.store.tab.constants", "常量" },
{ "hex.builtin.view.store.tab.yara", "Yara规则" },
{ "hex.builtin.view.store.loading", "正在加载仓库内容..." },
{ "hex.builtin.view.diff.name", "差异" },
//{ "hex.builtin.view.provider_settings.name", "Provider Settings" },
//{ "hex.builtin.view.provider_settings.load_popup", "Open Provider" },
{ "hex.builtin.command.calc.desc", "计算器" }, { "hex.builtin.command.calc.desc", "计算器" },
{ "hex.builtin.command.cmd.desc", "指令" }, { "hex.builtin.command.cmd.desc", "指令" },
@@ -664,6 +672,18 @@ namespace hex::plugin::builtin {
{ "hex.builtin.provider.file.creation", "创建时间" }, { "hex.builtin.provider.file.creation", "创建时间" },
{ "hex.builtin.provider.file.access", "最后访问时间" }, { "hex.builtin.provider.file.access", "最后访问时间" },
{ "hex.builtin.provider.file.modification", "最后更改时间" }, { "hex.builtin.provider.file.modification", "最后更改时间" },
//{ "hex.builtin.provider.file", "File Provider" },
//{ "hex.builtin.provider.gdb", "GDB Server Provider" },
//{ "hex.builtin.provider.gdb.name", "GDB Server <{0}:{1}>" },
//{ "hex.builtin.provider.gdb.server", "Server" },
//{ "hex.builtin.provider.gdb.ip", "IP Address" },
//{ "hex.builtin.provider.gdb.port", "Port" },
//{ "hex.builtin.provider.disk", "Raw Disk Provider" },
//{ "hex.builtin.provider.disk.selected_disk", "Disk" },
//{ "hex.builtin.provider.disk.disk_size", "Disk Size" },
//{ "hex.builtin.provider.disk.sector_size", "Sector Size" },
//{ "hex.builtin.provider.disk.reload", "Reload" },
}); });
} }

View File

@@ -2,12 +2,14 @@
namespace hex::plugin::builtin { namespace hex::plugin::builtin {
void registerViews();
void registerDataInspectorEntries(); void registerDataInspectorEntries();
void registerToolEntries(); void registerToolEntries();
void registerPatternLanguageFunctions(); void registerPatternLanguageFunctions();
void registerCommandPaletteCommands(); void registerCommandPaletteCommands();
void registerSettings(); void registerSettings();
void registerDataProcessorNodes(); void registerDataProcessorNodes();
void registerProviders();
void addFooterItems(); void addFooterItems();
void addToolbarItems(); void addToolbarItems();
@@ -23,12 +25,14 @@ IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") {
using namespace hex::plugin::builtin; using namespace hex::plugin::builtin;
registerViews();
registerDataInspectorEntries(); registerDataInspectorEntries();
registerToolEntries(); registerToolEntries();
registerPatternLanguageFunctions(); registerPatternLanguageFunctions();
registerCommandPaletteCommands(); registerCommandPaletteCommands();
registerSettings(); registerSettings();
registerDataProcessorNodes(); registerDataProcessorNodes();
registerProviders();
addFooterItems(); addFooterItems();
addToolbarItems(); addToolbarItems();

View File

@@ -1,7 +1,7 @@
[package] [package]
name = "example_rust" name = "example_rust"
version = "0.1.0" version = "0.1.0"
authors = ["Marc-André Moreau <marcandre.moreau@gmail.com>"] authors = ["WerWolv <hey@werwolv.net>"]
edition = "2018" edition = "2018"
[lib] [lib]
@@ -12,4 +12,4 @@ path = "source/plugin_example.rs"
hex = { path = "../libimhex-rust" } hex = { path = "../libimhex-rust" }
[profile.release] [profile.release]
lto = true lto = true

View File

@@ -77,6 +77,11 @@ set(LIBIMHEX_SOURCES
source/helpers/lang.cpp source/helpers/lang.cpp
source/helpers/net.cpp source/helpers/net.cpp
source/helpers/file.cpp source/helpers/file.cpp
source/helpers/socket.cpp
source/helpers/patches.cpp
source/helpers/project_file_handler.cpp
source/helpers/encoding_file.cpp
source/helpers/loader_script_handler.cpp
source/pattern_language/pattern_language.cpp source/pattern_language/pattern_language.cpp
source/pattern_language/preprocessor.cpp source/pattern_language/preprocessor.cpp

View File

@@ -3,6 +3,8 @@
#include <hex.hpp> #include <hex.hpp>
#include <hex/helpers/concepts.hpp> #include <hex/helpers/concepts.hpp>
#include <hex/pattern_language/token.hpp> #include <hex/pattern_language/token.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/event.hpp>
#include <functional> #include <functional>
#include <map> #include <map>
@@ -18,6 +20,7 @@ namespace hex {
class LanguageDefinition; class LanguageDefinition;
namespace pl { class Evaluator; } namespace pl { class Evaluator; }
namespace dp { class Node; } namespace dp { class Node; }
namespace prv { class Provider; }
/* /*
The Content Registry is the heart of all features in ImHex that are in some way extendable by Plugins. The Content Registry is the heart of all features in ImHex that are in some way extendable by Plugins.
@@ -52,7 +55,7 @@ namespace hex {
std::map<std::string, std::vector<Entry>>& getEntries(); std::map<std::string, std::vector<Entry>>& getEntries();
nlohmann::json getSetting(const std::string &unlocalizedCategory, const std::string &unlocalizedName); nlohmann::json getSetting(const std::string &unlocalizedCategory, const std::string &unlocalizedName);
nlohmann::json& getSettingsData(); nlohmann::json& getSettingsData();
}; }
/* Command Palette Command Registry. Allows adding of new commands to the command palette */ /* Command Palette Command Registry. Allows adding of new commands to the command palette */
namespace CommandPaletteCommands { namespace CommandPaletteCommands {
@@ -75,7 +78,7 @@ namespace hex {
void add(Type type, const std::string &command, const std::string &unlocalizedDescription, const DisplayCallback &displayCallback, const ExecuteCallback &executeCallback = [](auto){}); void add(Type type, const std::string &command, const std::string &unlocalizedDescription, const DisplayCallback &displayCallback, const ExecuteCallback &executeCallback = [](auto){});
std::vector<Entry>& getEntries(); std::vector<Entry>& getEntries();
}; }
/* Pattern Language Function Registry. Allows adding of new functions that may be used inside the pattern language */ /* Pattern Language Function Registry. Allows adding of new functions that may be used inside the pattern language */
namespace PatternLanguageFunctions { namespace PatternLanguageFunctions {
@@ -95,34 +98,45 @@ namespace hex {
void add(const Namespace &ns, const std::string &name, u32 parameterCount, const Callback &func); void add(const Namespace &ns, const std::string &name, u32 parameterCount, const Callback &func);
std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function>& getEntries(); std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function>& getEntries();
}; }
/* View Registry. Allows adding of new windows */ /* View Registry. Allows adding of new windows */
namespace Views { namespace Views {
void add(View *view);
namespace impl {
void add(View *view);
}
template<hex::derived_from<View> T, typename ... Args> template<hex::derived_from<View> T, typename ... Args>
void add(Args&& ... args) { void add(Args&& ... args) {
return add(new T(std::forward<Args>(args)...)); return impl::add(new T(std::forward<Args>(args)...));
} }
std::vector<View*>& getEntries(); std::vector<View*>& getEntries();
}; }
/* Tools Registry. Allows adding new entries to the tools window */ /* Tools Registry. Allows adding new entries to the tools window */
namespace Tools { namespace Tools {
using Callback = std::function<void()>;
struct Entry { namespace impl {
std::string name;
Callback function;
};
void add(const std::string &unlocalizedName, const Callback &function); using Callback = std::function<void()>;
std::vector<Entry>& getEntries(); struct Entry {
}; std::string name;
Callback function;
};
}
void add(const std::string &unlocalizedName, const impl::Callback &function);
std::vector<impl::Entry>& getEntries();
}
/* Data Inspector Registry. Allows adding of new types to the data inspector */ /* Data Inspector Registry. Allows adding of new types to the data inspector */
namespace DataInspector { namespace DataInspector {
@@ -133,35 +147,45 @@ namespace hex {
Octal Octal
}; };
using DisplayFunction = std::function<std::string()>; namespace impl {
using GeneratorFunction = std::function<DisplayFunction(const std::vector<u8>&, std::endian, NumberDisplayStyle)>;
struct Entry { using DisplayFunction = std::function<std::string()>;
std::string unlocalizedName; using GeneratorFunction = std::function<DisplayFunction(const std::vector<u8>&, std::endian, NumberDisplayStyle)>;
size_t requiredSize;
GeneratorFunction generatorFunction;
};
void add(const std::string &unlocalizedName, size_t requiredSize, GeneratorFunction function); struct Entry {
std::string unlocalizedName;
size_t requiredSize;
impl::GeneratorFunction generatorFunction;
};
std::vector<Entry>& getEntries(); }
};
void add(const std::string &unlocalizedName, size_t requiredSize, impl::GeneratorFunction function);
std::vector<impl::Entry>& getEntries();
}
/* Data Processor Node Registry. Allows adding new processor nodes to be used in the data processor */ /* Data Processor Node Registry. Allows adding new processor nodes to be used in the data processor */
namespace DataProcessorNode { namespace DataProcessorNode {
using CreatorFunction = std::function<dp::Node*()>; namespace impl {
struct Entry {
std::string category; using CreatorFunction = std::function<dp::Node*()>;
std::string name;
CreatorFunction creatorFunction; struct Entry {
}; std::string category;
std::string name;
CreatorFunction creatorFunction;
};
void add(const Entry &entry);
}
void add(const Entry &entry);
template<hex::derived_from<dp::Node> T, typename ... Args> template<hex::derived_from<dp::Node> T, typename ... Args>
void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, Args&& ... args) { void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, Args&& ... args) {
add(Entry{ unlocalizedCategory.c_str(), unlocalizedName.c_str(), add(impl::Entry{ unlocalizedCategory.c_str(), unlocalizedName.c_str(),
[=]{ [=]{
auto node = new T(std::forward<Args>(args)...); auto node = new T(std::forward<Args>(args)...);
node->setUnlocalizedName(unlocalizedName); node->setUnlocalizedName(unlocalizedName);
@@ -172,9 +196,9 @@ namespace hex {
void addSeparator(); void addSeparator();
std::vector<Entry>& getEntries(); std::vector<impl::Entry>& getEntries();
}; }
/* Language Registry. Allows together with the LangEntry class and the _lang user defined literal to add new languages */ /* Language Registry. Allows together with the LangEntry class and the _lang user defined literal to add new languages */
namespace Language { namespace Language {
@@ -183,7 +207,7 @@ namespace hex {
std::map<std::string, std::string>& getLanguages(); std::map<std::string, std::string>& getLanguages();
std::map<std::string, std::vector<LanguageDefinition>>& getLanguageDefinitions(); std::map<std::string, std::vector<LanguageDefinition>>& getLanguageDefinitions();
}; }
/* Interface Registry. Allows adding new items to various interfaces */ /* Interface Registry. Allows adding new items to various interfaces */
namespace Interface { namespace Interface {
@@ -196,7 +220,37 @@ namespace hex {
std::vector<DrawCallback>& getWelcomeScreenEntries(); std::vector<DrawCallback>& getWelcomeScreenEntries();
std::vector<DrawCallback>& getFooterItems(); std::vector<DrawCallback>& getFooterItems();
std::vector<DrawCallback>& getToolbarItems(); std::vector<DrawCallback>& getToolbarItems();
}; }
/* Provider Registry. Allows adding new data providers to be created from the UI */
namespace Provider {
namespace impl {
void addProviderName(const std::string &unlocalizedName);
}
template<hex::derived_from<hex::prv::Provider> T>
void add(const std::string &unlocalizedName, bool addToList = true) {
(void) EventManager::subscribe<RequestCreateProvider>([expectedName = unlocalizedName](const std::string &name, hex::prv::Provider **provider){
if (name != expectedName) return;
auto newProvider = new T();
hex::ImHexApi::Provider::add(newProvider);
if (provider != nullptr)
*provider = newProvider;
});
if (addToList)
impl::addProviderName(unlocalizedName);
}
const std::vector<std::string>& getEntries();
}
}; };
} }

View File

@@ -107,6 +107,7 @@ namespace hex {
EVENT_DEF(EventSettingsChanged); EVENT_DEF(EventSettingsChanged);
EVENT_DEF(EventAbnormalTermination, int); EVENT_DEF(EventAbnormalTermination, int);
EVENT_DEF(EventOSThemeChanged); EVENT_DEF(EventOSThemeChanged);
EVENT_DEF(EventProviderCreated, prv::Provider*);
EVENT_DEF(RequestOpenWindow, std::string); EVENT_DEF(RequestOpenWindow, std::string);
EVENT_DEF(RequestSelectionChange, Region); EVENT_DEF(RequestSelectionChange, Region);
@@ -117,6 +118,7 @@ namespace hex {
EVENT_DEF(RequestOpenFile, std::string); EVENT_DEF(RequestOpenFile, std::string);
EVENT_DEF(RequestChangeTheme, u32); EVENT_DEF(RequestChangeTheme, u32);
EVENT_DEF(RequestOpenPopup, std::string); EVENT_DEF(RequestOpenPopup, std::string);
EVENT_DEF(RequestCreateProvider, std::string, hex::prv::Provider **);
EVENT_DEF(QuerySelection, Region&); EVENT_DEF(QuerySelection, Region&);

View File

@@ -62,8 +62,8 @@ namespace hex {
static std::vector<ContentRegistry::CommandPaletteCommands::Entry> commandPaletteCommands; static std::vector<ContentRegistry::CommandPaletteCommands::Entry> commandPaletteCommands;
static std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> patternLanguageFunctions; static std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> patternLanguageFunctions;
static std::vector<View*> views; static std::vector<View*> views;
static std::vector<ContentRegistry::Tools::Entry> toolsEntries; static std::vector<ContentRegistry::Tools::impl::Entry> toolsEntries;
static std::vector<ContentRegistry::DataInspector::Entry> dataInspectorEntries; static std::vector<ContentRegistry::DataInspector::impl::Entry> dataInspectorEntries;
static u32 patternPaletteOffset; static u32 patternPaletteOffset;
static std::string popupMessage; static std::string popupMessage;
static std::list<ImHexApi::Bookmarks::Entry> bookmarkEntries; static std::list<ImHexApi::Bookmarks::Entry> bookmarkEntries;
@@ -77,7 +77,9 @@ namespace hex {
static std::vector<ContentRegistry::Interface::DrawCallback> footerItems; static std::vector<ContentRegistry::Interface::DrawCallback> footerItems;
static std::vector<ContentRegistry::Interface::DrawCallback> toolbarItems; static std::vector<ContentRegistry::Interface::DrawCallback> toolbarItems;
static std::vector<ContentRegistry::DataProcessorNode::Entry> dataProcessorNodes; static std::vector<std::string> providerNames;
static std::vector<ContentRegistry::DataProcessorNode::impl::Entry> dataProcessorNodes;
static u32 dataProcessorNodeIdCounter; static u32 dataProcessorNodeIdCounter;
static u32 dataProcessorLinkIdCounter; static u32 dataProcessorLinkIdCounter;
static u32 dataProcessorAttrIdCounter; static u32 dataProcessorAttrIdCounter;

View File

@@ -0,0 +1,55 @@
#pragma once
#include <hex.hpp>
#include <string>
#include <vector>
#if defined(OS_WINDOWS)
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#define SOCKET_NONE INVALID_SOCKET
#else
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#define SOCKET_NONE -1
#endif
namespace hex {
class Socket {
public:
Socket() = default;
Socket(const Socket&) = delete;
Socket(Socket &&other);
Socket(const std::string &address, u16 port);
~Socket();
void connect(const std::string &address, u16 port);
void disconnect();
[[nodiscard]]
bool isConnected() const;
std::string readString(size_t size = 0x1000) const;
std::vector<u8> readBytes(size_t size = 0x1000) const;
void writeString(const std::string &string) const;
void writeBytes(const std::vector<u8> &bytes) const;
private:
bool m_connected = false;
#if defined(OS_WINDOWS)
SOCKET m_socket = SOCKET_NONE;
#else
int m_socket = SOCKET_NONE;
#endif
};
}

View File

@@ -14,6 +14,7 @@
#include <optional> #include <optional>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <variant>
#include <vector> #include <vector>
#include <nfd.hpp> #include <nfd.hpp>
@@ -227,6 +228,17 @@ namespace hex {
return iter != a.end(); return iter != a.end();
} }
template<typename T, typename ... VariantTypes>
T get_or(const std::variant<VariantTypes...> &variant, T alt) {
const T *value = std::get_if<T>(&variant);
if (value == nullptr)
return alt;
else
return *value;
}
bool isProcessElevated();
namespace scope_guard { namespace scope_guard {
#define SCOPE_GUARD ::hex::scope_guard::ScopeGuardOnExit() + [&]() #define SCOPE_GUARD ::hex::scope_guard::ScopeGuardOnExit() + [&]()

View File

@@ -472,8 +472,13 @@ namespace hex::pl {
auto literal = dynamic_cast<ASTNodeLiteral*>(this->m_value->evaluate(evaluator)); auto literal = dynamic_cast<ASTNodeLiteral*>(this->m_value->evaluate(evaluator));
auto type = dynamic_cast<ASTNodeBuiltinType*>(this->m_type->evaluate(evaluator))->getType(); auto type = dynamic_cast<ASTNodeBuiltinType*>(this->m_type->evaluate(evaluator))->getType();
auto startOffset= evaluator->dataOffset();
auto typePattern = this->m_type->createPatterns(evaluator).front(); auto typePattern = this->m_type->createPatterns(evaluator).front();
ON_SCOPE_EXIT { delete typePattern; }; ON_SCOPE_EXIT {
evaluator->dataOffset() = startOffset;
delete typePattern;
};
return std::visit(overloaded { return std::visit(overloaded {
[&, this](PatternData * value) -> ASTNode* { LogConsole::abortEvaluation(hex::format("cannot cast custom type '{}' to '{}'", value->getTypeName(), Token::getTypeName(type)), this); }, [&, this](PatternData * value) -> ASTNode* { LogConsole::abortEvaluation(hex::format("cannot cast custom type '{}' to '{}'", value->getTypeName(), Token::getTypeName(type)), this); },
@@ -1085,13 +1090,13 @@ namespace hex::pl {
offset = evaluator->dataOffset(); offset = evaluator->dataOffset();
{ {
auto pointedAtPattern = this->m_type->createPatterns(evaluator).front();
u128 pointerAddress = 0; u128 pointerAddress = 0;
evaluator->getProvider()->read(pattern->getOffset(), &pointerAddress, pattern->getSize()); evaluator->getProvider()->read(pattern->getOffset(), &pointerAddress, pattern->getSize());
pointerAddress = hex::changeEndianess(pointerAddress, sizePattern->getSize(), sizePattern->getEndian()); pointerAddress = hex::changeEndianess(pointerAddress, sizePattern->getSize(), sizePattern->getEndian());
pointedAtPattern->setOffset(pointerAddress); evaluator->dataOffset() = pointerAddress;
auto pointedAtPattern = this->m_type->createPatterns(evaluator).front();
pattern->setPointedAtPattern(pointedAtPattern); pattern->setPointedAtPattern(pointedAtPattern);
pattern->setEndian(sizePattern->getEndian()); pattern->setEndian(sizePattern->getEndian());
@@ -1642,9 +1647,9 @@ namespace hex::pl {
LogConsole::abortEvaluation("array index out of bounds", this); LogConsole::abortEvaluation("array index out of bounds", this);
auto newPattern = searchScope.front()->clone(); auto newPattern = searchScope.front()->clone();
newPattern->setOffset(staticArrayPattern->getOffset() + index * staticArrayPattern->getTemplate()->getSize());
delete currPattern; delete currPattern;
currPattern = newPattern; currPattern = newPattern;
currPattern->setOffset(staticArrayPattern->getOffset() + index * staticArrayPattern->getSize());
} }
} }
}, index->getValue()); }, index->getValue());

View File

@@ -149,6 +149,18 @@ namespace hex::pl {
LogConsole::abortEvaluation("evaluation aborted by user"); LogConsole::abortEvaluation("evaluation aborted by user");
} }
[[nodiscard]]
std::optional<Token::Literal> getEnvVariable(const std::string &name) const {
if (this->m_envVariables.contains(name))
return this->m_envVariables.at(name);
else
return std::nullopt;
}
void setEnvVariable(const std::string &name, const Token::Literal &value) {
this->m_envVariables[name] = value;
}
private: private:
void patternCreated(); void patternCreated();
@@ -173,6 +185,7 @@ namespace hex::pl {
std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> m_customFunctions; std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> m_customFunctions;
std::vector<ASTNode*> m_customFunctionDefinitions; std::vector<ASTNode*> m_customFunctionDefinitions;
std::vector<Token::Literal> m_stack; std::vector<Token::Literal> m_stack;
std::map<std::string, Token::Literal> m_envVariables;
friend class PatternCreationLimiter; friend class PatternCreationLimiter;
}; };

View File

@@ -3,12 +3,14 @@
#include <hex.hpp> #include <hex.hpp>
#include <bit> #include <bit>
#include <map>
#include <optional> #include <optional>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <vector> #include <vector>
#include <hex/pattern_language/log_console.hpp> #include <hex/pattern_language/log_console.hpp>
#include <hex/pattern_language/token.hpp>
namespace hex::prv { class Provider; } namespace hex::prv { class Provider; }
@@ -28,8 +30,8 @@ namespace hex::pl {
PatternLanguage(); PatternLanguage();
~PatternLanguage(); ~PatternLanguage();
std::optional<std::vector<PatternData*>> executeString(prv::Provider *provider, const std::string &string); std::optional<std::vector<PatternData*>> executeString(prv::Provider *provider, const std::string &string, const std::map<std::string, Token::Literal> &envVars = { });
std::optional<std::vector<PatternData*>> executeFile(prv::Provider *provider, const std::string &path); std::optional<std::vector<PatternData*>> executeFile(prv::Provider *provider, const std::string &path, const std::map<std::string, Token::Literal> &envVars = { });
void abort(); void abort();

View File

@@ -19,16 +19,14 @@ namespace hex::prv {
Provider(); Provider();
virtual ~Provider(); virtual ~Provider();
virtual bool isAvailable() const = 0; [[nodiscard]] virtual bool isAvailable() const = 0;
virtual bool isReadable() const = 0; [[nodiscard]] virtual bool isReadable() const = 0;
virtual bool isWritable() const = 0; [[nodiscard]] virtual bool isWritable() const = 0;
virtual bool isResizable() const = 0; [[nodiscard]] virtual bool isResizable() const = 0;
virtual bool isSavable() const = 0; [[nodiscard]] virtual bool isSavable() const = 0;
virtual void read(u64 offset, void *buffer, size_t size, bool overlays = true); virtual void read(u64 offset, void *buffer, size_t size, bool overlays = true);
virtual void readRelative(u64 offset, void *buffer, size_t size, bool overlays = true);
virtual void write(u64 offset, const void *buffer, size_t size); virtual void write(u64 offset, const void *buffer, size_t size);
virtual void writeRelative(u64 offset, const void *buffer, size_t size);
virtual void resize(ssize_t newSize); virtual void resize(ssize_t newSize);
@@ -37,37 +35,46 @@ namespace hex::prv {
virtual void readRaw(u64 offset, void *buffer, size_t size) = 0; virtual void readRaw(u64 offset, void *buffer, size_t size) = 0;
virtual void writeRaw(u64 offset, const void *buffer, size_t size) = 0; virtual void writeRaw(u64 offset, const void *buffer, size_t size) = 0;
virtual size_t getActualSize() const = 0; [[nodiscard]] virtual size_t getActualSize() const = 0;
void applyOverlays(u64 offset, void *buffer, size_t size); void applyOverlays(u64 offset, void *buffer, size_t size);
std::map<u64, u8>& getPatches(); [[nodiscard]] std::map<u64, u8>& getPatches();
const std::map<u64, u8>& getPatches() const; [[nodiscard]] const std::map<u64, u8>& getPatches() const;
void applyPatches(); void applyPatches();
[[nodiscard]] Overlay* newOverlay(); [[nodiscard]] Overlay* newOverlay();
void deleteOverlay(Overlay *overlay); void deleteOverlay(Overlay *overlay);
[[nodiscard]] const std::list<Overlay*>& getOverlays(); [[nodiscard]] const std::list<Overlay*>& getOverlays();
u32 getPageCount() const; [[nodiscard]] u32 getPageCount() const;
u32 getCurrentPage() const; [[nodiscard]] u32 getCurrentPage() const;
void setCurrentPage(u32 page); void setCurrentPage(u32 page);
virtual void setBaseAddress(u64 address); virtual void setBaseAddress(u64 address);
virtual u64 getBaseAddress() const; [[nodiscard]] virtual u64 getBaseAddress() const;
virtual size_t getSize() const; [[nodiscard]] virtual u64 getCurrentPageAddress() const;
virtual std::optional<u32> getPageOfAddress(u64 address) const; [[nodiscard]] virtual size_t getSize() const;
[[nodiscard]] virtual std::optional<u32> getPageOfAddress(u64 address) const;
[[nodiscard]] virtual std::string getName() const = 0; [[nodiscard]] virtual std::string getName() const = 0;
[[nodiscard]] virtual std::vector<std::pair<std::string, std::string>> getDataInformation() const = 0; [[nodiscard]] virtual std::vector<std::pair<std::string, std::string>> getDataInformation() const = 0;
[[nodiscard]] virtual bool open() = 0;
virtual void close() = 0;
void addPatch(u64 offset, const void *buffer, size_t size); void addPatch(u64 offset, const void *buffer, size_t size);
void undo(); void undo();
void redo(); void redo();
bool canUndo() const; [[nodiscard]] bool canUndo() const;
bool canRedo() const; [[nodiscard]] bool canRedo() const;
[[nodiscard]] virtual bool hasLoadInterface() const;
[[nodiscard]] virtual bool hasInterface() const;
virtual void drawLoadInterface();
virtual void drawInterface();
protected: protected:
u32 m_currPage = 0; u32 m_currPage = 0;

View File

@@ -184,7 +184,7 @@ namespace hex {
/* Views */ /* Views */
void ContentRegistry::Views::add(View *view) { void ContentRegistry::Views::impl::add(View *view) {
getEntries().emplace_back(view); getEntries().emplace_back(view);
} }
@@ -196,27 +196,27 @@ namespace hex {
/* Tools */ /* Tools */
void ContentRegistry::Tools:: add(const std::string &unlocalizedName, const std::function<void()> &function) { void ContentRegistry::Tools:: add(const std::string &unlocalizedName, const std::function<void()> &function) {
getEntries().emplace_back(Entry{ unlocalizedName, function }); getEntries().emplace_back(impl::Entry{ unlocalizedName, function });
} }
std::vector<ContentRegistry::Tools::Entry>& ContentRegistry::Tools::getEntries() { std::vector<ContentRegistry::Tools::impl::Entry>& ContentRegistry::Tools::getEntries() {
return SharedData::toolsEntries; return SharedData::toolsEntries;
} }
/* Data Inspector */ /* Data Inspector */
void ContentRegistry::DataInspector::add(const std::string &unlocalizedName, size_t requiredSize, ContentRegistry::DataInspector::GeneratorFunction function) { void ContentRegistry::DataInspector::add(const std::string &unlocalizedName, size_t requiredSize, ContentRegistry::DataInspector::impl::GeneratorFunction function) {
getEntries().push_back({ unlocalizedName, requiredSize, std::move(function) }); getEntries().push_back({ unlocalizedName, requiredSize, std::move(function) });
} }
std::vector<ContentRegistry::DataInspector::Entry>& ContentRegistry::DataInspector::getEntries() { std::vector<ContentRegistry::DataInspector::impl::Entry>& ContentRegistry::DataInspector::getEntries() {
return SharedData::dataInspectorEntries; return SharedData::dataInspectorEntries;
} }
/* Data Processor Nodes */ /* Data Processor Nodes */
void ContentRegistry::DataProcessorNode::add(const Entry &entry) { void ContentRegistry::DataProcessorNode::impl::add(const impl::Entry &entry) {
getEntries().push_back(entry); getEntries().push_back(entry);
} }
@@ -224,7 +224,7 @@ namespace hex {
getEntries().push_back({ "", "", []{ return nullptr; } }); getEntries().push_back({ "", "", []{ return nullptr; } });
} }
std::vector<ContentRegistry::DataProcessorNode::Entry>& ContentRegistry::DataProcessorNode::getEntries() { std::vector<ContentRegistry::DataProcessorNode::impl::Entry>& ContentRegistry::DataProcessorNode::getEntries() {
return SharedData::dataProcessorNodes; return SharedData::dataProcessorNodes;
} }
@@ -269,4 +269,15 @@ namespace hex {
std::vector<ContentRegistry::Interface::DrawCallback>& ContentRegistry::Interface::getToolbarItems() { std::vector<ContentRegistry::Interface::DrawCallback>& ContentRegistry::Interface::getToolbarItems() {
return SharedData::toolbarItems; return SharedData::toolbarItems;
} }
/* Providers */
void ContentRegistry::Provider::impl::addProviderName(const std::string &unlocalizedName) {
SharedData::providerNames.push_back(unlocalizedName);
}
const std::vector<std::string> &ContentRegistry::Provider::getEntries() {
return SharedData::providerNames;
}
} }

View File

@@ -68,6 +68,8 @@ namespace hex {
void ImHexApi::Provider::add(prv::Provider *provider) { void ImHexApi::Provider::add(prv::Provider *provider) {
SharedData::providers.push_back(provider); SharedData::providers.push_back(provider);
SharedData::currentProvider = SharedData::providers.size() - 1; SharedData::currentProvider = SharedData::providers.size() - 1;
EventManager::post<EventProviderCreated>(provider);
} }
void ImHexApi::Provider::remove(prv::Provider *provider) { void ImHexApi::Provider::remove(prv::Provider *provider) {

View File

@@ -1,4 +1,4 @@
#include "helpers/encoding_file.hpp" #include <hex/helpers/encoding_file.hpp>
#include <hex/helpers/utils.hpp> #include <hex/helpers/utils.hpp>

View File

@@ -1,4 +1,4 @@
#include "helpers/loader_script_handler.hpp" #include <hex/helpers/loader_script_handler.hpp>
#include <hex/helpers/utils.hpp> #include <hex/helpers/utils.hpp>
#include <hex/helpers/paths.hpp> #include <hex/helpers/paths.hpp>

View File

@@ -65,7 +65,7 @@ namespace hex::magic {
std::string getDescription(prv::Provider *provider, size_t size) { std::string getDescription(prv::Provider *provider, size_t size) {
std::vector<u8> buffer(std::min(provider->getSize(), size), 0x00); std::vector<u8> buffer(std::min(provider->getSize(), size), 0x00);
provider->readRelative(0x00, buffer.data(), buffer.size()); provider->read(provider->getBaseAddress(), buffer.data(), buffer.size());
return getDescription(buffer); return getDescription(buffer);
} }
@@ -86,7 +86,7 @@ namespace hex::magic {
std::string getMIMEType(prv::Provider *provider, size_t size) { std::string getMIMEType(prv::Provider *provider, size_t size) {
std::vector<u8> buffer(std::min(provider->getSize(), size), 0x00); std::vector<u8> buffer(std::min(provider->getSize(), size), 0x00);
provider->readRelative(0x00, buffer.data(), buffer.size()); provider->read(provider->getBaseAddress(), buffer.data(), buffer.size());
return getMIMEType(buffer); return getMIMEType(buffer);
} }

Some files were not shown because too many files have changed in this diff Show More