mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-31 05:15:55 -05:00
Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16a0fe4281 | ||
|
|
fee176dc72 | ||
|
|
b6f76ad8ed | ||
|
|
0d11f4460f | ||
|
|
ee2b412a10 | ||
|
|
cf67adfa42 | ||
|
|
4029c333ed | ||
|
|
0c6bd73996 | ||
|
|
d91abb5eba | ||
|
|
d177d69724 | ||
|
|
64e35886b7 | ||
|
|
7f75f814e3 | ||
|
|
6527c942c2 | ||
|
|
ea71389982 | ||
|
|
32d47456de | ||
|
|
407c13fcce | ||
|
|
39b935affe | ||
|
|
1f2fe6b93d | ||
|
|
d7811e2c55 | ||
|
|
5b692067d8 | ||
|
|
ebbbcafe5c | ||
|
|
6fb6de6b64 | ||
|
|
24c7f1d5b7 | ||
|
|
93e1c4c4e8 | ||
|
|
72eac9f149 | ||
|
|
fddb790c70 | ||
|
|
771bb22962 | ||
|
|
59dd372ec8 | ||
|
|
a3b3eeb56a | ||
|
|
7795872be1 | ||
|
|
c3e41710c7 | ||
|
|
386ae7d8c3 | ||
|
|
2e338ebc01 | ||
|
|
8314b147d5 | ||
|
|
cab3410d23 | ||
|
|
45b00c8b5f | ||
|
|
183b8770bb | ||
|
|
950598911c | ||
|
|
8a485575f5 | ||
|
|
1e6b493b41 | ||
|
|
959988a670 | ||
|
|
907f25c231 | ||
|
|
2d7dd36b0d | ||
|
|
0168a3b741 | ||
|
|
2f19ff768d | ||
|
|
a2c80e3fd6 | ||
|
|
356273d71e | ||
|
|
6223b26888 | ||
|
|
147aefc7e5 | ||
|
|
0cc7004d0d | ||
|
|
f263685e44 | ||
|
|
a17bc43d80 | ||
|
|
d805d976a6 | ||
|
|
688ca01b1b | ||
|
|
42461c467f | ||
|
|
2c3a6d38ab | ||
|
|
ce22028781 | ||
|
|
2a7b698a3d | ||
|
|
ef747cc4c0 | ||
|
|
b7dd936dae | ||
|
|
f34b946ea9 | ||
|
|
2326e090af | ||
|
|
f2f6dd2219 | ||
|
|
ee10322603 | ||
|
|
af444999bf | ||
|
|
8423f78586 | ||
|
|
d4265f16eb | ||
|
|
cadd4e5c2b | ||
|
|
6cba868e20 | ||
|
|
4f98149fa7 | ||
|
|
32cfaac1e2 | ||
|
|
d954d9280f | ||
|
|
0ad0a91fa4 | ||
|
|
c18cb9f61e | ||
|
|
4a908a314f | ||
|
|
188723e888 | ||
|
|
4e86d874a7 | ||
|
|
8646fb4487 | ||
|
|
a91afdb6ae | ||
|
|
6e71d5aa31 | ||
|
|
b5912c59cc | ||
|
|
a9635bb78a | ||
|
|
9481c70ecd | ||
|
|
b6939654b3 | ||
|
|
c84ac0bc10 | ||
|
|
3a7a3a6e9c | ||
|
|
de327cf3a4 | ||
|
|
2e4eaf8d33 | ||
|
|
f0b392575f | ||
|
|
f1c03f8b1d | ||
|
|
8760fb39cb | ||
|
|
1e17aa7431 | ||
|
|
293fc17aa6 | ||
|
|
2eb83b0035 | ||
|
|
7a2b3397a3 | ||
|
|
7838d420d8 | ||
|
|
3e6865ffa9 | ||
|
|
c26bea06d6 | ||
|
|
f2cd60e7b2 | ||
|
|
903a4a9222 | ||
|
|
06e0bb19a3 | ||
|
|
e6dc731921 | ||
|
|
61cf13edf8 | ||
|
|
31e5ec7bc3 | ||
|
|
372981920e | ||
|
|
4c9459def3 | ||
|
|
26b881e4c9 | ||
|
|
93802f5872 | ||
|
|
205d88cd23 | ||
|
|
02a63639da | ||
|
|
4a1de5d1cb | ||
|
|
209d33ca57 | ||
|
|
e854e42bd7 | ||
|
|
b25cc17ac9 | ||
|
|
0af8b8155f | ||
|
|
7f97416e6e | ||
|
|
3cbbfb1782 | ||
|
|
ced9706c5b | ||
|
|
7f21cdffa2 | ||
|
|
0e2add204b | ||
|
|
490c7e8fec | ||
|
|
a4b4360df6 | ||
|
|
0a29f25330 | ||
|
|
5532a0673f | ||
|
|
9b9c040d2d | ||
|
|
305b4d0ac0 | ||
|
|
615a96f9d8 | ||
|
|
0da508594b | ||
|
|
89643d1538 | ||
|
|
9900a51757 |
50
.github/workflows/build.yml
vendored
50
.github/workflows/build.yml
vendored
@@ -18,24 +18,12 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: ⬇️ Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
gcc-10 \
|
||||
g++-10 \
|
||||
pkg-config \
|
||||
cmake \
|
||||
make \
|
||||
libglfw3-dev \
|
||||
libglm-dev \
|
||||
libmagic-dev \
|
||||
libmbedtls-dev \
|
||||
libcapstone-dev \
|
||||
python3-dev \
|
||||
libfreetype-dev \
|
||||
sudo bash dist/get_deps_debian.sh
|
||||
|
||||
- name: ✋ Build
|
||||
run: |
|
||||
@@ -60,43 +48,22 @@ jobs:
|
||||
|
||||
win:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { msystem: MINGW64, arch: x86_64 }
|
||||
#- { msystem: MINGW32, arch: i686 } # currently fail
|
||||
name: 🟦 ${{ matrix.msystem }} · ${{ matrix.arch }}
|
||||
name: 🟦 Windows MINGW64
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
env:
|
||||
MINGW_INSTALLS: ${{ matrix.msystem }}
|
||||
steps:
|
||||
|
||||
- name: 🧰 Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: ⬇️ Install dependencies
|
||||
submodules: recursive
|
||||
- name: 🟦 Install msys2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{ matrix.msystem }}
|
||||
update: true
|
||||
install: >
|
||||
mingw-w64-${{ matrix.arch }}-gcc
|
||||
mingw-w64-${{ matrix.arch }}-cmake
|
||||
mingw-w64-${{ matrix.arch }}-make
|
||||
mingw-w64-${{ matrix.arch }}-capstone
|
||||
mingw-w64-${{ matrix.arch }}-glfw
|
||||
mingw-w64-${{ matrix.arch }}-glm
|
||||
mingw-w64-${{ matrix.arch }}-file
|
||||
mingw-w64-${{ matrix.arch }}-mbedtls
|
||||
mingw-w64-${{ matrix.arch }}-polly
|
||||
mingw-w64-${{ matrix.arch }}-python
|
||||
mingw-w64-${{ matrix.arch }}-dlfcn
|
||||
mingw-w64-${{ matrix.arch }}-freetype
|
||||
- name: ⬇️ Install dependencies
|
||||
run: |
|
||||
bash dist/get_deps_msys2.sh
|
||||
|
||||
- name: ✋ Build
|
||||
run: |
|
||||
@@ -146,6 +113,7 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: ⬇️ Install dependencies
|
||||
run: |
|
||||
|
||||
16
.gitmodules
vendored
Normal file
16
.gitmodules
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[submodule "external/nativefiledialog"]
|
||||
path = external/nativefiledialog
|
||||
url = https://github.com/btzy/nativefiledialog-extended
|
||||
[submodule "external/yara/yara"]
|
||||
path = external/yara/yara
|
||||
url = https://github.com/VirusTotal/yara
|
||||
ignore = dirty
|
||||
[submodule "external/xdgpp"]
|
||||
path = external/xdgpp
|
||||
url = https://git.sr.ht/~danyspin97/xdgpp
|
||||
[submodule "external/fmt"]
|
||||
path = external/fmt
|
||||
url = https://github.com/fmtlib/fmt
|
||||
[submodule "external/curl"]
|
||||
path = external/curl
|
||||
url = https://github.com/curl/curl
|
||||
5
.idea/vcs.xml
generated
5
.idea/vcs.xml
generated
@@ -2,5 +2,10 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/external/curl" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/external/fmt" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/external/nativefiledialog" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/external/xdgpp" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/external/yara/yara" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,7 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# Updating the version here will update it throughout ImHex as well
|
||||
project(imhex VERSION 1.7.0)
|
||||
set(IMHEX_VERSION "1.8.0")
|
||||
project(imhex VERSION ${IMHEX_VERSION})
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
|
||||
@@ -10,8 +11,8 @@ setDefaultBuiltTypeIfUnset()
|
||||
|
||||
# List plugin names here. Project name must match folder name
|
||||
set(PLUGINS
|
||||
example
|
||||
builtin
|
||||
# example
|
||||
)
|
||||
|
||||
# List extra magic databases to compile here
|
||||
@@ -26,6 +27,7 @@ detectArch()
|
||||
|
||||
# Add bundled dependencies
|
||||
add_subdirectory(external/llvm)
|
||||
add_subdirectory(external/yara)
|
||||
add_subdirectory(plugins/libimhex)
|
||||
|
||||
# Add include directories
|
||||
@@ -38,10 +40,13 @@ add_executable(imhex ${application_type}
|
||||
source/main.cpp
|
||||
source/window.cpp
|
||||
|
||||
source/init/splash_window.cpp
|
||||
source/init/tasks.cpp
|
||||
|
||||
source/helpers/patches.cpp
|
||||
source/helpers/project_file_handler.cpp
|
||||
source/helpers/loader_script_handler.cpp
|
||||
source/helpers/plugin_handler.cpp
|
||||
source/helpers/plugin_manager.cpp
|
||||
source/helpers/encoding_file.cpp
|
||||
|
||||
source/providers/file_provider.cpp
|
||||
@@ -61,6 +66,7 @@ add_executable(imhex ${application_type}
|
||||
source/views/view_command_palette.cpp
|
||||
source/views/view_settings.cpp
|
||||
source/views/view_data_processor.cpp
|
||||
source/views/view_yara.cpp
|
||||
|
||||
${imhex_icon}
|
||||
)
|
||||
@@ -69,9 +75,9 @@ set_target_properties(imhex PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
target_link_directories(imhex PRIVATE ${CAPSTONE_LIBRARY_DIRS} ${MAGIC_LIBRARY_DIRS})
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(imhex libdl.a libmagic.a libgnurx.a libtre.a libintl.a libiconv.a libshlwapi.a libcapstone.a LLVMDemangle libimhex ${Python_LIBRARIES} wsock32 ws2_32)
|
||||
elseif (UNIX)
|
||||
target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl)
|
||||
endif()
|
||||
target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} wsock32 ws2_32 libyara)
|
||||
else ()
|
||||
target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl pthread libyara)
|
||||
endif ()
|
||||
|
||||
createPackage()
|
||||
createPackage()
|
||||
|
||||
61
README.md
61
README.md
@@ -69,7 +69,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
|
||||
- File magic-based file parser and MIME type database
|
||||
- Byte distribution graph
|
||||
- Entropy graph
|
||||
- Highest and avarage entropy
|
||||
- Highest and average entropy
|
||||
- Encrypted / Compressed file detection
|
||||
- Helpful tools
|
||||
- Itanium and MSVC demangler
|
||||
@@ -87,7 +87,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
|
||||
|
||||
## 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 langauge 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 [in the wiki](https://github.com/WerWolv/ImHex/wiki/Pattern-Language-Guide) or a simpler version in ImHex under `Help -> Pattern Language Cheat Sheet`
|
||||
|
||||
## Additional Files
|
||||
|
||||
@@ -111,17 +111,16 @@ You need a C++20 compatible compiler such as GCC 10.2.0 to compile ImHex. Moreov
|
||||
|
||||
- GLFW3
|
||||
- libmagic, libgnurx, libtre, libintl, libiconv
|
||||
- libcrypto
|
||||
- libmbedtls
|
||||
- capstone
|
||||
- nlohmann json
|
||||
- Python3
|
||||
- freetype2
|
||||
- Brew (macOS only)
|
||||
- Xcode (macOS only)
|
||||
|
||||
### Windows and Linux
|
||||
|
||||
Find all-in-one dependency installation scripts for Arch Linux, Fedora, Debian/Ubuntu and/or MSYS2 in [dist](dist).
|
||||
### Windows
|
||||
|
||||
On Windows, ImHex is built through msys2 / mingw. To install all dependencies, open a mys2 window and run the PKGCONFIG script in the (dist/msys2)[dist/msys2] folder.
|
||||
After all the dependencies are installed, run the following commands to build ImHex:
|
||||
|
||||
```sh
|
||||
@@ -135,8 +134,6 @@ make -j
|
||||
|
||||
To create a standalone zipfile on Windows, get the Python standard library (e.g. from https://github.com/python/cpython/tree/master/Lib) and place the files and folders in `lib/python3.8` next to your built executable. Don't forget to also copy the `libpython3.8.dll` and `libwinpthread-1.dll` from your mingw setup next to the executable.
|
||||
|
||||
On both Windows and Linux:
|
||||
|
||||
- Copy the files from `python_libs` in the `lib` folder next to your built executable.
|
||||
- Place your magic databases in the `magic` folder next to your built executable
|
||||
- Place your patterns in the `pattern` folder next to your built executable
|
||||
@@ -154,6 +151,52 @@ CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ PKG_CON
|
||||
make -j
|
||||
```
|
||||
|
||||
Install the ImHex executable as well as libimhex.dylib to wherever ImHex should be installed.
|
||||
|
||||
All other files belong in `~/Library/Application Support/imhex`:
|
||||
```
|
||||
Patterns: ~/Library/Application Support/imhex/patterns
|
||||
Pattern Includes: ~/Library/Application Support/imhex/includes
|
||||
Magic files: ~/Library/Application Support/imhex/magic
|
||||
Python: ~/Library/Application Support/imhex/lib/pythonX.X
|
||||
Plugins: ~/Library/Application Support/imhex/plugins
|
||||
Configuration: ~/Library/Application Support/imhex/config
|
||||
Resources: ~/Library/Application Support/imhex/resources
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
Dependency installation scripts are available for many common Linux distributions in the (/dist)[dist] folder.
|
||||
After all the dependencies are installed, run the following commands to build ImHex:
|
||||
|
||||
```sh
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make -j
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Put the ImHex executable into the `/usr/bin` folder.
|
||||
Put libimhex.so into the `/usr/lib` folder.
|
||||
Configuration files go to `/etc/xdg/imhex` or `~/.config/imhex`.
|
||||
All other files belong in `/usr/share/imhex` or `~/.local/share/imhex`:
|
||||
|
||||
```
|
||||
Patterns: /usr/share/imhex/patterns
|
||||
Pattern Includes: /usr/share/imhex/includes
|
||||
Magic files: /usr/share/imhex/magic
|
||||
Python: /usr/share/imhex/lib/pythonX.X
|
||||
Plugins: /usr/share/imhex/plugins
|
||||
Configuration: /etc/xdg/imhex/config
|
||||
Resources: /usr/share/imhex/resources
|
||||
```
|
||||
|
||||
All paths follow the XDG Base Directories standard, and can thus be modified
|
||||
with the environment variables `XDG_CONFIG_HOME`, `XDG_CONFIG_DIRS`,
|
||||
`XDG_DATA_HOME` and `XDG_DATA_DIRS`.
|
||||
|
||||
## Credits
|
||||
|
||||
- Thanks a lot to ocornut for their amazing [Dear ImGui](https://github.com/ocornut/imgui) which is used for building the entire interface
|
||||
|
||||
@@ -20,6 +20,7 @@ macro(addVersionDefines)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGIT_BRANCH=\"\\\"${GIT_BRANCH}\"\\\"")
|
||||
endif()
|
||||
|
||||
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DPROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} -DPROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR} -DPROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH} ")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}\"\\\"")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}-Debug\"\\\"")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DRELEASE -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}-ReleaseWithDebugInfo\"\\\"")
|
||||
@@ -71,10 +72,25 @@ endmacro()
|
||||
macro(detectOS)
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_WINDOWS")
|
||||
set(CMAKE_INSTALL_BINDIR ".")
|
||||
set(CMAKE_INSTALL_LIBDIR ".")
|
||||
set(PLUGINS_INSTALL_LOCATION "plugins")
|
||||
set(MAGIC_INSTALL_LOCATION "magic")
|
||||
set(RESOURCES_INSTALL_LOCATION "resources")
|
||||
elseif(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_MACOS")
|
||||
set(CMAKE_INSTALL_BINDIR ".")
|
||||
set(CMAKE_INSTALL_LIBDIR ".")
|
||||
set(PLUGINS_INSTALL_LOCATION "plugins")
|
||||
set(MAGIC_INSTALL_LOCATION "magic")
|
||||
set(RESOURCES_INSTALL_LOCATION "resources")
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_LINUX")
|
||||
set(CMAKE_INSTALL_BINDIR "bin")
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
set(PLUGINS_INSTALL_LOCATION "share/imhex/plugins")
|
||||
set(MAGIC_INSTALL_LOCATION "share/imhex/magic")
|
||||
set(RESOURCES_INSTALL_LOCATION "share/imhex/resources")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown / unsupported system!")
|
||||
endif()
|
||||
@@ -103,8 +119,8 @@ macro(configurePackageCreation)
|
||||
else ()
|
||||
set(application_type)
|
||||
endif ()
|
||||
set(imhex_icon "${PROJECT_SOURCE_DIR}/res/resource.rc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc -Wl,--allow-multiple-definition -static -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive")
|
||||
set(imhex_icon "${CMAKE_SOURCE_DIR}/res/resource.rc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wl,-subsystem,windows")
|
||||
|
||||
if (CREATE_PACKAGE)
|
||||
@@ -119,7 +135,7 @@ macro(configurePackageCreation)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/res/LICENSE.rtf")
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
set (imhex_icon "${PROJECT_SOURCE_DIR}/res/mac/AppIcon.icns")
|
||||
set (imhex_icon "${CMAKE_SOURCE_DIR}/res/mac/AppIcon.icns")
|
||||
|
||||
if (CREATE_BUNDLE)
|
||||
set(application_type MACOSX_BUNDLE)
|
||||
@@ -146,10 +162,12 @@ macro(createPackage)
|
||||
foreach (plugin IN LISTS PLUGINS)
|
||||
add_subdirectory("plugins/${plugin}")
|
||||
set_target_properties(${plugin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
|
||||
install(TARGETS ${plugin} RUNTIME DESTINATION ${PLUGINS_INSTALL_LOCATION})
|
||||
add_dependencies(imhex ${plugin})
|
||||
endforeach()
|
||||
|
||||
set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
install(TARGETS libimhex RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if (WIN32)
|
||||
# Install binaries directly in the prefix, usually C:\Program Files\ImHex.
|
||||
@@ -188,10 +206,7 @@ macro(createPackage)
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
install(TARGETS libimhex DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
string(REPLACE ":" ";" EXTRA_MAGICDBS "${EXTRA_MAGICDBS}")
|
||||
|
||||
endif ()
|
||||
|
||||
if (NOT EXTRA_MAGICDBS STREQUAL "")
|
||||
@@ -199,9 +214,9 @@ macro(createPackage)
|
||||
|
||||
if (NOT EXTRA_MAGICDBS STREQUAL "NOTFOUND")
|
||||
if (EXTRA_MAGICDBS MATCHES ".*\\.mgc")
|
||||
install(FILES "${EXTRA_MAGICDBS}" DESTINATION magic/)
|
||||
install(FILES "${EXTRA_MAGICDBS}" DESTINATION ${MAGIC_INSTALL_LOCATION})
|
||||
else ()
|
||||
install(FILES "${EXTRA_MAGICDBS}.mgc" DESTINATION magic/)
|
||||
install(FILES "${EXTRA_MAGICDBS}.mgc" DESTINATION ${MAGIC_INSTALL_LOCATION})
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
@@ -214,12 +229,13 @@ macro(createPackage)
|
||||
COMMAND file -C -m ${CMAKE_SOURCE_DIR}/magic_dbs
|
||||
)
|
||||
|
||||
foreach (plugin IN LISTS PLUGINS)
|
||||
install(FILES "$<TARGET_FILE:${plugin}>" DESTINATION plugins/)
|
||||
endforeach ()
|
||||
|
||||
# Install the magicdb files.
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/magic_dbs.mgc DESTINATION magic/ RENAME imhex.mgc)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/magic_dbs.mgc DESTINATION ${MAGIC_INSTALL_LOCATION} RENAME imhex.mgc)
|
||||
|
||||
# Install resources
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/resources/ DESTINATION ${RESOURCES_INSTALL_LOCATION})
|
||||
|
||||
|
||||
if (CREATE_BUNDLE)
|
||||
include(PostprocessBundle)
|
||||
@@ -238,11 +254,7 @@ macro(createPackage)
|
||||
|
||||
install(TARGETS imhex BUNDLE DESTINATION .)
|
||||
else()
|
||||
if (WIN32)
|
||||
install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
else ()
|
||||
install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
endif ()
|
||||
install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
1
dist/Brewfile
vendored
1
dist/Brewfile
vendored
@@ -7,6 +7,7 @@ brew "cmake"
|
||||
brew "python3"
|
||||
brew "freetype2"
|
||||
brew "libmagic"
|
||||
brew "pkg-config"
|
||||
|
||||
# TODO: Remove this when XCode version of clang will support the same level as LLVM 10
|
||||
brew "llvm"
|
||||
2
dist/ImHex-9999.ebuild
vendored
2
dist/ImHex-9999.ebuild
vendored
@@ -27,8 +27,8 @@ RDEPEND="${DEPEND}
|
||||
sys-apps/file
|
||||
dev-libs/mbedtls
|
||||
dev-libs/capstone
|
||||
sys-devel/llvm
|
||||
dev-cpp/nlohmann_json
|
||||
media-libs/glm
|
||||
x11-libs/gtk+
|
||||
"
|
||||
BDEPEND="${DEPEND}"
|
||||
|
||||
3
dist/get_deps_archlinux.sh
vendored
3
dist/get_deps_archlinux.sh
vendored
@@ -9,4 +9,5 @@ pacman -S --needed \
|
||||
capstone \
|
||||
glm \
|
||||
python3 \
|
||||
freetype2
|
||||
freetype2 \
|
||||
gtk3
|
||||
|
||||
28
dist/get_deps_debian.sh
vendored
28
dist/get_deps_debian.sh
vendored
@@ -10,19 +10,21 @@ then
|
||||
PKGCONF="pkgconf"
|
||||
fi
|
||||
|
||||
apt install \
|
||||
cmake \
|
||||
g++-10 \
|
||||
${PKGCONF:-} \
|
||||
libcapstone-dev \
|
||||
libmagic-dev \
|
||||
libglfw3-dev \
|
||||
libglm-dev \
|
||||
libjsoncpp-dev \
|
||||
libmbedtls-dev \
|
||||
libstdc++-10-dev \
|
||||
python3-dev \
|
||||
libfreetype-dev
|
||||
apt install -y \
|
||||
build-essential \
|
||||
gcc-10 \
|
||||
g++-10 \
|
||||
${PKGCONF:-} \
|
||||
cmake \
|
||||
make \
|
||||
libglfw3-dev \
|
||||
libglm-dev \
|
||||
libmagic-dev \
|
||||
libmbedtls-dev \
|
||||
libcapstone-dev \
|
||||
python3-dev \
|
||||
libfreetype-dev \
|
||||
libgtk-3-dev \
|
||||
|
||||
echo "Please consider this before running cmake (useful on e.g. Ubuntu 20.04):"
|
||||
echo "export CXX=g++-10"
|
||||
|
||||
3
dist/get_deps_fedora.sh
vendored
3
dist/get_deps_fedora.sh
vendored
@@ -10,4 +10,5 @@ dnf install \
|
||||
mesa-libGL-devel \
|
||||
mbedtls-devel \
|
||||
python-devel \
|
||||
freetype-devel
|
||||
freetype-devel \
|
||||
gtk3
|
||||
|
||||
3
dist/get_deps_msys2.sh
vendored
3
dist/get_deps_msys2.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
pacman -S --needed \
|
||||
pacman -S --needed --noconfirm \
|
||||
mingw-w64-x86_64-gcc \
|
||||
mingw-w64-x86_64-cmake \
|
||||
mingw-w64-x86_64-make \
|
||||
@@ -9,7 +9,6 @@ pacman -S --needed \
|
||||
mingw-w64-x86_64-glm \
|
||||
mingw-w64-x86_64-file \
|
||||
mingw-w64-x86_64-mbedtls \
|
||||
mingw-w64-x86_64-polly \
|
||||
mingw-w64-x86_64-python \
|
||||
mingw-w64-x86_64-freetype \
|
||||
mingw-w64-x86_64-dlfcn
|
||||
|
||||
4
dist/msys2/PKGBUILD
vendored
4
dist/msys2/PKGBUILD
vendored
@@ -11,12 +11,12 @@ depends=("${MINGW_PACKAGE_PREFIX}-python")
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
|
||||
"${MINGW_PACKAGE_PREFIX}-cmake"
|
||||
"${MINGW_PACKAGE_PREFIX}-make"
|
||||
"${MINGW_PACKAGE_PREFIX}-dlsym"
|
||||
"${MINGW_PACKAGE_PREFIX}-dlfcn"
|
||||
"${MINGW_PACKAGE_PREFIX}-capstone"
|
||||
"${MINGW_PACKAGE_PREFIX}-glfw"
|
||||
"${MINGW_PACKAGE_PREFIX}-glm"
|
||||
"${MINGW_PACKAGE_PREFIX}-file"
|
||||
"${MINGW_PACKAGE_PREFIX}-openssl"
|
||||
"${MINGW_PACKAGE_PREFIX}-mbedtls"
|
||||
"${MINGW_PACKAGE_PREFIX}-polly"
|
||||
"${MINGW_PACKAGE_PREFIX}-python"
|
||||
"${MINGW_PACKAGE_PREFIX}-freetype")
|
||||
|
||||
16
external/ImGui/CMakeLists.txt
vendored
16
external/ImGui/CMakeLists.txt
vendored
@@ -10,7 +10,7 @@ pkg_search_module(GLFW REQUIRED glfw3)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
|
||||
add_library(imgui
|
||||
add_library(imgui STATIC
|
||||
source/imgui.cpp
|
||||
source/imgui_demo.cpp
|
||||
source/imgui_draw.cpp
|
||||
@@ -19,22 +19,30 @@ add_library(imgui
|
||||
source/imgui_impl_opengl3.cpp
|
||||
source/imgui_tables.cpp
|
||||
source/imgui_widgets.cpp
|
||||
source/ImGuiFileBrowser.cpp
|
||||
|
||||
source/TextEditor.cpp
|
||||
|
||||
source/imgui_imhex_extensions.cpp
|
||||
|
||||
source/imnodes.cpp
|
||||
|
||||
source/implot.cpp
|
||||
source/implot_items.cpp
|
||||
source/implot_demo.cpp
|
||||
|
||||
fonts/fontawesome_font.c
|
||||
)
|
||||
|
||||
add_compile_definitions(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../glad ${CMAKE_CURRENT_BINARY_DIR}/external/glad)
|
||||
|
||||
target_include_directories(imgui PUBLIC include ${FREETYPE_INCLUDE_DIRS} ${GLFW_INCLUDE_DIRS})
|
||||
target_include_directories(imgui PUBLIC include fonts ${FREETYPE_INCLUDE_DIRS} ${GLFW_INCLUDE_DIRS})
|
||||
|
||||
target_link_directories(imgui PUBLIC ${GLM_INCLUDE_DIRS} ${GLFW_LIBRARY_DIRS})
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(imgui libstdc++.a libgcc.a libharfbuzz.a libfreetype.a libharfbuzz.a libgraphite2.a libpng.a libbrotlidec-static.a libbrotlicommon-static.a libz.a libbz2.a librpcrt4.a glad libglfw3.a)
|
||||
target_link_libraries(imgui Freetype::Freetype glad glfw3)
|
||||
elseif (UNIX)
|
||||
target_link_libraries(imgui Freetype::Freetype glad glfw)
|
||||
endif()
|
||||
|
||||
3025
external/ImGui/fonts/fontawesome_font.c
vendored
Normal file
3025
external/ImGui/fonts/fontawesome_font.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1015
external/ImGui/fonts/fontawesome_font.h
vendored
Normal file
1015
external/ImGui/fonts/fontawesome_font.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1160
external/ImGui/include/Dirent/dirent.h
vendored
1160
external/ImGui/include/Dirent/dirent.h
vendored
File diff suppressed because it is too large
Load Diff
123
external/ImGui/include/ImGuiFileBrowser.h
vendored
123
external/ImGui/include/ImGuiFileBrowser.h
vendored
@@ -1,123 +0,0 @@
|
||||
#ifndef IMGUIFILEBROWSER_H
|
||||
#define IMGUIFILEBROWSER_H
|
||||
|
||||
#include <imgui.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace imgui_addons
|
||||
{
|
||||
class ImGuiFileBrowser
|
||||
{
|
||||
public:
|
||||
ImGuiFileBrowser();
|
||||
~ImGuiFileBrowser();
|
||||
|
||||
enum class DialogMode
|
||||
{
|
||||
SELECT, //Select Directory Mode
|
||||
OPEN, //Open File mode
|
||||
SAVE //Save File mode.
|
||||
};
|
||||
|
||||
/* Use this to show an open file dialog. The function takes label for the window,
|
||||
* the size, a DialogMode enum value defining in which mode the dialog should operate and optionally the extensions that are valid for opening.
|
||||
* Note that the select directory mode doesn't need any extensions.
|
||||
*/
|
||||
bool showFileDialog(const std::string& label, const DialogMode mode, const ImVec2& sz_xy = ImVec2(0,0), const std::string& valid_types = "*.*");
|
||||
|
||||
/* Store the opened/saved file name or dir name (incase of selectDirectoryDialog) and the absolute path to the selection
|
||||
* Should only be accessed when above functions return true else may contain garbage.
|
||||
*/
|
||||
std::string selected_fn;
|
||||
std::string selected_path;
|
||||
std::string ext; // Store the saved file extension
|
||||
|
||||
|
||||
private:
|
||||
struct Info
|
||||
{
|
||||
Info(std::string name, bool is_hidden) : name(name), is_hidden(is_hidden)
|
||||
{
|
||||
}
|
||||
std::string name;
|
||||
bool is_hidden;
|
||||
};
|
||||
|
||||
//Enum used as bit flags.
|
||||
enum FilterMode
|
||||
{
|
||||
FilterMode_Files = 0x01,
|
||||
FilterMode_Dirs = 0x02
|
||||
};
|
||||
|
||||
//Helper Functions
|
||||
static std::string wStringToString(const wchar_t* wchar_arr);
|
||||
static bool alphaSortComparator(const Info& a, const Info& b);
|
||||
ImVec2 getButtonSize(std::string button_text);
|
||||
|
||||
/* Helper Functions that render secondary modals
|
||||
* and help in validating file extensions and for filtering, parsing top navigation bar.
|
||||
*/
|
||||
void setValidExtTypes(const std::string& valid_types_string);
|
||||
bool validateFile();
|
||||
void showErrorModal();
|
||||
void showInvalidFileModal();
|
||||
bool showReplaceFileModal();
|
||||
void showHelpMarker(std::string desc);
|
||||
void parsePathTabs(std::string str);
|
||||
void filterFiles(int filter_mode);
|
||||
|
||||
/* Core Functions that render the 4 different regions making up
|
||||
* a simple file dialog
|
||||
*/
|
||||
bool renderNavAndSearchBarRegion();
|
||||
bool renderFileListRegion();
|
||||
bool renderInputTextAndExtRegion();
|
||||
bool renderButtonsAndCheckboxRegion();
|
||||
bool renderInputComboBox();
|
||||
void renderExtBox();
|
||||
|
||||
/* Core Functions that handle navigation and
|
||||
* reading directories/files
|
||||
*/
|
||||
bool readDIR(std::string path);
|
||||
bool onNavigationButtonClick(int idx);
|
||||
bool onDirClick(int idx);
|
||||
|
||||
// Functions that reset state and/or clear file list when reading new directory
|
||||
void clearFileList();
|
||||
void closeDialog();
|
||||
|
||||
#if defined (WIN32) || defined (_WIN32) || defined (__WIN32)
|
||||
bool loadWindowsDrives(); // Helper Function for Windows to load Drive Letters.
|
||||
#endif
|
||||
|
||||
#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
void initCurrentPath(); // Helper function for UNIX based system to load Absolute path using realpath
|
||||
#endif
|
||||
|
||||
ImVec2 min_size, max_size, input_combobox_pos, input_combobox_sz;
|
||||
DialogMode dialog_mode;
|
||||
int filter_mode, col_items_limit, selected_idx, selected_ext_idx;
|
||||
float col_width, ext_box_width;
|
||||
bool show_hidden, show_inputbar_combobox, is_dir, is_appearing, filter_dirty, validate_file, path_input_enabled;
|
||||
char input_fn[256];
|
||||
char temp_dir_input[256];
|
||||
|
||||
std::vector<std::string> valid_exts;
|
||||
std::vector<std::string> current_dirlist;
|
||||
std::vector<Info> subdirs;
|
||||
std::vector<Info> subfiles;
|
||||
std::string current_path, error_msg, error_title, invfile_modal_id, repfile_modal_id;
|
||||
|
||||
ImGuiTextFilter filter;
|
||||
std::string valid_types;
|
||||
std::vector<const Info*> filtered_dirs; // Note: We don't need to call delete. It's just for storing filtered items from subdirs and subfiles so we don't use PassFilter every frame.
|
||||
std::vector<const Info*> filtered_files;
|
||||
std::vector< std::reference_wrapper<std::string> > inputcb_filter_files;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // IMGUIFILEBROWSER_H
|
||||
24
external/ImGui/include/imgui_imhex_extensions.h
vendored
24
external/ImGui/include/imgui_imhex_extensions.h
vendored
@@ -12,4 +12,28 @@ namespace ImGui {
|
||||
|
||||
void UnderlinedText(const char* label, ImColor color, const ImVec2& size_arg = ImVec2(0, 0));
|
||||
|
||||
void Disabled(const std::function<void()> &widgets, bool disabled);
|
||||
void TextSpinner(const char* label);
|
||||
|
||||
void Header(const char *label, bool firstEntry = false);
|
||||
|
||||
std::tuple<ImTextureID, int, int> LoadImageFromPath(const char *path);
|
||||
void UnloadImage(ImTextureID texture);
|
||||
|
||||
enum ImGuiCustomCol {
|
||||
ImGuiCustomCol_DescButton,
|
||||
ImGuiCustomCol_DescButtonHovered,
|
||||
ImGuiCustomCol_DescButtonActive,
|
||||
ImGuiCustomCol_COUNT
|
||||
};
|
||||
|
||||
struct ImHexCustomData {
|
||||
ImVec4 Colors[ImGuiCustomCol_COUNT];
|
||||
};
|
||||
|
||||
ImU32 GetCustomColorU32(ImGuiCustomCol idx, float alpha_mul = 1.0F);
|
||||
|
||||
void StyleCustomColorsDark();
|
||||
void StyleCustomColorsLight();
|
||||
void StyleCustomColorsClassic();
|
||||
}
|
||||
17
external/ImGui/include/imgui_memory_editor.h
vendored
17
external/ImGui/include/imgui_memory_editor.h
vendored
@@ -48,7 +48,7 @@
|
||||
#include <stdint.h> // uint8_t, etc.
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <hex/views/view.hpp>
|
||||
#include <hex/api/event.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -156,6 +156,13 @@ struct MemoryEditor
|
||||
HighlightMax = addr_max;
|
||||
}
|
||||
|
||||
void GotoAddrAndSelect(size_t addr_min, size_t addr_max)
|
||||
{
|
||||
GotoAddr = addr_min;
|
||||
DataPreviewAddr = addr_min;
|
||||
DataPreviewAddrEnd = addr_max;
|
||||
}
|
||||
|
||||
struct Sizes
|
||||
{
|
||||
int AddrDigitsCount;
|
||||
@@ -222,8 +229,8 @@ struct MemoryEditor
|
||||
if (ImGui::Begin(title, p_open, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNavInputs))
|
||||
{
|
||||
if (DataPreviewAddr != DataPreviewAddrOld || DataPreviewAddrEnd != DataPreviewAddrEndOld) {
|
||||
hex::Region selectionRegion = { std::min(DataPreviewAddr, DataPreviewAddrEnd), std::max(DataPreviewAddr, DataPreviewAddrEnd) - std::min(DataPreviewAddr, DataPreviewAddrEnd) };
|
||||
hex::View::postEvent(hex::Events::RegionSelected, selectionRegion);
|
||||
hex::Region selectionRegion = { std::min(DataPreviewAddr, DataPreviewAddrEnd) + base_display_addr, std::max(DataPreviewAddr, DataPreviewAddrEnd) - std::min(DataPreviewAddr, DataPreviewAddrEnd) };
|
||||
hex::EventManager::post<hex::EventRegionSelected>(selectionRegion);
|
||||
}
|
||||
|
||||
DataPreviewAddrOld = DataPreviewAddr;
|
||||
@@ -715,8 +722,8 @@ struct MemoryEditor
|
||||
ImGui::BeginChild("##scrolling");
|
||||
ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (GotoAddr / Cols) * ImGui::GetTextLineHeight());
|
||||
ImGui::EndChild();
|
||||
DataEditingAddr = DataPreviewAddr = DataPreviewAddrEnd = GotoAddr;
|
||||
DataEditingTakeFocus = true;
|
||||
DataEditingAddr = DataPreviewAddr = HighlightMin;
|
||||
DataPreviewAddrEnd = HighlightMax;
|
||||
}
|
||||
GotoAddr = (size_t)-1;
|
||||
}
|
||||
|
||||
688
external/ImGui/include/implot.h
vendored
Normal file
688
external/ImGui/include/implot.h
vendored
Normal file
@@ -0,0 +1,688 @@
|
||||
// MIT License
|
||||
|
||||
// Copyright (c) 2020 Evan Pezent
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
// ImPlot v0.8 WIP
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Macros and Defines
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
||||
// Using ImPlot via a shared library is not recommended, because we don't guarantee
|
||||
// backward nor forward ABI compatibility and also function call overhead. If you
|
||||
// do use ImPlot as a DLL, be sure to call SetImGuiContext (details below).
|
||||
#ifndef IMPLOT_API
|
||||
#define IMPLOT_API
|
||||
#endif
|
||||
|
||||
// ImPlot version string
|
||||
#define IMPLOT_VERSION "0.8 WIP"
|
||||
// Indicates variable should deduced automatically.
|
||||
#define IMPLOT_AUTO -1
|
||||
// Special color used to indicate that a color should be deduced automatically.
|
||||
#define IMPLOT_AUTO_COL ImVec4(0,0,0,-1)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward Declarations and Basic Types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Forward declarations
|
||||
struct ImPlotContext; // ImPlot context (opaque struct, see implot_internal.h)
|
||||
|
||||
// Enums/Flags
|
||||
typedef int ImPlotFlags; // -> enum ImPlotFlags_
|
||||
typedef int ImPlotAxisFlags; // -> enum ImPlotAxisFlags_
|
||||
typedef int ImPlotCol; // -> enum ImPlotCol_
|
||||
typedef int ImPlotStyleVar; // -> enum ImPlotStyleVar_
|
||||
typedef int ImPlotMarker; // -> enum ImPlotMarker_
|
||||
typedef int ImPlotColormap; // -> enum ImPlotColormap_
|
||||
typedef int ImPlotLocation; // -> enum ImPlotLocation_
|
||||
typedef int ImPlotOrientation; // -> enum ImPlotOrientation_
|
||||
typedef int ImPlotYAxis; // -> enum ImPlotYAxis_;
|
||||
|
||||
// Options for plots.
|
||||
enum ImPlotFlags_ {
|
||||
ImPlotFlags_None = 0, // default
|
||||
ImPlotFlags_NoLegend = 1 << 0, // the top-left legend will not be displayed
|
||||
ImPlotFlags_NoMenus = 1 << 1, // the user will not be able to open context menus with double-right click
|
||||
ImPlotFlags_NoBoxSelect = 1 << 2, // the user will not be able to box-select with right-mouse
|
||||
ImPlotFlags_NoMousePos = 1 << 3, // the mouse position, in plot coordinates, will not be displayed inside of the plot
|
||||
ImPlotFlags_NoHighlight = 1 << 4, // plot items will not be highlighted when their legend entry is hovered
|
||||
ImPlotFlags_NoChild = 1 << 5, // a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications)
|
||||
ImPlotFlags_YAxis2 = 1 << 6, // enable a 2nd y-axis on the right side
|
||||
ImPlotFlags_YAxis3 = 1 << 7, // enable a 3rd y-axis on the right side
|
||||
ImPlotFlags_Query = 1 << 8, // the user will be able to draw query rects with middle-mouse
|
||||
ImPlotFlags_Crosshairs = 1 << 9, // the default mouse cursor will be replaced with a crosshair when hovered
|
||||
ImPlotFlags_AntiAliased = 1 << 10, // plot lines will be software anti-aliased (not recommended for density plots, prefer MSAA)
|
||||
ImPlotFlags_CanvasOnly = ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMousePos
|
||||
};
|
||||
|
||||
// Options for plot axes (X and Y).
|
||||
enum ImPlotAxisFlags_ {
|
||||
ImPlotAxisFlags_None = 0, // default
|
||||
ImPlotAxisFlags_NoGridLines = 1 << 0, // no grid lines will be displayed
|
||||
ImPlotAxisFlags_NoTickMarks = 1 << 1, // no tick marks will be displayed
|
||||
ImPlotAxisFlags_NoTickLabels = 1 << 2, // no text labels will be displayed
|
||||
ImPlotAxisFlags_LogScale = 1 << 3, // a logartithmic (base 10) axis scale will be used (mutually exclusive with ImPlotAxisFlags_Time)
|
||||
ImPlotAxisFlags_Time = 1 << 4, // axis will display date/time formatted labels (mutually exclusive with ImPlotAxisFlags_LogScale)
|
||||
ImPlotAxisFlags_Invert = 1 << 5, // the axis will be inverted
|
||||
ImPlotAxisFlags_LockMin = 1 << 6, // the axis minimum value will be locked when panning/zooming
|
||||
ImPlotAxisFlags_LockMax = 1 << 7, // the axis maximum value will be locked when panning/zooming
|
||||
ImPlotAxisFlags_Lock = ImPlotAxisFlags_LockMin | ImPlotAxisFlags_LockMax,
|
||||
ImPlotAxisFlags_NoDecorations = ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_NoTickMarks | ImPlotAxisFlags_NoTickLabels
|
||||
};
|
||||
|
||||
// Plot styling colors.
|
||||
enum ImPlotCol_ {
|
||||
// item styling colors
|
||||
ImPlotCol_Line, // plot line/outline color (defaults to next unused color in current colormap)
|
||||
ImPlotCol_Fill, // plot fill color for bars (defaults to the current line color)
|
||||
ImPlotCol_MarkerOutline, // marker outline color (defaults to the current line color)
|
||||
ImPlotCol_MarkerFill, // marker fill color (defaults to the current line color)
|
||||
ImPlotCol_ErrorBar, // error bar color (defaults to ImGuiCol_Text)
|
||||
// plot styling colors
|
||||
ImPlotCol_FrameBg, // plot frame background color (defaults to ImGuiCol_FrameBg)
|
||||
ImPlotCol_PlotBg, // plot area background color (defaults to ImGuiCol_WindowBg)
|
||||
ImPlotCol_PlotBorder, // plot area border color (defaults to ImGuiCol_Border)
|
||||
ImPlotCol_LegendBg, // legend background color (defaults to ImGuiCol_PopupBg)
|
||||
ImPlotCol_LegendBorder, // legend border color (defaults to ImPlotCol_PlotBorder)
|
||||
ImPlotCol_LegendText, // legend text color (defaults to ImPlotCol_InlayText)
|
||||
ImPlotCol_TitleText, // plot title text color (defaults to ImGuiCol_Text)
|
||||
ImPlotCol_InlayText, // color of text appearing inside of plots (defaults to ImGuiCol_Text)
|
||||
ImPlotCol_XAxis, // x-axis label and tick lables color (defaults to ImGuiCol_Text)
|
||||
ImPlotCol_XAxisGrid, // x-axis grid color (defaults to 25% ImPlotCol_XAxis)
|
||||
ImPlotCol_YAxis, // y-axis label and tick labels color (defaults to ImGuiCol_Text)
|
||||
ImPlotCol_YAxisGrid, // y-axis grid color (defaults to 25% ImPlotCol_YAxis)
|
||||
ImPlotCol_YAxis2, // 2nd y-axis label and tick labels color (defaults to ImGuiCol_Text)
|
||||
ImPlotCol_YAxisGrid2, // 2nd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis2)
|
||||
ImPlotCol_YAxis3, // 3rd y-axis label and tick labels color (defaults to ImGuiCol_Text)
|
||||
ImPlotCol_YAxisGrid3, // 3rd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis3)
|
||||
ImPlotCol_Selection, // box-selection color (defaults to yellow)
|
||||
ImPlotCol_Query, // box-query color (defaults to green)
|
||||
ImPlotCol_Crosshairs, // crosshairs color (defaults to ImPlotCol_PlotBorder)
|
||||
ImPlotCol_COUNT
|
||||
};
|
||||
|
||||
// Plot styling variables.
|
||||
enum ImPlotStyleVar_ {
|
||||
// item styling variables
|
||||
ImPlotStyleVar_LineWeight, // float, plot item line weight in pixels
|
||||
ImPlotStyleVar_Marker, // int, marker specification
|
||||
ImPlotStyleVar_MarkerSize, // float, marker size in pixels (roughly the marker's "radius")
|
||||
ImPlotStyleVar_MarkerWeight, // float, plot outline weight of markers in pixels
|
||||
ImPlotStyleVar_FillAlpha, // float, alpha modifier applied to all plot item fills
|
||||
ImPlotStyleVar_ErrorBarSize, // float, error bar whisker width in pixels
|
||||
ImPlotStyleVar_ErrorBarWeight, // float, error bar whisker weight in pixels
|
||||
ImPlotStyleVar_DigitalBitHeight, // float, digital channels bit height (at 1) in pixels
|
||||
ImPlotStyleVar_DigitalBitGap, // float, digital channels bit padding gap in pixels
|
||||
// plot styling variables
|
||||
ImPlotStyleVar_PlotBorderSize, // float, thickness of border around plot area
|
||||
ImPlotStyleVar_MinorAlpha, // float, alpha multiplier applied to minor axis grid lines
|
||||
ImPlotStyleVar_MajorTickLen, // ImVec2, major tick lengths for X and Y axes
|
||||
ImPlotStyleVar_MinorTickLen, // ImVec2, minor tick lengths for X and Y axes
|
||||
ImPlotStyleVar_MajorTickSize, // ImVec2, line thickness of major ticks
|
||||
ImPlotStyleVar_MinorTickSize, // ImVec2, line thickness of minor ticks
|
||||
ImPlotStyleVar_MajorGridSize, // ImVec2, line thickness of major grid lines
|
||||
ImPlotStyleVar_MinorGridSize, // ImVec2, line thickness of minor grid lines
|
||||
ImPlotStyleVar_PlotPadding, // ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding)
|
||||
ImPlotStyleVar_LabelPadding, // ImVec2, padding between axes labels, tick labels, and plot edge
|
||||
ImPlotStyleVar_LegendPadding, // ImVec2, legend padding from plot edges
|
||||
ImPlotStyleVar_LegendInnerPadding, // ImVec2, legend inner padding from legend edges
|
||||
ImPlotStyleVar_LegendSpacing, // ImVec2, spacing between legend entries
|
||||
ImPlotStyleVar_MousePosPadding, // ImVec2, padding between plot edge and interior info text
|
||||
ImPlotStyleVar_AnnotationPadding, // ImVec2, text padding around annotation labels
|
||||
ImPlotStyleVar_PlotDefaultSize, // ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot
|
||||
ImPlotStyleVar_PlotMinSize, // ImVec2, minimum size plot frame can be when shrunk
|
||||
ImPlotStyleVar_COUNT
|
||||
};
|
||||
|
||||
// Marker specifications.
|
||||
enum ImPlotMarker_ {
|
||||
ImPlotMarker_None = -1, // no marker
|
||||
ImPlotMarker_Circle, // a circle marker
|
||||
ImPlotMarker_Square, // a square maker
|
||||
ImPlotMarker_Diamond, // a diamond marker
|
||||
ImPlotMarker_Up, // an upward-pointing triangle marker
|
||||
ImPlotMarker_Down, // an downward-pointing triangle marker
|
||||
ImPlotMarker_Left, // an leftward-pointing triangle marker
|
||||
ImPlotMarker_Right, // an rightward-pointing triangle marker
|
||||
ImPlotMarker_Cross, // a cross marker (not fillable)
|
||||
ImPlotMarker_Plus, // a plus marker (not fillable)
|
||||
ImPlotMarker_Asterisk, // a asterisk marker (not fillable)
|
||||
ImPlotMarker_COUNT
|
||||
};
|
||||
|
||||
// Built-in colormaps
|
||||
enum ImPlotColormap_ {
|
||||
ImPlotColormap_Default = 0, // ImPlot default colormap (n=10)
|
||||
ImPlotColormap_Deep = 1, // a.k.a. seaborn deep (n=10)
|
||||
ImPlotColormap_Dark = 2, // a.k.a. matplotlib "Set1" (n=9)
|
||||
ImPlotColormap_Pastel = 3, // a.k.a. matplotlib "Pastel1" (n=9)
|
||||
ImPlotColormap_Paired = 4, // a.k.a. matplotlib "Paired" (n=12)
|
||||
ImPlotColormap_Viridis = 5, // a.k.a. matplotlib "viridis" (n=11)
|
||||
ImPlotColormap_Plasma = 6, // a.k.a. matplotlib "plasma" (n=11)
|
||||
ImPlotColormap_Hot = 7, // a.k.a. matplotlib/MATLAB "hot" (n=11)
|
||||
ImPlotColormap_Cool = 8, // a.k.a. matplotlib/MATLAB "cool" (n=11)
|
||||
ImPlotColormap_Pink = 9, // a.k.a. matplotlib/MATLAB "pink" (n=11)
|
||||
ImPlotColormap_Jet = 10, // a.k.a. MATLAB "jet" (n=11)
|
||||
ImPlotColormap_COUNT
|
||||
};
|
||||
|
||||
// Used to position items on a plot (e.g. legends, labels, etc.)
|
||||
enum ImPlotLocation_ {
|
||||
ImPlotLocation_Center = 0, // center-center
|
||||
ImPlotLocation_North = 1 << 0, // top-center
|
||||
ImPlotLocation_South = 1 << 1, // bottom-center
|
||||
ImPlotLocation_West = 1 << 2, // center-left
|
||||
ImPlotLocation_East = 1 << 3, // center-right
|
||||
ImPlotLocation_NorthWest = ImPlotLocation_North | ImPlotLocation_West, // top-left
|
||||
ImPlotLocation_NorthEast = ImPlotLocation_North | ImPlotLocation_East, // top-right
|
||||
ImPlotLocation_SouthWest = ImPlotLocation_South | ImPlotLocation_West, // bottom-left
|
||||
ImPlotLocation_SouthEast = ImPlotLocation_South | ImPlotLocation_East // bottom-right
|
||||
};
|
||||
|
||||
// Used to orient items on a plot (e.g. legends, labels, etc.)
|
||||
enum ImPlotOrientation_ {
|
||||
ImPlotOrientation_Horizontal, // left/right
|
||||
ImPlotOrientation_Vertical // up/down
|
||||
};
|
||||
|
||||
// Enums for different y-axes.
|
||||
enum ImPlotYAxis_ {
|
||||
ImPlotYAxis_1 = 0, // left (default)
|
||||
ImPlotYAxis_2 = 1, // first on right side
|
||||
ImPlotYAxis_3 = 2 // second on right side
|
||||
};
|
||||
|
||||
// Double precision version of ImVec2 used by ImPlot. Extensible by end users.
|
||||
struct ImPlotPoint {
|
||||
double x, y;
|
||||
ImPlotPoint() { x = y = 0.0; }
|
||||
ImPlotPoint(double _x, double _y) { x = _x; y = _y; }
|
||||
ImPlotPoint(const ImVec2& p) { x = p.x; y = p.y; }
|
||||
double operator[] (size_t idx) const { return (&x)[idx]; }
|
||||
double& operator[] (size_t idx) { return (&x)[idx]; }
|
||||
#ifdef IMPLOT_POINT_CLASS_EXTRA
|
||||
IMPLOT_POINT_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h
|
||||
// to convert back and forth between your math types and ImPlotPoint.
|
||||
#endif
|
||||
};
|
||||
|
||||
// A range defined by a min/max value. Used for plot axes ranges.
|
||||
struct ImPlotRange {
|
||||
double Min, Max;
|
||||
ImPlotRange() { Min = 0; Max = 0; }
|
||||
ImPlotRange(double _min, double _max) { Min = _min; Max = _max; }
|
||||
bool Contains(double value) const { return value >= Min && value <= Max; };
|
||||
double Size() const { return Max - Min; };
|
||||
};
|
||||
|
||||
// Combination of two ranges for X and Y axes.
|
||||
struct ImPlotLimits {
|
||||
ImPlotRange X, Y;
|
||||
bool Contains(const ImPlotPoint& p) const { return Contains(p.x, p.y); }
|
||||
bool Contains(double x, double y) const { return X.Contains(x) && Y.Contains(y); }
|
||||
};
|
||||
|
||||
// Plot style structure
|
||||
struct ImPlotStyle {
|
||||
// item styling variables
|
||||
float LineWeight; // = 1, item line weight in pixels
|
||||
int Marker; // = ImPlotMarker_None, marker specification
|
||||
float MarkerSize; // = 4, marker size in pixels (roughly the marker's "radius")
|
||||
float MarkerWeight; // = 1, outline weight of markers in pixels
|
||||
float FillAlpha; // = 1, alpha modifier applied to plot fills
|
||||
float ErrorBarSize; // = 5, error bar whisker width in pixels
|
||||
float ErrorBarWeight; // = 1.5, error bar whisker weight in pixels
|
||||
float DigitalBitHeight; // = 8, digital channels bit height (at y = 1.0f) in pixels
|
||||
float DigitalBitGap; // = 4, digital channels bit padding gap in pixels
|
||||
// plot styling variables
|
||||
float PlotBorderSize; // = 1, line thickness of border around plot area
|
||||
float MinorAlpha; // = 0.25 alpha multiplier applied to minor axis grid lines
|
||||
ImVec2 MajorTickLen; // = 10,10 major tick lengths for X and Y axes
|
||||
ImVec2 MinorTickLen; // = 5,5 minor tick lengths for X and Y axes
|
||||
ImVec2 MajorTickSize; // = 1,1 line thickness of major ticks
|
||||
ImVec2 MinorTickSize; // = 1,1 line thickness of minor ticks
|
||||
ImVec2 MajorGridSize; // = 1,1 line thickness of major grid lines
|
||||
ImVec2 MinorGridSize; // = 1,1 line thickness of minor grid lines
|
||||
ImVec2 PlotPadding; // = 10,10 padding between widget frame and plot area, labels, or outside legends (i.e. main padding)
|
||||
ImVec2 LabelPadding; // = 5,5 padding between axes labels, tick labels, and plot edge
|
||||
ImVec2 LegendPadding; // = 10,10 legend padding from plot edges
|
||||
ImVec2 LegendInnerPadding; // = 5,5 legend inner padding from legend edges
|
||||
ImVec2 LegendSpacing; // = 0,0 spacing between legend entries
|
||||
ImVec2 MousePosPadding; // = 10,10 padding between plot edge and interior mouse location text
|
||||
ImVec2 AnnotationPadding; // = 2,2 text padding around annotation labels
|
||||
ImVec2 PlotDefaultSize; // = 400,300 default size used when ImVec2(0,0) is passed to BeginPlot
|
||||
ImVec2 PlotMinSize; // = 300,225 minimum size plot frame can be when shrunk
|
||||
// colors
|
||||
ImVec4 Colors[ImPlotCol_COUNT]; // array of plot specific colors
|
||||
// settings/flags
|
||||
bool AntiAliasedLines; // = false, enable global anti-aliasing on plot lines (overrides ImPlotFlags_AntiAliased)
|
||||
bool UseLocalTime; // = false, axis labels will be formatted for your timezone when ImPlotAxisFlag_Time is enabled
|
||||
bool UseISO8601; // = false, dates will be formatted according to ISO 8601 where applicable (e.g. YYYY-MM-DD, YYYY-MM, --MM-DD, etc.)
|
||||
bool Use24HourClock; // = false, times will be formatted using a 24 hour clock
|
||||
IMPLOT_API ImPlotStyle();
|
||||
};
|
||||
|
||||
// Input mapping structure, default values listed in the comments.
|
||||
struct ImPlotInputMap {
|
||||
ImGuiMouseButton PanButton; // LMB enables panning when held
|
||||
ImGuiKeyModFlags PanMod; // none optional modifier that must be held for panning
|
||||
ImGuiMouseButton FitButton; // LMB fits visible data when double clicked
|
||||
ImGuiMouseButton ContextMenuButton; // RMB opens plot context menu (if enabled) when double clicked
|
||||
ImGuiMouseButton BoxSelectButton; // RMB begins box selection when pressed and confirms selection when released
|
||||
ImGuiKeyModFlags BoxSelectMod; // none optional modifier that must be held for box selection
|
||||
ImGuiMouseButton BoxSelectCancelButton; // LMB cancels active box selection when pressed
|
||||
ImGuiMouseButton QueryButton; // MMB begins query selection when pressed and end query selection when released
|
||||
ImGuiKeyModFlags QueryMod; // none optional modifier that must be held for query selection
|
||||
ImGuiKeyModFlags QueryToggleMod; // Ctrl when held, active box selections turn into queries
|
||||
ImGuiKeyModFlags HorizontalMod; // Alt expands active box selection/query horizontally to plot edge when held
|
||||
ImGuiKeyModFlags VerticalMod; // Shift expands active box selection/query vertically to plot edge when held
|
||||
IMPLOT_API ImPlotInputMap();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ImPlot End-User API
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace ImPlot {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ImPlot Context
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Creates a new ImPlot context. Call this after ImGui::CreateContext.
|
||||
IMPLOT_API ImPlotContext* CreateContext();
|
||||
// Destroys an ImPlot context. Call this before ImGui::DestroyContext. NULL = destroy current context
|
||||
IMPLOT_API void DestroyContext(ImPlotContext* ctx = NULL);
|
||||
// Returns the current ImPlot context. NULL if no context has ben set.
|
||||
IMPLOT_API ImPlotContext* GetCurrentContext();
|
||||
// Sets the current ImPlot context.
|
||||
IMPLOT_API void SetCurrentContext(ImPlotContext* ctx);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Begin/End Plot
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Starts a 2D plotting context. If this function returns true, EndPlot() must
|
||||
// be called, e.g. "if (BeginPlot(...)) { ... EndPlot(); }". #title_id must
|
||||
// be unique. If you need to avoid ID collisions or don't want to display a
|
||||
// title in the plot, use double hashes (e.g. "MyPlot##Hidden" or "##NoTitle").
|
||||
// If #x_label and/or #y_label are provided, axes labels will be displayed.
|
||||
IMPLOT_API bool BeginPlot(const char* title_id,
|
||||
const char* x_label = NULL,
|
||||
const char* y_label = NULL,
|
||||
const ImVec2& size = ImVec2(-1,0),
|
||||
ImPlotFlags flags = ImPlotFlags_None,
|
||||
ImPlotAxisFlags x_flags = ImPlotAxisFlags_None,
|
||||
ImPlotAxisFlags y_flags = ImPlotAxisFlags_None,
|
||||
ImPlotAxisFlags y2_flags = ImPlotAxisFlags_NoGridLines,
|
||||
ImPlotAxisFlags y3_flags = ImPlotAxisFlags_NoGridLines);
|
||||
|
||||
// Only call EndPlot() if BeginPlot() returns true! Typically called at the end
|
||||
// of an if statement conditioned on BeginPlot().
|
||||
IMPLOT_API void EndPlot();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Plot Items
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// The template functions below are explicitly instantiated in implot_items.cpp.
|
||||
// They are not intended to be used generically with custom types. You will get
|
||||
// a linker error if you try! All functions support the following scalar types:
|
||||
//
|
||||
// float, double, ImS8, ImU8, ImS16, ImU16, ImS32, ImU32, ImS64, ImU64
|
||||
//
|
||||
//
|
||||
// If you need to plot custom or non-homogenous data you have a few options:
|
||||
//
|
||||
// 1. If your data is a simple struct/class (e.g. Vector2f), you can use striding.
|
||||
// This is the most performant option if applicable.
|
||||
//
|
||||
// struct Vector2f { float X, Y; };
|
||||
// ...
|
||||
// Vector2f data[42];
|
||||
// ImPlot::PlotLine("line", &data[0].x, &data[0].y, 42, 0, sizeof(Vector2f)); // or sizeof(float)*2
|
||||
//
|
||||
// 2. Write a custom getter function or C++ lambda and pass it and your data to
|
||||
// an ImPlot function post-fixed with a G (e.g. PlotScatterG). This has a
|
||||
// slight performance cost, but probably not enough to worry about.
|
||||
//
|
||||
// ImPlotPoint MyDataGetter(void* data, int idx) {
|
||||
// MyData* my_data = (MyData*)data;
|
||||
// ImPlotPoint p;
|
||||
// p.x = my_data->GetTime(idx);
|
||||
// p.y = my_data->GetValue(idx);
|
||||
// return p
|
||||
// }
|
||||
// ...
|
||||
// MyData my_data;
|
||||
// ImPlot::PlotScatterG("scatter", MyDataGetter, &my_data, my_data.Size());
|
||||
//
|
||||
// NB: All types are converted to double before plotting. You may loose information
|
||||
// if you try plotting extremely large 64-bit integral types. Proceed with caution!
|
||||
|
||||
// Plots a standard 2D line plot.
|
||||
template <typename T> IMPLOT_API void PlotLine(const char* label_id, const T* values, int count, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T));
|
||||
IMPLOT_API void PlotLineG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0);
|
||||
|
||||
// Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle.
|
||||
template <typename T> IMPLOT_API void PlotScatter(const char* label_id, const T* values, int count, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T));
|
||||
IMPLOT_API void PlotScatterG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0);
|
||||
|
||||
// Plots a a stairstep graph. The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i].
|
||||
template <typename T> IMPLOT_API void PlotStairs(const char* label_id, const T* values, int count, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotStairs(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T));
|
||||
IMPLOT_API void PlotStairsG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0);
|
||||
|
||||
// Plots a shaded (filled) region between two lines, or a line and a horizontal reference.
|
||||
template <typename T> IMPLOT_API void PlotShaded(const char* label_id, const T* values, int count, double y_ref=0, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double y_ref=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, int offset=0, int stride=sizeof(T));
|
||||
IMPLOT_API void PlotShadedG(const char* label_id, ImPlotPoint (*getter1)(void* data, int idx), void* data1, ImPlotPoint (*getter2)(void* data, int idx), void* data2, int count, int offset=0);
|
||||
|
||||
// Plots a vertical bar graph. #width and #shift are in X units.
|
||||
template <typename T> IMPLOT_API void PlotBars(const char* label_id, const T* values, int count, double width=0.67, double shift=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double width, int offset=0, int stride=sizeof(T));
|
||||
IMPLOT_API void PlotBarsG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double width, int offset=0);
|
||||
|
||||
// Plots a horizontal bar graph. #height and #shift are in Y units.
|
||||
template <typename T> IMPLOT_API void PlotBarsH(const char* label_id, const T* values, int count, double height=0.67, double shift=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotBarsH(const char* label_id, const T* xs, const T* ys, int count, double height, int offset=0, int stride=sizeof(T));
|
||||
IMPLOT_API void PlotBarsHG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double height, int offset=0);
|
||||
|
||||
// Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.
|
||||
template <typename T> IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, int offset=0, int stride=sizeof(T));
|
||||
|
||||
// Plots horizontal error bars. The label_id should be the same as the label_id of the associated line or bar plot.
|
||||
template <typename T> IMPLOT_API void PlotErrorBarsH(const char* label_id, const T* xs, const T* ys, const T* err, int count, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotErrorBarsH(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, int offset=0, int stride=sizeof(T));
|
||||
|
||||
/// Plots vertical stems.
|
||||
template <typename T> IMPLOT_API void PlotStems(const char* label_id, const T* values, int count, double y_ref=0, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T));
|
||||
template <typename T> IMPLOT_API void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double y_ref=0, int offset=0, int stride=sizeof(T));
|
||||
|
||||
// Plots a pie chart. If the sum of values > 1 or normalize is true, each value will be normalized. Center and radius are in plot units. #label_fmt can be set to NULL for no labels.
|
||||
template <typename T> IMPLOT_API void PlotPieChart(const char* const label_ids[], const T* values, int count, double x, double y, double radius, bool normalize=false, const char* label_fmt="%.1f", double angle0=90);
|
||||
|
||||
// Plots a 2D heatmap chart. Values are expected to be in row-major order. #label_fmt can be set to NULL for no labels.
|
||||
template <typename T> IMPLOT_API void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, double scale_min, double scale_max, const char* label_fmt="%.1f", const ImPlotPoint& bounds_min=ImPlotPoint(0,0), const ImPlotPoint& bounds_max=ImPlotPoint(1,1));
|
||||
|
||||
// Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.
|
||||
template <typename T> IMPLOT_API void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T));
|
||||
IMPLOT_API void PlotDigitalG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0);
|
||||
|
||||
// Plots an axis-aligned image. #bounds_min/bounds_max are in plot coordinatse (y-up) and #uv0/uv1 are in texture coordinates (y-down).
|
||||
IMPLOT_API void PlotImage(const char* label_id, ImTextureID user_texture_id, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, const ImVec2& uv0=ImVec2(0,0), const ImVec2& uv1=ImVec2(1,1), const ImVec4& tint_col=ImVec4(1,1,1,1));
|
||||
|
||||
// Plots a centered text label at point x,y with optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...).
|
||||
IMPLOT_API void PlotText(const char* text, double x, double y, bool vertical=false, const ImVec2& pix_offset=ImVec2(0,0));
|
||||
|
||||
// Plots an dummy item (i.e. adds a legend entry colored by ImPlotCol_Line)
|
||||
IMPLOT_API void PlotDummy(const char* label_id);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Plot Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// The following functions MUST be called before BeginPlot!
|
||||
|
||||
// Set the axes range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the axes limits will be locked.
|
||||
IMPLOT_API void SetNextPlotLimits(double xmin, double xmax, double ymin, double ymax, ImGuiCond cond = ImGuiCond_Once);
|
||||
// Set the X axis range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the X axis limits will be locked.
|
||||
IMPLOT_API void SetNextPlotLimitsX(double xmin, double xmax, ImGuiCond cond = ImGuiCond_Once);
|
||||
// Set the Y axis range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the Y axis limits will be locked.
|
||||
IMPLOT_API void SetNextPlotLimitsY(double ymin, double ymax, ImGuiCond cond = ImGuiCond_Once, ImPlotYAxis y_axis = 0);
|
||||
// Links the next plot limits to external values. Set to NULL for no linkage. The pointer data must remain valid until the matching call EndPlot.
|
||||
IMPLOT_API void LinkNextPlotLimits(double* xmin, double* xmax, double* ymin, double* ymax, double* ymin2 = NULL, double* ymax2 = NULL, double* ymin3 = NULL, double* ymax3 = NULL);
|
||||
// Fits the next plot axes to all plotted data if they are unlocked (equivalent to double-clicks).
|
||||
IMPLOT_API void FitNextPlotAxes(bool x = true, bool y = true, bool y2 = true, bool y3 = true);
|
||||
|
||||
// Set the X axis ticks and optionally the labels for the next plot.
|
||||
IMPLOT_API void SetNextPlotTicksX(const double* values, int n_ticks, const char* const labels[] = NULL, bool show_default = false);
|
||||
IMPLOT_API void SetNextPlotTicksX(double x_min, double x_max, int n_ticks, const char* const labels[] = NULL, bool show_default = false);
|
||||
|
||||
// Set the Y axis ticks and optionally the labels for the next plot.
|
||||
IMPLOT_API void SetNextPlotTicksY(const double* values, int n_ticks, const char* const labels[] = NULL, bool show_default = false, ImPlotYAxis y_axis = 0);
|
||||
IMPLOT_API void SetNextPlotTicksY(double y_min, double y_max, int n_ticks, const char* const labels[] = NULL, bool show_default = false, ImPlotYAxis y_axis = 0);
|
||||
|
||||
// The following functions MUST be called between Begin/EndPlot!
|
||||
|
||||
// Select which Y axis will be used for subsequent plot elements. The default is ImPlotYAxis_1, or the first (left) Y axis. Enable 2nd and 3rd axes with ImPlotFlags_YAxisX.
|
||||
IMPLOT_API void SetPlotYAxis(ImPlotYAxis y_axis);
|
||||
// Hides or shows the next plot item (i.e. as if it were toggled from the legend). Use ImGuiCond_Always if you need to forcefully set this every frame.
|
||||
IMPLOT_API void HideNextItem(bool hidden = true, ImGuiCond cond = ImGuiCond_Once);
|
||||
|
||||
// Convert pixels to a position in the current plot's coordinate system. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
|
||||
IMPLOT_API ImPlotPoint PixelsToPlot(const ImVec2& pix, ImPlotYAxis y_axis = IMPLOT_AUTO);
|
||||
IMPLOT_API ImPlotPoint PixelsToPlot(float x, float y, ImPlotYAxis y_axis = IMPLOT_AUTO);
|
||||
// Convert a position in the current plot's coordinate system to pixels. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
|
||||
IMPLOT_API ImVec2 PlotToPixels(const ImPlotPoint& plt, ImPlotYAxis y_axis = IMPLOT_AUTO);
|
||||
IMPLOT_API ImVec2 PlotToPixels(double x, double y, ImPlotYAxis y_axis = IMPLOT_AUTO);
|
||||
// Get the current Plot position (top-left) in pixels.
|
||||
IMPLOT_API ImVec2 GetPlotPos();
|
||||
// Get the curent Plot size in pixels.
|
||||
IMPLOT_API ImVec2 GetPlotSize();
|
||||
// Returns true if the plot area in the current plot is hovered.
|
||||
IMPLOT_API bool IsPlotHovered();
|
||||
// Returns true if the XAxis plot area in the current plot is hovered.
|
||||
IMPLOT_API bool IsPlotXAxisHovered();
|
||||
// Returns true if the YAxis[n] plot area in the current plot is hovered.
|
||||
IMPLOT_API bool IsPlotYAxisHovered(ImPlotYAxis y_axis = 0);
|
||||
// Returns the mouse position in x,y coordinates of the current plot. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
|
||||
IMPLOT_API ImPlotPoint GetPlotMousePos(ImPlotYAxis y_axis = IMPLOT_AUTO);
|
||||
// Returns the current plot axis range. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
|
||||
IMPLOT_API ImPlotLimits GetPlotLimits(ImPlotYAxis y_axis = IMPLOT_AUTO);
|
||||
|
||||
// Returns true if the current plot is being queried. Query must be enabled with ImPlotFlags_Query.
|
||||
IMPLOT_API bool IsPlotQueried();
|
||||
// Returns the current plot query bounds. Query must be enabled with ImPlotFlags_Query.
|
||||
IMPLOT_API ImPlotLimits GetPlotQuery(ImPlotYAxis y_axis = IMPLOT_AUTO);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Plot Tools
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// The following functions MUST be called between Begin/EndPlot!
|
||||
|
||||
// Shows an annotation callout at a chosen point.
|
||||
IMPLOT_API void Annotate(double x, double y, const ImVec2& pix_offset, const char* fmt, ...) IM_FMTARGS(4);
|
||||
IMPLOT_API void Annotate(double x, double y, const ImVec2& pix_offset, const ImVec4& color, const char* fmt, ...) IM_FMTARGS(5);
|
||||
IMPLOT_API void AnnotateV(double x, double y, const ImVec2& pix_offset, const char* fmt, va_list args) IM_FMTLIST(4);
|
||||
IMPLOT_API void AnnotateV(double x, double y, const ImVec2& pix_offset, const ImVec4& color, const char* fmt, va_list args) IM_FMTLIST(5);
|
||||
|
||||
// Same as above, but the annotation will always be clamped to stay inside the plot area.
|
||||
IMPLOT_API void AnnotateClamped(double x, double y, const ImVec2& pix_offset, const char* fmt, ...) IM_FMTARGS(4);
|
||||
IMPLOT_API void AnnotateClamped(double x, double y, const ImVec2& pix_offset, const ImVec4& color, const char* fmt, ...) IM_FMTARGS(5);
|
||||
IMPLOT_API void AnnotateClampedV(double x, double y, const ImVec2& pix_offset, const char* fmt, va_list args) IM_FMTLIST(4);
|
||||
IMPLOT_API void AnnotateClampedV(double x, double y, const ImVec2& pix_offset, const ImVec4& color, const char* fmt, va_list args) IM_FMTLIST(5);
|
||||
|
||||
// Shows a draggable vertical guide line at an x-value. #col defaults to ImGuiCol_Text.
|
||||
IMPLOT_API bool DragLineX(const char* id, double* x_value, bool show_label = true, const ImVec4& col = IMPLOT_AUTO_COL, float thickness = 1);
|
||||
// Shows a draggable horizontal guide line at a y-value. #col defaults to ImGuiCol_Text.
|
||||
IMPLOT_API bool DragLineY(const char* id, double* y_value, bool show_label = true, const ImVec4& col = IMPLOT_AUTO_COL, float thickness = 1);
|
||||
// Shows a draggable point at x,y. #col defaults to ImGuiCol_Text.
|
||||
IMPLOT_API bool DragPoint(const char* id, double* x, double* y, bool show_label = true, const ImVec4& col = IMPLOT_AUTO_COL, float radius = 4);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Legend Utils and Tools
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// The following functions MUST be called between Begin/EndPlot!
|
||||
|
||||
// Set the location of the current plot's legend.
|
||||
IMPLOT_API void SetLegendLocation(ImPlotLocation location, ImPlotOrientation orientation = ImPlotOrientation_Vertical, bool outside = false);
|
||||
// Set the location of the current plot's mouse position text (default = South|East).
|
||||
IMPLOT_API void SetMousePosLocation(ImPlotLocation location);
|
||||
// Returns true if a plot item legend entry is hovered.
|
||||
IMPLOT_API bool IsLegendEntryHovered(const char* label_id);
|
||||
// Begin a drag and drop source from a legend entry. The only supported flag is SourceNoPreviewTooltip
|
||||
IMPLOT_API bool BeginLegendDragDropSource(const char* label_id, ImGuiDragDropFlags flags = 0);
|
||||
// End legend drag and drop source.
|
||||
IMPLOT_API void EndLegendDragDropSource();
|
||||
// Begin a popup for a legend entry.
|
||||
IMPLOT_API bool BeginLegendPopup(const char* label_id, ImGuiMouseButton mouse_button = 1);
|
||||
// End a popup for a legend entry.
|
||||
IMPLOT_API void EndLegendPopup();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Plot and Item Styling
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Provides access to plot style structure for permanant modifications to colors, sizes, etc.
|
||||
IMPLOT_API ImPlotStyle& GetStyle();
|
||||
|
||||
// Style colors for current ImGui style (default).
|
||||
IMPLOT_API void StyleColorsAuto(ImPlotStyle* dst = NULL);
|
||||
// Style colors for ImGui "Classic".
|
||||
IMPLOT_API void StyleColorsClassic(ImPlotStyle* dst = NULL);
|
||||
// Style colors for ImGui "Dark".
|
||||
IMPLOT_API void StyleColorsDark(ImPlotStyle* dst = NULL);
|
||||
// Style colors for ImGui "Light".
|
||||
IMPLOT_API void StyleColorsLight(ImPlotStyle* dst = NULL);
|
||||
|
||||
// Use PushStyleX to temporarily modify your ImPlotStyle. The modification
|
||||
// will last until the matching call to PopStyleX. You MUST call a pop for
|
||||
// every push, otherwise you will leak memory! This behaves just like ImGui.
|
||||
|
||||
// Temporarily modify a plot color. Don't forget to call PopStyleColor!
|
||||
IMPLOT_API void PushStyleColor(ImPlotCol idx, ImU32 col);
|
||||
IMPLOT_API void PushStyleColor(ImPlotCol idx, const ImVec4& col);
|
||||
// Undo temporary color modification. Undo multiple pushes at once by increasing count.
|
||||
IMPLOT_API void PopStyleColor(int count = 1);
|
||||
|
||||
// Temporarily modify a style variable of float type. Don't forget to call PopStyleVar!
|
||||
IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, float val);
|
||||
// Temporarily modify a style variable of int type. Don't forget to call PopStyleVar!
|
||||
IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, int val);
|
||||
// Temporarily modify a style variable of ImVec2 type. Don't forget to call PopStyleVar!
|
||||
IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, const ImVec2& val);
|
||||
// Undo temporary style modification. Undo multiple pushes at once by increasing count.
|
||||
IMPLOT_API void PopStyleVar(int count = 1);
|
||||
|
||||
// The following can be used to modify the style of the next plot item ONLY. They do
|
||||
// NOT require calls to PopStyleX. Leave style attributes you don't want modified to
|
||||
// IMPLOT_AUTO or IMPLOT_AUTO_COL. Automatic styles will be deduced from the current
|
||||
// values in your ImPlotStyle or from Colormap data.
|
||||
|
||||
// Set the line color and weight for the next item only.
|
||||
IMPLOT_API void SetNextLineStyle(const ImVec4& col = IMPLOT_AUTO_COL, float weight = IMPLOT_AUTO);
|
||||
// Set the fill color for the next item only.
|
||||
IMPLOT_API void SetNextFillStyle(const ImVec4& col = IMPLOT_AUTO_COL, float alpha_mod = IMPLOT_AUTO);
|
||||
// Set the marker style for the next item only.
|
||||
IMPLOT_API void SetNextMarkerStyle(ImPlotMarker marker = IMPLOT_AUTO, float size = IMPLOT_AUTO, const ImVec4& fill = IMPLOT_AUTO_COL, float weight = IMPLOT_AUTO, const ImVec4& outline = IMPLOT_AUTO_COL);
|
||||
// Set the error bar style for the next item only.
|
||||
IMPLOT_API void SetNextErrorBarStyle(const ImVec4& col = IMPLOT_AUTO_COL, float size = IMPLOT_AUTO, float weight = IMPLOT_AUTO);
|
||||
|
||||
// Gets the last item primary color (i.e. its legend icon color)
|
||||
IMPLOT_API ImVec4 GetLastItemColor();
|
||||
|
||||
// Returns the null terminated string name for an ImPlotCol.
|
||||
IMPLOT_API const char* GetStyleColorName(ImPlotCol idx);
|
||||
// Returns the null terminated string name for an ImPlotMarker.
|
||||
IMPLOT_API const char* GetMarkerName(ImPlotMarker idx);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Colormaps
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Item styling is based on Colormaps when the relevant ImPlotCol is set to
|
||||
// IMPLOT_AUTO_COL (default). Several built in colormaps are available and can be
|
||||
// toggled in the demo. You can push/pop or set your own colormaps as well.
|
||||
|
||||
// The Colormap data will be ignored and a custom color will be used if you have either:
|
||||
// 1) Modified an item style color in your ImPlotStyle to anything but IMPLOT_AUTO_COL.
|
||||
// 2) Pushed an item style color using PushStyleColor().
|
||||
// 3) Set the next item style with a SetNextXStyle function.
|
||||
|
||||
// Temporarily switch to one of the built-in colormaps.
|
||||
IMPLOT_API void PushColormap(ImPlotColormap colormap);
|
||||
// Temporarily switch to your custom colormap. The pointer data must persist until the matching call to PopColormap!
|
||||
IMPLOT_API void PushColormap(const ImVec4* colormap, int size);
|
||||
// Undo temporary colormap modification.
|
||||
IMPLOT_API void PopColormap(int count = 1);
|
||||
|
||||
// Permanently sets a custom colormap. The colors will be copied to internal memory. Prefer PushColormap instead of calling this each frame.
|
||||
IMPLOT_API void SetColormap(const ImVec4* colormap, int size);
|
||||
// Permanently switch to one of the built-in colormaps. If samples is greater than 1, the map will be linearly resampled. Don't call this each frame.
|
||||
IMPLOT_API void SetColormap(ImPlotColormap colormap, int samples = 0);
|
||||
|
||||
// Returns the size of the current colormap.
|
||||
IMPLOT_API int GetColormapSize();
|
||||
// Returns a color from the Color map given an index >= 0 (modulo will be performed).
|
||||
IMPLOT_API ImVec4 GetColormapColor(int index);
|
||||
// Linearly interpolates a color from the current colormap given t between 0 and 1.
|
||||
IMPLOT_API ImVec4 LerpColormap(float t);
|
||||
// Returns the next unused colormap color and advances the colormap. Can be used to skip colors if desired.
|
||||
IMPLOT_API ImVec4 NextColormapColor();
|
||||
|
||||
// Renders a vertical color scale using the current color map. Call this outside of Begin/EndPlot.
|
||||
IMPLOT_API void ShowColormapScale(double scale_min, double scale_max, float height);
|
||||
|
||||
// Returns a null terminated string name for a built-in colormap.
|
||||
IMPLOT_API const char* GetColormapName(ImPlotColormap colormap);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Miscellaneous
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Allows changing how keyboard/mouse interaction works.
|
||||
IMPLOT_API ImPlotInputMap& GetInputMap();
|
||||
|
||||
// Get the plot draw list for rendering to the current plot area.
|
||||
IMPLOT_API ImDrawList* GetPlotDrawList();
|
||||
// Push clip rect for rendering to current plot area.
|
||||
IMPLOT_API void PushPlotClipRect();
|
||||
// Pop plot clip rect.
|
||||
IMPLOT_API void PopPlotClipRect();
|
||||
|
||||
// Shows ImPlot style selector dropdown menu.
|
||||
IMPLOT_API bool ShowStyleSelector(const char* label);
|
||||
// Shows ImPlot colormap selector dropdown menu.
|
||||
IMPLOT_API bool ShowColormapSelector(const char* label);
|
||||
// Shows ImPlot style editor block (not a window).
|
||||
IMPLOT_API void ShowStyleEditor(ImPlotStyle* ref = NULL);
|
||||
// Add basic help/info block (not a window): how to manipulate ImPlot as an end-user.
|
||||
IMPLOT_API void ShowUserGuide();
|
||||
// Shows ImPlot metrics/debug information.
|
||||
IMPLOT_API void ShowMetricsWindow(bool* p_popen = NULL);
|
||||
|
||||
// Sets the current _ImGui_ context. This is ONLY necessary if you are compiling
|
||||
// ImPlot as a DLL (not recommended) separate from your ImGui compilation. It
|
||||
// sets the global variable GImGui, which is not shared across DLL boundaries.
|
||||
// See GImGui documentation in imgui.cpp for more details.
|
||||
IMPLOT_API void SetImGuiContext(ImGuiContext* ctx);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Demo (add implot_demo.cpp to your sources!)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Shows the ImPlot demo. Pass the current ImGui context if ImPlot is a DLL.
|
||||
IMPLOT_API void ShowDemoWindow(bool* p_open = NULL);
|
||||
|
||||
} // namespace ImPlot
|
||||
981
external/ImGui/include/implot_internal.h
vendored
Normal file
981
external/ImGui/include/implot_internal.h
vendored
Normal file
@@ -0,0 +1,981 @@
|
||||
// MIT License
|
||||
|
||||
// Copyright (c) 2020 Evan Pezent
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
// ImPlot v0.8 WIP
|
||||
|
||||
// You may use this file to debug, understand or extend ImPlot features but we
|
||||
// don't provide any guarantee of forward compatibility!
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Header Mess
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include "imgui_internal.h"
|
||||
|
||||
#ifndef IMPLOT_VERSION
|
||||
#error Must include implot.h before implot_internal.h
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Forward Declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct ImPlotTick;
|
||||
struct ImPlotAxis;
|
||||
struct ImPlotAxisState;
|
||||
struct ImPlotAxisColor;
|
||||
struct ImPlotItem;
|
||||
struct ImPlotLegendData;
|
||||
struct ImPlotPlot;
|
||||
struct ImPlotNextPlotData;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Context Pointer
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern IMPLOT_API ImPlotContext* GImPlot; // Current implicit context pointer
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Macros and Constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Constants can be changed unless stated otherwise. We may move some of these
|
||||
// to ImPlotStyleVar_ over time.
|
||||
|
||||
// The maximum number of supported y-axes (DO NOT CHANGE THIS)
|
||||
#define IMPLOT_Y_AXES 3
|
||||
// The number of times to subdivided grid divisions (best if a multiple of 1, 2, and 5)
|
||||
#define IMPLOT_SUB_DIV 10
|
||||
// Zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click)
|
||||
#define IMPLOT_ZOOM_RATE 0.1f
|
||||
// Mimimum allowable timestamp value 01/01/1970 @ 12:00am (UTC) (DO NOT DECREASE THIS)
|
||||
#define IMPLOT_MIN_TIME 0
|
||||
// Maximum allowable timestamp value 01/01/3000 @ 12:00am (UTC) (DO NOT INCREASE THIS)
|
||||
#define IMPLOT_MAX_TIME 32503680000
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Generic Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Computes the common (base-10) logarithm
|
||||
static inline float ImLog10(float x) { return log10f(x); }
|
||||
static inline double ImLog10(double x) { return log10(x); }
|
||||
// Returns true if a flag is set
|
||||
template <typename TSet, typename TFlag>
|
||||
inline bool ImHasFlag(TSet set, TFlag flag) { return (set & flag) == flag; }
|
||||
// Flips a flag in a flagset
|
||||
template <typename TSet, typename TFlag>
|
||||
inline void ImFlipFlag(TSet& set, TFlag flag) { ImHasFlag(set, flag) ? set &= ~flag : set |= flag; }
|
||||
// Linearly remaps x from [x0 x1] to [y0 y1].
|
||||
template <typename T>
|
||||
inline T ImRemap(T x, T x0, T x1, T y0, T y1) { return y0 + (x - x0) * (y1 - y0) / (x1 - x0); }
|
||||
// Returns always positive modulo (assumes r != 0)
|
||||
inline int ImPosMod(int l, int r) { return (l % r + r) % r; }
|
||||
// Returns true if val is NAN or INFINITY
|
||||
inline bool ImNanOrInf(double val) { return val == HUGE_VAL || val == -HUGE_VAL || isnan(val); }
|
||||
// Turns NANs to 0s
|
||||
inline double ImConstrainNan(double val) { return isnan(val) ? 0 : val; }
|
||||
// Turns infinity to floating point maximums
|
||||
inline double ImConstrainInf(double val) { return val == HUGE_VAL ? DBL_MAX : val == -HUGE_VAL ? - DBL_MAX : val; }
|
||||
// Turns numbers less than or equal to 0 to 0.001 (sort of arbitrary, is there a better way?)
|
||||
inline double ImConstrainLog(double val) { return val <= 0 ? 0.001f : val; }
|
||||
// Turns numbers less than 0 to zero
|
||||
inline double ImConstrainTime(double val) { return val < IMPLOT_MIN_TIME ? IMPLOT_MIN_TIME : (val > IMPLOT_MAX_TIME ? IMPLOT_MAX_TIME : val); }
|
||||
|
||||
// Offset calculator helper
|
||||
template <int Count>
|
||||
struct ImOffsetCalculator {
|
||||
ImOffsetCalculator(const int* sizes) {
|
||||
Offsets[0] = 0;
|
||||
for (int i = 1; i < Count; ++i)
|
||||
Offsets[i] = Offsets[i-1] + sizes[i-1];
|
||||
}
|
||||
int Offsets[Count];
|
||||
};
|
||||
|
||||
// Character buffer writer helper
|
||||
struct ImBufferWriter
|
||||
{
|
||||
char* Buffer;
|
||||
int Size;
|
||||
int Pos;
|
||||
|
||||
ImBufferWriter(char* buffer, int size) {
|
||||
Buffer = buffer;
|
||||
Size = size;
|
||||
Pos = 0;
|
||||
}
|
||||
|
||||
void Write(const char* fmt, ...) {
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
const int written = ::vsnprintf(&Buffer[Pos], Size - Pos - 1, fmt, argp);
|
||||
if (written > 0)
|
||||
Pos += ImMin(written, Size-Pos-1);
|
||||
va_end(argp);
|
||||
}
|
||||
};
|
||||
|
||||
// Fixed size point array
|
||||
template <int N>
|
||||
struct ImPlotPointArray {
|
||||
inline ImPlotPoint& operator[](int i) { return Data[i]; }
|
||||
inline const ImPlotPoint& operator[](int i) const { return Data[i]; }
|
||||
inline int Size() { return N; }
|
||||
ImPlotPoint Data[N];
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] ImPlot Enums
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef int ImPlotScale; // -> enum ImPlotScale_
|
||||
typedef int ImPlotTimeUnit; // -> enum ImPlotTimeUnit_
|
||||
typedef int ImPlotDateFmt; // -> enum ImPlotDateFmt_
|
||||
typedef int ImPlotTimeFmt; // -> enum ImPlotTimeFmt_
|
||||
|
||||
// XY axes scaling combinations
|
||||
enum ImPlotScale_ {
|
||||
ImPlotScale_LinLin, // linear x, linear y
|
||||
ImPlotScale_LogLin, // log x, linear y
|
||||
ImPlotScale_LinLog, // linear x, log y
|
||||
ImPlotScale_LogLog // log x, log y
|
||||
};
|
||||
|
||||
enum ImPlotTimeUnit_ {
|
||||
ImPlotTimeUnit_Us, // microsecond
|
||||
ImPlotTimeUnit_Ms, // millisecond
|
||||
ImPlotTimeUnit_S, // second
|
||||
ImPlotTimeUnit_Min, // minute
|
||||
ImPlotTimeUnit_Hr, // hour
|
||||
ImPlotTimeUnit_Day, // day
|
||||
ImPlotTimeUnit_Mo, // month
|
||||
ImPlotTimeUnit_Yr, // year
|
||||
ImPlotTimeUnit_COUNT
|
||||
};
|
||||
|
||||
enum ImPlotDateFmt_ { // default [ ISO 8601 ]
|
||||
ImPlotDateFmt_None = 0,
|
||||
ImPlotDateFmt_DayMo, // 10/3 [ --10-03 ]
|
||||
ImPlotDateFmt_DayMoYr, // 10/3/91 [ 1991-10-03 ]
|
||||
ImPlotDateFmt_MoYr, // Oct 1991 [ 1991-10 ]
|
||||
ImPlotDateFmt_Mo, // Oct [ --10 ]
|
||||
ImPlotDateFmt_Yr // 1991 [ 1991 ]
|
||||
};
|
||||
|
||||
enum ImPlotTimeFmt_ { // default [ 24 Hour Clock ]
|
||||
ImPlotTimeFmt_None = 0,
|
||||
ImPlotTimeFmt_Us, // .428 552 [ .428 552 ]
|
||||
ImPlotTimeFmt_SUs, // :29.428 552 [ :29.428 552 ]
|
||||
ImPlotTimeFmt_SMs, // :29.428 [ :29.428 ]
|
||||
ImPlotTimeFmt_S, // :29 [ :29 ]
|
||||
ImPlotTimeFmt_HrMinSMs, // 7:21:29.428pm [ 19:21:29.428 ]
|
||||
ImPlotTimeFmt_HrMinS, // 7:21:29pm [ 19:21:29 ]
|
||||
ImPlotTimeFmt_HrMin, // 7:21pm [ 19:21 ]
|
||||
ImPlotTimeFmt_Hr // 7pm [ 19:00 ]
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] ImPlot Structs
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Combined data/time format spec
|
||||
struct ImPlotDateTimeFmt {
|
||||
ImPlotDateTimeFmt(ImPlotDateFmt date_fmt, ImPlotTimeFmt time_fmt, bool use_24_hr_clk = false, bool use_iso_8601 = false) {
|
||||
Date = date_fmt;
|
||||
Time = time_fmt;
|
||||
UseISO8601 = use_iso_8601;
|
||||
Use24HourClock = use_24_hr_clk;
|
||||
}
|
||||
ImPlotDateFmt Date;
|
||||
ImPlotTimeFmt Time;
|
||||
bool UseISO8601;
|
||||
bool Use24HourClock;
|
||||
};
|
||||
|
||||
// Two part timestamp struct.
|
||||
struct ImPlotTime {
|
||||
time_t S; // second part
|
||||
int Us; // microsecond part
|
||||
ImPlotTime() { S = 0; Us = 0; }
|
||||
ImPlotTime(time_t s, int us = 0) { S = s + us / 1000000; Us = us % 1000000; }
|
||||
void RollOver() { S = S + Us / 1000000; Us = Us % 1000000; }
|
||||
double ToDouble() const { return (double)S + (double)Us / 1000000.0; }
|
||||
static ImPlotTime FromDouble(double t) { return ImPlotTime((time_t)t, (int)(t * 1000000 - floor(t) * 1000000)); }
|
||||
};
|
||||
|
||||
static inline ImPlotTime operator+(const ImPlotTime& lhs, const ImPlotTime& rhs)
|
||||
{ return ImPlotTime(lhs.S + rhs.S, lhs.Us + rhs.Us); }
|
||||
static inline ImPlotTime operator-(const ImPlotTime& lhs, const ImPlotTime& rhs)
|
||||
{ return ImPlotTime(lhs.S - rhs.S, lhs.Us - rhs.Us); }
|
||||
static inline bool operator==(const ImPlotTime& lhs, const ImPlotTime& rhs)
|
||||
{ return lhs.S == rhs.S && lhs.Us == rhs.Us; }
|
||||
static inline bool operator<(const ImPlotTime& lhs, const ImPlotTime& rhs)
|
||||
{ return lhs.S == rhs.S ? lhs.Us < rhs.Us : lhs.S < rhs.S; }
|
||||
static inline bool operator>(const ImPlotTime& lhs, const ImPlotTime& rhs)
|
||||
{ return rhs < lhs; }
|
||||
static inline bool operator<=(const ImPlotTime& lhs, const ImPlotTime& rhs)
|
||||
{ return lhs < rhs || lhs == rhs; }
|
||||
static inline bool operator>=(const ImPlotTime& lhs, const ImPlotTime& rhs)
|
||||
{ return lhs > rhs || lhs == rhs; }
|
||||
|
||||
// Storage for colormap modifiers
|
||||
struct ImPlotColormapMod {
|
||||
ImPlotColormapMod(const ImVec4* colormap, int colormap_size) {
|
||||
Colormap = colormap;
|
||||
ColormapSize = colormap_size;
|
||||
}
|
||||
const ImVec4* Colormap;
|
||||
int ColormapSize;
|
||||
};
|
||||
|
||||
// ImPlotPoint with positive/negative error values
|
||||
struct ImPlotPointError
|
||||
{
|
||||
double X, Y, Neg, Pos;
|
||||
ImPlotPointError(double x, double y, double neg, double pos) {
|
||||
X = x; Y = y; Neg = neg; Pos = pos;
|
||||
}
|
||||
};
|
||||
|
||||
// Interior plot label/annotation
|
||||
struct ImPlotAnnotation {
|
||||
ImVec2 Pos;
|
||||
ImVec2 Offset;
|
||||
ImU32 ColorBg;
|
||||
ImU32 ColorFg;
|
||||
int TextOffset;
|
||||
bool Clamp;
|
||||
};
|
||||
|
||||
// Collection of plot labels
|
||||
struct ImPlotAnnotationCollection {
|
||||
|
||||
ImVector<ImPlotAnnotation> Annotations;
|
||||
ImGuiTextBuffer TextBuffer;
|
||||
int Size;
|
||||
|
||||
ImPlotAnnotationCollection() { Reset(); }
|
||||
|
||||
void AppendV(const ImVec2& pos, const ImVec2& off, ImU32 bg, ImU32 fg, bool clamp, const char* fmt, va_list args) IM_FMTLIST(7) {
|
||||
ImPlotAnnotation an;
|
||||
an.Pos = pos; an.Offset = off;
|
||||
an.ColorBg = bg; an.ColorFg = fg;
|
||||
an.TextOffset = TextBuffer.size();
|
||||
an.Clamp = clamp;
|
||||
Annotations.push_back(an);
|
||||
TextBuffer.appendfv(fmt, args);
|
||||
const char nul[] = "";
|
||||
TextBuffer.append(nul,nul+1);
|
||||
Size++;
|
||||
}
|
||||
|
||||
void Append(const ImVec2& pos, const ImVec2& off, ImU32 bg, ImU32 fg, bool clamp, const char* fmt, ...) IM_FMTARGS(7) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
AppendV(pos, off, bg, fg, clamp, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
const char* GetText(int idx) {
|
||||
return TextBuffer.Buf.Data + Annotations[idx].TextOffset;
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
Annotations.shrink(0);
|
||||
TextBuffer.Buf.shrink(0);
|
||||
Size = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Tick mark info
|
||||
struct ImPlotTick
|
||||
{
|
||||
double PlotPos;
|
||||
float PixelPos;
|
||||
ImVec2 LabelSize;
|
||||
int TextOffset;
|
||||
bool Major;
|
||||
bool ShowLabel;
|
||||
int Level;
|
||||
|
||||
ImPlotTick(double value, bool major, bool show_label) {
|
||||
PlotPos = value;
|
||||
Major = major;
|
||||
ShowLabel = show_label;
|
||||
TextOffset = -1;
|
||||
Level = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Collection of ticks
|
||||
struct ImPlotTickCollection {
|
||||
ImVector<ImPlotTick> Ticks;
|
||||
ImGuiTextBuffer TextBuffer;
|
||||
float TotalWidth;
|
||||
float TotalHeight;
|
||||
float MaxWidth;
|
||||
float MaxHeight;
|
||||
int Size;
|
||||
|
||||
ImPlotTickCollection() { Reset(); }
|
||||
|
||||
void Append(const ImPlotTick& tick) {
|
||||
if (tick.ShowLabel) {
|
||||
TotalWidth += tick.ShowLabel ? tick.LabelSize.x : 0;
|
||||
TotalHeight += tick.ShowLabel ? tick.LabelSize.y : 0;
|
||||
MaxWidth = tick.LabelSize.x > MaxWidth ? tick.LabelSize.x : MaxWidth;
|
||||
MaxHeight = tick.LabelSize.y > MaxHeight ? tick.LabelSize.y : MaxHeight;
|
||||
}
|
||||
Ticks.push_back(tick);
|
||||
Size++;
|
||||
}
|
||||
|
||||
void Append(double value, bool major, bool show_label, void (*labeler)(ImPlotTick& tick, ImGuiTextBuffer& buf)) {
|
||||
ImPlotTick tick(value, major, show_label);
|
||||
if (labeler)
|
||||
labeler(tick, TextBuffer);
|
||||
Append(tick);
|
||||
}
|
||||
|
||||
const char* GetText(int idx) {
|
||||
return TextBuffer.Buf.Data + Ticks[idx].TextOffset;
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
Ticks.shrink(0);
|
||||
TextBuffer.Buf.shrink(0);
|
||||
TotalWidth = TotalHeight = MaxWidth = MaxHeight = 0;
|
||||
Size = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Axis state information that must persist after EndPlot
|
||||
struct ImPlotAxis
|
||||
{
|
||||
ImPlotAxisFlags Flags;
|
||||
ImPlotAxisFlags PreviousFlags;
|
||||
ImPlotRange Range;
|
||||
ImPlotOrientation Direction;
|
||||
bool Dragging;
|
||||
bool HoveredExt;
|
||||
bool HoveredTot;
|
||||
double* LinkedMin;
|
||||
double* LinkedMax;
|
||||
ImPlotTime PickerTimeMin, PickerTimeMax;
|
||||
int PickerLevel;
|
||||
|
||||
ImPlotAxis() {
|
||||
Flags = PreviousFlags = ImPlotAxisFlags_None;
|
||||
Range.Min = 0;
|
||||
Range.Max = 1;
|
||||
Dragging = false;
|
||||
HoveredExt = false;
|
||||
HoveredTot = false;
|
||||
LinkedMin = LinkedMax = NULL;
|
||||
PickerLevel = 0;
|
||||
}
|
||||
|
||||
bool SetMin(double _min) {
|
||||
_min = ImConstrainNan(ImConstrainInf(_min));
|
||||
if (ImHasFlag(Flags, ImPlotAxisFlags_LogScale))
|
||||
_min = ImConstrainLog(_min);
|
||||
if (ImHasFlag(Flags, ImPlotAxisFlags_Time))
|
||||
_min = ImConstrainTime(_min);
|
||||
if (_min >= Range.Max)
|
||||
return false;
|
||||
Range.Min = _min;
|
||||
PickerTimeMin = ImPlotTime::FromDouble(Range.Min);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool SetMax(double _max) {
|
||||
_max = ImConstrainNan(ImConstrainInf(_max));
|
||||
if (ImHasFlag(Flags, ImPlotAxisFlags_LogScale))
|
||||
_max = ImConstrainLog(_max);
|
||||
if (ImHasFlag(Flags, ImPlotAxisFlags_Time))
|
||||
_max = ImConstrainTime(_max);
|
||||
if (_max <= Range.Min)
|
||||
return false;
|
||||
Range.Max = _max;
|
||||
PickerTimeMax = ImPlotTime::FromDouble(Range.Max);
|
||||
return true;
|
||||
};
|
||||
|
||||
void SetRange(double _min, double _max) {
|
||||
Range.Min = _min;
|
||||
Range.Max = _max;
|
||||
Constrain();
|
||||
PickerTimeMin = ImPlotTime::FromDouble(Range.Min);
|
||||
PickerTimeMax = ImPlotTime::FromDouble(Range.Max);
|
||||
}
|
||||
|
||||
void SetRange(const ImPlotRange& range) {
|
||||
SetRange(range.Min, range.Max);
|
||||
}
|
||||
|
||||
void Constrain() {
|
||||
Range.Min = ImConstrainNan(ImConstrainInf(Range.Min));
|
||||
Range.Max = ImConstrainNan(ImConstrainInf(Range.Max));
|
||||
if (ImHasFlag(Flags, ImPlotAxisFlags_LogScale)) {
|
||||
Range.Min = ImConstrainLog(Range.Min);
|
||||
Range.Max = ImConstrainLog(Range.Max);
|
||||
}
|
||||
if (ImHasFlag(Flags, ImPlotAxisFlags_Time)) {
|
||||
Range.Min = ImConstrainTime(Range.Min);
|
||||
Range.Max = ImConstrainTime(Range.Max);
|
||||
}
|
||||
if (Range.Max <= Range.Min)
|
||||
Range.Max = Range.Min + DBL_EPSILON;
|
||||
}
|
||||
};
|
||||
|
||||
// Axis state information only needed between BeginPlot/EndPlot
|
||||
struct ImPlotAxisState
|
||||
{
|
||||
ImPlotAxis* Axis;
|
||||
ImGuiCond RangeCond;
|
||||
bool HasRange;
|
||||
bool Present;
|
||||
bool HasLabels;
|
||||
bool Invert;
|
||||
bool LockMin;
|
||||
bool LockMax;
|
||||
bool Lock;
|
||||
bool IsTime;
|
||||
|
||||
ImPlotAxisState(ImPlotAxis* axis, bool has_range, ImGuiCond range_cond, bool present) {
|
||||
Axis = axis;
|
||||
HasRange = has_range;
|
||||
RangeCond = range_cond;
|
||||
Present = present;
|
||||
HasLabels = !ImHasFlag(Axis->Flags, ImPlotAxisFlags_NoTickLabels);
|
||||
Invert = ImHasFlag(Axis->Flags, ImPlotAxisFlags_Invert);
|
||||
LockMin = ImHasFlag(Axis->Flags, ImPlotAxisFlags_LockMin) || (HasRange && RangeCond == ImGuiCond_Always);
|
||||
LockMax = ImHasFlag(Axis->Flags, ImPlotAxisFlags_LockMax) || (HasRange && RangeCond == ImGuiCond_Always);
|
||||
Lock = !Present || ((LockMin && LockMax) || (HasRange && RangeCond == ImGuiCond_Always));
|
||||
IsTime = ImHasFlag(Axis->Flags, ImPlotAxisFlags_Time);
|
||||
}
|
||||
|
||||
ImPlotAxisState() { }
|
||||
};
|
||||
|
||||
struct ImPlotAxisColor
|
||||
{
|
||||
ImU32 Major, Minor, MajTxt, MinTxt;
|
||||
ImPlotAxisColor() { Major = Minor = MajTxt = MinTxt = 0; }
|
||||
};
|
||||
|
||||
// State information for Plot items
|
||||
struct ImPlotItem
|
||||
{
|
||||
ImGuiID ID;
|
||||
ImVec4 Color;
|
||||
int NameOffset;
|
||||
bool Show;
|
||||
bool LegendHovered;
|
||||
bool SeenThisFrame;
|
||||
|
||||
ImPlotItem() {
|
||||
ID = 0;
|
||||
Color = ImPlot::NextColormapColor();
|
||||
NameOffset = -1;
|
||||
Show = true;
|
||||
SeenThisFrame = false;
|
||||
LegendHovered = false;
|
||||
}
|
||||
|
||||
~ImPlotItem() { ID = 0; }
|
||||
};
|
||||
|
||||
// Holds Legend state labels and item references
|
||||
struct ImPlotLegendData
|
||||
{
|
||||
ImVector<int> Indices;
|
||||
ImGuiTextBuffer Labels;
|
||||
void Reset() { Indices.shrink(0); Labels.Buf.shrink(0); }
|
||||
};
|
||||
|
||||
// Holds Plot state information that must persist after EndPlot
|
||||
struct ImPlotPlot
|
||||
{
|
||||
ImGuiID ID;
|
||||
ImPlotFlags Flags;
|
||||
ImPlotFlags PreviousFlags;
|
||||
ImPlotAxis XAxis;
|
||||
ImPlotAxis YAxis[IMPLOT_Y_AXES];
|
||||
ImPlotLegendData LegendData;
|
||||
ImPool<ImPlotItem> Items;
|
||||
ImVec2 SelectStart;
|
||||
ImVec2 QueryStart;
|
||||
ImRect QueryRect;
|
||||
bool Selecting;
|
||||
bool Querying;
|
||||
bool Queried;
|
||||
bool DraggingQuery;
|
||||
bool LegendHovered;
|
||||
bool LegendOutside;
|
||||
bool LegendFlipSide;
|
||||
int ColormapIdx;
|
||||
int CurrentYAxis;
|
||||
ImPlotLocation MousePosLocation;
|
||||
ImPlotLocation LegendLocation;
|
||||
ImPlotOrientation LegendOrientation;
|
||||
|
||||
ImPlotPlot() {
|
||||
Flags = PreviousFlags = ImPlotFlags_None;
|
||||
XAxis.Direction = ImPlotOrientation_Horizontal;
|
||||
for (int i = 0; i < IMPLOT_Y_AXES; ++i)
|
||||
YAxis[i].Direction = ImPlotOrientation_Vertical;
|
||||
SelectStart = QueryStart = ImVec2(0,0);
|
||||
Selecting = Querying = Queried = DraggingQuery = LegendHovered = LegendOutside = LegendFlipSide = false;
|
||||
ColormapIdx = CurrentYAxis = 0;
|
||||
LegendLocation = ImPlotLocation_North | ImPlotLocation_West;
|
||||
LegendOrientation = ImPlotOrientation_Vertical;
|
||||
MousePosLocation = ImPlotLocation_South | ImPlotLocation_East;
|
||||
}
|
||||
|
||||
int GetLegendCount() const { return LegendData.Indices.size(); }
|
||||
ImPlotItem* GetLegendItem(int i);
|
||||
const char* GetLegendLabel(int i);
|
||||
};
|
||||
|
||||
// Temporary data storage for upcoming plot
|
||||
struct ImPlotNextPlotData
|
||||
{
|
||||
ImGuiCond XRangeCond;
|
||||
ImGuiCond YRangeCond[IMPLOT_Y_AXES];
|
||||
ImPlotRange X;
|
||||
ImPlotRange Y[IMPLOT_Y_AXES];
|
||||
bool HasXRange;
|
||||
bool HasYRange[IMPLOT_Y_AXES];
|
||||
bool ShowDefaultTicksX;
|
||||
bool ShowDefaultTicksY[IMPLOT_Y_AXES];
|
||||
bool FitX;
|
||||
bool FitY[IMPLOT_Y_AXES];
|
||||
double* LinkedXmin;
|
||||
double* LinkedXmax;
|
||||
double* LinkedYmin[IMPLOT_Y_AXES];
|
||||
double* LinkedYmax[IMPLOT_Y_AXES];
|
||||
|
||||
ImPlotNextPlotData() {
|
||||
HasXRange = false;
|
||||
ShowDefaultTicksX = true;
|
||||
FitX = false;
|
||||
LinkedXmin = LinkedXmax = NULL;
|
||||
for (int i = 0; i < IMPLOT_Y_AXES; ++i) {
|
||||
HasYRange[i] = false;
|
||||
ShowDefaultTicksY[i] = true;
|
||||
FitY[i] = false;
|
||||
LinkedYmin[i] = LinkedYmax[i] = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Temporary data storage for upcoming item
|
||||
struct ImPlotNextItemData {
|
||||
ImVec4 Colors[5]; // ImPlotCol_Line, ImPlotCol_Fill, ImPlotCol_MarkerOutline, ImPlotCol_MarkerFill, ImPlotCol_ErrorBar
|
||||
float LineWeight;
|
||||
ImPlotMarker Marker;
|
||||
float MarkerSize;
|
||||
float MarkerWeight;
|
||||
float FillAlpha;
|
||||
float ErrorBarSize;
|
||||
float ErrorBarWeight;
|
||||
float DigitalBitHeight;
|
||||
float DigitalBitGap;
|
||||
bool RenderLine;
|
||||
bool RenderFill;
|
||||
bool RenderMarkerLine;
|
||||
bool RenderMarkerFill;
|
||||
bool HasHidden;
|
||||
bool Hidden;
|
||||
ImGuiCond HiddenCond;
|
||||
ImPlotNextItemData() {
|
||||
for (int i = 0; i < 5; ++i)
|
||||
Colors[i] = IMPLOT_AUTO_COL;
|
||||
LineWeight = MarkerSize = MarkerWeight = FillAlpha = ErrorBarSize = ErrorBarWeight = DigitalBitHeight = DigitalBitGap = IMPLOT_AUTO;
|
||||
Marker = IMPLOT_AUTO;
|
||||
HasHidden = Hidden = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Holds state information that must persist between calls to BeginPlot()/EndPlot()
|
||||
struct ImPlotContext {
|
||||
// Plot States
|
||||
ImPool<ImPlotPlot> Plots;
|
||||
ImPlotPlot* CurrentPlot;
|
||||
ImPlotItem* CurrentItem;
|
||||
ImPlotItem* PreviousItem;
|
||||
|
||||
// Bounding Boxes
|
||||
ImRect BB_Frame;
|
||||
ImRect BB_Canvas;
|
||||
ImRect BB_Plot;
|
||||
ImRect BB_Axes;
|
||||
ImRect BB_X;
|
||||
ImRect BB_Y[IMPLOT_Y_AXES];
|
||||
|
||||
// Axis States
|
||||
ImPlotAxisColor Col_X;
|
||||
ImPlotAxisColor Col_Y[IMPLOT_Y_AXES];
|
||||
ImPlotAxisState X;
|
||||
ImPlotAxisState Y[IMPLOT_Y_AXES];
|
||||
|
||||
// Tick Marks and Labels
|
||||
ImPlotTickCollection XTicks;
|
||||
ImPlotTickCollection YTicks[IMPLOT_Y_AXES];
|
||||
float YAxisReference[IMPLOT_Y_AXES];
|
||||
|
||||
// Annotation and User Labels
|
||||
ImPlotAnnotationCollection Annotations;
|
||||
|
||||
// Transformations and Data Extents
|
||||
ImPlotScale Scales[IMPLOT_Y_AXES];
|
||||
ImRect PixelRange[IMPLOT_Y_AXES];
|
||||
double Mx;
|
||||
double My[IMPLOT_Y_AXES];
|
||||
double LogDenX;
|
||||
double LogDenY[IMPLOT_Y_AXES];
|
||||
ImPlotRange ExtentsX;
|
||||
ImPlotRange ExtentsY[IMPLOT_Y_AXES];
|
||||
|
||||
// Data Fitting Flags
|
||||
bool FitThisFrame;
|
||||
bool FitX;
|
||||
bool FitY[IMPLOT_Y_AXES];
|
||||
|
||||
// Hover states
|
||||
bool Hov_Frame;
|
||||
bool Hov_Plot;
|
||||
|
||||
// Axis Rendering Flags
|
||||
bool RenderX;
|
||||
bool RenderY[IMPLOT_Y_AXES];
|
||||
|
||||
// Axis Locking Flags
|
||||
bool LockPlot;
|
||||
bool ChildWindowMade;
|
||||
|
||||
// Style and Colormaps
|
||||
ImPlotStyle Style;
|
||||
ImVector<ImGuiColorMod> ColorModifiers;
|
||||
ImVector<ImGuiStyleMod> StyleModifiers;
|
||||
const ImVec4* Colormap;
|
||||
int ColormapSize;
|
||||
ImVector<ImPlotColormapMod> ColormapModifiers;
|
||||
|
||||
// Time
|
||||
tm Tm;
|
||||
|
||||
// Misc
|
||||
int VisibleItemCount;
|
||||
int DigitalPlotItemCnt;
|
||||
int DigitalPlotOffset;
|
||||
ImPlotNextPlotData NextPlotData;
|
||||
ImPlotNextItemData NextItemData;
|
||||
ImPlotInputMap InputMap;
|
||||
ImPlotPoint MousePos[IMPLOT_Y_AXES];
|
||||
};
|
||||
|
||||
struct ImPlotAxisScale
|
||||
{
|
||||
ImPlotPoint Min, Max;
|
||||
|
||||
ImPlotAxisScale(int y_axis, float tx, float ty, float zoom_rate) {
|
||||
ImPlotContext& gp = *GImPlot;
|
||||
Min = ImPlot::PixelsToPlot(gp.BB_Plot.Min - gp.BB_Plot.GetSize() * ImVec2(tx * zoom_rate, ty * zoom_rate), y_axis);
|
||||
Max = ImPlot::PixelsToPlot(gp.BB_Plot.Max + gp.BB_Plot.GetSize() * ImVec2((1 - tx) * zoom_rate, (1 - ty) * zoom_rate), y_axis);
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Internal API
|
||||
// No guarantee of forward compatibility here!
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace ImPlot {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Context Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Initializes an ImPlotContext
|
||||
IMPLOT_API void Initialize(ImPlotContext* ctx);
|
||||
// Resets an ImPlot context for the next call to BeginPlot
|
||||
IMPLOT_API void Reset(ImPlotContext* ctx);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Plot Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Gets a plot from the current ImPlotContext
|
||||
IMPLOT_API ImPlotPlot* GetPlot(const char* title);
|
||||
// Gets the current plot from the current ImPlotContext
|
||||
IMPLOT_API ImPlotPlot* GetCurrentPlot();
|
||||
// Busts the cache for every plot in the current context
|
||||
IMPLOT_API void BustPlotCache();
|
||||
|
||||
// Shows a plot's context menu.
|
||||
IMPLOT_API void ShowPlotContextMenu(ImPlotPlot& plot);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Item Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Begins a new item. Returns false if the item should not be plotted. Pushes PlotClipRect.
|
||||
IMPLOT_API bool BeginItem(const char* label_id, ImPlotCol recolor_from = -1);
|
||||
// Ends an item (call only if BeginItem returns true). Pops PlotClipRect.
|
||||
IMPLOT_API void EndItem();
|
||||
|
||||
// Register or get an existing item from the current plot.
|
||||
IMPLOT_API ImPlotItem* RegisterOrGetItem(const char* label_id, bool* just_created = NULL);
|
||||
// Get a plot item from the current plot.
|
||||
IMPLOT_API ImPlotItem* GetItem(const char* label_id);
|
||||
// Gets the current item.
|
||||
IMPLOT_API ImPlotItem* GetCurrentItem();
|
||||
// Busts the cache for every item for every plot in the current context.
|
||||
IMPLOT_API void BustItemCache();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Axis Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Gets the current y-axis for the current plot
|
||||
inline int GetCurrentYAxis() { return GImPlot->CurrentPlot->CurrentYAxis; }
|
||||
// Updates axis ticks, lins, and label colors
|
||||
IMPLOT_API void UpdateAxisColors(int axis_flag, ImPlotAxisColor* col);
|
||||
|
||||
// Updates plot-to-pixel space transformation variables for the current plot.
|
||||
IMPLOT_API void UpdateTransformCache();
|
||||
// Gets the XY scale for the current plot and y-axis
|
||||
inline ImPlotScale GetCurrentScale() { return GImPlot->Scales[GetCurrentYAxis()]; }
|
||||
|
||||
// Returns true if the user has requested data to be fit.
|
||||
inline bool FitThisFrame() { return GImPlot->FitThisFrame; }
|
||||
// Extends the current plots axes so that it encompasses point p
|
||||
IMPLOT_API void FitPoint(const ImPlotPoint& p);
|
||||
|
||||
// Returns true if two ranges overlap
|
||||
inline bool RangesOverlap(const ImPlotRange& r1, const ImPlotRange& r2)
|
||||
{ return r1.Min <= r2.Max && r2.Min <= r1.Max; }
|
||||
|
||||
// Updates pointers for linked axes from axis internal range.
|
||||
IMPLOT_API void PushLinkedAxis(ImPlotAxis& axis);
|
||||
// Updates axis internal range from points for linked axes.
|
||||
IMPLOT_API void PullLinkedAxis(ImPlotAxis& axis);
|
||||
|
||||
// Shows an axis's context menu.
|
||||
IMPLOT_API void ShowAxisContextMenu(ImPlotAxisState& state, bool time_allowed = false);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Legend Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Gets the position of an inner rect that is located inside of an outer rect according to an ImPlotLocation and padding amount.
|
||||
IMPLOT_API ImVec2 GetLocationPos(const ImRect& outer_rect, const ImVec2& inner_size, ImPlotLocation location, const ImVec2& pad = ImVec2(0,0));
|
||||
// Calculates the bounding box size of a legend
|
||||
IMPLOT_API ImVec2 CalcLegendSize(ImPlotPlot& plot, const ImVec2& pad, const ImVec2& spacing, ImPlotOrientation orientation);
|
||||
// Renders legend entries into a bounding box
|
||||
IMPLOT_API void ShowLegendEntries(ImPlotPlot& plot, const ImRect& legend_bb, bool interactable, const ImVec2& pad, const ImVec2& spacing, ImPlotOrientation orientation, ImDrawList& DrawList);
|
||||
// Shows an alternate legend for the plot identified by #title_id, outside of the plot frame (can be called before or after of Begin/EndPlot but must occur in the same ImGui window!).
|
||||
IMPLOT_API void ShowAltLegend(const char* title_id, ImPlotOrientation orientation = ImPlotOrientation_Vertical, const ImVec2 size = ImVec2(0,0), bool interactable = true);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Tick Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Label a tick with default formatting.
|
||||
IMPLOT_API void LabelTickDefault(ImPlotTick& tick, ImGuiTextBuffer& buffer);
|
||||
// Label a tick with scientific formating.
|
||||
IMPLOT_API void LabelTickScientific(ImPlotTick& tick, ImGuiTextBuffer& buffer);
|
||||
// Label a tick with time formatting.
|
||||
IMPLOT_API void LabelTickTime(ImPlotTick& tick, ImGuiTextBuffer& buffer, const ImPlotTime& t, ImPlotDateTimeFmt fmt);
|
||||
|
||||
// Populates a list of ImPlotTicks with normal spaced and formatted ticks
|
||||
IMPLOT_API void AddTicksDefault(const ImPlotRange& range, int nMajor, int nMinor, ImPlotTickCollection& ticks);
|
||||
// Populates a list of ImPlotTicks with logarithmic space and formatted ticks
|
||||
IMPLOT_API void AddTicksLogarithmic(const ImPlotRange& range, int nMajor, ImPlotTickCollection& ticks);
|
||||
// Populates a list of ImPlotTicks with time formatted ticks.
|
||||
IMPLOT_API void AddTicksTime(const ImPlotRange& range, int nMajor, ImPlotTickCollection& ticks);
|
||||
// Populates a list of ImPlotTicks with custom spaced and labeled ticks
|
||||
IMPLOT_API void AddTicksCustom(const double* values, const char* const labels[], int n, ImPlotTickCollection& ticks);
|
||||
|
||||
// Create a a string label for a an axis value
|
||||
IMPLOT_API int LabelAxisValue(const ImPlotAxis& axis, const ImPlotTickCollection& ticks, double value, char* buff, int size);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Styling Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Get styling data for next item (call between Begin/EndItem)
|
||||
inline const ImPlotNextItemData& GetItemData() { return GImPlot->NextItemData; }
|
||||
|
||||
// Returns true if a color is set to be automatically determined
|
||||
inline bool IsColorAuto(const ImVec4& col) { return col.w == -1; }
|
||||
// Returns true if a style color is set to be automaticaly determined
|
||||
inline bool IsColorAuto(ImPlotCol idx) { return IsColorAuto(GImPlot->Style.Colors[idx]); }
|
||||
// Returns the automatically deduced style color
|
||||
IMPLOT_API ImVec4 GetAutoColor(ImPlotCol idx);
|
||||
|
||||
// Returns the style color whether it is automatic or custom set
|
||||
inline ImVec4 GetStyleColorVec4(ImPlotCol idx) { return IsColorAuto(idx) ? GetAutoColor(idx) : GImPlot->Style.Colors[idx]; }
|
||||
inline ImU32 GetStyleColorU32(ImPlotCol idx) { return ImGui::ColorConvertFloat4ToU32(GetStyleColorVec4(idx)); }
|
||||
|
||||
// Get built-in colormap data and size
|
||||
IMPLOT_API const ImVec4* GetColormap(ImPlotColormap colormap, int* size_out);
|
||||
// Linearly interpolates a color from the current colormap given t between 0 and 1.
|
||||
IMPLOT_API ImVec4 LerpColormap(const ImVec4* colormap, int size, float t);
|
||||
// Resamples a colormap. #size_out must be greater than 1.
|
||||
IMPLOT_API void ResampleColormap(const ImVec4* colormap_in, int size_in, ImVec4* colormap_out, int size_out);
|
||||
|
||||
// Draws vertical text. The position is the bottom left of the text rect.
|
||||
IMPLOT_API void AddTextVertical(ImDrawList *DrawList, ImVec2 pos, ImU32 col, const char* text_begin, const char* text_end = NULL);
|
||||
// Calculates the size of vertical text
|
||||
inline ImVec2 CalcTextSizeVertical(const char *text) { ImVec2 sz = ImGui::CalcTextSize(text); return ImVec2(sz.y, sz.x); }
|
||||
// Returns white or black text given background color
|
||||
inline ImU32 CalcTextColor(const ImVec4& bg) { return (bg.x * 0.299 + bg.y * 0.587 + bg.z * 0.114) > 0.5 ? IM_COL32_BLACK : IM_COL32_WHITE; }
|
||||
|
||||
// Clamps a label position so that it fits a rect defined by Min/Max
|
||||
inline ImVec2 ClampLabelPos(ImVec2 pos, const ImVec2& size, const ImVec2& Min, const ImVec2& Max) {
|
||||
if (pos.x < Min.x) pos.x = Min.x;
|
||||
if (pos.y < Min.y) pos.y = Min.y;
|
||||
if ((pos.x + size.x) > Max.x) pos.x = Max.x - size.x;
|
||||
if ((pos.y + size.y) > Max.y) pos.y = Max.y - size.y;
|
||||
return pos;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Math and Misc Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Rounds x to powers of 2,5 and 10 for generating axis labels (from Graphics Gems 1 Chapter 11.2)
|
||||
IMPLOT_API double NiceNum(double x, bool round);
|
||||
// Computes order of magnitude of double.
|
||||
inline int OrderOfMagnitude(double val) { return val == 0 ? 0 : (int)(floor(log10(fabs(val)))); }
|
||||
// Returns the precision required for a order of magnitude.
|
||||
inline int OrderToPrecision(int order) { return order > 0 ? 0 : 1 - order; }
|
||||
// Returns a floating point precision to use given a value
|
||||
inline int Precision(double val) { return OrderToPrecision(OrderOfMagnitude(val)); }
|
||||
|
||||
// Returns the intersection point of two lines A and B (assumes they are not parallel!)
|
||||
inline ImVec2 Intersection(const ImVec2& a1, const ImVec2& a2, const ImVec2& b1, const ImVec2& b2) {
|
||||
float v1 = (a1.x * a2.y - a1.y * a2.x); float v2 = (b1.x * b2.y - b1.y * b2.x);
|
||||
float v3 = ((a1.x - a2.x) * (b1.y - b2.y) - (a1.y - a2.y) * (b1.x - b2.x));
|
||||
return ImVec2((v1 * (b1.x - b2.x) - v2 * (a1.x - a2.x)) / v3, (v1 * (b1.y - b2.y) - v2 * (a1.y - a2.y)) / v3);
|
||||
}
|
||||
|
||||
// Fills a buffer with n samples linear interpolated from vmin to vmax
|
||||
template <typename T>
|
||||
void FillRange(ImVector<T>& buffer, int n, T vmin, T vmax) {
|
||||
buffer.resize(n);
|
||||
T step = (vmax - vmin) / (n - 1);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
buffer[i] = vmin + i * step;
|
||||
}
|
||||
}
|
||||
|
||||
// Offsets and strides a data buffer
|
||||
template <typename T>
|
||||
inline T OffsetAndStride(const T* data, int idx, int count, int offset, int stride) {
|
||||
idx = ImPosMod(offset + idx, count);
|
||||
return *(const T*)(const void*)((const unsigned char*)data + (size_t)idx * stride);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Time Utils
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Returns true if year is leap year (366 days long)
|
||||
inline bool IsLeapYear(int year) {
|
||||
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
|
||||
}
|
||||
// Returns the number of days in a month, accounting for Feb. leap years. #month is zero indexed.
|
||||
inline int GetDaysInMonth(int year, int month) {
|
||||
static const int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
return days[month] + (int)(month == 1 && IsLeapYear(year));
|
||||
}
|
||||
|
||||
// Make a UNIX timestamp from a tm struct expressed in UTC time (i.e. GMT timezone).
|
||||
IMPLOT_API ImPlotTime MkGmtTime(struct tm *ptm);
|
||||
// Make a tm struct expressed in UTC time (i.e. GMT timezone) from a UNIX timestamp.
|
||||
IMPLOT_API tm* GetGmtTime(const ImPlotTime& t, tm* ptm);
|
||||
|
||||
// Make a UNIX timestamp from a tm struct expressed in local time.
|
||||
IMPLOT_API ImPlotTime MkLocTime(struct tm *ptm);
|
||||
// Make a tm struct expressed in local time from a UNIX timestamp.
|
||||
IMPLOT_API tm* GetLocTime(const ImPlotTime& t, tm* ptm);
|
||||
|
||||
// NB: The following functions only work if there is a current ImPlotContext because the
|
||||
// internal tm struct is owned by the context! They are aware of ImPlotStyle.UseLocalTime.
|
||||
|
||||
// Make a timestamp from time components.
|
||||
// year[1970-3000], month[0-11], day[1-31], hour[0-23], min[0-59], sec[0-59], us[0,999999]
|
||||
IMPLOT_API ImPlotTime MakeTime(int year, int month = 0, int day = 1, int hour = 0, int min = 0, int sec = 0, int us = 0);
|
||||
// Get year component from timestamp [1970-3000]
|
||||
IMPLOT_API int GetYear(const ImPlotTime& t);
|
||||
|
||||
// Adds or subtracts time from a timestamp. #count > 0 to add, < 0 to subtract.
|
||||
IMPLOT_API ImPlotTime AddTime(const ImPlotTime& t, ImPlotTimeUnit unit, int count);
|
||||
// Rounds a timestamp down to nearest unit.
|
||||
IMPLOT_API ImPlotTime FloorTime(const ImPlotTime& t, ImPlotTimeUnit unit);
|
||||
// Rounds a timestamp up to the nearest unit.
|
||||
IMPLOT_API ImPlotTime CeilTime(const ImPlotTime& t, ImPlotTimeUnit unit);
|
||||
// Rounds a timestamp up or down to the nearest unit.
|
||||
IMPLOT_API ImPlotTime RoundTime(const ImPlotTime& t, ImPlotTimeUnit unit);
|
||||
// Combines the date of one timestamp with the time-of-day of another timestamp.
|
||||
IMPLOT_API ImPlotTime CombineDateTime(const ImPlotTime& date_part, const ImPlotTime& time_part);
|
||||
|
||||
// Formats the time part of timestamp t into a buffer according to #fmt
|
||||
IMPLOT_API int FormatTime(const ImPlotTime& t, char* buffer, int size, ImPlotTimeFmt fmt, bool use_24_hr_clk);
|
||||
// Formats the date part of timestamp t into a buffer according to #fmt
|
||||
IMPLOT_API int FormatDate(const ImPlotTime& t, char* buffer, int size, ImPlotDateFmt fmt, bool use_iso_8601);
|
||||
// Formats the time and/or date parts of a timestamp t into a buffer according to #fmt
|
||||
IMPLOT_API int FormatDateTime(const ImPlotTime& t, char* buffer, int size, ImPlotDateTimeFmt fmt);
|
||||
|
||||
// Shows a date picker widget block (year/month/day).
|
||||
// #level = 0 for day, 1 for month, 2 for year. Modified by user interaction.
|
||||
// #t will be set when a day is clicked and the function will return true.
|
||||
// #t1 and #t2 are optional dates to highlight.
|
||||
IMPLOT_API bool ShowDatePicker(const char* id, int* level, ImPlotTime* t, const ImPlotTime* t1 = NULL, const ImPlotTime* t2 = NULL);
|
||||
// Shows a time picker widget block (hour/min/sec).
|
||||
// #t will be set when a new hour, minute, or sec is selected or am/pm is toggled, and the function will return true.
|
||||
IMPLOT_API bool ShowTimePicker(const char* id, ImPlotTime* t);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Internal / Experimental Plotters
|
||||
// No guarantee of forward compatibility here!
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Plots axis-aligned, filled rectangles. Every two consecutive points defines opposite corners of a single rectangle.
|
||||
IMPLOT_API void PlotRects(const char* label_id, const float* xs, const float* ys, int count, int offset = 0, int stride = sizeof(float));
|
||||
IMPLOT_API void PlotRects(const char* label_id, const double* xs, const double* ys, int count, int offset = 0, int stride = sizeof(double));
|
||||
IMPLOT_API void PlotRects(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset = 0);
|
||||
|
||||
} // namespace ImPlot
|
||||
7762
external/ImGui/include/stb_image.h
vendored
Normal file
7762
external/ImGui/include/stb_image.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1214
external/ImGui/source/ImGuiFileBrowser.cpp
vendored
1214
external/ImGui/source/ImGuiFileBrowser.cpp
vendored
File diff suppressed because it is too large
Load Diff
94
external/ImGui/source/imgui_imhex_extensions.cpp
vendored
94
external/ImGui/source/imgui_imhex_extensions.cpp
vendored
@@ -6,8 +6,13 @@
|
||||
#include <imgui_internal.h>
|
||||
#undef IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <stb_image.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace ImGui {
|
||||
|
||||
bool Hyperlink(const char* label, const ImVec2& size_arg, ImGuiButtonFlags flags) {
|
||||
@@ -107,11 +112,11 @@ namespace ImGui {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0, 0.5));
|
||||
|
||||
// Render
|
||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_TableHeaderBg : hovered ? ImGuiCol_TableBorderLight : ImGuiCol_TableBorderStrong);
|
||||
const ImU32 col = GetCustomColorU32((held && hovered) ? ImGuiCustomCol_DescButtonActive : hovered ? ImGuiCustomCol_DescButtonHovered : ImGuiCustomCol_DescButton);
|
||||
RenderNavHighlight(bb, id);
|
||||
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
||||
PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_ButtonActive));
|
||||
RenderTextClipped(bb.Min + style.FramePadding * 2, bb.Max - style.FramePadding * 2, label, NULL, &text_size, style.ButtonTextAlign, &bb);
|
||||
RenderTextWrapped(bb.Min + style.FramePadding * 2, label, nullptr, CalcWrapWidthForPos(window->DC.CursorPos, window->DC.TextWrapPos));
|
||||
PopStyleColor();
|
||||
PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_Text));
|
||||
RenderTextClipped(bb.Min + style.FramePadding * 2 + ImVec2(style.FramePadding.x * 2, label_size.y), bb.Max - style.FramePadding, description, NULL, &text_size, style.ButtonTextAlign, &bb);
|
||||
@@ -141,4 +146,89 @@ namespace ImGui {
|
||||
PopStyleColor();
|
||||
}
|
||||
|
||||
void Disabled(const std::function<void()> &widgets, bool disabled) {
|
||||
if (disabled) {
|
||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5F);
|
||||
widgets();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopItemFlag();
|
||||
} else {
|
||||
widgets();
|
||||
}
|
||||
}
|
||||
|
||||
void TextSpinner(const char* label) {
|
||||
ImGui::Text("[%c] %s", "|/-\\"[ImU32(ImGui::GetTime() * 20) % 4], label);
|
||||
}
|
||||
|
||||
void Header(const char *label, bool firstEntry) {
|
||||
if (!firstEntry)
|
||||
ImGui::NewLine();
|
||||
ImGui::TextUnformatted(label);
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
ImU32 GetCustomColorU32(ImGuiCustomCol idx, float alpha_mul) {
|
||||
auto& customData = *static_cast<ImHexCustomData*>(GImGui->IO.UserData);
|
||||
ImVec4 c = customData.Colors[idx];
|
||||
c.w *= GImGui->Style.Alpha * alpha_mul;
|
||||
return ColorConvertFloat4ToU32(c);
|
||||
}
|
||||
|
||||
void StyleCustomColorsDark() {
|
||||
auto &colors = static_cast<ImHexCustomData*>(GImGui->IO.UserData)->Colors;
|
||||
|
||||
colors[ImGuiCustomCol_DescButton] = ImColor(20, 20, 20);
|
||||
colors[ImGuiCustomCol_DescButtonHovered] = ImColor(40, 40, 40);
|
||||
colors[ImGuiCustomCol_DescButtonActive] = ImColor(60, 60, 60);
|
||||
}
|
||||
|
||||
void StyleCustomColorsLight() {
|
||||
auto &colors = static_cast<ImHexCustomData*>(GImGui->IO.UserData)->Colors;
|
||||
|
||||
colors[ImGuiCustomCol_DescButton] = ImColor(230, 230, 230);
|
||||
colors[ImGuiCustomCol_DescButtonHovered] = ImColor(210, 210, 210);
|
||||
colors[ImGuiCustomCol_DescButtonActive] = ImColor(190, 190, 190);
|
||||
}
|
||||
|
||||
void StyleCustomColorsClassic() {
|
||||
auto &colors = static_cast<ImHexCustomData*>(GImGui->IO.UserData)->Colors;
|
||||
|
||||
colors[ImGuiCustomCol_DescButton] = ImColor(40, 40, 80);
|
||||
colors[ImGuiCustomCol_DescButtonHovered] = ImColor(60, 60, 100);
|
||||
colors[ImGuiCustomCol_DescButtonActive] = ImColor(80, 80, 120);
|
||||
}
|
||||
|
||||
std::tuple<ImTextureID, int, int> LoadImageFromPath(const char *path) {
|
||||
int imageWidth = 0;
|
||||
int imageHeight = 0;
|
||||
|
||||
unsigned char* imageData = stbi_load(path, &imageWidth, &imageHeight, nullptr, 4);
|
||||
if (imageData == nullptr)
|
||||
return { nullptr, -1, -1 };
|
||||
|
||||
GLuint texture;
|
||||
glGenTextures(1, &texture);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
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_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
#if defined(GL_UNPACK_ROW_LENGTH)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
#endif
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imageWidth, imageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
|
||||
stbi_image_free(imageData);
|
||||
|
||||
return { reinterpret_cast<ImTextureID>(static_cast<intptr_t>(texture)), imageWidth, imageHeight };
|
||||
}
|
||||
|
||||
void UnloadImage(ImTextureID texture) {
|
||||
auto glTextureId = static_cast<GLuint>(reinterpret_cast<intptr_t>(texture));
|
||||
glDeleteTextures(1, &glTextureId);
|
||||
}
|
||||
|
||||
}
|
||||
4109
external/ImGui/source/implot.cpp
vendored
Normal file
4109
external/ImGui/source/implot.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1691
external/ImGui/source/implot_demo.cpp
vendored
Normal file
1691
external/ImGui/source/implot_demo.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1915
external/ImGui/source/implot_items.cpp
vendored
Normal file
1915
external/ImGui/source/implot_items.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
external/curl
vendored
Submodule
1
external/curl
vendored
Submodule
Submodule external/curl added at 566b74a0e1
1
external/fmt
vendored
Submodule
1
external/fmt
vendored
Submodule
Submodule external/fmt added at 6271406233
12
external/glad/CMakeLists.txt
vendored
12
external/glad/CMakeLists.txt
vendored
@@ -3,20 +3,12 @@ project(glad)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
|
||||
add_library(glad
|
||||
add_library(glad STATIC
|
||||
source/glad.c
|
||||
)
|
||||
|
||||
target_include_directories(glad PUBLIC include)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(glad PRIVATE libdl.a)
|
||||
else()
|
||||
target_link_libraries(glad PRIVATE dl)
|
||||
endif()
|
||||
target_link_libraries(glad PRIVATE dl)
|
||||
6
external/llvm/CMakeLists.txt
vendored
6
external/llvm/CMakeLists.txt
vendored
@@ -3,13 +3,9 @@ project(LLVMDemangle)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
|
||||
add_library(LLVMDemangle
|
||||
add_library(LLVMDemangle STATIC
|
||||
Demangle/Demangle.cpp
|
||||
Demangle/ItaniumDemangle.cpp
|
||||
Demangle/MicrosoftDemangle.cpp
|
||||
|
||||
1
external/nativefiledialog
vendored
Submodule
1
external/nativefiledialog
vendored
Submodule
Submodule external/nativefiledialog added at 300203a98d
1
external/xdgpp
vendored
Submodule
1
external/xdgpp
vendored
Submodule
Submodule external/xdgpp added at f01f810714
128
external/yara/CMakeLists.txt
vendored
Normal file
128
external/yara/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(LIBYARA_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/yara/libyara")
|
||||
|
||||
set(LIBYARA_INCLUDES
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/ahocorasick.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/arena.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/atoms.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/bitmask.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/compiler.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/error.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/exec.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/exefiles.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/filemap.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/hash.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/integers.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/libyara.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/limits.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/mem.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/modules.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/object.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/parser.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/proc.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/re.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/rules.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/scan.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/scanner.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/sizedstr.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/stack.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/stopwatch.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/stream.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/strutils.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/threading.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/types.h
|
||||
${LIBYARA_SOURCE_PATH}/include/yara/utils.h
|
||||
${LIBYARA_SOURCE_PATH}/crypto.h
|
||||
)
|
||||
|
||||
set(LIBYARA_SOURCE
|
||||
${LIBYARA_SOURCE_PATH}/grammar.y
|
||||
${LIBYARA_SOURCE_PATH}/ahocorasick.c
|
||||
${LIBYARA_SOURCE_PATH}/arena.c
|
||||
${LIBYARA_SOURCE_PATH}/atoms.c
|
||||
${LIBYARA_SOURCE_PATH}/base64.c
|
||||
${LIBYARA_SOURCE_PATH}/bitmask.c
|
||||
${LIBYARA_SOURCE_PATH}/compiler.c
|
||||
${LIBYARA_SOURCE_PATH}/endian.c
|
||||
${LIBYARA_SOURCE_PATH}/exec.c
|
||||
${LIBYARA_SOURCE_PATH}/exefiles.c
|
||||
${LIBYARA_SOURCE_PATH}/filemap.c
|
||||
${LIBYARA_SOURCE_PATH}/hash.c
|
||||
${LIBYARA_SOURCE_PATH}/hex_grammar.y
|
||||
${LIBYARA_SOURCE_PATH}/hex_lexer.l
|
||||
${LIBYARA_SOURCE_PATH}/lexer.l
|
||||
${LIBYARA_SOURCE_PATH}/libyara.c
|
||||
${LIBYARA_SOURCE_PATH}/mem.c
|
||||
${LIBYARA_SOURCE_PATH}/modules.c
|
||||
${LIBYARA_SOURCE_PATH}/notebook.c
|
||||
${LIBYARA_SOURCE_PATH}/object.c
|
||||
${LIBYARA_SOURCE_PATH}/parser.c
|
||||
${LIBYARA_SOURCE_PATH}/proc.c
|
||||
${LIBYARA_SOURCE_PATH}/re.c
|
||||
${LIBYARA_SOURCE_PATH}/re_grammar.y
|
||||
${LIBYARA_SOURCE_PATH}/re_lexer.l
|
||||
${LIBYARA_SOURCE_PATH}/rules.c
|
||||
${LIBYARA_SOURCE_PATH}/scan.c
|
||||
${LIBYARA_SOURCE_PATH}/scanner.c
|
||||
${LIBYARA_SOURCE_PATH}/sizedstr.c
|
||||
${LIBYARA_SOURCE_PATH}/stack.c
|
||||
${LIBYARA_SOURCE_PATH}/stopwatch.c
|
||||
${LIBYARA_SOURCE_PATH}/strutils.c
|
||||
${LIBYARA_SOURCE_PATH}/stream.c
|
||||
${LIBYARA_SOURCE_PATH}/threading.c
|
||||
${LIBYARA_SOURCE_PATH}/lexer.c
|
||||
${LIBYARA_SOURCE_PATH}/hex_lexer.c
|
||||
${LIBYARA_SOURCE_PATH}/grammar.c
|
||||
${LIBYARA_SOURCE_PATH}/re_lexer.c
|
||||
${LIBYARA_SOURCE_PATH}/hex_grammar.c
|
||||
${LIBYARA_SOURCE_PATH}/re_grammar.c
|
||||
${LIBYARA_SOURCE_PATH}/proc/none.c
|
||||
)
|
||||
|
||||
set(LIBYARA_MODULES
|
||||
${LIBYARA_SOURCE_PATH}/modules/tests/tests.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/pe/pe.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/pe/pe_utils.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/elf/elf.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/math/math.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/time/time.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/macho/macho.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/hash/hash.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/dex/dex.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/dotnet/dotnet.c
|
||||
${LIBYARA_SOURCE_PATH}/modules/magic/magic.c)
|
||||
|
||||
# Add mbedtls crypto wrappers
|
||||
file(READ crypto_mbedtls.h MBEDTLS_CRYPTO_H)
|
||||
file(WRITE ${LIBYARA_SOURCE_PATH}/crypto.h "${MBEDTLS_CRYPTO_H}")
|
||||
add_compile_definitions("HAVE_MBEDTLS")
|
||||
|
||||
add_compile_definitions("USE_NO_PROC")
|
||||
|
||||
add_compile_definitions("HASH_MODULE")
|
||||
add_compile_definitions("DOTNET_MODULE")
|
||||
add_compile_definitions("MAGIC_MODULE")
|
||||
add_compile_definitions("MACHO_MODULE")
|
||||
add_compile_definitions("DEX_MODULE")
|
||||
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shift-count-overflow")
|
||||
add_library(libyara STATIC ${LIBYARA_SOURCE} ${LIBYARA_INCLUDES} ${LIBYARA_MODULES})
|
||||
|
||||
target_include_directories(
|
||||
libyara
|
||||
PUBLIC $<BUILD_INTERFACE:${LIBYARA_SOURCE_PATH}/include> $<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${LIBYARA_SOURCE_PATH} ${MBEDTLS_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(libyara magic pthread)
|
||||
else ()
|
||||
target_link_libraries(libyara magic)
|
||||
endif ()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
configure_file(${LIBYARA_SOURCE_PATH}/yara.pc.in
|
||||
${LIBYARA_SOURCE_PATH}/yara.pc @ONLY)
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
143
external/yara/crypto_mbedtls.h
vendored
Normal file
143
external/yara/crypto_mbedtls.h
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
Copyright (c) 2017. The YARA Authors. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef YR_CRYPTO_H
|
||||
#define YR_CRYPTO_H
|
||||
|
||||
#define YR_MD5_LEN 16
|
||||
#define YR_SHA1_LEN 20
|
||||
#define YR_SHA256_LEN 32
|
||||
|
||||
#if defined(HAVE_LIBCRYPTO)
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
typedef MD5_CTX yr_md5_ctx;
|
||||
typedef SHA_CTX yr_sha1_ctx;
|
||||
typedef SHA256_CTX yr_sha256_ctx;
|
||||
|
||||
#define yr_md5_init(ctx) MD5_Init(ctx)
|
||||
#define yr_md5_update(ctx, data, len) MD5_Update(ctx, data, len)
|
||||
#define yr_md5_final(digest, ctx) MD5_Final(digest, ctx)
|
||||
|
||||
#define yr_sha1_init(ctx) SHA1_Init(ctx)
|
||||
#define yr_sha1_update(ctx, data, len) SHA1_Update(ctx, data, len)
|
||||
#define yr_sha1_final(digest, ctx) SHA1_Final(digest, ctx)
|
||||
|
||||
#define yr_sha256_init(ctx) SHA256_Init(ctx)
|
||||
#define yr_sha256_update(ctx, data, len) SHA256_Update(ctx, data, len)
|
||||
#define yr_sha256_final(digest, ctx) SHA256_Final(digest, ctx)
|
||||
|
||||
#elif defined(HAVE_WINCRYPT_H)
|
||||
#include <windows.h>
|
||||
|
||||
#include <wincrypt.h>
|
||||
|
||||
extern HCRYPTPROV yr_cryptprov;
|
||||
|
||||
typedef HCRYPTHASH yr_md5_ctx;
|
||||
typedef HCRYPTHASH yr_sha1_ctx;
|
||||
typedef HCRYPTHASH yr_sha256_ctx;
|
||||
|
||||
#define yr_md5_init(ctx) CryptCreateHash(yr_cryptprov, CALG_MD5, 0, 0, ctx)
|
||||
#define yr_md5_update(ctx, data, len) \
|
||||
CryptHashData(*ctx, (const BYTE*) data, len, 0)
|
||||
#define yr_md5_final(digest, ctx) \
|
||||
{ \
|
||||
DWORD len = YR_MD5_LEN; \
|
||||
CryptGetHashParam(*ctx, HP_HASHVAL, digest, &len, 0); \
|
||||
CryptDestroyHash(*ctx); \
|
||||
}
|
||||
|
||||
#define yr_sha1_init(ctx) CryptCreateHash(yr_cryptprov, CALG_SHA1, 0, 0, ctx)
|
||||
#define yr_sha1_update(ctx, data, len) \
|
||||
CryptHashData(*ctx, (const BYTE*) data, len, 0)
|
||||
#define yr_sha1_final(digest, ctx) \
|
||||
{ \
|
||||
DWORD len = YR_SHA1_LEN; \
|
||||
CryptGetHashParam(*ctx, HP_HASHVAL, digest, &len, 0); \
|
||||
CryptDestroyHash(*ctx); \
|
||||
}
|
||||
|
||||
#define yr_sha256_init(ctx) \
|
||||
CryptCreateHash(yr_cryptprov, CALG_SHA_256, 0, 0, ctx)
|
||||
#define yr_sha256_update(ctx, data, len) \
|
||||
CryptHashData(*ctx, (const BYTE*) data, len, 0)
|
||||
#define yr_sha256_final(digest, ctx) \
|
||||
{ \
|
||||
DWORD len = YR_SHA256_LEN; \
|
||||
CryptGetHashParam(*ctx, HP_HASHVAL, digest, &len, 0); \
|
||||
CryptDestroyHash(*ctx); \
|
||||
}
|
||||
|
||||
#elif defined(HAVE_COMMONCRYPTO_COMMONCRYPTO_H)
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
|
||||
typedef CC_MD5_CTX yr_md5_ctx;
|
||||
typedef CC_SHA1_CTX yr_sha1_ctx;
|
||||
typedef CC_SHA256_CTX yr_sha256_ctx;
|
||||
|
||||
#define yr_md5_init(ctx) CC_MD5_Init(ctx)
|
||||
#define yr_md5_update(ctx, data, len) CC_MD5_Update(ctx, data, len)
|
||||
#define yr_md5_final(digest, ctx) CC_MD5_Final(digest, ctx)
|
||||
|
||||
#define yr_sha1_init(ctx) CC_SHA1_Init(ctx)
|
||||
#define yr_sha1_update(ctx, data, len) CC_SHA1_Update(ctx, data, len)
|
||||
#define yr_sha1_final(digest, ctx) CC_SHA1_Final(digest, ctx)
|
||||
|
||||
#define yr_sha256_init(ctx) CC_SHA256_Init(ctx)
|
||||
#define yr_sha256_update(ctx, data, len) CC_SHA256_Update(ctx, data, len)
|
||||
#define yr_sha256_final(digest, ctx) CC_SHA256_Final(digest, ctx)
|
||||
|
||||
#elif defined(HAVE_MBEDTLS)
|
||||
#include <mbedtls/md5.h>
|
||||
#include <mbedtls/sha1.h>
|
||||
#include <mbedtls/sha256.h>
|
||||
|
||||
typedef mbedtls_md5_context yr_md5_ctx;
|
||||
typedef mbedtls_sha1_context yr_sha1_ctx;
|
||||
typedef mbedtls_sha256_context yr_sha256_ctx;
|
||||
|
||||
#define yr_md5_init(ctx) { mbedtls_md5_init(ctx); mbedtls_md5_starts_ret(ctx); }
|
||||
#define yr_md5_update(ctx, data, len) mbedtls_md5_update_ret(ctx, data, len)
|
||||
#define yr_md5_final(digest, ctx) { mbedtls_md5_finish_ret(ctx, digest); mbedtls_md5_free(ctx); }
|
||||
|
||||
#define yr_sha1_init(ctx) { mbedtls_sha1_init(ctx); mbedtls_sha1_starts_ret(ctx); }
|
||||
#define yr_sha1_update(ctx, data, len) mbedtls_sha1_update_ret(ctx, data, len)
|
||||
#define yr_sha1_final(digest, ctx) { mbedtls_sha1_finish_ret(ctx, digest); mbedtls_sha1_free(ctx); }
|
||||
|
||||
#define yr_sha256_init(ctx) { mbedtls_sha256_init(ctx); mbedtls_sha256_starts_ret(ctx, false); }
|
||||
#define yr_sha256_update(ctx, data, len) mbedtls_sha256_update_ret(ctx, data, len)
|
||||
#define yr_sha256_final(digest, ctx) { mbedtls_sha256_finish_ret(ctx, digest); mbedtls_sha256_free(ctx); }
|
||||
|
||||
#define HAVE_COMMONCRYPTO_COMMONCRYPTO_H
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1
external/yara/yara
vendored
Submodule
1
external/yara/yara
vendored
Submodule
Submodule external/yara/yara added at 1842271119
@@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <hex/views/view.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace hex {
|
||||
|
||||
class Plugin {
|
||||
public:
|
||||
Plugin(std::string_view path);
|
||||
Plugin(const Plugin&) = delete;
|
||||
Plugin(Plugin &&other);
|
||||
~Plugin();
|
||||
|
||||
void initializePlugin() const;
|
||||
|
||||
private:
|
||||
using InitializePluginFunc = void(*)();
|
||||
|
||||
void *m_handle = nullptr;
|
||||
|
||||
InitializePluginFunc m_initializePluginFunction = nullptr;
|
||||
};
|
||||
|
||||
class PluginHandler {
|
||||
public:
|
||||
PluginHandler() = delete;
|
||||
|
||||
static void load(std::string_view pluginFolder);
|
||||
static void unload();
|
||||
static void reload();
|
||||
|
||||
static const auto& getPlugins() {
|
||||
return PluginHandler::s_plugins;
|
||||
}
|
||||
|
||||
private:
|
||||
static inline std::string s_pluginFolder;
|
||||
static inline std::vector<Plugin> s_plugins;
|
||||
};
|
||||
|
||||
}
|
||||
64
include/helpers/plugin_manager.hpp
Normal file
64
include/helpers/plugin_manager.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <hex/views/view.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <string_view>
|
||||
#include <dlfcn.h>
|
||||
|
||||
namespace hex {
|
||||
|
||||
class Plugin {
|
||||
public:
|
||||
Plugin(std::string_view path);
|
||||
Plugin(const Plugin&) = delete;
|
||||
Plugin(Plugin &&other) noexcept;
|
||||
~Plugin();
|
||||
|
||||
void initializePlugin() const;
|
||||
std::string getPluginName() const;
|
||||
std::string getPluginAuthor() const;
|
||||
std::string getPluginDescription() const;
|
||||
|
||||
|
||||
private:
|
||||
using InitializePluginFunc = void(*)();
|
||||
using GetPluginNameFunc = const char*(*)();
|
||||
using GetPluginAuthorFunc = const char*(*)();
|
||||
using GetPluginDescriptionFunc = const char*(*)();
|
||||
|
||||
void *m_handle = nullptr;
|
||||
|
||||
InitializePluginFunc m_initializePluginFunction = nullptr;
|
||||
GetPluginNameFunc m_getPluginNameFunction = nullptr;
|
||||
GetPluginAuthorFunc m_getPluginAuthorFunction = nullptr;
|
||||
GetPluginDescriptionFunc m_getPluginDescriptionFunction = nullptr;
|
||||
|
||||
template<typename T>
|
||||
auto getPluginFunction(std::string_view pluginName, std::string_view symbol) {
|
||||
auto symbolName = hex::format(symbol.data(), pluginName.length(), pluginName.data());
|
||||
return reinterpret_cast<T>(dlsym(this->m_handle, symbolName.c_str()));
|
||||
};
|
||||
};
|
||||
|
||||
class PluginManager {
|
||||
public:
|
||||
PluginManager() = delete;
|
||||
|
||||
static bool load(std::string_view pluginFolder);
|
||||
static void unload();
|
||||
static void reload();
|
||||
|
||||
static const auto& getPlugins() {
|
||||
return PluginManager::s_plugins;
|
||||
}
|
||||
|
||||
private:
|
||||
static inline std::string s_pluginFolder;
|
||||
static inline std::vector<Plugin> s_plugins;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -33,6 +33,9 @@ namespace hex {
|
||||
[[nodiscard]] static const std::list<ImHexApi::Bookmarks::Entry>& getBookmarks() { return ProjectFile::s_bookmarks; }
|
||||
static void setBookmarks(const std::list<ImHexApi::Bookmarks::Entry> &bookmarks) { ProjectFile::s_hasUnsavedChanged = true; ProjectFile::s_bookmarks = bookmarks; }
|
||||
|
||||
[[nodiscard]] static const std::string_view getDataProcessorContent() { return ProjectFile::s_dataProcessorContent; }
|
||||
static void setDataProcessorContent(std::string_view json) { ProjectFile::s_dataProcessorContent = json; }
|
||||
|
||||
private:
|
||||
static inline std::string s_currProjectFilePath;
|
||||
static inline bool s_hasUnsavedChanged = false;
|
||||
@@ -41,6 +44,7 @@ namespace hex {
|
||||
static inline std::string s_pattern;
|
||||
static inline Patches s_patches;
|
||||
static inline std::list<ImHexApi::Bookmarks::Entry> s_bookmarks;
|
||||
static inline std::string s_dataProcessorContent;
|
||||
};
|
||||
|
||||
}
|
||||
41
include/init/splash_window.hpp
Normal file
41
include/init/splash_window.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <vector>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
namespace hex::init {
|
||||
|
||||
class WindowSplash {
|
||||
public:
|
||||
WindowSplash(int &argc, char **&argv);
|
||||
~WindowSplash();
|
||||
|
||||
bool loop();
|
||||
|
||||
void addStartupTask(std::string_view taskName, const std::function<bool()> &task) {
|
||||
this->m_tasks.emplace_back(taskName, task);
|
||||
}
|
||||
|
||||
private:
|
||||
GLFWwindow *m_window;
|
||||
std::mutex m_progressMutex;
|
||||
float m_progress = 0;
|
||||
std::string m_currTaskName;
|
||||
|
||||
void initGLFW();
|
||||
void initImGui();
|
||||
|
||||
void deinitGLFW();
|
||||
void deinitImGui();
|
||||
|
||||
std::future<bool> processTasksAsync();
|
||||
|
||||
std::vector<std::pair<std::string, std::function<bool()>>> m_tasks;
|
||||
};
|
||||
|
||||
}
|
||||
22
include/init/tasks.hpp
Normal file
22
include/init/tasks.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace hex::init {
|
||||
|
||||
struct Task {
|
||||
std::string name;
|
||||
std::function<bool()> function;
|
||||
};
|
||||
|
||||
struct Argument {
|
||||
std::string name, value;
|
||||
};
|
||||
|
||||
std::vector<Task> getInitTasks();
|
||||
std::vector<Task> getExitTasks();
|
||||
|
||||
std::vector<Argument>& getInitArguments();
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace hex::prv {
|
||||
bool isReadable() override;
|
||||
bool isWritable() override;
|
||||
|
||||
void read(u64 offset, void *buffer, size_t size) 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 readRaw(u64 offset, void *buffer, size_t size) override;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace hex {
|
||||
bool isAvailable() override { return true; }
|
||||
bool shouldProcess() override { return true; }
|
||||
|
||||
bool handleShortcut(int key, int mods) override;
|
||||
bool handleShortcut(bool keys[512], bool ctrl, bool shift, bool alt) override;
|
||||
|
||||
bool hasViewMenuItemEntry() override { return false; }
|
||||
ImVec2 getMinSize() override { return ImVec2(400, 100); }
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace hex {
|
||||
void drawMenu() override;
|
||||
|
||||
private:
|
||||
struct InspectorCacheEntry {
|
||||
std::string unlocalizedName;
|
||||
ContentRegistry::DataInspector::DisplayFunction displayFunction;
|
||||
};
|
||||
|
||||
bool m_shouldInvalidate = true;
|
||||
|
||||
std::endian m_endian = std::endian::native;
|
||||
@@ -28,7 +33,7 @@ namespace hex {
|
||||
|
||||
u64 m_startAddress = 0;
|
||||
size_t m_validBytes = 0;
|
||||
std::vector<std::pair<std::string, ContentRegistry::DataInspector::DisplayFunction>> m_cachedData;
|
||||
std::vector<InspectorCacheEntry> m_cachedData;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -37,6 +37,9 @@ namespace hex {
|
||||
void eraseLink(u32 id);
|
||||
void eraseNodes(const std::vector<int> &ids);
|
||||
void processNodes();
|
||||
|
||||
std::string saveNodes();
|
||||
void loadNodes(std::string_view data);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace hex {
|
||||
void drawMenu() override;
|
||||
|
||||
private:
|
||||
bool m_shouldInvalidate = false;
|
||||
bool m_disassembling = false;
|
||||
|
||||
u64 m_baseAddress = 0;
|
||||
u64 m_codeRegion[2] = { 0 };
|
||||
@@ -42,7 +42,7 @@ namespace hex {
|
||||
|
||||
std::vector<Disassembly> m_disassembly;
|
||||
|
||||
|
||||
void disassemble();
|
||||
};
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "helpers/encoding_file.hpp"
|
||||
|
||||
#include <imgui_memory_editor.h>
|
||||
#include <ImGuiFileBrowser.h>
|
||||
|
||||
#include <list>
|
||||
#include <tuple>
|
||||
@@ -22,19 +21,17 @@ namespace hex {
|
||||
|
||||
class ViewHexEditor : public View {
|
||||
public:
|
||||
ViewHexEditor(std::vector<lang::PatternData*> &patternData);
|
||||
ViewHexEditor();
|
||||
~ViewHexEditor() override;
|
||||
|
||||
void drawContent() override;
|
||||
void drawAlwaysVisible() override;
|
||||
void drawMenu() override;
|
||||
bool handleShortcut(int key, int mods) override;
|
||||
bool handleShortcut(bool keys[512], bool ctrl, bool shift, bool alt) override;
|
||||
|
||||
private:
|
||||
MemoryEditor m_memoryEditor;
|
||||
|
||||
std::vector<lang::PatternData*> &m_patternData;
|
||||
|
||||
std::map<u64, u32> m_highlightedBytes;
|
||||
|
||||
std::vector<char> m_searchStringBuffer;
|
||||
@@ -56,6 +53,7 @@ namespace hex {
|
||||
std::string m_loaderScriptFilePath;
|
||||
|
||||
hex::EncodingFile m_currEncodingFile;
|
||||
u8 m_highlightAlpha = 0x80;
|
||||
|
||||
void drawSearchPopup();
|
||||
void drawGotoPopup();
|
||||
@@ -67,6 +65,7 @@ namespace hex {
|
||||
|
||||
enum class Language { C, Cpp, CSharp, Rust, Python, Java, JavaScript };
|
||||
void copyBytes();
|
||||
void pasteBytes();
|
||||
void copyString();
|
||||
void copyLanguageArray(Language language);
|
||||
void copyHexView();
|
||||
|
||||
@@ -26,13 +26,17 @@ namespace hex {
|
||||
float m_highestBlockEntropy = 0;
|
||||
std::vector<float> m_blockEntropy;
|
||||
|
||||
std::array<float, 256> m_valueCounts = { 0 };
|
||||
bool m_shouldInvalidate = false;
|
||||
double m_entropyHandlePosition;
|
||||
|
||||
std::array<ImU64, 256> m_valueCounts = { 0 };
|
||||
bool m_analyzing = false;
|
||||
|
||||
std::pair<u64, u64> m_analyzedRegion = { 0, 0 };
|
||||
|
||||
std::string m_fileDescription;
|
||||
std::string m_mimeType;
|
||||
|
||||
void analyze();
|
||||
};
|
||||
|
||||
}
|
||||
@@ -12,14 +12,13 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <ImGuiFileBrowser.h>
|
||||
#include <TextEditor.h>
|
||||
|
||||
namespace hex {
|
||||
|
||||
class ViewPattern : public View {
|
||||
public:
|
||||
explicit ViewPattern(std::vector<lang::PatternData*> &patternData);
|
||||
ViewPattern();
|
||||
~ViewPattern() override;
|
||||
|
||||
void drawMenu() override;
|
||||
@@ -28,9 +27,10 @@ namespace hex {
|
||||
|
||||
private:
|
||||
lang::PatternLanguage *m_patternLanguageRuntime;
|
||||
std::vector<lang::PatternData*> &m_patternData;
|
||||
std::vector<std::string> m_possiblePatternFiles;
|
||||
int m_selectedPatternFile = 0;
|
||||
bool m_runAutomatically = false;
|
||||
bool m_evaluatorRunning = false;
|
||||
|
||||
TextEditor m_textEditor;
|
||||
std::vector<std::pair<lang::LogConsole::Level, std::string>> m_console;
|
||||
|
||||
@@ -16,15 +16,13 @@ namespace hex {
|
||||
|
||||
class ViewPatternData : public View {
|
||||
public:
|
||||
ViewPatternData(std::vector<lang::PatternData*> &patternData);
|
||||
ViewPatternData();
|
||||
~ViewPatternData() override;
|
||||
|
||||
void drawContent() override;
|
||||
void drawMenu() override;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<lang::PatternData*> &m_patternData;
|
||||
std::vector<lang::PatternData*> m_sortedPatternData;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace hex {
|
||||
void drawMenu() override;
|
||||
|
||||
private:
|
||||
bool m_shouldInvalidate = false;
|
||||
bool m_searching = false;
|
||||
|
||||
std::vector<FoundString> m_foundStrings;
|
||||
int m_minimumLength = 5;
|
||||
@@ -33,6 +33,7 @@ namespace hex {
|
||||
std::string m_selectedString;
|
||||
std::string m_demangledName;
|
||||
|
||||
void searchStrings();
|
||||
void createStringContextMenu(const FoundString &foundString);
|
||||
};
|
||||
|
||||
|
||||
36
include/views/view_yara.hpp
Normal file
36
include/views/view_yara.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <hex/views/view.hpp>
|
||||
|
||||
namespace hex {
|
||||
|
||||
class ViewYara : public View {
|
||||
public:
|
||||
ViewYara();
|
||||
~ViewYara() override;
|
||||
|
||||
void drawContent() override;
|
||||
void drawMenu() override;
|
||||
|
||||
private:
|
||||
struct YaraMatch {
|
||||
std::string identifier;
|
||||
s64 address;
|
||||
s32 size;
|
||||
bool wholeDataMatch;
|
||||
};
|
||||
|
||||
std::vector<std::string> m_rules;
|
||||
std::vector<YaraMatch> m_matches;
|
||||
u32 m_selectedRule = 0;
|
||||
bool m_matching = false;
|
||||
std::vector<char> m_errorMessage;
|
||||
|
||||
void reloadRules();
|
||||
void applyRules();
|
||||
};
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace hex {
|
||||
|
||||
class Window {
|
||||
public:
|
||||
Window(int &argc, char **&argv);
|
||||
Window();
|
||||
~Window();
|
||||
|
||||
void loop();
|
||||
@@ -26,14 +26,12 @@ namespace hex {
|
||||
friend void ImHexSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf);
|
||||
|
||||
bool setFont(const std::filesystem::path &font_path);
|
||||
|
||||
void initPlugins();
|
||||
void deinitPlugins();
|
||||
private:
|
||||
void frameBegin();
|
||||
void frameEnd();
|
||||
|
||||
void drawWelcomeScreen();
|
||||
void resetLayout();
|
||||
|
||||
void initGLFW();
|
||||
void initImGui();
|
||||
@@ -44,11 +42,15 @@ namespace hex {
|
||||
|
||||
float m_globalScale = 1.0f, m_fontScale = 1.0f;
|
||||
bool m_fpsVisible = false;
|
||||
double m_targetFps = 60.0;
|
||||
bool m_demoWindowOpen = false;
|
||||
bool m_layoutConfigured = false;
|
||||
|
||||
static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
|
||||
double m_lastFrameTime;
|
||||
|
||||
std::list<std::string> m_recentFiles;
|
||||
bool m_prevKeysDown[512];
|
||||
|
||||
std::string m_availableUpdate;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -13,9 +13,13 @@ add_library(${PROJECT_NAME} SHARED
|
||||
source/content/tools_entries.cpp
|
||||
source/content/data_processor_nodes.cpp
|
||||
|
||||
source/content/footer_items.cpp
|
||||
|
||||
source/math_evaluator.cpp
|
||||
|
||||
source/lang/en_US.cpp
|
||||
source/lang/de_DE.cpp
|
||||
source/lang/it_IT.cpp
|
||||
)
|
||||
|
||||
# Add additional include directories here #
|
||||
@@ -32,7 +36,7 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug")
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc -Wl,--allow-multiple-definition -fvisibility=hidden")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -fvisibility=hidden")
|
||||
endif()
|
||||
|
||||
add_compile_definitions(IMHEX_PLUGIN_NAME=${PROJECT_NAME})
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
if (result.has_value())
|
||||
return hex::format("#%s = %Lf", input.data(), result.value());
|
||||
return hex::format("#{0} = %{1}", input.data(), result.value());
|
||||
else
|
||||
return hex::format("#%s = ???", input.data());
|
||||
return hex::format("#{0} = ???", input.data());
|
||||
});
|
||||
|
||||
hex::ContentRegistry::CommandPaletteCommands::add(
|
||||
|
||||
@@ -25,76 +25,79 @@ namespace hex::plugin::builtin {
|
||||
for (u8 i = 0; i < 8; i++)
|
||||
binary += ((buffer[0] << i) & 0x80) == 0 ? '0' : '1';
|
||||
|
||||
return [binary] { ImGui::TextUnformatted(binary.c_str()); };
|
||||
return [binary] {
|
||||
ImGui::TextUnformatted(binary.c_str());
|
||||
return binary;
|
||||
};
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u8", sizeof(u8), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, *reinterpret_cast<u8*>(buffer.data()));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s8", sizeof(s8), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, *reinterpret_cast<s8*>(buffer.data()));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u16", sizeof(u16), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u16*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s16", sizeof(s16), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s16*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u32", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u32*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s32", sizeof(s32), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s32*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u64", sizeof(u64), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%llu" : ((style == Style::Hexadecimal) ? "0x%llX" : "0o%llo");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u64*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s64", sizeof(s64), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "%lld" : ((style == Style::Hexadecimal) ? "0x%llX" : "0o%llo");
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s64*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.float", sizeof(float), [](auto buffer, auto endian, auto style) {
|
||||
auto value = hex::format("%e", hex::changeEndianess(*reinterpret_cast<float*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
auto value = hex::format("{0:E}", hex::changeEndianess(*reinterpret_cast<float*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.double", sizeof(double), [](auto buffer, auto endian, auto style) {
|
||||
auto value = hex::format("%e", hex::changeEndianess(*reinterpret_cast<double*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
auto value = hex::format("{0:E}", hex::changeEndianess(*reinterpret_cast<float*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.ascii", sizeof(char8_t), [](auto buffer, auto endian, auto style) {
|
||||
auto value = hex::format("'%s'", makePrintable(*reinterpret_cast<char8_t*>(buffer.data())).c_str());
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
auto value = hex::format("'{0}'", makePrintable(*reinterpret_cast<char8_t*>(buffer.data())).c_str());
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.wide", sizeof(char16_t), [](auto buffer, auto endian, auto style) {
|
||||
auto c = *reinterpret_cast<char16_t*>(buffer.data());
|
||||
auto value = hex::format("'%lc'", c == 0 ? '\x01' : hex::changeEndianess(c, endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
auto value = hex::format("'{0}'", c == 0 ? '\x01' : char16_t(hex::changeEndianess(c, endian)));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.utf8", sizeof(char8_t) * 4, [](auto buffer, auto endian, auto style) {
|
||||
@@ -106,55 +109,52 @@ namespace hex::plugin::builtin {
|
||||
u8 codepointSize = ImTextCharFromUtf8(&codepoint, utf8Buffer, utf8Buffer + 4);
|
||||
|
||||
std::memcpy(codepointString, &codepoint, std::min(codepointSize, u8(4)));
|
||||
auto value = hex::format("'%s' (U+%04lx)", codepoint == 0xFFFD ? "Invalid" :
|
||||
auto value = hex::format("'{0}' (U+0x{1:04X})", codepoint == 0xFFFD ? "Invalid" :
|
||||
codepoint < 0xFF ? makePrintable(codepoint).c_str() :
|
||||
codepointString,
|
||||
codepoint);
|
||||
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
#if defined(OS_WINDOWS) && defined(ARCH_64_BIT)
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(__time32_t), [](auto buffer, auto endian, auto style) {
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<__time32_t*>(buffer.data()), endian);
|
||||
std::tm * ptm = _localtime32(&endianAdjustedTime);
|
||||
char timeBuffer[32];
|
||||
struct tm *ptm = _localtime32(&endianAdjustedTime);
|
||||
std::string value;
|
||||
if (ptm != nullptr && std::strftime(timeBuffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm))
|
||||
value = timeBuffer;
|
||||
if (ptm != nullptr)
|
||||
value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *ptm);
|
||||
else
|
||||
value = "Invalid";
|
||||
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(__time64_t), [](auto buffer, auto endian, auto style) {
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<__time64_t*>(buffer.data()), endian);
|
||||
std::tm * ptm = _localtime64(&endianAdjustedTime);
|
||||
char timeBuffer[64];
|
||||
struct tm *ptm = _localtime64(&endianAdjustedTime);
|
||||
std::string value;
|
||||
if (ptm != nullptr && std::strftime(timeBuffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm))
|
||||
value = timeBuffer;
|
||||
if (ptm != nullptr)
|
||||
value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *ptm);
|
||||
else
|
||||
value = "Invalid";
|
||||
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
#else
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) {
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<time_t*>(buffer.data()), endian);
|
||||
std::tm * ptm = localtime(&endianAdjustedTime);
|
||||
char timeBuffer[64];
|
||||
struct tm *ptm = localtime(&endianAdjustedTime);
|
||||
std::string value;
|
||||
if (ptm != nullptr && std::strftime(timeBuffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm))
|
||||
value = timeBuffer;
|
||||
if (ptm != nullptr)
|
||||
value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *ptm);
|
||||
else
|
||||
value = "Invalid";
|
||||
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
#endif
|
||||
@@ -162,7 +162,7 @@ namespace hex::plugin::builtin {
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.guid", sizeof(GUID), [](auto buffer, auto endian, auto style) {
|
||||
GUID guid;
|
||||
std::memcpy(&guid, buffer.data(), sizeof(GUID));
|
||||
auto value = hex::format("%s{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
|
||||
auto value = hex::format("{}{{{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}}}",
|
||||
(hex::changeEndianess(guid.data3, endian) >> 12) <= 5 && ((guid.data4[0] >> 4) >= 8 || (guid.data4[0] >> 4) == 0) ? "" : "Invalid ",
|
||||
hex::changeEndianess(guid.data1, endian),
|
||||
hex::changeEndianess(guid.data2, endian),
|
||||
@@ -170,16 +170,19 @@ namespace hex::plugin::builtin {
|
||||
guid.data4[0], guid.data4[1], guid.data4[2], guid.data4[3],
|
||||
guid.data4[4], guid.data4[5], guid.data4[6], guid.data4[7]);
|
||||
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.rgba8", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
ImColor value(hex::changeEndianess(*reinterpret_cast<u32*>(buffer.data()), endian));
|
||||
|
||||
return [value] {
|
||||
auto stringValue = hex::format("(0x{:02X}, 0x{:02X}, 0x{:02X}, 0x{:02X})", u8(0xFF * (value.Value.x)), u8(0xFF * (value.Value.y)), u8(0xFF * (value.Value.z)), u8(0xFF * (value.Value.w)));
|
||||
|
||||
return [value, stringValue] {
|
||||
ImGui::ColorButton("##inspectorColor", value,
|
||||
ImGuiColorEditFlags_None,
|
||||
ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight()));
|
||||
return stringValue;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -38,6 +38,20 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, this->m_buffer);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["size"] = this->m_size;
|
||||
output["data"] = this->m_buffer;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_size = j["size"];
|
||||
this->m_buffer = j["data"].get<std::vector<u8>>();
|
||||
}
|
||||
|
||||
private:
|
||||
u32 m_size = 1;
|
||||
std::vector<u8> m_buffer;
|
||||
@@ -66,6 +80,18 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, output);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_value = j["data"];
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_value;
|
||||
};
|
||||
@@ -77,9 +103,8 @@ namespace hex::plugin::builtin {
|
||||
}) {}
|
||||
|
||||
void drawNode() override {
|
||||
ImGui::TextUnformatted("0x"); ImGui::SameLine(0, 0);
|
||||
ImGui::PushItemWidth(100);
|
||||
ImGui::InputScalar("##integerValue", ImGuiDataType_U64, &this->m_value, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
|
||||
ImGui::InputScalar("hex", ImGuiDataType_U64, &this->m_value, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
|
||||
ImGui::PopItemWidth();
|
||||
}
|
||||
|
||||
@@ -90,6 +115,18 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, data);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_value = j["data"];
|
||||
}
|
||||
|
||||
private:
|
||||
u64 m_value = 0;
|
||||
};
|
||||
@@ -114,6 +151,18 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, data);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_value = j["data"];
|
||||
}
|
||||
|
||||
private:
|
||||
float m_value = 0;
|
||||
};
|
||||
@@ -140,6 +189,22 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = nlohmann::json::object();
|
||||
output["data"]["r"] = this->m_color.Value.x;
|
||||
output["data"]["g"] = this->m_color.Value.y;
|
||||
output["data"]["b"] = this->m_color.Value.z;
|
||||
output["data"]["a"] = this->m_color.Value.w;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_color = ImVec4(j["data"]["r"], j["data"]["g"], j["data"]["b"], j["data"]["a"]);
|
||||
}
|
||||
|
||||
private:
|
||||
ImColor m_color;
|
||||
};
|
||||
@@ -158,6 +223,18 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["comment"] = this->m_comment;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_comment = j["comment"];
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_comment;
|
||||
};
|
||||
@@ -328,6 +405,19 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
};
|
||||
|
||||
class NodeDataSize : public dp::Node {
|
||||
public:
|
||||
NodeDataSize() : Node("hex.builtin.nodes.data_access.size.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.size.size")
|
||||
}) { }
|
||||
|
||||
void process() override {
|
||||
auto size = SharedData::currentProvider->getActualSize();
|
||||
|
||||
this->setIntegerOnOutput(0, size);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeCastIntegerToBuffer : public dp::Node {
|
||||
public:
|
||||
NodeCastIntegerToBuffer() : Node("hex.builtin.nodes.casting.int_to_buffer.header", {
|
||||
@@ -360,6 +450,160 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
};
|
||||
|
||||
class NodeArithmeticAdd : public dp::Node {
|
||||
public:
|
||||
NodeArithmeticAdd() : Node("hex.builtin.nodes.arithmetic.add.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.add.input.a"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.add.input.b"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.add.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto inputA = this->getIntegerOnInput(0);
|
||||
auto inputB = this->getIntegerOnInput(1);
|
||||
|
||||
auto output = inputA + inputB;
|
||||
|
||||
this->setIntegerOnOutput(2, output);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeArithmeticSubtract : public dp::Node {
|
||||
public:
|
||||
NodeArithmeticSubtract() : Node("hex.builtin.nodes.arithmetic.sub.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.sub.input.a"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.sub.input.b"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.sub.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto inputA = this->getIntegerOnInput(0);
|
||||
auto inputB = this->getIntegerOnInput(1);
|
||||
|
||||
auto output = inputA - inputB;
|
||||
|
||||
this->setIntegerOnOutput(2, output);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeArithmeticMultiply : public dp::Node {
|
||||
public:
|
||||
NodeArithmeticMultiply() : Node("hex.builtin.nodes.arithmetic.mul.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.mul.input.a"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.mul.input.b"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.mul.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto inputA = this->getIntegerOnInput(0);
|
||||
auto inputB = this->getIntegerOnInput(1);
|
||||
|
||||
auto output = inputA * inputB;
|
||||
|
||||
this->setIntegerOnOutput(2, output);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeArithmeticDivide : public dp::Node {
|
||||
public:
|
||||
NodeArithmeticDivide() : Node("hex.builtin.nodes.arithmetic.div.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.div.input.a"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.div.input.b"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.div.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto inputA = this->getIntegerOnInput(0);
|
||||
auto inputB = this->getIntegerOnInput(1);
|
||||
|
||||
if (inputB == 0)
|
||||
throwNodeError("Division by zero");
|
||||
|
||||
auto output = inputA / inputB;
|
||||
|
||||
this->setIntegerOnOutput(2, output);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeArithmeticModulus : public dp::Node {
|
||||
public:
|
||||
NodeArithmeticModulus() : Node("hex.builtin.nodes.arithmetic.mod.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.mod.input.a"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.mod.input.b"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.arithmetic.mod.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto inputA = this->getIntegerOnInput(0);
|
||||
auto inputB = this->getIntegerOnInput(1);
|
||||
|
||||
if (inputB == 0)
|
||||
throwNodeError("Division by zero");
|
||||
|
||||
auto output = inputA % inputB;
|
||||
|
||||
this->setIntegerOnOutput(2, output);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeBufferCombine : public dp::Node {
|
||||
public:
|
||||
NodeBufferCombine() : Node("hex.builtin.nodes.buffer.combine.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.buffer.combine.input.a"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.buffer.combine.input.b"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.buffer.combine.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto inputA = this->getBufferOnInput(0);
|
||||
auto inputB = this->getBufferOnInput(1);
|
||||
|
||||
auto &output = inputA;
|
||||
std::copy(inputB.begin(), inputB.end(), std::back_inserter(output));
|
||||
|
||||
this->setBufferOnOutput(2, output);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeBufferSlice : public dp::Node {
|
||||
public:
|
||||
NodeBufferSlice() : Node("hex.builtin.nodes.buffer.slice.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.buffer.slice.input.buffer"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.buffer.slice.input.from"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.buffer.slice.input.to"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.buffer.slice.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto input = this->getBufferOnInput(0);
|
||||
auto from = this->getIntegerOnInput(1);
|
||||
auto to = this->getIntegerOnInput(2);
|
||||
|
||||
if (from < 0 || from >= input.size())
|
||||
throwNodeError("'from' input out of range");
|
||||
if (to < 0 || from >= input.size())
|
||||
throwNodeError("'to' input out of range");
|
||||
if (to >= from)
|
||||
throwNodeError("'to' input needs to be greater than 'from' input");
|
||||
|
||||
this->setBufferOnOutput(3, std::vector(input.begin() + from, input.begin() + to));
|
||||
}
|
||||
};
|
||||
|
||||
class NodeBufferRepeat : public dp::Node {
|
||||
public:
|
||||
NodeBufferRepeat() : Node("hex.builtin.nodes.buffer.repeat.header", {
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.buffer.repeat.input.buffer"),
|
||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.buffer.repeat.input.count"),
|
||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.buffer.combine.output") }) {}
|
||||
|
||||
void process() override {
|
||||
auto buffer = this->getBufferOnInput(0);
|
||||
auto count = this->getIntegerOnInput(1);
|
||||
|
||||
std::vector<u8> output;
|
||||
output.resize(buffer.size() * count);
|
||||
|
||||
for (u32 i = 0; i < count; i++)
|
||||
std::copy(buffer.begin(), buffer.end(), output.begin() + buffer.size() * i);
|
||||
|
||||
this->setBufferOnOutput(2, output);
|
||||
}
|
||||
};
|
||||
|
||||
class NodeIf : public dp::Node {
|
||||
public:
|
||||
NodeIf() : Node("ex.builtin.nodes.control_flow.if.header",
|
||||
@@ -507,6 +751,22 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(4, output);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = nlohmann::json::object();
|
||||
output["data"]["mode"] = this->m_mode;
|
||||
output["data"]["key_length"] = this->m_keyLength;
|
||||
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_mode = j["data"]["mode"];
|
||||
this->m_keyLength = j["data"]["key_length"];
|
||||
}
|
||||
|
||||
private:
|
||||
int m_mode = 0;
|
||||
int m_keyLength = 0;
|
||||
@@ -579,10 +839,21 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeReadData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.read");
|
||||
ContentRegistry::DataProcessorNode::add<NodeWriteData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.write");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDataSize>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.size");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeCastIntegerToBuffer>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.int_to_buffer");
|
||||
ContentRegistry::DataProcessorNode::add<NodeCastBufferToInteger>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.buffer_to_int");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticAdd>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.add");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticSubtract>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.sub");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticMultiply>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.mul");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticDivide>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.div");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticModulus>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.mod");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferCombine>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.combine");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferSlice>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.slice");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferRepeat>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.repeat");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeIf>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.if");
|
||||
ContentRegistry::DataProcessorNode::add<NodeEquals>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.equals");
|
||||
ContentRegistry::DataProcessorNode::add<NodeNot>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.not");
|
||||
|
||||
31
plugins/builtin/source/content/footer_items.cpp
Normal file
31
plugins/builtin/source/content/footer_items.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <hex/plugin.hpp>
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#endif
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void addFooterItems() {
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
ContentRegistry::Interface::addFooterItem([] {
|
||||
static MEMORYSTATUSEX memInfo;
|
||||
static PROCESS_MEMORY_COUNTERS_EX pmc;
|
||||
|
||||
if (ImGui::GetFrameCount() % 60 == 0) {
|
||||
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
|
||||
GlobalMemoryStatusEx(&memInfo);
|
||||
GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&pmc), sizeof(pmc));
|
||||
}
|
||||
|
||||
auto totalMem = memInfo.ullTotalPhys;
|
||||
auto usedMem = pmc.PrivateUsage;
|
||||
|
||||
ImGui::TextUnformatted(hex::format("{0} / {1}", hex::toByteString(usedMem), hex::toByteString(totalMem)).c_str());
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace hex::plugin::builtin {
|
||||
auto message = AS_TYPE(ASTNodeStringLiteral, params[1])->getString();
|
||||
|
||||
if (LITERAL_COMPARE(condition, condition == 0))
|
||||
ctx.getConsole().abortEvaluation(hex::format("assert failed \"%s\"", message.data()));
|
||||
ctx.getConsole().abortEvaluation(hex::format("assert failed \"{0}\"", message.data()));
|
||||
|
||||
return nullptr;
|
||||
});
|
||||
@@ -116,7 +116,7 @@ namespace hex::plugin::builtin {
|
||||
auto message = AS_TYPE(ASTNodeStringLiteral, params[1])->getString();
|
||||
|
||||
if (LITERAL_COMPARE(condition, condition == 0))
|
||||
ctx.getConsole().log(LogConsole::Level::Warning, hex::format("assert failed \"%s\"", message.data()));
|
||||
ctx.getConsole().log(LogConsole::Level::Warning, hex::format("assert failed \"{0}\"", message.data()));
|
||||
|
||||
return nullptr;
|
||||
});
|
||||
@@ -153,36 +153,6 @@ namespace hex::plugin::builtin {
|
||||
return nullptr;
|
||||
});
|
||||
|
||||
/* addressof(rValueString) */
|
||||
ContentRegistry::PatternLanguageFunctions::add("addressof", 1, [](auto &ctx, auto params) -> ASTNode* {
|
||||
auto name = AS_TYPE(ASTNodeStringLiteral, params[0])->getString();
|
||||
|
||||
std::vector<std::string> path = splitString(name, ".");
|
||||
auto pattern = ctx.patternFromName(path);
|
||||
|
||||
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(pattern->getOffset()) });
|
||||
});
|
||||
|
||||
/* sizeof(rValueString) */
|
||||
ContentRegistry::PatternLanguageFunctions::add("sizeof", 1, [](auto &ctx, auto params) -> ASTNode* {
|
||||
auto name = AS_TYPE(ASTNodeStringLiteral, params[0])->getString();
|
||||
|
||||
std::vector<std::string> path = splitString(name, ".");
|
||||
auto pattern = ctx.patternFromName(path);
|
||||
|
||||
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(pattern->getSize()) });
|
||||
});
|
||||
|
||||
/* nextAfter(rValueString) */
|
||||
ContentRegistry::PatternLanguageFunctions::add("nextAfter", 1, [](auto &ctx, auto params) -> ASTNode* {
|
||||
auto name = AS_TYPE(ASTNodeStringLiteral, params[0])->getString();
|
||||
|
||||
std::vector<std::string> path = splitString(name, ".");
|
||||
auto pattern = ctx.patternFromName(path);
|
||||
|
||||
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(pattern->getOffset() + pattern->getSize()) });
|
||||
});
|
||||
|
||||
/* alignTo(alignment, value) */
|
||||
ContentRegistry::PatternLanguageFunctions::add("alignTo", 2, [](auto &ctx, auto params) -> ASTNode* {
|
||||
auto alignment = AS_TYPE(ASTNodeIntegerLiteral, params[0])->getValue();
|
||||
@@ -195,6 +165,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(result) });
|
||||
});
|
||||
|
||||
/* dataSize() */
|
||||
ContentRegistry::PatternLanguageFunctions::add("dataSize", ContentRegistry::PatternLanguageFunctions::NoParameters, [](auto &ctx, auto params) -> ASTNode* {
|
||||
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(SharedData::currentProvider->getActualSize()) });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace hex::plugin::builtin {
|
||||
void registerSettings() {
|
||||
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.color", 0, [](auto name, nlohmann::json &setting) {
|
||||
static int selection = setting;
|
||||
static int selection = setting.is_number() ? static_cast<int>(setting) : 0;
|
||||
|
||||
const char* themes[] = {
|
||||
"hex.builtin.setting.interface.color.dark"_lang,
|
||||
@@ -61,6 +61,28 @@ namespace hex::plugin::builtin {
|
||||
return false;
|
||||
});
|
||||
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.fps", 60, [](auto name, nlohmann::json &setting) {
|
||||
static int fps = setting.is_number() ? static_cast<int>(setting) : 60;
|
||||
|
||||
if (ImGui::SliderInt(name.data(), &fps, 15, 60)) {
|
||||
setting = fps;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.highlight_alpha", 0x80, [](auto name, nlohmann::json &setting) {
|
||||
static int alpha = setting.is_number() ? static_cast<int>(setting) : 0x80;
|
||||
|
||||
if (ImGui::SliderInt(name.data(), &alpha, 0x00, 0xFF)) {
|
||||
setting = alpha;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -311,8 +311,8 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
auto base10String = std::to_string(number);
|
||||
auto base16String = hex::format("%X", number);
|
||||
auto base8String = hex::format("%o", number);
|
||||
auto base16String = hex::format("0x{0:X}", number);
|
||||
auto base8String = hex::format("{0:#o}", number);
|
||||
auto base2String = hex::toBinaryString(number);
|
||||
|
||||
std::strncpy(buffer[0], base10String.c_str(), sizeof(buffer[0]));
|
||||
|
||||
535
plugins/builtin/source/lang/de_DE.cpp
Normal file
535
plugins/builtin/source/lang/de_DE.cpp
Normal file
@@ -0,0 +1,535 @@
|
||||
#include <hex/plugin.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void registerLanguageDeDE() {
|
||||
ContentRegistry::Language::registerLanguage("German", "de-DE");
|
||||
|
||||
ContentRegistry::Language::addLocalizations("de-DE", {
|
||||
/* ImHex default functionality */
|
||||
{ "hex.menu.file", "Datei" },
|
||||
{ "hex.menu.edit", "Bearbeiten" },
|
||||
{ "hex.menu.view", "Ansicht" },
|
||||
{ "hex.menu.view.fps", "FPS anzeigen" },
|
||||
{ "hex.menu.view.demo", "ImGui Demo anzeigen" },
|
||||
{ "hex.menu.help", "Hilfe" },
|
||||
|
||||
{ "hex.welcome.header.main", "Wilkommen zu ImHex" },
|
||||
{ "hex.welcome.header.start", "Start" },
|
||||
{ "hex.welcome.start.open_file", "Datei Öffnen" },
|
||||
{ "hex.welcome.start.open_project", "Projekt Öffnen" },
|
||||
{ "hex.welcome.start.recent", "Kürzlich geöffnet" },
|
||||
{ "hex.welcome.header.help", "Hilfe" },
|
||||
{ "hex.welcome.help.repo", "GitHub Repository" },
|
||||
{ "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" },
|
||||
{ "hex.welcome.help.gethelp", "Hilfe erhalten" },
|
||||
{ "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" },
|
||||
{ "hex.welcome.header.plugins", "Geladene Plugins" },
|
||||
{ "hex.welcome.plugins.plugin", "Plugin" },
|
||||
{ "hex.welcome.plugins.author", "Autor" },
|
||||
{ "hex.welcome.plugins.desc", "Beschreibung" },
|
||||
{ "hex.welcome.header.customize", "Anpassen" },
|
||||
{ "hex.welcome.customize.settings.title", "Einstellungen" },
|
||||
{ "hex.welcome.customize.settings.desc", "Ändere ImHex' Einstellungen" },
|
||||
{ "hex.welcome.header.update", "Updates" },
|
||||
{ "hex.welcome.update.title", "Neues Update verfügbar!" },
|
||||
{ "hex.welcome.update.desc", "ImHex {0} wurde gerade released! Downloade die neue version hier" },
|
||||
{ "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
||||
{ "hex.welcome.header.learn", "Lernen" },
|
||||
{ "hex.welcome.learn.latest.title", "Neuster Release" },
|
||||
{ "hex.welcome.learn.latest.desc", "Lies den momentanen ImHex Changelog" },
|
||||
{ "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
||||
{ "hex.welcome.learn.pattern.title", "Pattern Language Dokumentation" },
|
||||
{ "hex.welcome.learn.pattern.desc", "Lern ImHex Patterns zu schreiben mit unserer umfangreichen Dokumentation" },
|
||||
{ "hex.welcome.learn.pattern.link", "https://github.com/WerWolv/ImHex/wiki/Pattern-Language-Guide" },
|
||||
{ "hex.welcome.learn.plugins.title", "Plugins API" },
|
||||
{ "hex.welcome.learn.plugins.desc", "Erweitere ImHex mit neuen Funktionen mit Plugins" },
|
||||
{ "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" },
|
||||
{ "hex.welcome.header.various", "Verschiedenes" },
|
||||
|
||||
{ "hex.common.little_endian", "Little Endian" },
|
||||
{ "hex.common.big_endian", "Big Endian" },
|
||||
{ "hex.common.decimal", "Dezimal" },
|
||||
{ "hex.common.hexadecimal", "Hexadezimal" },
|
||||
{ "hex.common.octal", "Oktal" },
|
||||
{ "hex.common.error", "Fehler" },
|
||||
{ "hex.common.fatal", "Fataler Fehler" },
|
||||
{ "hex.common.address", "Adresse" },
|
||||
{ "hex.common.size", "Länge" },
|
||||
{ "hex.common.region", "Region" },
|
||||
{ "hex.common.match_selection", "Arbeitsbereich synchronisieren" },
|
||||
{ "hex.common.yes", "Ja" },
|
||||
{ "hex.common.no", "Nein" },
|
||||
{ "hex.common.okay", "Okay" },
|
||||
{ "hex.common.load", "Laden" },
|
||||
{ "hex.common.cancel", "Abbrechen" },
|
||||
{ "hex.common.set", "Setzen" },
|
||||
|
||||
{ "hex.view.bookmarks.name", "Lesezeichen" },
|
||||
{ "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 hinzufügen" },
|
||||
{ "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.view.data_inspector.name", "Dateninspektor" },
|
||||
{ "hex.view.data_inspector.table.name", "Name" },
|
||||
{ "hex.view.data_inspector.table.value", "Wert" },
|
||||
|
||||
{ "hex.view.data_processor.name", "Datenprozessor" },
|
||||
{ "hex.view.data_processor.menu.remove_selection", "Auswahl entfernen" },
|
||||
{ "hex.view.data_processor.menu.remove_node", "Knoten entfernen" },
|
||||
{ "hex.view.data_processor.menu.remove_link", "Link entfernen" },
|
||||
|
||||
{ "hex.view.disassembler.name", "Disassembler" },
|
||||
{ "hex.view.disassembler.position", "Position" },
|
||||
{ "hex.view.disassembler.base", "Basisadresse" },
|
||||
{ "hex.view.disassembler.region", "Code Region" },
|
||||
{ "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.view.disassembler.mips.mips64", "MIPS64 Modus" },
|
||||
{ "hex.view.disassembler.mips.mips32R6", "MIPS32R6 Modus" },
|
||||
{ "hex.view.disassembler.mips.micro", "Micro Modus" },
|
||||
|
||||
{ "hex.view.disassembler.x86.16bit", "16-bit Modus" },
|
||||
{ "hex.view.disassembler.x86.32bit", "32-bit Modus" },
|
||||
{ "hex.view.disassembler.x86.64bit", "64-bit Modus" },
|
||||
|
||||
{ "hex.view.disassembler.ppc.32bit", "32-bit Modus" },
|
||||
{ "hex.view.disassembler.ppc.64bit", "64-bit Modus" },
|
||||
|
||||
{ "hex.view.disassembler.sparc.v9", "Sparc V9 Modus" },
|
||||
|
||||
{ "hex.view.disassembler.disassemble", "Disassemble" },
|
||||
{ "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.view.hashes.settings", "Einstellungen" },
|
||||
{ "hex.view.hashes.function", "Hash Funktion" },
|
||||
{ "hex.view.hashes.iv", "Startwert" },
|
||||
{ "hex.view.hashes.poly", "Polynomial" },
|
||||
{ "hex.view.hashes.result", "Resultat" },
|
||||
|
||||
{ "hex.view.help.name", "Hilfe" },
|
||||
{ "hex.view.help.about.name", "Über ImHex" },
|
||||
{ "hex.view.help.about.translator", "Von WerWolv übersetzt" },
|
||||
{ "hex.view.help.about.source", "Quellcode auf GitHub verfügbar:" },
|
||||
{ "hex.view.help.about.donations", "Spenden" },
|
||||
{ "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.view.help.about.libs", "Benutzte Libraries" },
|
||||
{ "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.view.hexeditor.save_changes", "Änderungen sichern" },
|
||||
{ "hex.view.hexeditor.open_file", "Datei öffnen" },
|
||||
{ "hex.view.hexeditor.open_project", "Projekt öffnen" },
|
||||
{ "hex.view.hexeditor.save_project", "Projekt speichern" },
|
||||
{ "hex.view.hexeditor.save_data", "Daten speichern" },
|
||||
{ "hex.view.hexeditor.open_base64", "Base64 Datei öffnen" },
|
||||
{ "hex.view.hexeditor.load_enconding_file", "Custom encoding Datei laden" },
|
||||
{ "hex.view.hexeditor.page", "Seite {0} / {1}" },
|
||||
{ "hex.view.hexeditor.save_as", "Speichern unter" },
|
||||
{ "hex.view.hexeditor.save_changes.title", "Änderung sichern" },
|
||||
{ "hex.view.hexeditor.save_changes.desc", "Es wurden ungespeicherte Änderungen an diesem Projekt vorgenommen\nBist du sicher, dass du ImHex schliessen willst?" },
|
||||
{ "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.view.hexeditor.menu.file.open_recent", "Kürzlich geöffnete Dateien"},
|
||||
{ "hex.view.hexeditor.menu.file.save", "Speichern" },
|
||||
{ "hex.view.hexeditor.menu.file.save_as", "Speichern unter..." },
|
||||
{ "hex.view.hexeditor.menu.file.close", "Schliessen" },
|
||||
{ "hex.view.hexeditor.menu.file.open_project", "Projekt öffnen..." },
|
||||
{ "hex.view.hexeditor.menu.file.save_project", "Projekt speichern..." },
|
||||
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Custom encoding laden..." },
|
||||
{ "hex.view.hexeditor.menu.file.import", "Importieren..." },
|
||||
{ "hex.view.hexeditor.menu.file.import.base64", "Base64 Datei" },
|
||||
{ "hex.view.hexeditor.base64.import_error", "Datei ist nicht in einem korrekten Base64 Format!" },
|
||||
{ "hex.view.hexeditor.file_open_error", "Öffnen der Datei fehlgeschlagen!" },
|
||||
{ "hex.view.hexeditor.menu.file.import.ips", "IPS Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.import.script", "Datei mit Loader Script" },
|
||||
|
||||
{ "hex.view.hexeditor.menu.file.export", "Exportieren..." },
|
||||
{ "hex.view.hexeditor.menu.file.export.title", "Datei exportieren" },
|
||||
{ "hex.view.hexeditor.menu.file.export.ips", "IPS Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.search", "Suchen" },
|
||||
{ "hex.view.hexeditor.search.string", "String" },
|
||||
{ "hex.view.hexeditor.search.hex", "Hex" },
|
||||
{ "hex.view.hexeditor.search.find", "Suchen" },
|
||||
{ "hex.view.hexeditor.search.find_next", "Nächstes" },
|
||||
{ "hex.view.hexeditor.search.find_prev", "Vorheriges" },
|
||||
{ "hex.view.hexeditor.menu.file.goto", "Sprung" },
|
||||
{ "hex.view.hexeditor.goto.offset.absolute", "Absolut" },
|
||||
{ "hex.view.hexeditor.goto.offset.current", "Momentan" },
|
||||
{ "hex.view.hexeditor.goto.offset.begin", "Beginn" },
|
||||
{ "hex.view.hexeditor.goto.offset.end", "Ende" },
|
||||
{ "hex.view.hexeditor.error.read_only", "Schreibzugriff konnte nicht erlangt werden. Datei wurde im Lesemodus geöffnet." },
|
||||
{ "hex.view.hexeditor.error.open", "Öffnen der 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.bookmark", "Lesezeichen erstellen" },
|
||||
{ "hex.view.hexeditor.menu.edit.set_base", "Basisadresse setzen" },
|
||||
|
||||
{ "hex.view.information.name", "Dateninformationen" },
|
||||
{ "hex.view.information.control", "Einstellungen" },
|
||||
{ "hex.view.information.analyze", "Seite analysieren" },
|
||||
{ "hex.view.information.analyzing", "Analysieren..." },
|
||||
{ "hex.view.information.region", "Analysierte Region" },
|
||||
{ "hex.view.information.magic", "Magic Informationen" },
|
||||
{ "hex.view.information.description", "Beschreibung:" },
|
||||
{ "hex.view.information.mime", "MIME Typ:" },
|
||||
{ "hex.view.information.info_analysis", "Informationsanalysis" },
|
||||
{ "hex.view.information.distribution", "Byte Verteilung" },
|
||||
{ "hex.view.information.entropy", "Entropie" },
|
||||
{ "hex.view.information.block_size", "Blockgrösse" },
|
||||
{ "hex.view.information.block_size.desc", "{0} Blöcke min {1} bytes" },
|
||||
{ "hex.view.information.file_entropy", "Dateientropie" },
|
||||
{ "hex.view.information.highest_entropy", "Höchste Blockentropie" },
|
||||
{ "hex.view.information.encrypted", "Diese Daten sind vermutlich verschlüsselt oder komprimiert!" },
|
||||
|
||||
{ "hex.view.patches.name", "Patches" },
|
||||
{ "hex.view.patches.offset", "Offset" },
|
||||
{ "hex.view.patches.orig", "Originalwert" },
|
||||
{ "hex.view.patches.patch", "Patchwert"},
|
||||
{ "hex.view.patches.remove", "Patch entfernen" },
|
||||
|
||||
{ "hex.view.pattern.name", "Pattern Editor" },
|
||||
{ "hex.view.pattern.accept_pattern", "Pattern akzeptieren" },
|
||||
{ "hex.view.pattern.accept_pattern.desc", "Ein oder mehrere kompatible Pattern wurden für diesen Dateityp gefunden" },
|
||||
{ "hex.view.pattern.accept_pattern.patterns", "Pattern" },
|
||||
{ "hex.view.pattern.accept_pattern.question", "Ausgewähltes Pattern anwenden?" },
|
||||
{ "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.view.pattern_data.name", "Name" },
|
||||
{ "hex.view.pattern_data.color", "Farbe" },
|
||||
{ "hex.view.pattern_data.offset", "Offset" },
|
||||
{ "hex.view.pattern_data.size", "Grösse" },
|
||||
{ "hex.view.pattern_data.type", "Typ" },
|
||||
{ "hex.view.pattern_data.value", "Wert" },
|
||||
|
||||
{ "hex.view.settings.name", "Einstellungen" },
|
||||
|
||||
{ "hex.view.strings.name", "Strings" },
|
||||
{ "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.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.view.yara.name", "Yara Regeln" },
|
||||
{ "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.whole_data", "Gesammte Daten Übereinstimmung!" },
|
||||
{ "hex.view.yara.no_rules", "Keine Yara Regeln gefunden. Platziere sie in ImHex' 'yara' Ordner" },
|
||||
|
||||
/* Builtin plugin features */
|
||||
|
||||
{ "hex.builtin.command.calc.desc", "Rechner" },
|
||||
{ "hex.builtin.command.web.desc", "Webseite nachschlagen" },
|
||||
{ "hex.builtin.command.web.result", "'{0}' nachschlagen"},
|
||||
|
||||
{ "hex.builtin.inspector.binary", "Binär (8 bit)" },
|
||||
{ "hex.builtin.inspector.u8", "uint8_t" },
|
||||
{ "hex.builtin.inspector.s8", "int8_t" },
|
||||
{ "hex.builtin.inspector.u16", "uint16_t" },
|
||||
{ "hex.builtin.inspector.s16", "int16_t" },
|
||||
{ "hex.builtin.inspector.u32", "uint32_t" },
|
||||
{ "hex.builtin.inspector.s32", "int32_t" },
|
||||
{ "hex.builtin.inspector.u64", "uint64_t" },
|
||||
{ "hex.builtin.inspector.s64", "int64_t" },
|
||||
{ "hex.builtin.inspector.float", "float (32 bit)" },
|
||||
{ "hex.builtin.inspector.double", "double (64 bit)" },
|
||||
{ "hex.builtin.inspector.ascii", "ASCII Zeichen" },
|
||||
{ "hex.builtin.inspector.wide", "Wide Zeichen" },
|
||||
{ "hex.builtin.inspector.utf8", "UTF-8 code point" },
|
||||
{ "hex.builtin.inspector.time32", "__time32_t" },
|
||||
{ "hex.builtin.inspector.time64", "__time64_t" },
|
||||
{ "hex.builtin.inspector.time", "time_t" },
|
||||
{ "hex.builtin.inspector.guid", "GUID" },
|
||||
{ "hex.builtin.inspector.rgba8", "RGBA8 Farbe" },
|
||||
|
||||
{ "hex.builtin.nodes.constants", "Konstanten" },
|
||||
{ "hex.builtin.nodes.constants.int", "Integral" },
|
||||
{ "hex.builtin.nodes.constants.int.header", "Integral" },
|
||||
{ "hex.builtin.nodes.constants.int.output", "" },
|
||||
{ "hex.builtin.nodes.constants.float", "Kommazahl" },
|
||||
{ "hex.builtin.nodes.constants.float.header", "Kommazahl" },
|
||||
{ "hex.builtin.nodes.constants.float.output", "" },
|
||||
{ "hex.builtin.nodes.constants.nullptr", "Nullptr" },
|
||||
{ "hex.builtin.nodes.constants.nullptr.header", "Nullptr" },
|
||||
{ "hex.builtin.nodes.constants.nullptr.output", "" },
|
||||
{ "hex.builtin.nodes.constants.buffer", "Buffer" },
|
||||
{ "hex.builtin.nodes.constants.buffer.header", "Buffer" },
|
||||
{ "hex.builtin.nodes.constants.buffer.size", "Size" },
|
||||
{ "hex.builtin.nodes.constants.buffer.output", "" },
|
||||
{ "hex.builtin.nodes.constants.string", "String" },
|
||||
{ "hex.builtin.nodes.constants.string.header", "String" },
|
||||
{ "hex.builtin.nodes.constants.string.output", "" },
|
||||
{ "hex.builtin.nodes.constants.rgba8", "RGBA8 Farbe" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.header", "RGBA8 Farbe" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.r", "Rot" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.g", "Grün" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.b", "Blau" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.a", "Alpha" },
|
||||
{ "hex.builtin.nodes.constants.comment", "Kommentar" },
|
||||
{ "hex.builtin.nodes.constants.comment.header", "Kommentar" },
|
||||
|
||||
{ "hex.builtin.nodes.display", "Anzeigen" },
|
||||
{ "hex.builtin.nodes.display.int", "Integral" },
|
||||
{ "hex.builtin.nodes.display.int.header", "Integral Anzeige" },
|
||||
{ "hex.builtin.nodes.display.int.input", "Wert" },
|
||||
{ "hex.builtin.nodes.display.float", "Kommazahl" },
|
||||
{ "hex.builtin.nodes.display.float.header", "Kommazahl Anzeige" },
|
||||
{ "hex.builtin.nodes.display.float.input", "Wert" },
|
||||
|
||||
{ "hex.builtin.nodes.data_access", "Datenzugriff" },
|
||||
{ "hex.builtin.nodes.data_access.read", "Lesen" },
|
||||
{ "hex.builtin.nodes.data_access.read.header", "Lesen" },
|
||||
{ "hex.builtin.nodes.data_access.read.address", "Adresse" },
|
||||
{ "hex.builtin.nodes.data_access.read.size", "Grösse" },
|
||||
{ "hex.builtin.nodes.data_access.read.data", "Daten" },
|
||||
{ "hex.builtin.nodes.data_access.write", "Schreiben" },
|
||||
{ "hex.builtin.nodes.data_access.write.header", "Schreiben" },
|
||||
{ "hex.builtin.nodes.data_access.write.address", "Adresse" },
|
||||
{ "hex.builtin.nodes.data_access.write.data", "Daten" },
|
||||
{ "hex.builtin.nodes.data_access.size", "Datengrösse"},
|
||||
{ "hex.builtin.nodes.data_access.size.header", "Datengrösse"},
|
||||
{ "hex.builtin.nodes.data_access.size.size", "Grösse"},
|
||||
|
||||
{ "hex.builtin.nodes.casting", "Datenumwandlung" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer", "Integral zu Buffer" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer.header", "Integral zu Buffer" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer.input", "In" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer.output", "Out" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int", "Buffer zu Integral" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.header", "Buffer zu Integral" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.input", "In" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.output", "Out" },
|
||||
|
||||
{ "hex.builtin.nodes.arithmetic", "Arithmetisch" },
|
||||
{ "hex.builtin.nodes.arithmetic.add", "Addition" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.header", "Plus" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub", "Subtraktion" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.header", "Minus" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul", "Multiplikation" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.header", "Mal" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.div", "Division" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.header", "Durch" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod", "Modulus" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.header", "Modulo" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.buffer", "Buffer" },
|
||||
{ "hex.builtin.nodes.buffer.combine", "Kombinieren" },
|
||||
{ "hex.builtin.nodes.buffer.combine.header", "Buffer kombinieren" },
|
||||
{ "hex.builtin.nodes.buffer.combine.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.buffer.combine.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.buffer.combine.output", "Output" },
|
||||
{ "hex.builtin.nodes.buffer.slice", "Zerschneiden" },
|
||||
{ "hex.builtin.nodes.buffer.slice.header", "Buffer zerschneiden" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.buffer", "Input" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.from", "Von" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.to", "Bis" },
|
||||
{ "hex.builtin.nodes.buffer.slice.output", "Output" },
|
||||
{ "hex.builtin.nodes.buffer.repeat", "Wiederholen" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.header", "Buffer wiederholen" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "Anzahl" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.control_flow", "Kontrollfluss" },
|
||||
{ "hex.builtin.nodes.control_flow.if", "If" },
|
||||
{ "hex.builtin.nodes.control_flow.if.header", "If" },
|
||||
{ "hex.builtin.nodes.control_flow.if.condition", "Bedingung" },
|
||||
{ "hex.builtin.nodes.control_flow.if.true", "Wahr" },
|
||||
{ "hex.builtin.nodes.control_flow.if.false", "Falsch" },
|
||||
{ "hex.builtin.nodes.control_flow.if.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.equals", "Gleich" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.header", "Gleich" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.not", "Nicht" },
|
||||
{ "hex.builtin.nodes.control_flow.not.header", "Nicht" },
|
||||
{ "hex.builtin.nodes.control_flow.not.input", "Input" },
|
||||
{ "hex.builtin.nodes.control_flow.not.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.gt", "Grösser als" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.header", "Grösser als" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.lt", "Kleiner als" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.header", "Kleiner als" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.and", "UND" },
|
||||
{ "hex.builtin.nodes.control_flow.and.header", "Bool'sches UND" },
|
||||
{ "hex.builtin.nodes.control_flow.and.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.and.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.and.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.or", "ODER" },
|
||||
{ "hex.builtin.nodes.control_flow.or.header", "Bool'sches ODER" },
|
||||
{ "hex.builtin.nodes.control_flow.or.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.or.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.or.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.bitwise", "Bitweise Operationen" },
|
||||
{ "hex.builtin.nodes.bitwise.and", "UND" },
|
||||
{ "hex.builtin.nodes.bitwise.and.header", "Bitweise UND" },
|
||||
{ "hex.builtin.nodes.bitwise.and.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.bitwise.and.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.bitwise.and.output", "Output" },
|
||||
{ "hex.builtin.nodes.bitwise.or", "ODER" },
|
||||
{ "hex.builtin.nodes.bitwise.or.header", "Bitweise ODER" },
|
||||
{ "hex.builtin.nodes.bitwise.or.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.bitwise.or.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.bitwise.or.output", "Output" },
|
||||
{ "hex.builtin.nodes.bitwise.xor", "Exklusiv ODER" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.header", "Bitweise Exklusiv ODER" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.output", "Output" },
|
||||
{ "hex.builtin.nodes.bitwise.not", "Nicht" },
|
||||
{ "hex.builtin.nodes.bitwise.not.header", "Bitweise Nicht" },
|
||||
{ "hex.builtin.nodes.bitwise.not.input", "Input" },
|
||||
{ "hex.builtin.nodes.bitwise.not.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.decoding", "Dekodieren" },
|
||||
{ "hex.builtin.nodes.decoding.base64", "Base64" },
|
||||
{ "hex.builtin.nodes.decoding.base64.header", "Base64 Dekodierer" },
|
||||
{ "hex.builtin.nodes.decoding.base64.input", "In" },
|
||||
{ "hex.builtin.nodes.decoding.base64.output", "Out" },
|
||||
{ "hex.builtin.nodes.decoding.hex", "Hexadezimal" },
|
||||
{ "hex.builtin.nodes.decoding.hex.header", "Hexadezimal Dekodierer" },
|
||||
{ "hex.builtin.nodes.decoding.hex.input", "In" },
|
||||
{ "hex.builtin.nodes.decoding.hex.output", "Out" },
|
||||
|
||||
{ "hex.builtin.nodes.crypto", "Kryptographie" },
|
||||
{ "hex.builtin.nodes.crypto.aes", "AES Dekryptor" },
|
||||
{ "hex.builtin.nodes.crypto.aes.header", "AES Dekryptor" },
|
||||
{ "hex.builtin.nodes.crypto.aes.key", "Schlüssel" },
|
||||
{ "hex.builtin.nodes.crypto.aes.iv", "IV" },
|
||||
{ "hex.builtin.nodes.crypto.aes.nonce", "Nonce" },
|
||||
{ "hex.builtin.nodes.crypto.aes.input", "Input" },
|
||||
{ "hex.builtin.nodes.crypto.aes.output", "Output" },
|
||||
{ "hex.builtin.nodes.crypto.aes.mode", "Modus" },
|
||||
{ "hex.builtin.nodes.crypto.aes.key_length", "Schlüssellänge" },
|
||||
|
||||
|
||||
|
||||
{ "hex.builtin.tools.demangler", "Itanium/MSVC demangler" },
|
||||
{ "hex.builtin.tools.demangler.mangled", "Mangled Namen" },
|
||||
{ "hex.builtin.tools.demangler.demangled", "Demangled Namen" },
|
||||
{ "hex.builtin.tools.ascii_table", "ASCII Tabelle" },
|
||||
{ "hex.builtin.tools.ascii_table.octal", "Oktal anzeigen" },
|
||||
{ "hex.builtin.tools.regex_replacer", "Regex Ersetzer" },
|
||||
{ "hex.builtin.tools.regex_replacer.pattern", "Regex pattern" },
|
||||
{ "hex.builtin.tools.regex_replacer.replace", "Ersatz pattern" },
|
||||
{ "hex.builtin.tools.regex_replacer.input", "Input" },
|
||||
{ "hex.builtin.tools.regex_replacer.output", "Output" },
|
||||
{ "hex.builtin.tools.color", "Farbwähler" },
|
||||
{ "hex.builtin.tools.calc", "Rechner" },
|
||||
{ "hex.builtin.tools.input", "Input" },
|
||||
{ "hex.builtin.tools.format.standard", "Standard" },
|
||||
{ "hex.builtin.tools.format.scientific", "Wissenschaftlich" },
|
||||
{ "hex.builtin.tools.format.engineering", "Ingenieur" },
|
||||
{ "hex.builtin.tools.format.programmer", "Programmierer" },
|
||||
{ "hex.builtin.tools.error", "Letzter Fehler: '{0}'" },
|
||||
{ "hex.builtin.tools.history", "Geschichte" },
|
||||
{ "hex.builtin.tools.name", "Name" },
|
||||
{ "hex.builtin.tools.value", "Wert" },
|
||||
{ "hex.builtin.tools.base_converter", "Basiskonverter" },
|
||||
{ "hex.builtin.tools.base_converter.dec", "DEC" },
|
||||
{ "hex.builtin.tools.base_converter.hex", "HEX" },
|
||||
{ "hex.builtin.tools.base_converter.oct", "OCT" },
|
||||
{ "hex.builtin.tools.base_converter.bin", "BIN" },
|
||||
|
||||
{ "hex.builtin.setting.imhex", "ImHex" },
|
||||
{ "hex.builtin.setting.imhex.recent_files", "Kürzlich geöffnete Dateien" },
|
||||
{ "hex.builtin.setting.interface", "Aussehen" },
|
||||
{ "hex.builtin.setting.interface.color", "Farbthema" },
|
||||
{ "hex.builtin.setting.interface.color.dark", "Dunkel" },
|
||||
{ "hex.builtin.setting.interface.color.light", "Hell" },
|
||||
{ "hex.builtin.setting.interface.color.classic", "Klassisch" },
|
||||
{ "hex.builtin.setting.interface.language", "Sprache" },
|
||||
{ "hex.builtin.setting.interface.fps", "FPS Limite" },
|
||||
{ "hex.builtin.setting.interface.highlight_alpha", "Markierungssichtbarkeit" },
|
||||
|
||||
{ "hex.builtin.provider.file.path", "Dateipfad" },
|
||||
{ "hex.builtin.provider.file.size", "Größe" },
|
||||
{ "hex.builtin.provider.file.creation", "Erstellungszeit" },
|
||||
{ "hex.builtin.provider.file.access", "Letzte Zugriffszeit" },
|
||||
{ "hex.builtin.provider.file.modification", "Letzte Modifikationszeit" },
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,12 +24,20 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" },
|
||||
{ "hex.welcome.help.gethelp", "Get Help" },
|
||||
{ "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" },
|
||||
{ "hex.welcome.header.plugins", "Loaded Plugins" },
|
||||
{ "hex.welcome.plugins.plugin", "Plugin" },
|
||||
{ "hex.welcome.plugins.author", "Author" },
|
||||
{ "hex.welcome.plugins.desc", "Description" },
|
||||
{ "hex.welcome.header.customize", "Customize" },
|
||||
{ "hex.welcome.customize.settings.title", "Settings" },
|
||||
{ "hex.welcome.customize.settings.desc", "Change preferences of ImHex" },
|
||||
{ "hex.welcome.header.update", "Updates" },
|
||||
{ "hex.welcome.update.title", "New Update available!" },
|
||||
{ "hex.welcome.update.desc", "ImHex {0} just released! Download it here." },
|
||||
{ "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
||||
{ "hex.welcome.header.learn", "Learn" },
|
||||
{ "hex.welcome.learn.latest.title", "Latest Release" },
|
||||
{ "hex.welcome.learn.latest.desc", "Get the latest version of ImHex or read the current changelog" },
|
||||
{ "hex.welcome.learn.latest.desc", "Read ImHex' current changelog" },
|
||||
{ "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
||||
{ "hex.welcome.learn.pattern.title", "Pattern Language Documentation" },
|
||||
{ "hex.welcome.learn.pattern.desc", "Learn how to write ImHex patterns with our extensive documentation" },
|
||||
@@ -45,21 +53,23 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.common.hexadecimal", "Hexadecimal" },
|
||||
{ "hex.common.octal", "Octal" },
|
||||
{ "hex.common.error", "Error" },
|
||||
{ "hex.common.fatal", "Fatal Error" },
|
||||
{ "hex.common.address", "Address" },
|
||||
{ "hex.common.size", "Size" },
|
||||
{ "hex.common.region", "Region" },
|
||||
{ "hex.common.match_selection", "Match Selection" },
|
||||
{ "hex.common.yes", "Yes" },
|
||||
{ "hex.common.no", "No" },
|
||||
{ "hex.common.okay", "Okay" },
|
||||
{ "hex.common.load", "Load" },
|
||||
{ "hex.common.cancel", "Cancel" },
|
||||
{ "hex.common.set", "Set" },
|
||||
|
||||
{ "hex.view.bookmarks.name", "Bookmarks" },
|
||||
{ "hex.view.bookmarks.default_title", "Bookmark [0x%lX - 0x%lX]" },
|
||||
{ "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 -> Add Bookmark" },
|
||||
{ "hex.view.bookmarks.title.info", "Information" },
|
||||
{ "hex.view.bookmarks.address", "0x%08lx : 0x%08lx (%lu bytes)" },
|
||||
{ "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" },
|
||||
@@ -104,6 +114,7 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.view.disassembler.sparc.v9", "Sparc V9 mode" },
|
||||
|
||||
{ "hex.view.disassembler.disassemble", "Disassemble" },
|
||||
{ "hex.view.disassembler.disassembling", "Disassembling..." },
|
||||
{ "hex.view.disassembler.disassembly.title", "Disassembly" },
|
||||
{ "hex.view.disassembler.disassembly.address", "Address" },
|
||||
{ "hex.view.disassembler.disassembly.offset", "Offset" },
|
||||
@@ -116,15 +127,17 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.view.hashes.poly", "Polynomial" },
|
||||
{ "hex.view.hashes.result", "Result" },
|
||||
|
||||
{ "hex.view.help.title", "Help" },
|
||||
{ "hex.view.help.about.title", "About" },
|
||||
{ "hex.view.help.name", "Help" },
|
||||
{ "hex.view.help.about.name", "About" },
|
||||
{ "hex.view.help.about.translator", "Translated by WerWolv" },
|
||||
{ "hex.view.help.about.source", "Source code available on GitHub:" },
|
||||
{ "hex.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.view.help.about.libs", "Libraries used" },
|
||||
{ "hex.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
|
||||
{ "hex.view.help.calc_cheat_sheet", "Calculator Cheat Sheet" },
|
||||
|
||||
{ "hex.view.hexeditor.title", "Hex editor" },
|
||||
{ "hex.view.hexeditor.name", "Hex editor" },
|
||||
{ "hex.view.hexeditor.save_changes", "Save Changes" },
|
||||
{ "hex.view.hexeditor.open_file", "Open File" },
|
||||
{ "hex.view.hexeditor.open_project", "Open Project" },
|
||||
@@ -132,7 +145,7 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.view.hexeditor.save_data", "Save Data" },
|
||||
{ "hex.view.hexeditor.open_base64", "Open Base64 File" },
|
||||
{ "hex.view.hexeditor.load_enconding_file", "Load custom encoding File" },
|
||||
{ "hex.view.hexeditor.page", "Page %d / %d" },
|
||||
{ "hex.view.hexeditor.page", "Page {0} / {1}" },
|
||||
{ "hex.view.hexeditor.save_as", "Save As" },
|
||||
{ "hex.view.hexeditor.save_changes.title", "Save Changes" },
|
||||
{ "hex.view.hexeditor.save_changes.desc", "You have unsaved changes made to your Project.\nAre you sure you want to exit?" },
|
||||
@@ -144,8 +157,10 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.view.hexeditor.script.file.title", "Loader Script: Open File" },
|
||||
|
||||
{ "hex.view.hexeditor.menu.file.open_file", "Open File..." },
|
||||
{ "hex.view.hexeditor.menu.file.open_recent", "Open Recent"},
|
||||
{ "hex.view.hexeditor.menu.file.save", "Save" },
|
||||
{ "hex.view.hexeditor.menu.file.save_as", "Save As..." },
|
||||
{ "hex.view.hexeditor.menu.file.close", "Close" },
|
||||
{ "hex.view.hexeditor.menu.file.open_project", "Open Project..." },
|
||||
{ "hex.view.hexeditor.menu.file.save_project", "Save Project..." },
|
||||
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Load custom encoding..." },
|
||||
@@ -168,14 +183,17 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.view.hexeditor.search.find_next", "Find next" },
|
||||
{ "hex.view.hexeditor.search.find_prev", "Find previous" },
|
||||
{ "hex.view.hexeditor.menu.file.goto", "Goto" },
|
||||
{ "hex.view.hexeditor.goto.offset.absolute", "Absolute" },
|
||||
{ "hex.view.hexeditor.goto.offset.current", "Current" },
|
||||
{ "hex.view.hexeditor.goto.offset.begin", "Begin" },
|
||||
{ "hex.view.hexeditor.goto.offset.end", "End" },
|
||||
{ "hex.view.hexeditor.error.read_only", "Couldn't get write access. File opened in read-only mode." },
|
||||
{ "hex.view.hexeditor.error.open", "Filed to open file!" },
|
||||
{ "hex.view.hexeditor.menu.edit.copy", "Copy as..." },
|
||||
{ "hex.view.hexeditor.copy.bytes", "Bytes" },
|
||||
{ "hex.view.hexeditor.copy.hex", "Hex String" },
|
||||
{ "hex.view.hexeditor.error.open", "Failed to open file!" },
|
||||
{ "hex.view.hexeditor.menu.edit.undo", "Undo" },
|
||||
{ "hex.view.hexeditor.menu.edit.redo", "Redo" },
|
||||
{ "hex.view.hexeditor.menu.edit.copy", "Copy" },
|
||||
{ "hex.view.hexeditor.menu.edit.copy_as", "Copy as..." },
|
||||
{ "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" },
|
||||
@@ -185,37 +203,44 @@ namespace hex::plugin::builtin {
|
||||
{ "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", "Paste" },
|
||||
{ "hex.view.hexeditor.menu.edit.bookmark", "Create bookmark" },
|
||||
{ "hex.view.hexeditor.menu.edit.set_base", "Set base address" },
|
||||
|
||||
{ "hex.view.information.title", "Data Information" },
|
||||
{ "hex.view.information.analyze", "Analyze current page" },
|
||||
{ "hex.view.information.region", "analyzed region" },
|
||||
{ "hex.view.information.name", "Data Information" },
|
||||
{ "hex.view.information.control", "Control" },
|
||||
{ "hex.view.information.analyze", "Analyze page" },
|
||||
{ "hex.view.information.analyzing", "Analyzing..." },
|
||||
{ "hex.view.information.region", "Analyzed region" },
|
||||
{ "hex.view.information.magic", "Magic information" },
|
||||
{ "hex.view.information.description", "Description:" },
|
||||
{ "hex.view.information.mime", "MIME Type:" },
|
||||
{ "hex.view.information.info_analysis", "Information analysis" },
|
||||
{ "hex.view.information.distribution", "Byte distribution" },
|
||||
{ "hex.view.information.entropy", "Entropy" },
|
||||
{ "hex.view.information.block_size", "Block size" },
|
||||
{ "hex.view.information.block_size.desc", "2046 blocks of %lu bytes" },
|
||||
{ "hex.view.information.block_size.desc", "{0} blocks of {1} bytes" },
|
||||
{ "hex.view.information.file_entropy", "File entropy" },
|
||||
{ "hex.view.information.highest_entropy", "Highest entropy block" },
|
||||
{ "hex.view.information.encrypted", "This data is most likely encrypted or compressed!" },
|
||||
|
||||
{ "hex.view.patches.title", "Patches" },
|
||||
{ "hex.view.patches.name", "Patches" },
|
||||
{ "hex.view.patches.offset", "Offset" },
|
||||
{ "hex.view.patches.orig", "Original value" },
|
||||
{ "hex.view.patches.patch", "Patched value"},
|
||||
{ "hex.view.patches.remove", "Remove patch" },
|
||||
|
||||
{ "hex.view.pattern.title", "Pattern editor" },
|
||||
{ "hex.view.pattern.name", "Pattern editor" },
|
||||
{ "hex.view.pattern.accept_pattern", "Accept pattern" },
|
||||
{ "hex.view.pattern.accept_pattern.desc", "One or more patterns compatible with this data type has been found" },
|
||||
{ "hex.view.pattern.accept_pattern.patterns", "Patterns" },
|
||||
{ "hex.view.pattern.accept_pattern.question", "Do you want to apply the selected pattern?" },
|
||||
{ "hex.view.pattern.menu.file.load_pattern", "Load pattern..." },
|
||||
{ "hex.view.pattern.open_pattern", "Open pattern" },
|
||||
{ "hex.view.pattern.evaluating", "Evaluating..." },
|
||||
{ "hex.view.pattern.auto", "Auto evaluate" },
|
||||
|
||||
{ "hex.view.pattern_data.title", "Pattern Data" },
|
||||
{ "hex.view.pattern_data.name", "Pattern Data" },
|
||||
{ "hex.view.pattern_data.name", "Name" },
|
||||
{ "hex.view.pattern_data.color", "Color" },
|
||||
{ "hex.view.pattern_data.offset", "Offset" },
|
||||
@@ -223,27 +248,39 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.view.pattern_data.type", "Type" },
|
||||
{ "hex.view.pattern_data.value", "Value" },
|
||||
|
||||
{ "hex.view.settings.title", "Settings" },
|
||||
{ "hex.view.settings.name", "Settings" },
|
||||
|
||||
{ "hex.view.strings.title", "Strings" },
|
||||
{ "hex.view.strings.name", "Strings" },
|
||||
{ "hex.view.strings.copy", "Copy string" },
|
||||
{ "hex.view.strings.demangle", "Demangle" },
|
||||
{ "hex.view.strings.min_length", "Minimum length" },
|
||||
{ "hex.view.strings.filter", "Filter" },
|
||||
{ "hex.view.strings.extract", "Extract" },
|
||||
{ "hex.view.strings.searching", "Searching..." },
|
||||
{ "hex.view.strings.offset", "Offset" },
|
||||
{ "hex.view.strings.size", "Size" },
|
||||
{ "hex.view.strings.string", "String" },
|
||||
{ "hex.view.strings.demangle.title", "Demangled name" },
|
||||
{ "hex.view.strings.demangle.copy", "Copy" },
|
||||
|
||||
{ "hex.view.tools.title", "Tools" },
|
||||
{ "hex.view.tools.name", "Tools" },
|
||||
|
||||
{ "hex.view.yara.name", "Yara Rules" },
|
||||
{ "hex.view.yara.header.rules", "Rules" },
|
||||
{ "hex.view.yara.reload", "Reload" },
|
||||
{ "hex.view.yara.match", "Match Rules" },
|
||||
{ "hex.view.yara.matching", "Matching..." },
|
||||
{ "hex.view.yara.error", "Yara Compiler error: " },
|
||||
{ "hex.view.yara.header.matches", "Matches" },
|
||||
{ "hex.view.yara.matches.identifier", "Identifier" },
|
||||
{ "hex.view.yara.whole_data", "Whole file matches!" },
|
||||
{ "hex.view.yara.no_rules", "No YARA rules found. Put them in ImHex' 'yara' folder" },
|
||||
|
||||
/* Builtin plugin features */
|
||||
|
||||
{ "hex.builtin.command.calc.desc", "Calculator" },
|
||||
{ "hex.builtin.command.web.desc", "Website lookup" },
|
||||
{ "hex.builtin.command.web.result", "Navigate to '%s'"},
|
||||
{ "hex.builtin.command.web.result", "Navigate to '{0}'"},
|
||||
|
||||
{ "hex.builtin.inspector.binary", "Binary (8 bit)" },
|
||||
{ "hex.builtin.inspector.u8", "uint8_t" },
|
||||
@@ -305,10 +342,13 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.nodes.data_access.read.address", "Address" },
|
||||
{ "hex.builtin.nodes.data_access.read.size", "Size" },
|
||||
{ "hex.builtin.nodes.data_access.read.data", "Data" },
|
||||
{ "hex.builtin.nodes.data_access.write", "Write" },
|
||||
{ "hex.builtin.nodes.data_access.write", "Write" },
|
||||
{ "hex.builtin.nodes.data_access.write.header", "Write" },
|
||||
{ "hex.builtin.nodes.data_access.write.address", "Address" },
|
||||
{ "hex.builtin.nodes.data_access.write.data", "Data" },
|
||||
{ "hex.builtin.nodes.data_access.size", "Data Size"},
|
||||
{ "hex.builtin.nodes.data_access.size.header", "Data Size"},
|
||||
{ "hex.builtin.nodes.data_access.size.size", "Size"},
|
||||
|
||||
{ "hex.builtin.nodes.casting", "Data conversion" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer", "Integer to Buffer" },
|
||||
@@ -320,6 +360,51 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.input", "In" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.output", "Out" },
|
||||
|
||||
{ "hex.builtin.nodes.arithmetic", "Arithmetic" },
|
||||
{ "hex.builtin.nodes.arithmetic.add", "Addition" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.header", "Add" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub", "Subtraction" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.header", "Subtract" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul", "Multiplication" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.header", "Multiply" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.div", "Division" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.header", "Divide" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod", "Modulus" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.header", "Modulo" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.buffer", "Buffer" },
|
||||
{ "hex.builtin.nodes.buffer.combine", "Combine" },
|
||||
{ "hex.builtin.nodes.buffer.combine.header", "Combine buffers" },
|
||||
{ "hex.builtin.nodes.buffer.combine.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.buffer.combine.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.buffer.combine.output", "Output" },
|
||||
{ "hex.builtin.nodes.buffer.slice", "Slice" },
|
||||
{ "hex.builtin.nodes.buffer.slice.header", "Slice buffer" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.buffer", "Input" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.from", "From" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.to", "To" },
|
||||
{ "hex.builtin.nodes.buffer.slice.output", "Output" },
|
||||
{ "hex.builtin.nodes.buffer.repeat", "Repeat" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.header", "Repeat buffer" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "Count" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.control_flow", "Control flow" },
|
||||
{ "hex.builtin.nodes.control_flow.if", "If" },
|
||||
{ "hex.builtin.nodes.control_flow.if.header", "If" },
|
||||
@@ -418,7 +503,7 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.tools.format.scientific", "Scientific" },
|
||||
{ "hex.builtin.tools.format.engineering", "Engineering" },
|
||||
{ "hex.builtin.tools.format.programmer", "Programmer" },
|
||||
{ "hex.builtin.tools.error", "Last error: '%s'" },
|
||||
{ "hex.builtin.tools.error", "Last error: '{0}'" },
|
||||
{ "hex.builtin.tools.history", "History" },
|
||||
{ "hex.builtin.tools.name", "Name" },
|
||||
{ "hex.builtin.tools.value", "Value" },
|
||||
@@ -435,7 +520,15 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.setting.interface.color.dark", "Dark" },
|
||||
{ "hex.builtin.setting.interface.color.light", "Light" },
|
||||
{ "hex.builtin.setting.interface.color.classic", "Classic" },
|
||||
{ "hex.builtin.setting.interface.language", "Language" }
|
||||
{ "hex.builtin.setting.interface.language", "Language" },
|
||||
{ "hex.builtin.setting.interface.fps", "FPS Limit" },
|
||||
{ "hex.builtin.setting.interface.highlight_alpha", "Highlighting opacity" },
|
||||
|
||||
{ "hex.builtin.provider.file.path", "File path" },
|
||||
{ "hex.builtin.provider.file.size", "Size" },
|
||||
{ "hex.builtin.provider.file.creation", "Creation time" },
|
||||
{ "hex.builtin.provider.file.access", "Last access time" },
|
||||
{ "hex.builtin.provider.file.modification", "Last modification time" },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
535
plugins/builtin/source/lang/it_IT.cpp
Normal file
535
plugins/builtin/source/lang/it_IT.cpp
Normal file
@@ -0,0 +1,535 @@
|
||||
#include <hex/plugin.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void registerLanguageItIT() {
|
||||
ContentRegistry::Language::registerLanguage("Italian", "it-IT");
|
||||
|
||||
ContentRegistry::Language::addLocalizations("it-IT", {
|
||||
/* ImHex default functionality */
|
||||
{ "hex.menu.file", "File" },
|
||||
{ "hex.menu.edit", "Modifica" },
|
||||
{ "hex.menu.view", "Vista" },
|
||||
{ "hex.menu.view.fps", "Mostra FPS" },
|
||||
{ "hex.menu.view.demo", "Mostra la demo di ImGui" },
|
||||
{ "hex.menu.help", "Aiuto" },
|
||||
|
||||
{ "hex.welcome.header.main", "Benvenuto in ImHex" },
|
||||
{ "hex.welcome.header.start", "Inizia" },
|
||||
{ "hex.welcome.start.open_file", "Apri un File" },
|
||||
{ "hex.welcome.start.open_project", "Apri un Progetto" },
|
||||
{ "hex.welcome.start.recent", "File recenti" },
|
||||
{ "hex.welcome.header.help", "Aiuto" },
|
||||
{ "hex.welcome.help.repo", "Repo GitHub" },
|
||||
{ "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" },
|
||||
{ "hex.welcome.help.gethelp", "Chiedi aiuto" },
|
||||
{ "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" },
|
||||
{ "hex.welcome.header.plugins", "Plugins caricati" },
|
||||
{ "hex.welcome.plugins.plugin", "Plugin" },
|
||||
{ "hex.welcome.plugins.author", "Autore" },
|
||||
{ "hex.welcome.plugins.desc", "Descrizione" },
|
||||
{ "hex.welcome.header.customize", "Personalizza" },
|
||||
{ "hex.welcome.customize.settings.title", "Impostazioni" },
|
||||
{ "hex.welcome.customize.settings.desc", "Cambia le preferenze di ImHex" },
|
||||
{ "hex.welcome.header.update", "Aggiornamenti" },
|
||||
{ "hex.welcome.update.title", "Nuovo aggiornamento disponibile!" },
|
||||
{ "hex.welcome.update.desc", "ImHex {0} è appena stato rilasciato! Scaricalo qua" },
|
||||
{ "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
||||
{ "hex.welcome.header.learn", "Scopri" },
|
||||
{ "hex.welcome.learn.latest.title", "Ultima Versione" },
|
||||
{ "hex.welcome.learn.latest.desc", "Leggi il nuovo changelog di ImHex'" },
|
||||
{ "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
||||
{ "hex.welcome.learn.pattern.title", "Documentazione dei Pattern" },
|
||||
{ "hex.welcome.learn.pattern.desc", "Scopri come scrivere pattern per ImHex con la nostra dettagliata documentazione" },
|
||||
{ "hex.welcome.learn.pattern.link", "https://github.com/WerWolv/ImHex/wiki/Pattern-Language-Guide" },
|
||||
{ "hex.welcome.learn.plugins.title", "Plugins API" },
|
||||
{ "hex.welcome.learn.plugins.desc", "Espandi l'utilizzo di ImHex con i Plugin" },
|
||||
{ "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" },
|
||||
{ "hex.welcome.header.various", "Varie" },
|
||||
|
||||
{ "hex.common.little_endian", "Little Endian" },
|
||||
{ "hex.common.big_endian", "Big Endian" },
|
||||
{ "hex.common.decimal", "Decimale" },
|
||||
{ "hex.common.hexadecimal", "Esadecimale" },
|
||||
{ "hex.common.octal", "Ottale" },
|
||||
{ "hex.common.error", "Errore" },
|
||||
{ "hex.common.fatal", "Errore Fatale" },
|
||||
{ "hex.common.address", "Indirizzo" },
|
||||
{ "hex.common.size", "Dimensione" },
|
||||
{ "hex.common.region", "Regione" },
|
||||
{ "hex.common.match_selection", "Seleziona abbinamento" },
|
||||
{ "hex.common.yes", "Sì" },
|
||||
{ "hex.common.no", "No" },
|
||||
{ "hex.common.okay", "Okay" },
|
||||
{ "hex.common.load", "Carica" },
|
||||
{ "hex.common.cancel", "Cancella" },
|
||||
{ "hex.common.set", "Imposta" },
|
||||
|
||||
{ "hex.view.bookmarks.name", "Segnalibri" },
|
||||
{ "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 -> Aggiungi 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.view.data_inspector.name", "Ispezione Dati" },
|
||||
{ "hex.view.data_inspector.table.name", "Nome" },
|
||||
{ "hex.view.data_inspector.table.value", "Valore" },
|
||||
|
||||
{ "hex.view.data_processor.name", "Processa Dati" },
|
||||
{ "hex.view.data_processor.menu.remove_selection", "Rimuovi i selezionati" },
|
||||
{ "hex.view.data_processor.menu.remove_node", "Rimuovi Nodo" },
|
||||
{ "hex.view.data_processor.menu.remove_link", "Rimuovi Link" },
|
||||
|
||||
{ "hex.view.disassembler.name", "Disassembla" },
|
||||
{ "hex.view.disassembler.position", "Posiziona" },
|
||||
{ "hex.view.disassembler.base", "Indirizzo di base" },
|
||||
{ "hex.view.disassembler.region", "Regione del Codice" },
|
||||
{ "hex.view.disassembler.settings.header", "Impostazioni" },
|
||||
{ "hex.view.disassembler.arch", "Architettura" },
|
||||
{ "hex.view.disassembler.arm.arm", "Modalità ARM" },
|
||||
{ "hex.view.disassembler.arm.thumb", "Modalità Thumb" },
|
||||
{ "hex.view.disassembler.arm.default", "Modalità di Default" },
|
||||
{ "hex.view.disassembler.arm.cortex_m", "Modalità Cortex-M" },
|
||||
{ "hex.view.disassembler.arm.armv8", "Modalità ARMv8" },
|
||||
|
||||
{ "hex.view.disassembler.mips.mips32", "Modalità MIPS32" },
|
||||
{ "hex.view.disassembler.mips.mips64", "Modalità MIPS64" },
|
||||
{ "hex.view.disassembler.mips.mips32R6", "Modalità MIPS32R6" },
|
||||
{ "hex.view.disassembler.mips.micro", "Modalità Micro" },
|
||||
|
||||
{ "hex.view.disassembler.x86.16bit", "Modalità 16-bit" },
|
||||
{ "hex.view.disassembler.x86.32bit", "Modalità 32-bit" },
|
||||
{ "hex.view.disassembler.x86.64bit", "Modalità 64-bit" },
|
||||
|
||||
{ "hex.view.disassembler.ppc.32bit", "Modalità 32-bit" },
|
||||
{ "hex.view.disassembler.ppc.64bit", "Modalità 64-bit" },
|
||||
|
||||
{ "hex.view.disassembler.sparc.v9", "Modalità Sparc V9" },
|
||||
|
||||
{ "hex.view.disassembler.disassemble", "Disassembla" },
|
||||
{ "hex.view.disassembler.disassembling", "Disassemblaggio..." },
|
||||
{ "hex.view.disassembler.disassembly.title", "Disassembla" },
|
||||
{ "hex.view.disassembler.disassembly.address", "Indirizzo" },
|
||||
{ "hex.view.disassembler.disassembly.offset", "Offset" },
|
||||
{ "hex.view.disassembler.disassembly.bytes", "Byte" },
|
||||
|
||||
{ "hex.view.hashes.name", "Hash" },
|
||||
{ "hex.view.hashes.settings", "Impostazioni" },
|
||||
{ "hex.view.hashes.function", "Funzioni di Hash" },
|
||||
{ "hex.view.hashes.iv", "Valore Iniziale" },
|
||||
{ "hex.view.hashes.poly", "Polinomio" },
|
||||
{ "hex.view.hashes.result", "Risultato" },
|
||||
|
||||
{ "hex.view.help.name", "Aiuto" },
|
||||
{ "hex.view.help.about.name", "Riguardo ImHex" },
|
||||
{ "hex.view.help.about.translator", "Tradotto da CrustySeanPro" },
|
||||
{ "hex.view.help.about.source", "Codice Sorgente disponibile su GitHub:" },
|
||||
{ "hex.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.view.help.about.libs", "Librerie usate" },
|
||||
{ "hex.view.help.pattern_cheat_sheet", "Pattern Language Cheat Sheet"},
|
||||
{ "hex.view.help.calc_cheat_sheet", "Calcolatrice Cheat Sheet" },
|
||||
|
||||
{ "hex.view.hexeditor.name", "Hex editor" },
|
||||
{ "hex.view.hexeditor.save_changes", "Salva le modifiche" },
|
||||
{ "hex.view.hexeditor.open_file", "Apri File" },
|
||||
{ "hex.view.hexeditor.menu.file.open_recent", "File recenti" },
|
||||
{ "hex.view.hexeditor.open_project", "Apri i Progetti" },
|
||||
{ "hex.view.hexeditor.save_project", "Salva i Progetti" },
|
||||
{ "hex.view.hexeditor.save_data", "Salva i Dati" },
|
||||
{ "hex.view.hexeditor.open_base64", "Apri Base64 File" },
|
||||
{ "hex.view.hexeditor.load_enconding_file", "Carica un File di codfica personalizzato" },
|
||||
{ "hex.view.hexeditor.page", "Pagina {0} / {1}" },
|
||||
{ "hex.view.hexeditor.save_as", "Salva come" },
|
||||
{ "hex.view.hexeditor.save_changes.title", "Salva le modifiche" },
|
||||
{ "hex.view.hexeditor.save_changes.desc", "Hai delle modifiche non salvate nel tuo progetto.\nSei sicuro di voler uscire?" },
|
||||
{ "hex.view.hexeditor.script.title", "Carica un File tramite il Caricatore di Script" },
|
||||
{ "hex.view.hexeditor.script.desc", "Carica un file tramite il Caricatore di Script di Python." },
|
||||
{ "hex.view.hexeditor.script.script", "Script" },
|
||||
{ "hex.view.hexeditor.script.script.title", "Caricatore Script: Apri Script" },
|
||||
{ "hex.view.hexeditor.script.file", "File" },
|
||||
{ "hex.view.hexeditor.script.file.title", "Caricatore Script: Apri File" },
|
||||
|
||||
{ "hex.view.hexeditor.menu.file.open_file", "Apri File..." },
|
||||
{ "hex.view.hexeditor.menu.file.save", "Salva" },
|
||||
{ "hex.view.hexeditor.menu.file.save_as", "Salva come..." },
|
||||
{ "hex.view.hexeditor.menu.file.close", "Chiudi" },
|
||||
{ "hex.view.hexeditor.menu.file.open_project", "Apri un Progetto..." },
|
||||
{ "hex.view.hexeditor.menu.file.save_project", "Salva Progetto..." },
|
||||
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Carica una codifica personalizzata..." },
|
||||
{ "hex.view.hexeditor.menu.file.import", "Importa..." },
|
||||
{ "hex.view.hexeditor.menu.file.import.base64", "Base64 File" },
|
||||
{ "hex.view.hexeditor.base64.import_error", "Il file non è in un formato bas64 corretto!" },
|
||||
{ "hex.view.hexeditor.file_open_error", "Impossibile aprire il File!" },
|
||||
{ "hex.view.hexeditor.menu.file.import.ips", "IPS Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.import.ips32", "IPS32 Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.import.script", "File con il Caricatore di Script" },
|
||||
|
||||
{ "hex.view.hexeditor.menu.file.export", "Esporta..." },
|
||||
{ "hex.view.hexeditor.menu.file.export.title", "Esporta File" },
|
||||
{ "hex.view.hexeditor.menu.file.export.ips", "IPS Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.export.ips32", "IPS32 Patch" },
|
||||
{ "hex.view.hexeditor.menu.file.search", "Cerca" },
|
||||
{ "hex.view.hexeditor.search.string", "Stringa" },
|
||||
{ "hex.view.hexeditor.search.hex", "Hex" },
|
||||
{ "hex.view.hexeditor.search.find", "Cerca" },
|
||||
{ "hex.view.hexeditor.search.find_next", "Cerca il prossimo" },
|
||||
{ "hex.view.hexeditor.search.find_prev", "Cerca il precedente" },
|
||||
{ "hex.view.hexeditor.menu.file.goto", "Vai a" },
|
||||
{ "hex.view.hexeditor.goto.offset.absolute", "Assoluto" },
|
||||
{ "hex.view.hexeditor.goto.offset.current", "Corrente" },
|
||||
{ "hex.view.hexeditor.goto.offset.begin", "Inizo" },
|
||||
{ "hex.view.hexeditor.goto.offset.end", "Fine" },
|
||||
{ "hex.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.view.hexeditor.menu.edit.undo", "Annulla" },
|
||||
{ "hex.view.hexeditor.menu.edit.redo", "Ripeti" },
|
||||
{ "hex.view.hexeditor.menu.edit.copy", "Copia" },
|
||||
{ "hex.view.hexeditor.menu.edit.copy_as", "Copia come..." },
|
||||
{ "hex.view.hexeditor.copy.hex", "Stringa" },
|
||||
{ "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", "Incolla" },
|
||||
{ "hex.view.hexeditor.menu.edit.bookmark", "Crea segnalibro" },
|
||||
{ "hex.view.hexeditor.menu.edit.set_base", "Imposta indirizzo di base" },
|
||||
|
||||
{ "hex.view.information.name", "Informazione sui Dati" },
|
||||
{ "hex.view.information.control", "Controllo" },
|
||||
{ "hex.view.information.analyze", "Analizza Pagina" },
|
||||
{ "hex.view.information.analyzing", "Sto analizzando..." },
|
||||
{ "hex.view.information.region", "Regione Analizzata" },
|
||||
{ "hex.view.information.magic", "Informazione Magica" },
|
||||
{ "hex.view.information.description", "Descrizione:" },
|
||||
{ "hex.view.information.mime", "Tipo di MIME:" },
|
||||
{ "hex.view.information.info_analysis", "Informazioni dell'analisi" },
|
||||
{ "hex.view.information.distribution", "Distribuzione dei Byte" },
|
||||
{ "hex.view.information.entropy", "Entropia" },
|
||||
{ "hex.view.information.block_size", "Dimensione del Blocco" },
|
||||
{ "hex.view.information.block_size.desc", "{0} blocchi di {1} bytes" },
|
||||
{ "hex.view.information.file_entropy", "Entropia dei File" },
|
||||
{ "hex.view.information.highest_entropy", "Highest entropy block" },
|
||||
{ "hex.view.information.encrypted", "Questi dati sono probabilmente codificati o compressi!" },
|
||||
|
||||
{ "hex.view.patches.name", "Patches" },
|
||||
{ "hex.view.patches.offset", "Offset" },
|
||||
{ "hex.view.patches.orig", "Valore Originale" },
|
||||
{ "hex.view.patches.patch", "Valore patchato"},
|
||||
{ "hex.view.patches.remove", "Rimuovi patch" },
|
||||
|
||||
{ "hex.view.pattern.name", "Editor dei Pattern" },
|
||||
{ "hex.view.pattern.accept_pattern", "Accetta pattern" },
|
||||
{ "hex.view.pattern.accept_pattern.desc", "Uno o più pattern compatibili con questo tipo di dati sono stati trovati!" },
|
||||
{ "hex.view.pattern.accept_pattern.patterns", "Pattern" },
|
||||
{ "hex.view.pattern.accept_pattern.question", "Vuoi applicare i patter selezionati" },
|
||||
{ "hex.view.pattern.menu.file.load_pattern", "Caricamento dei pattern..." },
|
||||
{ "hex.view.pattern.open_pattern", "Apri pattern" },
|
||||
{ "hex.view.pattern.evaluating", "Valutazione..." },
|
||||
{ "hex.view.pattern.auto", "Auto valutazione" },
|
||||
|
||||
{ "hex.view.pattern_data.name", "Dati dei Pattern" },
|
||||
{ "hex.view.pattern_data.name", "Nome" },
|
||||
{ "hex.view.pattern_data.color", "Colore" },
|
||||
{ "hex.view.pattern_data.offset", "Offset" },
|
||||
{ "hex.view.pattern_data.size", "Dimensione" },
|
||||
{ "hex.view.pattern_data.type", "Tipo" },
|
||||
{ "hex.view.pattern_data.value", "Valore" },
|
||||
|
||||
{ "hex.view.settings.name", "Impostazioni" },
|
||||
|
||||
{ "hex.view.strings.name", "Stringhe" },
|
||||
{ "hex.view.strings.copy", "Copia stringa" },
|
||||
{ "hex.view.strings.demangle", "Demangle" },
|
||||
{ "hex.view.strings.min_length", "Lunghezza minima" },
|
||||
{ "hex.view.strings.filter", "Filtro" },
|
||||
{ "hex.view.strings.extract", "Estrai" },
|
||||
{ "hex.view.strings.searching", "Sto cercando..." },
|
||||
{ "hex.view.strings.offset", "Offset" },
|
||||
{ "hex.view.strings.size", "Dimensione" },
|
||||
{ "hex.view.strings.string", "Stringa" },
|
||||
{ "hex.view.strings.demangle.title", "Nome Demangled" },
|
||||
{ "hex.view.strings.demangle.copy", "Copia" },
|
||||
|
||||
{ "hex.view.tools.name", "Strumenti" },
|
||||
|
||||
{ "hex.view.yara.name", "Regole di Yara" },
|
||||
{ "hex.view.yara.header.rules", "Regola" },
|
||||
{ "hex.view.yara.reload", "Ricarica" },
|
||||
{ "hex.view.yara.match", "Abbina Regole" },
|
||||
{ "hex.view.yara.matching", "Abbinamento..." },
|
||||
{ "hex.view.yara.error", "Errore compilazione Yara: " },
|
||||
{ "hex.view.yara.header.matches", "Abbinamenti" },
|
||||
{ "hex.view.yara.matches.identifier", "Identificatore" },
|
||||
{ "hex.view.yara.whole_data", "Tutti i file combaciano!" },
|
||||
{ "hex.view.yara.no_rules", "Nessuna regola di YARA. Aggiungile in nella cartella 'yara' di 'ImHex'" },
|
||||
|
||||
/* Builtin plugin features */
|
||||
|
||||
{ "hex.builtin.command.calc.desc", "Calcolatrice" },
|
||||
{ "hex.builtin.command.web.desc", "Consulta il Web" },
|
||||
{ "hex.builtin.command.web.result", "Naviga a '{0}'"},
|
||||
|
||||
{ "hex.builtin.inspector.binary", "Binary (8 bit)" },
|
||||
{ "hex.builtin.inspector.u8", "uint8_t" },
|
||||
{ "hex.builtin.inspector.s8", "int8_t" },
|
||||
{ "hex.builtin.inspector.u16", "uint16_t" },
|
||||
{ "hex.builtin.inspector.s16", "int16_t" },
|
||||
{ "hex.builtin.inspector.u32", "uint32_t" },
|
||||
{ "hex.builtin.inspector.s32", "int32_t" },
|
||||
{ "hex.builtin.inspector.u64", "uint64_t" },
|
||||
{ "hex.builtin.inspector.s64", "int64_t" },
|
||||
{ "hex.builtin.inspector.float", "float (32 bit)" },
|
||||
{ "hex.builtin.inspector.double", "double (64 bit)" },
|
||||
{ "hex.builtin.inspector.ascii", "ASCII Character" },
|
||||
{ "hex.builtin.inspector.wide", "Wide Character" },
|
||||
{ "hex.builtin.inspector.utf8", "UTF-8 code point" },
|
||||
{ "hex.builtin.inspector.time32", "__time32_t" },
|
||||
{ "hex.builtin.inspector.time64", "__time64_t" },
|
||||
{ "hex.builtin.inspector.time", "time_t" },
|
||||
{ "hex.builtin.inspector.guid", "GUID" },
|
||||
{ "hex.builtin.inspector.rgba8", "Colori RGBA8" },
|
||||
|
||||
{ "hex.builtin.nodes.constants", "Costanti" },
|
||||
{ "hex.builtin.nodes.constants.int", "Intero" },
|
||||
{ "hex.builtin.nodes.constants.int.header", "Intero" },
|
||||
{ "hex.builtin.nodes.constants.int.output", "" },
|
||||
{ "hex.builtin.nodes.constants.float", "Float" },
|
||||
{ "hex.builtin.nodes.constants.float.header", "Float" },
|
||||
{ "hex.builtin.nodes.constants.float.output", "" },
|
||||
{ "hex.builtin.nodes.constants.nullptr", "Nullptr" },
|
||||
{ "hex.builtin.nodes.constants.nullptr.header", "Nullptr" },
|
||||
{ "hex.builtin.nodes.constants.nullptr.output", "" },
|
||||
{ "hex.builtin.nodes.constants.buffer", "Buffer" },
|
||||
{ "hex.builtin.nodes.constants.buffer.header", "Buffer" },
|
||||
{ "hex.builtin.nodes.constants.buffer.size", "Dimensione" },
|
||||
{ "hex.builtin.nodes.constants.buffer.output", "" },
|
||||
{ "hex.builtin.nodes.constants.string", "Stringa" },
|
||||
{ "hex.builtin.nodes.constants.string.header", "Stringa" },
|
||||
{ "hex.builtin.nodes.constants.string.output", "" },
|
||||
{ "hex.builtin.nodes.constants.rgba8", "Colore RGBA8" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.header", "Colore RGBA8" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.r", "Rosso" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.g", "Verde" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.b", "Blu" },
|
||||
{ "hex.builtin.nodes.constants.rgba8.output.a", "Alpha" },
|
||||
{ "hex.builtin.nodes.constants.comment", "Comment" },
|
||||
{ "hex.builtin.nodes.constants.comment.header", "Commento" },
|
||||
|
||||
{ "hex.builtin.nodes.display", "Mostra" },
|
||||
{ "hex.builtin.nodes.display.int", "Intero" },
|
||||
{ "hex.builtin.nodes.display.int.header", "Mostra Intero" },
|
||||
{ "hex.builtin.nodes.display.int.input", "Valore" },
|
||||
{ "hex.builtin.nodes.display.float", "Float" },
|
||||
{ "hex.builtin.nodes.display.float.header", "Mostra Float" },
|
||||
{ "hex.builtin.nodes.display.float.input", "Valore" },
|
||||
|
||||
{ "hex.builtin.nodes.data_access", "Accesso ai Dati" },
|
||||
{ "hex.builtin.nodes.data_access.read", "Leggi" },
|
||||
{ "hex.builtin.nodes.data_access.read.header", "Leggi" },
|
||||
{ "hex.builtin.nodes.data_access.read.address", "Indirizzo" },
|
||||
{ "hex.builtin.nodes.data_access.read.size", "Dimensione" },
|
||||
{ "hex.builtin.nodes.data_access.read.data", "Dati" },
|
||||
{ "hex.builtin.nodes.data_access.write", "Scrivi" },
|
||||
{ "hex.builtin.nodes.data_access.write.header", "Scrivi" },
|
||||
{ "hex.builtin.nodes.data_access.write.address", "Indirizzo" },
|
||||
{ "hex.builtin.nodes.data_access.write.data", "Dati" },
|
||||
{ "hex.builtin.nodes.data_access.size", "Dati Dimensione"},
|
||||
{ "hex.builtin.nodes.data_access.size.header", "Dati Dimensione"},
|
||||
{ "hex.builtin.nodes.data_access.size.size", "Dimensione"},
|
||||
|
||||
{ "hex.builtin.nodes.casting", "Conversione Dati" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer", "Da Intero a Buffer" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer.header", "Da Intero a Buffer" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer.input", "Entrata" },
|
||||
{ "hex.builtin.nodes.casting.int_to_buffer.output", "Uscita" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int", "Da Buffer a Intero" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.header", "Da Buffer a Integer" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.input", "Entrata" },
|
||||
{ "hex.builtin.nodes.casting.buffer_to_int.output", "Uscita" },
|
||||
|
||||
{ "hex.builtin.nodes.arithmetic", "Aritmetica" },
|
||||
{ "hex.builtin.nodes.arithmetic.add", "Addizione" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.header", "Aggiungi" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.add.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub", "Sottrazione" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.header", "Sottrai" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.sub.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul", "Moltiplicazione" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.header", "Moltiplica" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.mul.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.div", "Divisione" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.header", "Dividi" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.div.output", "Output" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod", "Modulo" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.header", "Modulo" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.arithmetic.mod.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.buffer", "Buffer" },
|
||||
{ "hex.builtin.nodes.buffer.combine", "Combina" },
|
||||
{ "hex.builtin.nodes.buffer.combine.header", "Combina buffer" },
|
||||
{ "hex.builtin.nodes.buffer.combine.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.buffer.combine.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.buffer.combine.output", "Output" },
|
||||
{ "hex.builtin.nodes.buffer.slice", "Affetta" },
|
||||
{ "hex.builtin.nodes.buffer.slice.header", "Affetta buffer" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.buffer", "Input" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.from", "Inizio" },
|
||||
{ "hex.builtin.nodes.buffer.slice.input.to", "Fine" },
|
||||
{ "hex.builtin.nodes.buffer.slice.output", "Output" },
|
||||
{ "hex.builtin.nodes.buffer.repeat", "Ripeti" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.header", "Ripeti buffer" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "Conta" },
|
||||
{ "hex.builtin.nodes.buffer.repeat.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.control_flow", "Controlla Flusso" },
|
||||
{ "hex.builtin.nodes.control_flow.if", "Se" },
|
||||
{ "hex.builtin.nodes.control_flow.if.header", "Se" },
|
||||
{ "hex.builtin.nodes.control_flow.if.condition", "Condizione" },
|
||||
{ "hex.builtin.nodes.control_flow.if.true", "Vero" },
|
||||
{ "hex.builtin.nodes.control_flow.if.false", "Falso" },
|
||||
{ "hex.builtin.nodes.control_flow.if.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.equals", "Uguale a" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.header", "Uguale a" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.equals.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.not", "Non" },
|
||||
{ "hex.builtin.nodes.control_flow.not.header", "Non" },
|
||||
{ "hex.builtin.nodes.control_flow.not.input", "Input" },
|
||||
{ "hex.builtin.nodes.control_flow.not.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.gt", "Maggiore di" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.header", "Maggiore di" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.gt.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.lt", "Minore di" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.header", "Minore di" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.lt.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.and", "E" },
|
||||
{ "hex.builtin.nodes.control_flow.and.header", "Boolean E" },
|
||||
{ "hex.builtin.nodes.control_flow.and.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.and.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.and.output", "Output" },
|
||||
{ "hex.builtin.nodes.control_flow.or", "O" },
|
||||
{ "hex.builtin.nodes.control_flow.or.header", "Boolean O" },
|
||||
{ "hex.builtin.nodes.control_flow.or.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.control_flow.or.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.control_flow.or.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.bitwise", "Operazioni di Bitwise" },
|
||||
{ "hex.builtin.nodes.bitwise.and", "E" },
|
||||
{ "hex.builtin.nodes.bitwise.and.header", "Bitwise E" },
|
||||
{ "hex.builtin.nodes.bitwise.and.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.bitwise.and.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.bitwise.and.output", "Output" },
|
||||
{ "hex.builtin.nodes.bitwise.or", "O" },
|
||||
{ "hex.builtin.nodes.bitwise.or.header", "Bitwise O" },
|
||||
{ "hex.builtin.nodes.bitwise.or.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.bitwise.or.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.bitwise.or.output", "Output" },
|
||||
{ "hex.builtin.nodes.bitwise.xor", "XOR" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.header", "Bitwise XOR" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.input.a", "Input A" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.input.b", "Input B" },
|
||||
{ "hex.builtin.nodes.bitwise.xor.output", "Output" },
|
||||
{ "hex.builtin.nodes.bitwise.not", "NON" },
|
||||
{ "hex.builtin.nodes.bitwise.not.header", "Bitwise NON" },
|
||||
{ "hex.builtin.nodes.bitwise.not.input", "Input" },
|
||||
{ "hex.builtin.nodes.bitwise.not.output", "Output" },
|
||||
|
||||
{ "hex.builtin.nodes.decoding", "Decodifica" },
|
||||
{ "hex.builtin.nodes.decoding.base64", "Base64" },
|
||||
{ "hex.builtin.nodes.decoding.base64.header", "Decodificatore Base64" },
|
||||
{ "hex.builtin.nodes.decoding.base64.input", "In" },
|
||||
{ "hex.builtin.nodes.decoding.base64.output", "Out" },
|
||||
{ "hex.builtin.nodes.decoding.hex", "Esadecimale" },
|
||||
{ "hex.builtin.nodes.decoding.hex.header", "Decodificatore Esadecimale" },
|
||||
{ "hex.builtin.nodes.decoding.hex.input", "In" },
|
||||
{ "hex.builtin.nodes.decoding.hex.output", "Out" },
|
||||
|
||||
{ "hex.builtin.nodes.crypto", "Cryptografia" },
|
||||
{ "hex.builtin.nodes.crypto.aes", "Decriptatore AES" },
|
||||
{ "hex.builtin.nodes.crypto.aes.header", "Decriptatore AES" },
|
||||
{ "hex.builtin.nodes.crypto.aes.key", "Chiave" },
|
||||
{ "hex.builtin.nodes.crypto.aes.iv", "IV" },
|
||||
{ "hex.builtin.nodes.crypto.aes.nonce", "Nonce" },
|
||||
{ "hex.builtin.nodes.crypto.aes.input", "Input" },
|
||||
{ "hex.builtin.nodes.crypto.aes.output", "Output" },
|
||||
{ "hex.builtin.nodes.crypto.aes.mode", "Modalità" },
|
||||
{ "hex.builtin.nodes.crypto.aes.key_length", "Lunghezza Chiave" },
|
||||
|
||||
|
||||
|
||||
{ "hex.builtin.tools.demangler", "Itanium/MSVC demangler" },
|
||||
{ "hex.builtin.tools.demangler.mangled", "Nome Mangled" },
|
||||
{ "hex.builtin.tools.demangler.demangled", "Nome Demangled" },
|
||||
{ "hex.builtin.tools.ascii_table", "Tavola ASCII" },
|
||||
{ "hex.builtin.tools.ascii_table.octal", "Mostra ottale" },
|
||||
{ "hex.builtin.tools.regex_replacer", "Sostituzione Regex" },
|
||||
{ "hex.builtin.tools.regex_replacer.pattern", "Regex pattern" },
|
||||
{ "hex.builtin.tools.regex_replacer.replace", "Replace pattern" },
|
||||
{ "hex.builtin.tools.regex_replacer.input", "Input" },
|
||||
{ "hex.builtin.tools.regex_replacer.output", "Output" },
|
||||
{ "hex.builtin.tools.color", "Selettore di Colore" },
|
||||
{ "hex.builtin.tools.calc", "Calcolatrice" },
|
||||
{ "hex.builtin.tools.input", "Input" },
|
||||
{ "hex.builtin.tools.format.standard", "Standard" },
|
||||
{ "hex.builtin.tools.format.scientific", "Scientifica" },
|
||||
{ "hex.builtin.tools.format.engineering", "Ingegnere" },
|
||||
{ "hex.builtin.tools.format.programmer", "Programmatore" },
|
||||
{ "hex.builtin.tools.error", "Ultimo Errore: '{0}'" },
|
||||
{ "hex.builtin.tools.history", "Storia" },
|
||||
{ "hex.builtin.tools.name", "Nome" },
|
||||
{ "hex.builtin.tools.value", "Valore" },
|
||||
{ "hex.builtin.tools.base_converter", "Convertitore di Base" },
|
||||
{ "hex.builtin.tools.base_converter.dec", "DEC" },
|
||||
{ "hex.builtin.tools.base_converter.hex", "HEX" },
|
||||
{ "hex.builtin.tools.base_converter.oct", "OCT" },
|
||||
{ "hex.builtin.tools.base_converter.bin", "BIN" },
|
||||
|
||||
{ "hex.builtin.setting.imhex", "ImHex" },
|
||||
{ "hex.builtin.setting.imhex.recent_files", "File recenti" },
|
||||
{ "hex.builtin.setting.interface", "Interfaccia" },
|
||||
{ "hex.builtin.setting.interface.color", "Colore del Tema" },
|
||||
{ "hex.builtin.setting.interface.color.dark", "Scuro" },
|
||||
{ "hex.builtin.setting.interface.color.light", "Chiaro" },
|
||||
{ "hex.builtin.setting.interface.color.classic", "Classico" },
|
||||
{ "hex.builtin.setting.interface.language", "Lingua" },
|
||||
{ "hex.builtin.setting.interface.fps", "Limite FPS" },
|
||||
{ "hex.builtin.setting.interface.highlight_alpha", "Evidenziazione dell'opacità" },
|
||||
|
||||
{ "hex.builtin.provider.file.path", "Percorso del File" },
|
||||
{ "hex.builtin.provider.file.size", "Dimensione" },
|
||||
{ "hex.builtin.provider.file.creation", "Data di creazione" },
|
||||
{ "hex.builtin.provider.file.access", "Data dell'ultimo accesso" },
|
||||
{ "hex.builtin.provider.file.modification", "Data dell'ultima modifica" },
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,11 +9,15 @@ namespace hex::plugin::builtin {
|
||||
void registerSettings();
|
||||
void registerDataProcessorNodes();
|
||||
|
||||
void addFooterItems();
|
||||
|
||||
void registerLanguageEnUS();
|
||||
void registerLanguageDeDE();
|
||||
void registerLanguageItIT();
|
||||
|
||||
}
|
||||
|
||||
IMHEX_PLUGIN_SETUP {
|
||||
IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") {
|
||||
|
||||
using namespace hex::plugin::builtin;
|
||||
|
||||
@@ -24,7 +28,11 @@ IMHEX_PLUGIN_SETUP {
|
||||
registerSettings();
|
||||
registerDataProcessorNodes();
|
||||
|
||||
addFooterItems();
|
||||
|
||||
registerLanguageEnUS();
|
||||
registerLanguageDeDE();
|
||||
registerLanguageItIT();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug")
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc -Wl,--allow-multiple-definition -fvisibility=hidden")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -fvisibility=hidden")
|
||||
endif()
|
||||
|
||||
add_compile_definitions(IMHEX_PLUGIN_NAME=${PROJECT_NAME})
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
IMHEX_PLUGIN_SETUP {
|
||||
IMHEX_PLUGIN_SETUP("Example", "WerWolv", "Example plugin used as template for plugin devs") {
|
||||
|
||||
ContentRegistry::Views::add<ViewExample>();
|
||||
|
||||
|
||||
@@ -3,46 +3,66 @@ project(libimhex)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/ImGui ${CMAKE_CURRENT_BINARY_DIR}/external/ImGui)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json)
|
||||
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc -Wl,--allow-multiple-definition -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive")
|
||||
endif()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nativefiledialog ${CMAKE_CURRENT_BINARY_DIR}/external/nativefiledialog EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt)
|
||||
set(XDGPP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../external/xdgpp")
|
||||
set(CMAKE_USE_MBEDTLS ON)
|
||||
set(BUILD_CURL_EXE OFF)
|
||||
set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/curl ${CMAKE_CURRENT_BINARY_DIR}/external/curl EXCLUDE_FROM_ALL)
|
||||
set_target_properties(libcurl PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||
|
||||
add_library(libimhex SHARED
|
||||
source/api/event.cpp
|
||||
source/api/imhex_api.cpp
|
||||
source/api/content_registry.cpp
|
||||
set(LIBIMHEX_SOURCES
|
||||
source/api/event.cpp
|
||||
source/api/imhex_api.cpp
|
||||
source/api/content_registry.cpp
|
||||
|
||||
source/helpers/utils.cpp
|
||||
source/helpers/shared_data.cpp
|
||||
source/helpers/crypto.cpp
|
||||
source/helpers/lang.cpp
|
||||
source/helpers/utils.cpp
|
||||
source/helpers/shared_data.cpp
|
||||
source/helpers/crypto.cpp
|
||||
source/helpers/lang.cpp
|
||||
source/helpers/net.cpp
|
||||
|
||||
source/lang/pattern_language.cpp
|
||||
source/lang/preprocessor.cpp
|
||||
source/lang/lexer.cpp
|
||||
source/lang/parser.cpp
|
||||
source/lang/validator.cpp
|
||||
source/lang/evaluator.cpp
|
||||
source/lang/builtin_functions.cpp
|
||||
source/lang/pattern_language.cpp
|
||||
source/lang/preprocessor.cpp
|
||||
source/lang/lexer.cpp
|
||||
source/lang/parser.cpp
|
||||
source/lang/validator.cpp
|
||||
source/lang/evaluator.cpp
|
||||
source/providers/provider.cpp
|
||||
|
||||
source/providers/provider.cpp
|
||||
source/views/view.cpp
|
||||
)
|
||||
|
||||
source/views/view.cpp
|
||||
)
|
||||
if (APPLE)
|
||||
set(OSX_11_0_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk)
|
||||
if (NOT CMAKE_OSX_SYSROOT)
|
||||
if (IS_DIRECTORY ${OSX_11_0_SDK_PATH})
|
||||
set(CMAKE_OSX_SYSROOT ${OSX_11_0_SDK_PATH})
|
||||
else ()
|
||||
message(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
|
||||
endif ()
|
||||
endif ()
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
|
||||
|
||||
target_include_directories(libimhex PUBLIC include ${MBEDTLS_INCLUDE_DIR})
|
||||
set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES} source/helpers/utils_mac.mm)
|
||||
endif ()
|
||||
|
||||
add_library(libimhex SHARED ${LIBIMHEX_SOURCES})
|
||||
|
||||
target_include_directories(libimhex PUBLIC include ${MBEDTLS_INCLUDE_DIR} ${XDGPP_INCLUDE_DIRS})
|
||||
target_link_directories(libimhex PUBLIC ${MBEDTLS_LIBRARY_DIR})
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(libimhex PUBLIC imgui nlohmann_json libmbedcrypto.a)
|
||||
if (APPLE)
|
||||
find_library(FOUNDATION NAMES Foundation)
|
||||
target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto ${FOUNDATION} nfd fmt-header-only libcurl)
|
||||
else ()
|
||||
target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto)
|
||||
target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto nfd fmt-header-only libcurl)
|
||||
endif ()
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <hex/helpers/lang.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
using namespace hex::lang_literals;
|
||||
|
||||
using u8 = std::uint8_t;
|
||||
|
||||
@@ -51,17 +51,10 @@ namespace hex {
|
||||
static std::vector<std::string> read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, const std::vector<std::string>& defaultValue = { });
|
||||
|
||||
static std::map<std::string, std::vector<Entry>>& getEntries();
|
||||
static std::optional<nlohmann::json> getSetting(std::string_view unlocalizedCategory, std::string_view unlocalizedName);
|
||||
static nlohmann::json getSetting(std::string_view unlocalizedCategory, std::string_view unlocalizedName);
|
||||
static nlohmann::json& getSettingsData();
|
||||
};
|
||||
|
||||
/* Events Registry. Allows to define new events that can be used by other plugins later on subscribe to */
|
||||
struct Events {
|
||||
Events() = delete;
|
||||
|
||||
static auto get(std::string_view name);
|
||||
};
|
||||
|
||||
/* Command Palette Command Registry. Allows adding of new commands to the command palette */
|
||||
struct CommandPaletteCommands {
|
||||
CommandPaletteCommands() = delete;
|
||||
@@ -107,13 +100,13 @@ namespace hex {
|
||||
|
||||
template<hex::derived_from<View> T, typename ... Args>
|
||||
static void add(Args&& ... args) {
|
||||
return add(std::make_unique<T>(std::forward<Args>(args)...));
|
||||
return add(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
static std::vector<std::unique_ptr<View>>& getEntries();
|
||||
static std::vector<View*>& getEntries();
|
||||
|
||||
private:
|
||||
static void add(std::unique_ptr<View> &&view);
|
||||
static void add(View *view);
|
||||
|
||||
|
||||
};
|
||||
@@ -142,7 +135,7 @@ namespace hex {
|
||||
Octal
|
||||
};
|
||||
|
||||
using DisplayFunction = std::function<void()>;
|
||||
using DisplayFunction = std::function<std::string()>;
|
||||
using GeneratorFunction = std::function<DisplayFunction(const std::vector<u8>&, std::endian, NumberDisplayStyle)>;
|
||||
|
||||
struct Entry {
|
||||
@@ -156,6 +149,7 @@ namespace hex {
|
||||
static std::vector<Entry>& getEntries();
|
||||
};
|
||||
|
||||
/* Data Processor Node Registry. Allows adding new processor nodes to be used in the data processor */
|
||||
struct DataProcessorNode {
|
||||
using CreatorFunction = std::function<dp::Node*()>;
|
||||
struct Entry {
|
||||
@@ -166,7 +160,13 @@ namespace hex {
|
||||
|
||||
template<hex::derived_from<dp::Node> T, typename ... Args>
|
||||
static void add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, Args&& ... args) {
|
||||
add(Entry{ unlocalizedCategory.data(), unlocalizedName.data(), [args...]{ return new T(std::forward<Args>(args)...); } });
|
||||
add(Entry{ unlocalizedCategory.data(), unlocalizedName.data(),
|
||||
[args..., name = std::string(unlocalizedName)]{
|
||||
auto node = new T(std::forward<Args>(args)...);
|
||||
node->setUnlocalizedName(name);
|
||||
return node;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void addSeparator();
|
||||
@@ -176,6 +176,7 @@ namespace hex {
|
||||
static void add(const Entry &entry);
|
||||
};
|
||||
|
||||
/* Language Registry. Allows together with the LangEntry class and the _lang user defined literal to add new languages */
|
||||
struct Language {
|
||||
static void registerLanguage(std::string_view name, std::string_view languageCode);
|
||||
static void addLocalizations(std::string_view languageCode, const LanguageDefinition &definition);
|
||||
@@ -184,6 +185,7 @@ namespace hex {
|
||||
static std::map<std::string, std::vector<LanguageDefinition>>& getLanguageDefinitions();
|
||||
};
|
||||
|
||||
/* Interface Registry. Allows adding new items to various interfaces */
|
||||
struct Interface {
|
||||
using DrawCallback = std::function<void()>;
|
||||
|
||||
|
||||
@@ -2,48 +2,116 @@
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <any>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string_view>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
|
||||
#define EVENT_DEF(event_name, ...) \
|
||||
struct event_name final : public hex::Event<__VA_ARGS__> { \
|
||||
constexpr static auto id = [] { return hex::EventId(); }(); \
|
||||
event_name(Callback func) noexcept : Event(func) { } \
|
||||
};
|
||||
|
||||
class GLFWwindow;
|
||||
|
||||
namespace hex {
|
||||
|
||||
enum class Events : u32 {
|
||||
FileLoaded,
|
||||
DataChanged,
|
||||
PatternChanged,
|
||||
FileDropped,
|
||||
WindowClosing,
|
||||
RegionSelected,
|
||||
class EventId {
|
||||
public:
|
||||
constexpr EventId(const char *func = __builtin_FUNCTION(), u32 line = __builtin_LINE()) {
|
||||
this->m_hash = line ^ 123456789;
|
||||
for (auto c : std::string_view(func)) {
|
||||
this->m_hash = (this->m_hash >> 5) | (this->m_hash << 27);
|
||||
this->m_hash ^= c;
|
||||
}
|
||||
}
|
||||
|
||||
SelectionChangeRequest,
|
||||
constexpr bool operator ==(const EventId &rhs) const = default;
|
||||
|
||||
AddBookmark,
|
||||
AppendPatternLanguageCode,
|
||||
|
||||
ProjectFileStore,
|
||||
ProjectFileLoad,
|
||||
|
||||
SettingsChanged,
|
||||
|
||||
OpenWindow,
|
||||
CloseImHex,
|
||||
|
||||
/* This is not a real event but a flag to show all events after this one are plugin ones */
|
||||
Events_BuiltinEnd
|
||||
private:
|
||||
u32 m_hash;
|
||||
};
|
||||
|
||||
struct EventHandler {
|
||||
void *owner;
|
||||
Events eventType;
|
||||
std::function<std::any(const std::any&)> callback;
|
||||
struct EventBase {
|
||||
EventBase() noexcept = default;
|
||||
};
|
||||
|
||||
template<typename ... Params>
|
||||
struct Event : public EventBase {
|
||||
using Callback = std::function<void(Params...)>;
|
||||
|
||||
explicit Event(Callback func) noexcept : m_func(func) {}
|
||||
|
||||
void operator()(Params... params) const noexcept {
|
||||
this->m_func(params...);
|
||||
}
|
||||
|
||||
private:
|
||||
Callback m_func;
|
||||
};
|
||||
|
||||
class EventManager {
|
||||
public:
|
||||
static std::vector<std::any> post(Events eventType, const std::any &userData);
|
||||
static void subscribe(Events eventType, void *owner, std::function<std::any(const std::any&)> callback);
|
||||
static void unsubscribe(Events eventType, void *sender);
|
||||
using EventList = std::list<std::pair<EventId, EventBase*>>;
|
||||
|
||||
template<typename E>
|
||||
[[nodiscard]] static EventList::iterator subscribe(typename E::Callback function) {
|
||||
return s_events.insert(s_events.end(), std::make_pair(E::id, new E(function)));
|
||||
}
|
||||
|
||||
template<typename E>
|
||||
static void subscribe(void *token, typename E::Callback function) {
|
||||
s_tokenStore.insert(std::make_pair(token, subscribe<E>(function)));
|
||||
}
|
||||
|
||||
static void unsubscribe(EventList::iterator iter) noexcept {
|
||||
s_events.remove(*iter);
|
||||
}
|
||||
|
||||
template<typename E>
|
||||
static void unsubscribe(void *token) noexcept {
|
||||
auto iter = std::find_if(s_tokenStore.begin(), s_tokenStore.end(), [&](auto &item){
|
||||
return item.first == token && item.second->first == E::id;
|
||||
});
|
||||
|
||||
if (iter != s_tokenStore.end()) {
|
||||
s_events.remove(*iter->second);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename E>
|
||||
static void post(auto ... args) noexcept {
|
||||
for (const auto &[id, event] : s_events) {
|
||||
if (id == E::id)
|
||||
(*reinterpret_cast<E *>(event))(args...);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static std::map<void*, EventList::iterator> s_tokenStore;
|
||||
static EventList s_events;
|
||||
};
|
||||
|
||||
/* Default Events */
|
||||
EVENT_DEF(EventFileLoaded, std::string);
|
||||
EVENT_DEF(EventFileUnloaded);
|
||||
EVENT_DEF(EventDataChanged);
|
||||
EVENT_DEF(EventPatternChanged);
|
||||
EVENT_DEF(EventFileDropped, std::string);
|
||||
EVENT_DEF(EventWindowClosing, GLFWwindow*);
|
||||
EVENT_DEF(EventRegionSelected, Region);
|
||||
EVENT_DEF(EventProjectFileStore);
|
||||
EVENT_DEF(EventProjectFileLoad);
|
||||
EVENT_DEF(EventSettingsChanged);
|
||||
|
||||
EVENT_DEF(RequestOpenWindow, std::string);
|
||||
EVENT_DEF(RequestSelectionChange, Region);
|
||||
EVENT_DEF(RequestAddBookmark, ImHexApi::Bookmarks::Entry);
|
||||
EVENT_DEF(RequestAppendPatternLanguageCode, std::string);
|
||||
EVENT_DEF(RequestChangeWindowTitle, std::string);
|
||||
EVENT_DEF(RequestCloseImHex);
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ namespace hex {
|
||||
std::vector<char> name;
|
||||
std::vector<char> comment;
|
||||
u32 color;
|
||||
bool locked;
|
||||
};
|
||||
|
||||
static void add(Region region, std::string_view name, std::string_view comment, u32 color = 0x00000000);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace hex::dp {
|
||||
In, Out
|
||||
};
|
||||
|
||||
Attribute(IOType ioType, Type type, std::string_view unlocalizedName) : m_id(SharedData::dataProcessorNodeIdCounter++), m_ioType(ioType), m_type(type), m_unlocalizedName(unlocalizedName) {
|
||||
Attribute(IOType ioType, Type type, std::string_view unlocalizedName) : m_id(SharedData::dataProcessorAttrIdCounter++), m_ioType(ioType), m_type(type), m_unlocalizedName(unlocalizedName) {
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace hex::dp {
|
||||
}
|
||||
|
||||
[[nodiscard]] u32 getID() const { return this->m_id; }
|
||||
void setID(u32 id) { this->m_id = id; }
|
||||
|
||||
[[nodiscard]] IOType getIOType() const { return this->m_ioType; }
|
||||
[[nodiscard]] Type getType() const { return this->m_type; }
|
||||
[[nodiscard]] std::string_view getUnlocalizedName() const { return this->m_unlocalizedName; }
|
||||
|
||||
@@ -4,9 +4,11 @@ namespace hex::dp {
|
||||
|
||||
class Link {
|
||||
public:
|
||||
Link(u32 from, u32 to) : m_id(SharedData::dataProcessorNodeIdCounter++), m_from(from), m_to(to) { }
|
||||
Link(u32 from, u32 to) : m_id(SharedData::dataProcessorLinkIdCounter++), m_from(from), m_to(to) { }
|
||||
|
||||
[[nodiscard]] u32 getID() const { return this->m_id; }
|
||||
void setID(u32 id) { this->m_id = id; }
|
||||
|
||||
[[nodiscard]] u32 getFromID() const { return this->m_from; }
|
||||
[[nodiscard]] u32 getToID() const { return this->m_to; }
|
||||
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
|
||||
#include <hex/data_processor/attribute.hpp>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace hex::dp {
|
||||
|
||||
class Node {
|
||||
public:
|
||||
Node(std::string_view unlocalizedName, std::vector<Attribute> attributes) : m_id(SharedData::dataProcessorNodeIdCounter++), m_unlocalizedName(unlocalizedName), m_attributes(std::move(attributes)) {
|
||||
Node(std::string_view unlocalizedTitle, std::vector<Attribute> attributes) : m_id(SharedData::dataProcessorNodeIdCounter++), m_unlocalizedTitle(unlocalizedTitle), m_attributes(std::move(attributes)) {
|
||||
for (auto &attr : this->m_attributes)
|
||||
attr.setParentNode(this);
|
||||
}
|
||||
@@ -14,7 +19,12 @@ namespace hex::dp {
|
||||
virtual ~Node() = default;
|
||||
|
||||
[[nodiscard]] u32 getID() const { return this->m_id; }
|
||||
void setID(u32 id) { this->m_id = id; }
|
||||
|
||||
[[nodiscard]] std::string_view getUnlocalizedName() const { return this->m_unlocalizedName; }
|
||||
void setUnlocalizedName(std::string_view unlocalizedName) { this->m_unlocalizedName = unlocalizedName; }
|
||||
|
||||
[[nodiscard]] std::string_view getUnlocalizedTitle() const { return this->m_unlocalizedTitle; }
|
||||
[[nodiscard]] std::vector<Attribute>& getAttributes() { return this->m_attributes; }
|
||||
|
||||
void setCurrentOverlay(prv::Overlay *overlay) {
|
||||
@@ -24,6 +34,9 @@ namespace hex::dp {
|
||||
virtual void drawNode() { }
|
||||
virtual void process() = 0;
|
||||
|
||||
virtual nlohmann::json store() { return nullptr; }
|
||||
virtual void load(nlohmann::json &j) { }
|
||||
|
||||
using NodeError = std::pair<Node*, std::string>;
|
||||
|
||||
void resetOutputData() {
|
||||
@@ -31,10 +44,15 @@ namespace hex::dp {
|
||||
attribute.getOutputData().reset();
|
||||
}
|
||||
|
||||
void resetProcessedInputs() {
|
||||
this->m_processedInputs.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
u32 m_id;
|
||||
std::string m_unlocalizedName;
|
||||
std::string m_unlocalizedTitle, m_unlocalizedName;
|
||||
std::vector<Attribute> m_attributes;
|
||||
std::set<u32> m_processedInputs;
|
||||
prv::Overlay *m_overlay = nullptr;
|
||||
|
||||
Attribute* getConnectedInputAttribute(u32 index) {
|
||||
@@ -49,6 +67,12 @@ namespace hex::dp {
|
||||
return connectedAttribute.begin()->second;
|
||||
}
|
||||
|
||||
void markInputProcessed(u32 index) {
|
||||
const auto &[iter, inserted] = this->m_processedInputs.insert(index);
|
||||
if (!inserted)
|
||||
throwNodeError("Recursion detected!");
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
[[noreturn]] void throwNodeError(std::string_view message) {
|
||||
@@ -59,11 +83,12 @@ namespace hex::dp {
|
||||
auto attribute = this->getConnectedInputAttribute(index);
|
||||
|
||||
if (attribute == nullptr)
|
||||
throwNodeError(hex::format("Nothing connected to input '%s'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||
throwNodeError(hex::format("Nothing connected to input '{0}'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||
|
||||
if (attribute->getType() != Attribute::Type::Buffer)
|
||||
throwNodeError("Tried to read buffer from non-buffer attribute");
|
||||
|
||||
markInputProcessed(index);
|
||||
attribute->getParentNode()->process();
|
||||
|
||||
auto &outputData = attribute->getOutputData();
|
||||
@@ -78,11 +103,12 @@ namespace hex::dp {
|
||||
auto attribute = this->getConnectedInputAttribute(index);
|
||||
|
||||
if (attribute == nullptr)
|
||||
throwNodeError(hex::format("Nothing connected to input '%s'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||
throwNodeError(hex::format("Nothing connected to input '{0}'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||
|
||||
if (attribute->getType() != Attribute::Type::Integer)
|
||||
throwNodeError("Tried to read integer from non-integer attribute");
|
||||
|
||||
markInputProcessed(index);
|
||||
attribute->getParentNode()->process();
|
||||
|
||||
auto &outputData = attribute->getOutputData();
|
||||
@@ -100,11 +126,12 @@ namespace hex::dp {
|
||||
auto attribute = this->getConnectedInputAttribute(index);
|
||||
|
||||
if (attribute == nullptr)
|
||||
throwNodeError(hex::format("Nothing connected to input '%s'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||
throwNodeError(hex::format("Nothing connected to input '{0}'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||
|
||||
if (attribute->getType() != Attribute::Type::Float)
|
||||
throwNodeError("Tried to read float from non-float attribute");
|
||||
|
||||
markInputProcessed(index);
|
||||
attribute->getParentNode()->process();
|
||||
|
||||
auto &outputData = attribute->getOutputData();
|
||||
|
||||
40
plugins/libimhex/include/hex/helpers/logger.hpp
Normal file
40
plugins/libimhex/include/hex/helpers/logger.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/color.h>
|
||||
|
||||
namespace hex::log {
|
||||
|
||||
void debug(std::string_view fmt, auto ... args) {
|
||||
#if defined(DEBUG)
|
||||
fmt::print(fg(fmt::color::green_yellow) | fmt::emphasis::bold, "[DEBUG] ");
|
||||
fmt::print(fmt, args...);
|
||||
fmt::print("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void info(std::string_view fmt, auto ... args) {
|
||||
fmt::print(fg(fmt::color::cadet_blue) | fmt::emphasis::bold, "[INFO] ");
|
||||
fmt::print(fmt, args...);
|
||||
fmt::print("\n");
|
||||
}
|
||||
|
||||
void warn(std::string_view fmt, auto ... args) {
|
||||
fmt::print(fg(fmt::color::light_golden_rod_yellow) | fmt::emphasis::bold, "[WARN] ");
|
||||
fmt::print(fmt, args...);
|
||||
fmt::print("\n");
|
||||
}
|
||||
|
||||
void error(std::string_view fmt, auto ... args) {
|
||||
fmt::print(fg(fmt::color::red) | fmt::emphasis::bold, "[ERROR] ");
|
||||
fmt::print(fmt, args...);
|
||||
fmt::print("\n");
|
||||
}
|
||||
|
||||
void fatal(std::string_view fmt, auto ... args) {
|
||||
fmt::print(fg(fmt::color::purple) | fmt::emphasis::bold, "[FATAL] ");
|
||||
fmt::print(fmt, args...);
|
||||
fmt::print("\n");
|
||||
}
|
||||
|
||||
}
|
||||
30
plugins/libimhex/include/hex/helpers/net.hpp
Normal file
30
plugins/libimhex/include/hex/helpers/net.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
#include <future>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
||||
namespace hex {
|
||||
|
||||
template<typename T>
|
||||
struct Response {
|
||||
u32 code;
|
||||
T response;
|
||||
};
|
||||
|
||||
class Net {
|
||||
public:
|
||||
Net();
|
||||
~Net();
|
||||
|
||||
Response<std::string> getString(std::string_view url);
|
||||
Response<nlohmann::json> getJson(std::string_view url);
|
||||
|
||||
private:
|
||||
CURL *m_ctx;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -9,11 +9,9 @@
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/event.hpp>
|
||||
#include <hex/views/view.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <ImGuiFileBrowser.h>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -27,6 +25,8 @@ namespace hex {
|
||||
|
||||
namespace prv { class Provider; }
|
||||
namespace dp { class Node; }
|
||||
namespace lang { class PatternData; }
|
||||
|
||||
class View;
|
||||
|
||||
class SharedData {
|
||||
@@ -48,21 +48,19 @@ namespace hex {
|
||||
}
|
||||
|
||||
public:
|
||||
static std::vector<EventHandler> eventHandlers;
|
||||
static std::vector<std::function<void()>> deferredCalls;
|
||||
static prv::Provider *currentProvider;
|
||||
static std::map<std::string, std::vector<ContentRegistry::Settings::Entry>> settingsEntries;
|
||||
static nlohmann::json settingsJson;
|
||||
static std::map<std::string, Events> customEvents;
|
||||
static u32 customEventsLastId;
|
||||
static std::vector<ContentRegistry::CommandPaletteCommands::Entry> commandPaletteCommands;
|
||||
static std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> patternLanguageFunctions;
|
||||
static std::vector<std::unique_ptr<View>> views;
|
||||
static std::vector<View*> views;
|
||||
static std::vector<ContentRegistry::Tools::Entry> toolsEntries;
|
||||
static std::vector<ContentRegistry::DataInspector::Entry> dataInspectorEntries;
|
||||
static u32 patternPaletteOffset;
|
||||
static std::string errorPopupMessage;
|
||||
static std::list<ImHexApi::Bookmarks::Entry> bookmarkEntries;
|
||||
static std::vector<lang::PatternData*> patternData;
|
||||
|
||||
static std::map<std::string, std::string> languageNames;
|
||||
static std::map<std::string, std::vector<LanguageDefinition>> languageDefinitions;
|
||||
@@ -71,14 +69,12 @@ namespace hex {
|
||||
static std::vector<ContentRegistry::Interface::DrawCallback> welcomeScreenEntries;
|
||||
static std::vector<ContentRegistry::Interface::DrawCallback> footerItems;
|
||||
|
||||
static imgui_addons::ImGuiFileBrowser fileBrowser;
|
||||
static imgui_addons::ImGuiFileBrowser::DialogMode fileBrowserDialogMode;
|
||||
static std::string fileBrowserTitle;
|
||||
static std::string fileBrowserValidExtensions;
|
||||
static std::function<void(std::string)> fileBrowserCallback;
|
||||
|
||||
static std::vector<ContentRegistry::DataProcessorNode::Entry> dataProcessorNodes;
|
||||
static u32 dataProcessorNodeIdCounter;
|
||||
static u32 dataProcessorLinkIdCounter;
|
||||
static u32 dataProcessorAttrIdCounter;
|
||||
|
||||
static std::list<std::string> recentFilePaths;
|
||||
|
||||
static int mainArgc;
|
||||
static char **mainArgv;
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/chrono.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <winsock.h>
|
||||
#else
|
||||
@@ -73,6 +76,7 @@ namespace hex {
|
||||
|
||||
#define TOKEN_CONCAT_IMPL(x, y) x ## y
|
||||
#define TOKEN_CONCAT(x, y) TOKEN_CONCAT_IMPL(x, y)
|
||||
#define ANONYMOUS_VARIABLE(prefix) TOKEN_CONCAT(prefix, __COUNTER__)
|
||||
|
||||
namespace hex {
|
||||
|
||||
@@ -85,18 +89,13 @@ namespace hex {
|
||||
void openWebpage(std::string_view url);
|
||||
|
||||
template<typename ... Args>
|
||||
inline std::string format(const char *format, Args ... args) {
|
||||
ssize_t size = snprintf( nullptr, 0, format, args ... );
|
||||
inline std::string format(std::string_view format, Args ... args) {
|
||||
return fmt::format(format, args...);
|
||||
}
|
||||
|
||||
if (size <= 0)
|
||||
return "";
|
||||
|
||||
std::vector<char> buffer(size + 1, 0x00);
|
||||
if (snprintf(buffer.data(), size + 1, format, args ...) <= 0)
|
||||
return "";
|
||||
|
||||
|
||||
return std::string(buffer.data(), buffer.data() + size);
|
||||
template<typename ... Args>
|
||||
inline void print(std::string_view format, Args ... args) {
|
||||
fmt::print(format, args...);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr inline u64 extract(u8 from, u8 to, const hex::unsigned_integral auto &value) {
|
||||
@@ -106,12 +105,6 @@ namespace hex {
|
||||
return (value & mask) >> to;
|
||||
}
|
||||
|
||||
template<hex::integral T>
|
||||
[[nodiscard]] constexpr inline T signExtend(T value, u8 currWidth, u8 targetWidth) {
|
||||
T mask = 1LLU << (currWidth - 1);
|
||||
return (((value ^ mask) - mask) << ((sizeof(T) * 8) - targetWidth)) >> ((sizeof(T) * 8) - targetWidth);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct always_false : std::false_type {};
|
||||
|
||||
@@ -167,6 +160,7 @@ namespace hex {
|
||||
}
|
||||
|
||||
std::vector<std::string> splitString(std::string_view string, std::string_view delimiter);
|
||||
std::string combineStrings(const std::vector<std::string> &strings, std::string_view delimiter = "");
|
||||
|
||||
std::string toEngineeringString(double value);
|
||||
|
||||
@@ -197,11 +191,11 @@ namespace hex {
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::string toBinaryString(hex::integral auto number) {
|
||||
inline std::string toBinaryString(hex::unsigned_integral auto number) {
|
||||
if (number == 0) return "0";
|
||||
|
||||
std::string result;
|
||||
for (u8 bit = hex::bit_width(number); bit > 0; bit--)
|
||||
for (s16 bit = hex::bit_width(number) - 1; bit >= 0; bit--)
|
||||
result += (number & (0b1 << bit)) == 0 ? '0' : '1';
|
||||
|
||||
return result;
|
||||
@@ -224,20 +218,45 @@ namespace hex {
|
||||
trimRight(s);
|
||||
}
|
||||
|
||||
#define SCOPE_EXIT(func) ScopeExit TOKEN_CONCAT(scopeGuard, __COUNTER__)([&] { func })
|
||||
class ScopeExit {
|
||||
public:
|
||||
ScopeExit(std::function<void()> func) : m_func(func) {}
|
||||
~ScopeExit() { if (this->m_func != nullptr) this->m_func(); }
|
||||
enum class ImHexPath {
|
||||
Patterns,
|
||||
PatternsInclude,
|
||||
Magic,
|
||||
Python,
|
||||
Plugins,
|
||||
Yara,
|
||||
Config,
|
||||
Resources
|
||||
};
|
||||
|
||||
void release() {
|
||||
this->m_func = nullptr;
|
||||
std::vector<std::string> getPath(ImHexPath path);
|
||||
|
||||
#define SCOPE_GUARD ::hex::ScopeGuardOnExit() + [&]()
|
||||
#define ON_SCOPE_EXIT auto ANONYMOUS_VARIABLE(SCOPE_EXIT_) = SCOPE_GUARD
|
||||
template<class F>
|
||||
class ScopeGuard {
|
||||
private:
|
||||
F m_func;
|
||||
bool m_active;
|
||||
public:
|
||||
constexpr ScopeGuard(F func) : m_func(std::move(func)), m_active(true) { }
|
||||
~ScopeGuard() { if (this->m_active) { this->m_func(); } }
|
||||
void release() { this->m_active = false; }
|
||||
|
||||
ScopeGuard(ScopeGuard &&other) noexcept : m_func(std::move(other.m_func)), m_active(other.m_active) {
|
||||
other.cancel();
|
||||
}
|
||||
|
||||
private:
|
||||
std::function<void()> m_func;
|
||||
ScopeGuard& operator=(ScopeGuard &&) = delete;
|
||||
};
|
||||
|
||||
enum class ScopeGuardOnExit { };
|
||||
|
||||
template <typename F>
|
||||
constexpr ScopeGuard<F> operator+(ScopeGuardOnExit, F&& f) {
|
||||
return ScopeGuard<F>(std::forward<F>(f));
|
||||
}
|
||||
|
||||
struct Region {
|
||||
u64 address;
|
||||
size_t size;
|
||||
|
||||
9
plugins/libimhex/include/hex/helpers/utils_mac.h
Normal file
9
plugins/libimhex/include/hex/helpers/utils_mac.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(OS_MACOS)
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
namespace hex {
|
||||
std::string getPathForMac(ImHexPath path);
|
||||
}
|
||||
#endif
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <bit>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace hex::lang {
|
||||
@@ -149,7 +150,10 @@ namespace hex::lang {
|
||||
|
||||
ASTNodeTypeDecl(const ASTNodeTypeDecl& other) : ASTNode(other), Attributable(other) {
|
||||
this->m_name = other.m_name;
|
||||
this->m_type = other.m_type->clone();
|
||||
if (other.m_type != nullptr)
|
||||
this->m_type = other.m_type->clone();
|
||||
else
|
||||
this->m_type = nullptr;
|
||||
this->m_endian = other.m_endian;
|
||||
}
|
||||
|
||||
@@ -188,6 +192,7 @@ namespace hex::lang {
|
||||
|
||||
~ASTNodeVariableDecl() override {
|
||||
delete this->m_type;
|
||||
delete this->m_placementOffset;
|
||||
}
|
||||
|
||||
[[nodiscard]] ASTNode* clone() const override {
|
||||
@@ -226,6 +231,7 @@ namespace hex::lang {
|
||||
~ASTNodeArrayVariableDecl() override {
|
||||
delete this->m_type;
|
||||
delete this->m_size;
|
||||
delete this->m_placementOffset;
|
||||
}
|
||||
|
||||
[[nodiscard]] ASTNode* clone() const override {
|
||||
@@ -262,6 +268,8 @@ namespace hex::lang {
|
||||
|
||||
~ASTNodePointerVariableDecl() override {
|
||||
delete this->m_type;
|
||||
delete this->m_sizeType;
|
||||
delete this->m_placementOffset;
|
||||
}
|
||||
|
||||
[[nodiscard]] ASTNode* clone() const override {
|
||||
@@ -387,20 +395,29 @@ namespace hex::lang {
|
||||
|
||||
class ASTNodeRValue : public ASTNode {
|
||||
public:
|
||||
explicit ASTNodeRValue(std::vector<std::string> path) : ASTNode(), m_path(std::move(path)) { }
|
||||
using Path = std::vector<std::variant<std::string, ASTNode*>>;
|
||||
|
||||
explicit ASTNodeRValue(Path path) : ASTNode(), m_path(std::move(path)) { }
|
||||
|
||||
ASTNodeRValue(const ASTNodeRValue&) = default;
|
||||
|
||||
~ASTNodeRValue() override {
|
||||
for (auto &part : this->m_path) {
|
||||
if (auto node = std::get_if<ASTNode*>(&part); node != nullptr)
|
||||
delete *node;
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ASTNode* clone() const override {
|
||||
return new ASTNodeRValue(*this);
|
||||
}
|
||||
|
||||
const std::vector<std::string>& getPath() {
|
||||
const Path& getPath() {
|
||||
return this->m_path;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::string> m_path;
|
||||
Path m_path;
|
||||
};
|
||||
|
||||
class ASTNodeScopeResolution : public ASTNode {
|
||||
@@ -550,4 +567,35 @@ namespace hex::lang {
|
||||
std::optional<std::string> m_value;
|
||||
};
|
||||
|
||||
class ASTNodeTypeOperator : public ASTNode {
|
||||
public:
|
||||
ASTNodeTypeOperator(Token::Operator op, ASTNode *expression) : m_op(op), m_expression(expression) {
|
||||
|
||||
}
|
||||
|
||||
ASTNodeTypeOperator(const ASTNodeTypeOperator &other) : ASTNode(other) {
|
||||
this->m_op = other.m_op;
|
||||
this->m_expression = other.m_expression->clone();
|
||||
}
|
||||
|
||||
[[nodiscard]] ASTNode* clone() const override {
|
||||
return new ASTNodeTypeOperator(*this);
|
||||
}
|
||||
|
||||
~ASTNodeTypeOperator() override {
|
||||
delete this->m_expression;
|
||||
}
|
||||
|
||||
Token::Operator getOperator() const {
|
||||
return this->m_op;
|
||||
}
|
||||
|
||||
ASTNode* getExpression() const {
|
||||
return this->m_expression;
|
||||
}
|
||||
|
||||
private:
|
||||
Token::Operator m_op;
|
||||
ASTNode *m_expression;
|
||||
};
|
||||
}
|
||||
@@ -24,10 +24,11 @@ namespace hex::lang {
|
||||
LogConsole& getConsole() { return this->m_console; }
|
||||
|
||||
void setDefaultEndian(std::endian endian) { this->m_defaultDataEndian = endian; }
|
||||
void setRecursionLimit(u32 limit) { this->m_recursionLimit = limit; }
|
||||
void setProvider(prv::Provider *provider) { this->m_provider = provider; }
|
||||
[[nodiscard]] std::endian getCurrentEndian() const { return this->m_endianStack.back(); }
|
||||
|
||||
PatternData* patternFromName(const std::vector<std::string> &name);
|
||||
PatternData* patternFromName(const ASTNodeRValue::Path &name);
|
||||
|
||||
template<typename T>
|
||||
T* asType(ASTNode *param) {
|
||||
@@ -45,18 +46,23 @@ namespace hex::lang {
|
||||
std::vector<std::endian> m_endianStack;
|
||||
std::vector<PatternData*> m_globalMembers;
|
||||
std::vector<std::vector<PatternData*>*> m_currMembers;
|
||||
std::vector<PatternData*> m_currMemberScope;
|
||||
LogConsole m_console;
|
||||
|
||||
u32 m_recursionLimit;
|
||||
u32 m_currRecursionDepth;
|
||||
|
||||
|
||||
ASTNodeIntegerLiteral* evaluateScopeResolution(ASTNodeScopeResolution *node);
|
||||
ASTNodeIntegerLiteral* evaluateRValue(ASTNodeRValue *node);
|
||||
ASTNode* evaluateFunctionCall(ASTNodeFunctionCall *node);
|
||||
ASTNodeIntegerLiteral* evaluateTypeOperator(ASTNodeTypeOperator *typeOperatorNode);
|
||||
ASTNodeIntegerLiteral* evaluateOperator(ASTNodeIntegerLiteral *left, ASTNodeIntegerLiteral *right, Token::Operator op);
|
||||
ASTNodeIntegerLiteral* evaluateOperand(ASTNode *node);
|
||||
ASTNodeIntegerLiteral* evaluateTernaryExpression(ASTNodeTernaryExpression *node);
|
||||
ASTNodeIntegerLiteral* evaluateMathematicalExpression(ASTNodeNumericExpression *node);
|
||||
|
||||
PatternData* findPattern(std::vector<PatternData*> currMembers, const ASTNodeRValue::Path &path);
|
||||
PatternData* evaluateAttributes(ASTNode *currNode, PatternData *currPattern);
|
||||
PatternData* evaluateBuiltinType(ASTNodeBuiltinType *node);
|
||||
void evaluateMember(ASTNode *node, std::vector<PatternData*> &currMembers, bool increaseOffset);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace hex::lang {
|
||||
ASTNode* parseFunctionCall();
|
||||
ASTNode* parseStringLiteral();
|
||||
ASTNode* parseScopeResolution(std::vector<std::string> &path);
|
||||
ASTNode* parseRValue(std::vector<std::string> &path);
|
||||
ASTNode* parseRValue(ASTNodeRValue::Path &path);
|
||||
ASTNode* parseFactor();
|
||||
ASTNode* parseUnaryExpression();
|
||||
ASTNode* parseMultiplicativeExpression();
|
||||
@@ -91,7 +91,10 @@ namespace hex::lang {
|
||||
|
||||
std::vector<ASTNode*> parseTillToken(Token::Type endTokenType, const auto value) {
|
||||
std::vector<ASTNode*> program;
|
||||
ScopeExit guard([&]{ for (auto &node : program) delete node; });
|
||||
auto guard = SCOPE_GUARD {
|
||||
for (auto &node : program)
|
||||
delete node;
|
||||
};
|
||||
|
||||
while (this->m_curr->type != endTokenType || (*this->m_curr) != value) {
|
||||
program.push_back(parseStatement());
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <hex/views/view.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <random>
|
||||
#include <string>
|
||||
|
||||
@@ -25,7 +27,7 @@ namespace hex::lang {
|
||||
if (iscntrl(*c) || *c > 0x7F)
|
||||
result += " ";
|
||||
else
|
||||
result += *c;
|
||||
result += static_cast<char>(*c);
|
||||
}
|
||||
|
||||
if (*(data + size - 1) == '\x00')
|
||||
@@ -39,7 +41,7 @@ namespace hex::lang {
|
||||
class PatternData {
|
||||
public:
|
||||
PatternData(u64 offset, size_t size, u32 color = 0)
|
||||
: m_offset(offset), m_size(size), m_color(color) {
|
||||
: m_offset(offset), m_size(size), m_color(color), m_parent(nullptr) {
|
||||
constexpr u32 Palette[] = { 0x70b4771f, 0x700e7fff, 0x702ca02c, 0x702827d6, 0x70bd6794, 0x704b568c, 0x70c277e3, 0x707f7f7f, 0x7022bdbc, 0x70cfbe17 };
|
||||
|
||||
if (color != 0)
|
||||
@@ -55,7 +57,10 @@ namespace hex::lang {
|
||||
virtual PatternData* clone() = 0;
|
||||
|
||||
[[nodiscard]] u64 getOffset() const { return this->m_offset; }
|
||||
void setOffset(u64 offset) { this->m_offset = offset; }
|
||||
|
||||
[[nodiscard]] size_t getSize() const { return this->m_size; }
|
||||
void setSize(size_t size) { this->m_size = size; }
|
||||
|
||||
[[nodiscard]] const std::string& getVariableName() const { return this->m_variableName; }
|
||||
void setVariableName(std::string name) { this->m_variableName = std::move(name); }
|
||||
@@ -72,6 +77,9 @@ namespace hex::lang {
|
||||
[[nodiscard]] std::endian getEndian() const { return this->m_endian; }
|
||||
void setEndian(std::endian endian) { this->m_endian = endian; }
|
||||
|
||||
[[nodiscard]] PatternData* getParent() const { return this->m_parent; }
|
||||
void setParent(PatternData *parent) { this->m_parent = parent; }
|
||||
|
||||
virtual void createEntry(prv::Provider* &provider) = 0;
|
||||
[[nodiscard]] virtual std::string getFormattedName() const = 0;
|
||||
|
||||
@@ -154,8 +162,7 @@ namespace hex::lang {
|
||||
ImGui::TreeNodeEx(this->getVariableName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_AllowItemOverlap);
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Selectable(("##PatternDataLine"s + std::to_string(this->getOffset())).c_str(), false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
|
||||
Region selectRegion = { this->getOffset(), this->getSize() };
|
||||
View::postEvent(Events::SelectionChangeRequest, selectRegion);
|
||||
EventManager::post<RequestSelectionChange>(Region { this->getOffset(), this->getSize() });
|
||||
}
|
||||
this->drawCommentTooltip();
|
||||
ImGui::SameLine();
|
||||
@@ -192,6 +199,8 @@ namespace hex::lang {
|
||||
std::string m_variableName;
|
||||
std::optional<std::string> m_comment;
|
||||
std::string m_typeName;
|
||||
|
||||
PatternData *m_parent;
|
||||
};
|
||||
|
||||
class PatternDataPadding : public PatternData {
|
||||
@@ -212,9 +221,16 @@ namespace hex::lang {
|
||||
|
||||
class PatternDataPointer : public PatternData {
|
||||
public:
|
||||
PatternDataPointer(u64 offset, size_t size, PatternData *pointedAt, u32 color = 0)
|
||||
: PatternData(offset, size, color), m_pointedAt(pointedAt) {
|
||||
this->m_pointedAt->setVariableName("*" + this->m_pointedAt->getVariableName());
|
||||
PatternDataPointer(u64 offset, size_t size, u32 color = 0)
|
||||
: PatternData(offset, size, color), m_pointedAt(nullptr) {
|
||||
}
|
||||
|
||||
PatternDataPointer(const PatternDataPointer &other) : PatternData(other.getOffset(), other.getSize(), other.getColor()) {
|
||||
this->m_pointedAt = other.m_pointedAt->clone();
|
||||
}
|
||||
|
||||
~PatternDataPointer() override {
|
||||
delete this->m_pointedAt;
|
||||
}
|
||||
|
||||
PatternData* clone() override {
|
||||
@@ -237,7 +253,7 @@ namespace hex::lang {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("0x%04llX", this->getSize());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(ImColor(0xFF9BC64D), "%s*", this->m_pointedAt->getFormattedName().c_str());
|
||||
ImGui::TextColored(ImColor(0xFF9BC64D), "%s", this->getFormattedName().c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("*(0x%llX)", data);
|
||||
|
||||
@@ -269,7 +285,21 @@ namespace hex::lang {
|
||||
return this->m_highlightedAddresses;
|
||||
}
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
return "Pointer";
|
||||
std::string result = this->m_pointedAt->getFormattedName() + "* : ";
|
||||
switch (this->getSize()) {
|
||||
case 1: result += "u8"; break;
|
||||
case 2: result += "u16"; break;
|
||||
case 4: result += "u32"; break;
|
||||
case 8: result += "u64"; break;
|
||||
case 16: result += "u128"; break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void setPointedAtPattern(PatternData *pattern) {
|
||||
this->m_pointedAt = pattern;
|
||||
this->m_pointedAt->setVariableName("*" + this->getVariableName());
|
||||
}
|
||||
|
||||
[[nodiscard]] PatternData* getPointedAtPattern() {
|
||||
@@ -294,7 +324,7 @@ namespace hex::lang {
|
||||
provider->read(this->getOffset(), &data, this->getSize());
|
||||
data = hex::changeEndianess(data, this->getSize(), this->getEndian());
|
||||
|
||||
this->createDefaultEntry(hex::format("%llu (0x%0*llX)", data, this->getSize() * 2, data));
|
||||
this->createDefaultEntry(hex::format("{:d} (0x{:0{}X})", data, data, this->getSize() * 2));
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
@@ -319,13 +349,42 @@ namespace hex::lang {
|
||||
}
|
||||
|
||||
void createEntry(prv::Provider* &provider) override {
|
||||
u64 data = 0;
|
||||
u128 data = 0;
|
||||
provider->read(this->getOffset(), &data, this->getSize());
|
||||
data = hex::changeEndianess(data, this->getSize(), this->getEndian());
|
||||
|
||||
s64 signedData = hex::signExtend(data, this->getSize(), 64);
|
||||
|
||||
this->createDefaultEntry(hex::format("%lld (0x%0*llX)", signedData, this->getSize() * 2, data));
|
||||
switch (this->getSize()) {
|
||||
case 1: {
|
||||
s8 signedData;
|
||||
std::memcpy(&signedData, &data, 1);
|
||||
this->createDefaultEntry(hex::format("{:d} (0x{:0{}X})", signedData, data, 1 * 2));
|
||||
}
|
||||
break;
|
||||
case 2: {
|
||||
s16 signedData;
|
||||
std::memcpy(&signedData, &data, 2);
|
||||
this->createDefaultEntry(hex::format("{:d} (0x{:0{}X})", signedData, data, 2 * 2));
|
||||
}
|
||||
break;
|
||||
case 4: {
|
||||
s32 signedData;
|
||||
std::memcpy(&signedData, &data, 4);
|
||||
this->createDefaultEntry(hex::format("{:d} (0x{:0{}X})", signedData, data, 4 * 2));
|
||||
}
|
||||
break;
|
||||
case 8: {
|
||||
s64 signedData;
|
||||
std::memcpy(&signedData, &data, 8);
|
||||
this->createDefaultEntry(hex::format("{:d} (0x{:0{}X})", signedData, data, 8 * 2));
|
||||
}
|
||||
break;
|
||||
case 16: {
|
||||
s128 signedData;
|
||||
std::memcpy(&signedData, &data, 16);
|
||||
this->createDefaultEntry(hex::format("{:d} (0x{:0{}X})", signedData, data, 16 * 2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
@@ -355,13 +414,13 @@ namespace hex::lang {
|
||||
provider->read(this->getOffset(), &data, 4);
|
||||
data = hex::changeEndianess(data, 4, this->getEndian());
|
||||
|
||||
this->createDefaultEntry(hex::format("%e (0x%0*lX)", *reinterpret_cast<float*>(&data), this->getSize() * 2, data));
|
||||
this->createDefaultEntry(hex::format("{:e} (0x{:0{}X})", *reinterpret_cast<float*>(&data), data, this->getSize() * 2));
|
||||
} else if (this->getSize() == 8) {
|
||||
u64 data = 0;
|
||||
provider->read(this->getOffset(), &data, 8);
|
||||
data = hex::changeEndianess(data, 8, this->getEndian());
|
||||
|
||||
this->createDefaultEntry(hex::format("%e (0x%0*llX)", *reinterpret_cast<double*>(&data), this->getSize() * 2, data));
|
||||
this->createDefaultEntry(hex::format("{:e} (0x{:0{}X})", *reinterpret_cast<double*>(&data), data, this->getSize() * 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +472,7 @@ namespace hex::lang {
|
||||
char character;
|
||||
provider->read(this->getOffset(), &character, 1);
|
||||
|
||||
this->createDefaultEntry(hex::format("'%c'", character));
|
||||
this->createDefaultEntry(hex::format("'{0}'", character));
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
@@ -421,6 +480,27 @@ namespace hex::lang {
|
||||
}
|
||||
};
|
||||
|
||||
class PatternDataCharacter16 : public PatternData {
|
||||
public:
|
||||
explicit PatternDataCharacter16(u64 offset, u32 color = 0)
|
||||
: PatternData(offset, 2, color) { }
|
||||
|
||||
PatternData* clone() override {
|
||||
return new PatternDataCharacter16(*this);
|
||||
}
|
||||
|
||||
void createEntry(prv::Provider* &provider) override {
|
||||
char16_t character;
|
||||
provider->read(this->getOffset(), &character, 2);
|
||||
|
||||
this->createDefaultEntry(hex::format("'{0}'", std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(character)));
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
return "char16";
|
||||
}
|
||||
};
|
||||
|
||||
class PatternDataString : public PatternData {
|
||||
public:
|
||||
PatternDataString(u64 offset, size_t size, u32 color = 0)
|
||||
@@ -435,7 +515,7 @@ namespace hex::lang {
|
||||
provider->read(this->getOffset(), buffer.data(), this->getSize());
|
||||
buffer[this->getSize()] = '\0';
|
||||
|
||||
this->createDefaultEntry(hex::format("\"%s\"", makeDisplayable(buffer.data(), this->getSize()).c_str()));
|
||||
this->createDefaultEntry(hex::format("\"{0}\"", makeDisplayable(buffer.data(), this->getSize()).c_str()));
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
@@ -443,14 +523,47 @@ namespace hex::lang {
|
||||
}
|
||||
};
|
||||
|
||||
class PatternDataString16 : public PatternData {
|
||||
public:
|
||||
PatternDataString16(u64 offset, size_t size, u32 color = 0)
|
||||
: PatternData(offset, size, color) { }
|
||||
|
||||
PatternData* clone() override {
|
||||
return new PatternDataString16(*this);
|
||||
}
|
||||
|
||||
void createEntry(prv::Provider* &provider) override {
|
||||
std::u16string buffer(this->getSize() + 1, 0x00);
|
||||
provider->read(this->getOffset(), buffer.data(), this->getSize());
|
||||
buffer[this->getSize()] = '\0';
|
||||
|
||||
auto utf8String = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(buffer);
|
||||
|
||||
this->createDefaultEntry(hex::format("\"{0}\"", utf8String)) ;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
return "String16";
|
||||
}
|
||||
};
|
||||
|
||||
class PatternDataArray : public PatternData {
|
||||
public:
|
||||
PatternDataArray(u64 offset, size_t size, std::vector<PatternData*> entries, u32 color = 0)
|
||||
: PatternData(offset, size, color), m_entries(std::move(entries)) { }
|
||||
PatternDataArray(u64 offset, size_t size, u32 color = 0)
|
||||
: PatternData(offset, size, color) {
|
||||
}
|
||||
|
||||
PatternDataArray(const PatternDataArray &other) : PatternData(other.getOffset(), other.getSize(), other.getColor()) {
|
||||
std::vector<PatternData*> entries;
|
||||
for (const auto &entry : other.m_entries)
|
||||
this->m_entries.push_back(entry->clone());
|
||||
entries.push_back(entry->clone());
|
||||
|
||||
this->setEntries(entries);
|
||||
}
|
||||
|
||||
~PatternDataArray() override {
|
||||
for (const auto &entry : this->m_entries)
|
||||
delete entry;
|
||||
}
|
||||
|
||||
PatternData* clone() override {
|
||||
@@ -510,24 +623,43 @@ namespace hex::lang {
|
||||
|
||||
return this->m_highlightedAddresses;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
return this->m_entries[0]->getTypeName() + "[" + std::to_string(this->m_entries.size()) + "]";
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::vector<PatternData*>& getEntries() {
|
||||
return this->m_entries;
|
||||
}
|
||||
|
||||
void setEntries(const std::vector<PatternData*> &entries) {
|
||||
this->m_entries = entries;
|
||||
|
||||
for (auto &entry : this->m_entries) {
|
||||
entry->setColor(this->getColor());
|
||||
entry->setParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<PatternData*> m_entries;
|
||||
};
|
||||
|
||||
class PatternDataStruct : public PatternData {
|
||||
public:
|
||||
PatternDataStruct(u64 offset, size_t size, const std::vector<PatternData*> & members, u32 color = 0)
|
||||
: PatternData(offset, size, color), m_members(members), m_sortedMembers(members) { }
|
||||
PatternDataStruct(u64 offset, size_t size, u32 color = 0) : PatternData(offset, size, color){
|
||||
}
|
||||
|
||||
PatternDataStruct(const PatternDataStruct &other) : PatternData(other.getOffset(), other.getSize(), other.getColor()) {
|
||||
for (const auto &member : other.m_members)
|
||||
this->m_members.push_back(member->clone());
|
||||
}
|
||||
|
||||
~PatternDataStruct() override {
|
||||
for (const auto &member : this->m_members)
|
||||
delete member;
|
||||
}
|
||||
|
||||
PatternData* clone() override {
|
||||
return new PatternDataStruct(*this);
|
||||
}
|
||||
@@ -590,10 +722,23 @@ namespace hex::lang {
|
||||
return "struct " + PatternData::getTypeName();
|
||||
}
|
||||
|
||||
const auto& getMembers() const {
|
||||
[[nodiscard]] const auto& getMembers() const {
|
||||
return this->m_members;
|
||||
}
|
||||
|
||||
void setMembers(const std::vector<PatternData*> & members) {
|
||||
this->m_members.clear();
|
||||
|
||||
for (auto &member : members) {
|
||||
if (member == nullptr) continue;
|
||||
|
||||
this->m_members.push_back(member);
|
||||
member->setParent(this);
|
||||
}
|
||||
|
||||
this->m_sortedMembers = this->m_members;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<PatternData*> m_members;
|
||||
std::vector<PatternData*> m_sortedMembers;
|
||||
@@ -601,14 +746,20 @@ namespace hex::lang {
|
||||
|
||||
class PatternDataUnion : public PatternData {
|
||||
public:
|
||||
PatternDataUnion(u64 offset, size_t size, const std::vector<PatternData*> & members, u32 color = 0)
|
||||
: PatternData(offset, size, color), m_members(members), m_sortedMembers(members) { }
|
||||
PatternDataUnion(u64 offset, size_t size, u32 color = 0) : PatternData(offset, size, color) {
|
||||
|
||||
}
|
||||
|
||||
PatternDataUnion(const PatternDataUnion &other) : PatternData(other.getOffset(), other.getSize(), other.getColor()) {
|
||||
for (const auto &member : other.m_members)
|
||||
this->m_members.push_back(member->clone());
|
||||
}
|
||||
|
||||
~PatternDataUnion() override {
|
||||
for (const auto &member : this->m_members)
|
||||
delete member;
|
||||
}
|
||||
|
||||
PatternData* clone() override {
|
||||
return new PatternDataUnion(*this);
|
||||
}
|
||||
@@ -672,10 +823,21 @@ namespace hex::lang {
|
||||
return "union " + PatternData::getTypeName();;
|
||||
}
|
||||
|
||||
const auto& getMembers() const {
|
||||
[[nodiscard]] const auto& getMembers() const {
|
||||
return this->m_members;
|
||||
}
|
||||
|
||||
void setMembers(const std::vector<PatternData*> & members) {
|
||||
for (auto &member : members) {
|
||||
if (member == nullptr) continue;
|
||||
|
||||
this->m_members.push_back(member);
|
||||
member->setParent(this);
|
||||
}
|
||||
|
||||
this->m_sortedMembers = this->m_members;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<PatternData*> m_members;
|
||||
std::vector<PatternData*> m_sortedMembers;
|
||||
@@ -683,8 +845,9 @@ namespace hex::lang {
|
||||
|
||||
class PatternDataEnum : public PatternData {
|
||||
public:
|
||||
PatternDataEnum(u64 offset, size_t size, std::vector<std::pair<Token::IntegerLiteral, std::string>> enumValues, u32 color = 0)
|
||||
: PatternData(offset, size, color), m_enumValues(std::move(enumValues)) { }
|
||||
PatternDataEnum(u64 offset, size_t size, u32 color = 0) : PatternData(offset, size, color) {
|
||||
|
||||
}
|
||||
|
||||
PatternData* clone() override {
|
||||
return new PatternDataEnum(*this);
|
||||
@@ -720,8 +883,7 @@ namespace hex::lang {
|
||||
this->drawCommentTooltip();
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Selectable(("##PatternDataLine"s + std::to_string(this->getOffset())).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||
Region selectRegion = { this->getOffset(), this->getSize() };
|
||||
View::postEvent(Events::SelectionChangeRequest, selectRegion);
|
||||
EventManager::post<RequestSelectionChange>(Region { this->getOffset(), this->getSize() });
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("%s", this->getVariableName().c_str());
|
||||
@@ -734,25 +896,30 @@ namespace hex::lang {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(ImColor(0xFFD69C56), "enum"); ImGui::SameLine(); ImGui::Text("%s", PatternData::getTypeName().c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", hex::format("%s (0x%0*llX)", valueString.c_str(), this->getSize() * 2, value).c_str());
|
||||
ImGui::Text("%s", hex::format("{} (0x{:0{}X})", valueString.c_str(), value, this->getSize() * 2).c_str());
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string getFormattedName() const override {
|
||||
return "enum " + PatternData::getTypeName();
|
||||
}
|
||||
|
||||
const auto& getEnumValues() const {
|
||||
[[nodiscard]] const auto& getEnumValues() const {
|
||||
return this->m_enumValues;
|
||||
}
|
||||
|
||||
void setEnumValues(const std::vector<std::pair<Token::IntegerLiteral, std::string>> &enumValues) {
|
||||
this->m_enumValues = enumValues;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::pair<Token::IntegerLiteral, std::string>> m_enumValues;
|
||||
};
|
||||
|
||||
class PatternDataBitfield : public PatternData {
|
||||
public:
|
||||
PatternDataBitfield(u64 offset, size_t size, std::vector<std::pair<std::string, size_t>> fields, u32 color = 0)
|
||||
: PatternData(offset, size, color), m_fields(std::move(fields)) { }
|
||||
PatternDataBitfield(u64 offset, size_t size, u32 color = 0) : PatternData(offset, size, color) {
|
||||
|
||||
}
|
||||
|
||||
PatternData* clone() override {
|
||||
return new PatternDataBitfield(*this);
|
||||
@@ -779,8 +946,8 @@ namespace hex::lang {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
std::string valueString = "{ ";
|
||||
for (u64 i = 0; i < value.size(); i++)
|
||||
valueString += hex::format("%02x ", value[i]);
|
||||
for (auto i : value)
|
||||
valueString += hex::format("{0:02X} ", i);
|
||||
valueString += "}";
|
||||
|
||||
ImGui::TextUnformatted(valueString.c_str());
|
||||
@@ -821,13 +988,16 @@ namespace hex::lang {
|
||||
return "bitfield " + PatternData::getTypeName();
|
||||
}
|
||||
|
||||
const auto& getFields() const {
|
||||
[[nodiscard]] const auto& getFields() const {
|
||||
return this->m_fields;
|
||||
}
|
||||
|
||||
void setFields(const std::vector<std::pair<std::string, size_t>> &fields) {
|
||||
this->m_fields = fields;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::pair<std::string, size_t>> m_fields;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -39,8 +39,9 @@ namespace hex::lang {
|
||||
Validator *m_validator;
|
||||
Evaluator *m_evaluator;
|
||||
|
||||
prv::Provider *m_provider;
|
||||
std::endian m_defaultEndian;
|
||||
prv::Provider *m_provider = nullptr;
|
||||
std::endian m_defaultEndian = std::endian::native;
|
||||
u32 m_recursionLimit = 32;
|
||||
|
||||
std::optional<std::pair<u32, std::string>> m_currError;
|
||||
};
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace hex::lang {
|
||||
|
||||
std::unordered_map<std::string, std::function<bool(std::string)>> m_pragmaHandlers;
|
||||
|
||||
std::set<std::pair<std::string, std::string>> m_defines;
|
||||
std::set<std::pair<std::string, std::string>> m_pragmas;
|
||||
std::set<std::tuple<std::string, std::string, u32>> m_defines;
|
||||
std::set<std::tuple<std::string, std::string, u32>> m_pragmas;
|
||||
|
||||
std::pair<u32, std::string> m_error;
|
||||
};
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace hex::lang {
|
||||
LittleEndian,
|
||||
BigEndian,
|
||||
If,
|
||||
Else
|
||||
Else,
|
||||
Parent
|
||||
};
|
||||
|
||||
enum class Operator {
|
||||
@@ -60,7 +61,9 @@ namespace hex::lang {
|
||||
BoolXor,
|
||||
BoolNot,
|
||||
TernaryConditional,
|
||||
Dollar
|
||||
Dollar,
|
||||
AddressOf,
|
||||
SizeOf
|
||||
};
|
||||
|
||||
enum class ValueType {
|
||||
@@ -75,6 +78,7 @@ namespace hex::lang {
|
||||
Unsigned128Bit = 0x100,
|
||||
Signed128Bit = 0x101,
|
||||
Character = 0x13,
|
||||
Character16 = 0x23,
|
||||
Boolean = 0x14,
|
||||
Float = 0x42,
|
||||
Double = 0x82,
|
||||
@@ -102,7 +106,8 @@ namespace hex::lang {
|
||||
EndOfProgram
|
||||
};
|
||||
|
||||
using IntegerLiteral = std::pair<ValueType, std::variant<u8, s8, u16, s16, u32, s32, u64, s64, u128, s128, float, double>>;
|
||||
using Integers = std::variant<u8, s8, u16, s16, u32, s32, u64, s64, u128, s128, float, double>;
|
||||
using IntegerLiteral = std::pair<ValueType, Integers>;
|
||||
using ValueTypes = std::variant<Keyword, std::string, Operator, IntegerLiteral, ValueType, Separator>;
|
||||
|
||||
Token(Type type, auto value, u32 lineNumber) : type(type), value(value), lineNumber(lineNumber) {
|
||||
@@ -125,6 +130,28 @@ namespace hex::lang {
|
||||
return static_cast<u32>(type) >> 4;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr static inline IntegerLiteral castTo(ValueType type, const Integers &literal) {
|
||||
return std::visit([type](auto &&value) {
|
||||
switch (type) {
|
||||
case ValueType::Signed8Bit: return IntegerLiteral(type, static_cast<s8>(value));
|
||||
case ValueType::Signed16Bit: return IntegerLiteral(type, static_cast<s16>(value));
|
||||
case ValueType::Signed32Bit: return IntegerLiteral(type, static_cast<s32>(value));
|
||||
case ValueType::Signed64Bit: return IntegerLiteral(type, static_cast<s64>(value));
|
||||
case ValueType::Signed128Bit: return IntegerLiteral(type, static_cast<s128>(value));
|
||||
case ValueType::Unsigned8Bit: return IntegerLiteral(type, static_cast<u8>(value));
|
||||
case ValueType::Unsigned16Bit: return IntegerLiteral(type, static_cast<u16>(value));
|
||||
case ValueType::Unsigned32Bit: return IntegerLiteral(type, static_cast<u32>(value));
|
||||
case ValueType::Unsigned64Bit: return IntegerLiteral(type, static_cast<u64>(value));
|
||||
case ValueType::Unsigned128Bit: return IntegerLiteral(type, static_cast<u128>(value));
|
||||
case ValueType::Float: return IntegerLiteral(type, static_cast<float>(value));
|
||||
case ValueType::Double: return IntegerLiteral(type, static_cast<double>(value));
|
||||
case ValueType::Character: return IntegerLiteral(type, static_cast<char>(value));
|
||||
case ValueType::Character16: return IntegerLiteral(type, static_cast<char16_t>(value));
|
||||
default: __builtin_unreachable();
|
||||
}
|
||||
}, literal);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr static auto getTypeName(const lang::Token::ValueType type) {
|
||||
switch (type) {
|
||||
case ValueType::Signed8Bit: return "s8";
|
||||
@@ -140,6 +167,7 @@ namespace hex::lang {
|
||||
case ValueType::Float: return "float";
|
||||
case ValueType::Double: return "double";
|
||||
case ValueType::Character: return "char";
|
||||
case ValueType::Character16: return "char16";
|
||||
default: return "< ??? >";
|
||||
}
|
||||
}
|
||||
@@ -196,6 +224,7 @@ namespace hex::lang {
|
||||
#define KEYWORD_BE COMPONENT(Keyword, BigEndian)
|
||||
#define KEYWORD_IF COMPONENT(Keyword, If)
|
||||
#define KEYWORD_ELSE COMPONENT(Keyword, Else)
|
||||
#define KEYWORD_PARENT COMPONENT(Keyword, Parent)
|
||||
|
||||
#define INTEGER hex::lang::Token::Type::Integer, hex::lang::Token::IntegerLiteral(hex::lang::Token::ValueType::Any, u64(0))
|
||||
#define IDENTIFIER hex::lang::Token::Type::Identifier, ""
|
||||
@@ -227,6 +256,8 @@ namespace hex::lang {
|
||||
#define OPERATOR_BOOLNOT COMPONENT(Operator, BoolNot)
|
||||
#define OPERATOR_TERNARYCONDITIONAL COMPONENT(Operator, TernaryConditional)
|
||||
#define OPERATOR_DOLLAR COMPONENT(Operator, Dollar)
|
||||
#define OPERATOR_ADDRESSOF COMPONENT(Operator, AddressOf)
|
||||
#define OPERATOR_SIZEOF COMPONENT(Operator, SizeOf)
|
||||
|
||||
#define VALUETYPE_CUSTOMTYPE COMPONENT(ValueType, CustomType)
|
||||
#define VALUETYPE_PADDING COMPONENT(ValueType, Padding)
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace hex::lang {
|
||||
Validator();
|
||||
|
||||
bool validate(const std::vector<ASTNode*>& ast);
|
||||
void printAST(const std::vector<ASTNode*>& ast);
|
||||
|
||||
const std::pair<u32, std::string>& getError() { return this->m_error; }
|
||||
|
||||
|
||||
@@ -11,9 +11,14 @@
|
||||
#include <hex/helpers/shared_data.hpp>
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
#define IMHEX_PLUGIN_SETUP IMHEX_PLUGIN_SETUP_IMPL(IMHEX_PLUGIN_NAME)
|
||||
#define IMHEX_PLUGIN_SETUP(name, author, description) IMHEX_PLUGIN_SETUP_IMPL(IMHEX_PLUGIN_NAME, name, author, description)
|
||||
|
||||
#define IMHEX_PLUGIN_SETUP_IMPL(name) namespace hex::plugin::name::internal { \
|
||||
[[gnu::visibility("default")]] void initializePlugin(); \
|
||||
} \
|
||||
void hex::plugin::name::internal::initializePlugin()
|
||||
#define IMHEX_PLUGIN_SETUP_IMPL(namespaceName, name, author, description) \
|
||||
namespace hex::plugin::namespaceName::internal { \
|
||||
[[gnu::visibility("default")]] void initializePlugin(); \
|
||||
\
|
||||
[[gnu::visibility("default")]] const char* getPluginName() { return name; } \
|
||||
[[gnu::visibility("default")]] const char* getPluginAuthor() { return author; } \
|
||||
[[gnu::visibility("default")]] const char* getPluginDescription() { return description; } \
|
||||
} \
|
||||
void hex::plugin::namespaceName::internal::initializePlugin()
|
||||
|
||||
@@ -23,13 +23,17 @@ namespace hex::prv {
|
||||
virtual bool isReadable() = 0;
|
||||
virtual bool isWritable() = 0;
|
||||
|
||||
virtual void read(u64 offset, void *buffer, size_t size);
|
||||
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 writeRelative(u64 offset, const void *buffer, size_t size);
|
||||
|
||||
virtual void readRaw(u64 offset, void *buffer, size_t size) = 0;
|
||||
virtual void writeRaw(u64 offset, const void *buffer, size_t size) = 0;
|
||||
virtual size_t getActualSize() = 0;
|
||||
|
||||
void applyOverlays(u64 offset, void *buffer, size_t size);
|
||||
|
||||
std::map<u64, u8>& getPatches();
|
||||
void applyPatches();
|
||||
|
||||
@@ -48,10 +52,19 @@ namespace hex::prv {
|
||||
|
||||
virtual std::vector<std::pair<std::string, std::string>> getDataInformation() = 0;
|
||||
|
||||
void addPatch(u64 offset, const void *buffer, size_t size);
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
bool canUndo();
|
||||
bool canRedo();
|
||||
|
||||
protected:
|
||||
u32 m_currPage = 0;
|
||||
u64 m_baseAddress = 0;
|
||||
|
||||
u32 m_patchTreeOffset = 0;
|
||||
std::vector<std::map<u64, u8>> m_patches;
|
||||
std::list<Overlay*> m_overlays;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <ImGuiFileBrowser.h>
|
||||
#include <imgui_imhex_extensions.h>
|
||||
|
||||
#include <fontawesome_font.h>
|
||||
#include <nfd.hpp>
|
||||
|
||||
#include <hex/api/event.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
@@ -17,25 +20,30 @@ namespace hex {
|
||||
|
||||
class View {
|
||||
public:
|
||||
explicit View(std::string viewName);
|
||||
explicit View(std::string unlocalizedViewName);
|
||||
virtual ~View() = default;
|
||||
|
||||
virtual void drawContent() = 0;
|
||||
virtual void drawAlwaysVisible() { }
|
||||
virtual void drawMenu();
|
||||
virtual bool handleShortcut(int key, int mods);
|
||||
virtual bool handleShortcut(bool keys[512], bool ctrl, bool shift, bool alt);
|
||||
virtual bool isAvailable();
|
||||
virtual bool shouldProcess() { return this->isAvailable() && this->getWindowOpenState(); }
|
||||
|
||||
static void openFileBrowser(std::string title, imgui_addons::ImGuiFileBrowser::DialogMode mode, std::string validExtensions, const std::function<void(std::string)> &callback);
|
||||
enum class DialogMode {
|
||||
Open,
|
||||
Save,
|
||||
Folder
|
||||
};
|
||||
|
||||
static void openFileBrowser(std::string_view title, DialogMode mode, const std::vector<nfdfilteritem_t> &validExtensions, const std::function<void(std::string)> &callback);
|
||||
static void doLater(std::function<void()> &&function);
|
||||
static std::vector<std::function<void()>>& getDeferedCalls();
|
||||
|
||||
static std::vector<std::any> postEvent(Events eventType, const std::any &userData = { });
|
||||
|
||||
static void drawCommonInterfaces();
|
||||
|
||||
static void showErrorPopup(std::string_view errorMessage);
|
||||
static void showFatalPopup(std::string_view errorMessage);
|
||||
|
||||
virtual bool hasViewMenuItemEntry();
|
||||
virtual ImVec2 getMinSize();
|
||||
@@ -43,20 +51,19 @@ namespace hex {
|
||||
|
||||
bool& getWindowOpenState();
|
||||
|
||||
std::string_view getName() const;
|
||||
std::string_view getUnlocalizedName() const;
|
||||
|
||||
protected:
|
||||
void subscribeEvent(Events eventType, const std::function<std::any(const std::any&)> &callback);
|
||||
void subscribeEvent(Events eventType, const std::function<void(const std::any&)> &callback);
|
||||
|
||||
void unsubscribeEvent(Events eventType);
|
||||
|
||||
void discardNavigationRequests();
|
||||
protected:
|
||||
|
||||
void confirmButtons(const char *textLeft, const char *textRight, const std::function<void()> &leftButtonFn, const std::function<void()> &rightButtonFn);
|
||||
|
||||
static inline std::string toWindowName(std::string_view unlocalizedName) {
|
||||
return LangEntry(unlocalizedName) + "##" + std::string(unlocalizedName);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_viewName;
|
||||
std::string m_unlocalizedViewName;
|
||||
bool m_windowOpen = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,15 +10,25 @@ namespace hex {
|
||||
/* Settings */
|
||||
|
||||
void ContentRegistry::Settings::load() {
|
||||
std::ifstream settingsFile(std::filesystem::path((SharedData::mainArgv)[0]).parent_path() / "settings.json");
|
||||
for (const auto &dir : hex::getPath(ImHexPath::Config)) {
|
||||
std::ifstream settingsFile(dir + "/settings.json");
|
||||
|
||||
if (settingsFile.good())
|
||||
settingsFile >> getSettingsData();
|
||||
if (settingsFile.good()) {
|
||||
settingsFile >> getSettingsData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ContentRegistry::Settings::store() {
|
||||
std::ofstream settingsFile(std::filesystem::path((SharedData::mainArgv)[0]).parent_path() / "settings.json", std::ios::trunc);
|
||||
settingsFile << getSettingsData();
|
||||
for (const auto &dir : hex::getPath(ImHexPath::Config)) {
|
||||
std::ofstream settingsFile(dir + "/settings.json", std::ios::trunc);
|
||||
|
||||
if (settingsFile.good()) {
|
||||
settingsFile << getSettingsData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ContentRegistry::Settings::add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 defaultValue, const std::function<bool(std::string_view, nlohmann::json&)> &callback) {
|
||||
@@ -28,8 +38,8 @@ namespace hex {
|
||||
|
||||
if (!json.contains(unlocalizedCategory.data()))
|
||||
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = defaultValue;
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()) || !json[unlocalizedCategory.data()][unlocalizedName.data()].is_number())
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = int(defaultValue);
|
||||
}
|
||||
|
||||
void ContentRegistry::Settings::add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view defaultValue, const std::function<bool(std::string_view, nlohmann::json&)> &callback) {
|
||||
@@ -39,8 +49,8 @@ namespace hex {
|
||||
|
||||
if (!json.contains(unlocalizedCategory.data()))
|
||||
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = defaultValue;
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()) || !json[unlocalizedCategory.data()][unlocalizedName.data()].is_string())
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = std::string(defaultValue);
|
||||
}
|
||||
|
||||
void ContentRegistry::Settings::write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 value) {
|
||||
@@ -109,7 +119,7 @@ namespace hex {
|
||||
return SharedData::settingsEntries;
|
||||
}
|
||||
|
||||
std::optional<nlohmann::json> ContentRegistry::Settings::getSetting(std::string_view unlocalizedCategory, std::string_view unlocalizedName) {
|
||||
nlohmann::json ContentRegistry::Settings::getSetting(std::string_view unlocalizedCategory, std::string_view unlocalizedName) {
|
||||
auto &settings = getSettingsData();
|
||||
|
||||
if (!settings.contains(unlocalizedCategory)) return { };
|
||||
@@ -123,21 +133,6 @@ namespace hex {
|
||||
}
|
||||
|
||||
|
||||
/* Events */
|
||||
|
||||
auto ContentRegistry::Events::get(std::string_view name) {
|
||||
auto &customEvents = SharedData::customEvents;
|
||||
auto &lastId = SharedData::customEventsLastId;
|
||||
|
||||
if (!customEvents.contains(name.data())) {
|
||||
customEvents[name.data()] = static_cast<hex::Events>(lastId);
|
||||
lastId++;
|
||||
}
|
||||
|
||||
return customEvents[name.data()];
|
||||
}
|
||||
|
||||
|
||||
/* Command Palette Commands */
|
||||
|
||||
void ContentRegistry::CommandPaletteCommands::add(ContentRegistry::CommandPaletteCommands::Type type, std::string_view command, std::string_view unlocalizedDescription, const std::function<std::string(std::string)> &displayCallback, const std::function<void(std::string)> &executeCallback) {
|
||||
@@ -162,11 +157,11 @@ namespace hex {
|
||||
|
||||
/* Views */
|
||||
|
||||
void ContentRegistry::Views::add(std::unique_ptr<View> &&view) {
|
||||
getEntries().emplace_back(std::move(view));
|
||||
void ContentRegistry::Views::add(View *view) {
|
||||
getEntries().emplace_back(view);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<View>>& ContentRegistry::Views::getEntries() {
|
||||
std::vector<View*>& ContentRegistry::Views::getEntries() {
|
||||
return SharedData::views;
|
||||
}
|
||||
|
||||
@@ -215,7 +210,7 @@ namespace hex {
|
||||
void ContentRegistry::Language::addLocalizations(std::string_view languageCode, const LanguageDefinition &definition) {
|
||||
getLanguageDefinitions()[languageCode.data()].push_back(definition);
|
||||
|
||||
EventManager::post(hex::Events::SettingsChanged, {});
|
||||
EventManager::post<EventSettingsChanged>();
|
||||
}
|
||||
|
||||
std::map<std::string, std::string>& ContentRegistry::Language::getLanguages() {
|
||||
|
||||
@@ -1,30 +1,8 @@
|
||||
#include <hex/api/event.hpp>
|
||||
|
||||
#include <hex/helpers/shared_data.hpp>
|
||||
|
||||
namespace hex {
|
||||
|
||||
std::vector<std::any> EventManager::post(Events eventType, const std::any &userData) {
|
||||
std::vector<std::any> results;
|
||||
for (auto &handler : SharedData::eventHandlers)
|
||||
if (eventType == handler.eventType)
|
||||
results.push_back(handler.callback(userData));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
void EventManager::subscribe(Events eventType, void *owner, std::function<std::any(const std::any&)> callback) {
|
||||
for (auto &handler : SharedData::eventHandlers)
|
||||
if (eventType == handler.eventType && owner == handler.owner)
|
||||
return;
|
||||
|
||||
SharedData::eventHandlers.push_back(EventHandler { owner, eventType, callback });
|
||||
}
|
||||
|
||||
void EventManager::unsubscribe(Events eventType, void *sender) {
|
||||
std::erase_if(SharedData::eventHandlers, [&eventType, &sender](EventHandler handler) {
|
||||
return eventType == handler.eventType && sender == handler.owner;
|
||||
});
|
||||
}
|
||||
std::map<void*, EventManager::EventList::iterator> EventManager::s_tokenStore;
|
||||
EventManager::EventList EventManager::s_events;
|
||||
|
||||
}
|
||||
@@ -14,10 +14,11 @@ namespace hex {
|
||||
entry.comment.reserve(comment.length());
|
||||
std::copy(name.begin(), name.end(), std::back_inserter(entry.name));
|
||||
std::copy(comment.begin(), comment.end(), std::back_inserter(entry.comment));
|
||||
entry.locked = false;
|
||||
|
||||
entry.color = color;
|
||||
|
||||
EventManager::post(Events::AddBookmark, entry);
|
||||
EventManager::post<RequestAddBookmark>(entry);
|
||||
}
|
||||
|
||||
void ImHexApi::Bookmarks::add(u64 addr, size_t size, std::string_view name, std::string_view comment, u32 color) {
|
||||
|
||||
92
plugins/libimhex/source/helpers/net.cpp
Normal file
92
plugins/libimhex/source/helpers/net.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
#include <hex/helpers/net.hpp>
|
||||
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace hex {
|
||||
|
||||
Net::Net() {
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
this->m_ctx = curl_easy_init();
|
||||
}
|
||||
|
||||
Net::~Net() {
|
||||
curl_easy_cleanup(this->m_ctx);
|
||||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
static size_t writeToString(void *contents, size_t size, size_t nmemb, void *userp){
|
||||
static_cast<std::string*>(userp)->append((char*)contents, size * nmemb);
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
static void setCommonSettings(CURL *ctx, std::string &response, std::string_view path, const std::map<std::string, std::string> &extraHeaders, const std::string &body) {
|
||||
struct curl_slist *headers = nullptr;
|
||||
headers = curl_slist_append(headers, "Cache-Control: no-cache");
|
||||
|
||||
if (!extraHeaders.empty())
|
||||
for (const auto &[key, value] : extraHeaders) {
|
||||
std::string entry = key;
|
||||
entry += ": ";
|
||||
entry += value;
|
||||
|
||||
headers = curl_slist_append(headers, entry.c_str());
|
||||
}
|
||||
|
||||
if (!body.empty())
|
||||
curl_easy_setopt(ctx, CURLOPT_POSTFIELDS, body.c_str());
|
||||
|
||||
curl_easy_setopt(ctx, CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(ctx, CURLOPT_USERAGENT, "ImHex/1.0");
|
||||
curl_easy_setopt(ctx, CURLOPT_URL, path.data());
|
||||
curl_easy_setopt(ctx, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(ctx, CURLOPT_DEFAULT_PROTOCOL, "https");
|
||||
curl_easy_setopt(ctx, CURLOPT_WRITEFUNCTION, writeToString);
|
||||
curl_easy_setopt(ctx, CURLOPT_SSL_VERIFYPEER, 1L);
|
||||
curl_easy_setopt(ctx, CURLOPT_SSL_VERIFYHOST, 1L);
|
||||
for (const auto &resourceDir : hex::getPath(hex::ImHexPath::Resources)) {
|
||||
if (std::filesystem::exists(resourceDir + "/cacert.pem"))
|
||||
curl_easy_setopt(ctx, CURLOPT_CAPATH, resourceDir.c_str());
|
||||
}
|
||||
curl_easy_setopt(ctx, CURLOPT_WRITEDATA, &response);
|
||||
curl_easy_setopt(ctx, CURLOPT_TIMEOUT_MS, 2000L);
|
||||
curl_easy_setopt(ctx, CURLOPT_CONNECTTIMEOUT_MS, 2000L);
|
||||
curl_easy_setopt(ctx, CURLOPT_NOPROGRESS, 1L);
|
||||
}
|
||||
|
||||
Response<std::string> Net::getString(std::string_view url) {
|
||||
std::string response;
|
||||
|
||||
curl_easy_setopt(this->m_ctx, CURLOPT_CUSTOMREQUEST, "GET");
|
||||
setCommonSettings(this->m_ctx, response, url, {}, "");
|
||||
|
||||
CURLcode result = curl_easy_perform(this->m_ctx);
|
||||
|
||||
u32 responseCode = 0;
|
||||
curl_easy_getinfo(this->m_ctx, CURLINFO_RESPONSE_CODE, &responseCode);
|
||||
|
||||
if (result != CURLE_OK)
|
||||
return Response<std::string>{ responseCode, "" };
|
||||
else
|
||||
return Response<std::string>{ responseCode, response };
|
||||
}
|
||||
|
||||
Response<nlohmann::json> Net::getJson(std::string_view url) {
|
||||
std::string response;
|
||||
|
||||
curl_easy_setopt(this->m_ctx, CURLOPT_CUSTOMREQUEST, "GET");
|
||||
setCommonSettings(this->m_ctx, response, url, {}, "");
|
||||
|
||||
CURLcode result = curl_easy_perform(this->m_ctx);
|
||||
|
||||
u32 responseCode = 0;
|
||||
curl_easy_getinfo(this->m_ctx, CURLINFO_RESPONSE_CODE, &responseCode);
|
||||
|
||||
if (result != CURLE_OK)
|
||||
return Response<nlohmann::json>{ responseCode, { } };
|
||||
else
|
||||
return Response<nlohmann::json>{ responseCode, nlohmann::json::parse(response) };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,21 +2,19 @@
|
||||
|
||||
namespace hex {
|
||||
|
||||
std::vector<EventHandler> SharedData::eventHandlers;
|
||||
std::vector<std::function<void()>> SharedData::deferredCalls;
|
||||
prv::Provider *SharedData::currentProvider;
|
||||
std::map<std::string, std::vector<ContentRegistry::Settings::Entry>> SharedData::settingsEntries;
|
||||
nlohmann::json SharedData::settingsJson;
|
||||
std::map<std::string, Events> SharedData::customEvents;
|
||||
u32 SharedData::customEventsLastId;
|
||||
std::vector<ContentRegistry::CommandPaletteCommands::Entry> SharedData::commandPaletteCommands;
|
||||
std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> SharedData::patternLanguageFunctions;
|
||||
std::vector<std::unique_ptr<View>> SharedData::views;
|
||||
std::vector<View*> SharedData::views;
|
||||
std::vector<ContentRegistry::Tools::Entry> SharedData::toolsEntries;
|
||||
std::vector<ContentRegistry::DataInspector::Entry> SharedData::dataInspectorEntries;
|
||||
u32 SharedData::patternPaletteOffset;
|
||||
std::string SharedData::errorPopupMessage;
|
||||
std::list<ImHexApi::Bookmarks::Entry> SharedData::bookmarkEntries;
|
||||
std::vector<lang::PatternData*> SharedData::patternData;
|
||||
|
||||
std::map<std::string, std::string> SharedData::languageNames;
|
||||
std::map<std::string, std::vector<LanguageDefinition>> SharedData::languageDefinitions;
|
||||
@@ -25,14 +23,12 @@ namespace hex {
|
||||
std::vector<ContentRegistry::Interface::DrawCallback> SharedData::welcomeScreenEntries;
|
||||
std::vector<ContentRegistry::Interface::DrawCallback> SharedData::footerItems;
|
||||
|
||||
imgui_addons::ImGuiFileBrowser SharedData::fileBrowser;
|
||||
imgui_addons::ImGuiFileBrowser::DialogMode SharedData::fileBrowserDialogMode;
|
||||
std::string SharedData::fileBrowserTitle;
|
||||
std::string SharedData::fileBrowserValidExtensions;
|
||||
std::function<void(std::string)> SharedData::fileBrowserCallback;
|
||||
|
||||
std::vector<ContentRegistry::DataProcessorNode::Entry> SharedData::dataProcessorNodes;
|
||||
u32 SharedData::dataProcessorNodeIdCounter = 1;
|
||||
u32 SharedData::dataProcessorLinkIdCounter = 1;
|
||||
u32 SharedData::dataProcessorAttrIdCounter = 1;
|
||||
|
||||
std::list<std::string> SharedData::recentFilePaths;
|
||||
|
||||
int SharedData::mainArgc;
|
||||
char **SharedData::mainArgv;
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
#include <cstdio>
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <filesystem>
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#elif defined(OS_MACOS)
|
||||
#include <hex/helpers/utils_mac.h>
|
||||
#elif defined(OS_LINUX)
|
||||
#include <xdg.hpp>
|
||||
#endif
|
||||
|
||||
namespace hex {
|
||||
|
||||
@@ -50,7 +60,7 @@ namespace hex {
|
||||
break;
|
||||
}
|
||||
|
||||
std::string result = hex::format("%.2f", value);
|
||||
std::string result = hex::format("{0:.2f}", value);
|
||||
|
||||
switch (unitIndex) {
|
||||
case 0: result += " Bytes"; break;
|
||||
@@ -117,10 +127,20 @@ namespace hex {
|
||||
res.push_back(token);
|
||||
}
|
||||
|
||||
res.push_back(std::string(string.substr(start)));
|
||||
res.emplace_back(string.substr(start));
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string combineStrings(const std::vector<std::string> &strings, std::string_view delimiter) {
|
||||
std::string result;
|
||||
for (const auto &string : strings) {
|
||||
result += string;
|
||||
result += delimiter;
|
||||
}
|
||||
|
||||
return result.substr(0, result.length() - delimiter.length());
|
||||
}
|
||||
|
||||
std::string toEngineeringString(double value) {
|
||||
constexpr std::array Suffixes = { "a", "f", "p", "n", "u", "m", "", "k", "M", "G", "T", "P", "E" };
|
||||
|
||||
@@ -158,15 +178,99 @@ namespace hex {
|
||||
void openWebpage(std::string_view url) {
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
system(hex::format("start %s", url.data()).c_str());
|
||||
system(hex::format("start {0}", url.data()).c_str());
|
||||
#elif defined(OS_MACOS)
|
||||
system(hex::format("open %s", url.data()).c_str());
|
||||
system(hex::format("open {0}", url.data()).c_str());
|
||||
#elif defined(OS_LINUX)
|
||||
system(hex::format("xdg-open %s", url.data()).c_str());
|
||||
system(hex::format("xdg-open {0}", url.data()).c_str());
|
||||
#else
|
||||
#warning "Unknown OS, can't open webpages"
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::string> getPath(ImHexPath path) {
|
||||
#if defined(OS_WINDOWS)
|
||||
std::string exePath(MAX_PATH, '\0');
|
||||
GetModuleFileName(nullptr, exePath.data(), exePath.length());
|
||||
auto parentDir = std::filesystem::path(exePath).parent_path();
|
||||
|
||||
std::filesystem::path appDataDir;
|
||||
{
|
||||
LPWSTR wAppDataPath = nullptr;
|
||||
if (!SUCCEEDED(SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_CREATE, nullptr, &wAppDataPath)))
|
||||
throw std::runtime_error("Failed to get APPDATA folder path");
|
||||
|
||||
appDataDir = wAppDataPath;
|
||||
CoTaskMemFree(wAppDataPath);
|
||||
}
|
||||
|
||||
switch (path) {
|
||||
case ImHexPath::Patterns:
|
||||
return { (parentDir / "patterns").string() };
|
||||
case ImHexPath::PatternsInclude:
|
||||
return { (parentDir / "includes").string() };
|
||||
case ImHexPath::Magic:
|
||||
return { (parentDir / "magic").string() };
|
||||
case ImHexPath::Python:
|
||||
return { parentDir.string() };
|
||||
case ImHexPath::Plugins:
|
||||
return { (parentDir / "plugins").string() };
|
||||
case ImHexPath::Yara:
|
||||
return { (parentDir / "yara").string() };
|
||||
case ImHexPath::Config:
|
||||
return { (appDataDir / "imhex" / "config").string() };
|
||||
case ImHexPath::Resources:
|
||||
return { (parentDir / "resources").string() };
|
||||
default: __builtin_unreachable();
|
||||
}
|
||||
#elif defined(OS_MACOS)
|
||||
return { getPathForMac(path) };
|
||||
#else
|
||||
std::vector<std::filesystem::path> configDirs = xdg::ConfigDirs();
|
||||
std::vector<std::filesystem::path> dataDirs = xdg::DataDirs();
|
||||
|
||||
configDirs.insert(configDirs.begin(), xdg::ConfigHomeDir());
|
||||
dataDirs.insert(dataDirs.begin(), xdg::DataHomeDir());
|
||||
|
||||
std::vector<std::string> result;
|
||||
|
||||
switch (path) {
|
||||
case ImHexPath::Patterns:
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex" / "patterns").string(); });
|
||||
return result;
|
||||
case ImHexPath::PatternsInclude:
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex" / "includes").string(); });
|
||||
return result;
|
||||
case ImHexPath::Magic:
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex" / "magic").string(); });
|
||||
return result;
|
||||
case ImHexPath::Python:
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex").string(); });
|
||||
return result;
|
||||
case ImHexPath::Plugins:
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex" / "plugins").string(); });
|
||||
return result;
|
||||
case ImHexPath::Yara:
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex" / "yara").string(); });
|
||||
return result;
|
||||
case ImHexPath::Config:
|
||||
std::transform(configDirs.begin(), configDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex").string(); });
|
||||
return result;
|
||||
case ImHexPath::Resources:
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result),
|
||||
[](auto p) { return (p / "imhex" / "resources").string(); });
|
||||
return result;
|
||||
default: __builtin_unreachable();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
56
plugins/libimhex/source/helpers/utils_mac.mm
Normal file
56
plugins/libimhex/source/helpers/utils_mac.mm
Normal file
@@ -0,0 +1,56 @@
|
||||
#if defined(OS_MACOS)
|
||||
#include <hex/helpers/utils_mac.h>
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
namespace hex {
|
||||
std::string getPathForMac(ImHexPath path) {
|
||||
@autoreleasepool {
|
||||
NSError * error = nil;
|
||||
NSURL * appSupportDir = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory
|
||||
inDomain:NSUserDomainMask
|
||||
appropriateForURL:nil
|
||||
create:YES
|
||||
error:&error];
|
||||
if (error != nil) {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
NSURL * result = nil;
|
||||
switch (path) {
|
||||
case ImHexPath::Patterns:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/patterns"];
|
||||
break;
|
||||
|
||||
case ImHexPath::PatternsInclude:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/patterns"];
|
||||
break;
|
||||
case ImHexPath::Magic:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/magic"];
|
||||
break;
|
||||
case ImHexPath::Python:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex"];
|
||||
break;
|
||||
case ImHexPath::Plugins:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/plugins"];
|
||||
break;
|
||||
case ImHexPath::Yara:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/yara"];
|
||||
break;
|
||||
case ImHexPath::Config:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/config"];
|
||||
break;
|
||||
case ImHexPath::Resources:
|
||||
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/resources"];
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == nil) {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
return std::string([[result path] UTF8String]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,10 +0,0 @@
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
|
||||
|
||||
namespace hex::lang {
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user