Compare commits

...

52 Commits

Author SHA1 Message Date
WerWolv
44a90f5c7d build: Bumped version to 1.23.0 2022-09-15 14:40:14 +02:00
WerWolv
5c3ee9f499 fix: Dangerous function call popup keep appearing 2022-09-15 11:38:22 +02:00
WerWolv
03f357efd1 patterns: Updated pattern language 2022-09-15 11:31:13 +02:00
WerWolv
5462575f5c sys: Allow multiple files to be opened through the command line 2022-09-15 09:48:02 +02:00
WerWolv
120e2bc300 sys: Fix opening files in existing instance not working on Intel GPUs 2022-09-15 09:47:47 +02:00
WerWolv
c3137df83c patterns: Updated pattern language 2022-09-15 09:46:38 +02:00
WerWolv
737155a226 patterns: Added hex::core::get_selection function 2022-09-15 09:34:59 +02:00
WerWolv
66d64cf020 patterns: Refactor creation of default runtime 2022-09-15 09:34:40 +02:00
WerWolv
42f5c0f484 fix: Tasks being interrupted even if they already finished 2022-09-14 13:51:48 +02:00
WerWolv
75047e26e2 feat: Added various new Copy as... options 2022-09-13 23:48:47 +02:00
Colin Kinloch
9fa6d82775 build: Install Database files from subdirectory in offline builds (#737)
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Co-authored-by: Colin Kinloch <colin.kinloch@collabora.com>
2022-09-13 22:34:33 +02:00
WerWolv
d1468984e7 fix: Copy as... -> ASCII Art inserting too much whitespace 2022-09-13 22:02:57 +02:00
WerWolv
20a2331504 feat: Allow task stop button to abort pattern evaluation 2022-09-13 16:05:41 +02:00
WerWolv
5b00c8ee08 feat: Added find view reset button 2022-09-13 14:22:18 +02:00
WerWolv
bda4aadc54 fix: Sequence escape codes 2022-09-13 14:10:52 +02:00
WerWolv
9d7e2eccac feat: Added "Require full match" toggle to regex string search 2022-09-13 14:06:19 +02:00
WerWolv
8c219b981c fix: Searching for invalid binary sequence causing too many matches 2022-09-13 14:05:48 +02:00
WerWolv
7d87c8bb98 patterns: Added references 2022-09-13 13:14:36 +02:00
WerWolv
13afd96806 fix: Build issues due to invalid capture 2022-09-12 23:45:37 +02:00
WerWolv
4fb74a1769 patterns: Updated pattern language 2022-09-12 21:28:29 +02:00
WerWolv
aa658b7dbc sys: Make sure constexpr variables don't get copied onto the stack 2022-09-12 21:28:02 +02:00
xtexChooser
7e3601989a lang: Update Chinese(Simplified) translation (#739) 2022-09-11 21:56:55 +02:00
WerWolv
3a1c0f8d66 fix: Disk provider slowing down loading of ImHex 2022-09-11 21:06:15 +02:00
WerWolv
91160b4311 fix: Copy as... function sometimes producing invalid results
Fixes #738
2022-09-09 20:13:49 +02:00
WerWolv
83f4093796 fix: Rendering of pattern array entries not working correctly 2022-09-08 23:03:58 +02:00
iTrooz_
f219395b25 build: Added AppImage zsync and updated metadata (#733)
* added update information

* upload zsync

* set version of appimage

* release: do not execute steps which needs a token when not provided

* set the appimage output name directly in the recipe file

* add metainfo file in every Linux package

* update metainfo file

* set categories in the metainfo file

* add both .metainfo.xml and .appdata.xml files because it is the old standard still wanted by some things

* actually use WerWolv's repository for AppImage updates

* rename metainfo files

* Typo : appdata and not appinfo

* split screenshots
2022-09-08 09:31:49 +02:00
iTrooz_
ae6a7ad8e5 build: Change Ubuntu package name, updated README (#734)
* rename Ubuntu 22.04 deb

* fix typo in readme

* says explicitely that AppImage is available for all distributions
2022-09-08 09:30:56 +02:00
WerWolv
d990ee102a sys: More cleanup 2022-09-07 23:11:24 +02:00
WerWolv
cfde9939b4 sys: Refactor and cleanup pattern drawer 2022-09-07 23:11:13 +02:00
iTrooz_
a22725bb67 build: Cleanup PKGBUILD (#732)
* [From Morten Linderud] update PKGBUILD

* quote strings in PKGBUILD

* do not use ls to

* do not hardcode version
2022-09-07 22:23:56 +02:00
WerWolv
7a4040f6ec ui: Fixed indentation of sealed patterns in pattern data view 2022-09-07 22:21:44 +02:00
WerWolv
2fbb351314 patterns: Updated pattern language 2022-09-07 11:32:47 +02:00
WerWolv
96e85c0685 ui: Removed unused space in hex editor footer 2022-09-07 11:32:33 +02:00
WerWolv
50577c9ea0 patterns: Updated pattern language 2022-09-07 00:14:05 +02:00
WerWolv
073323b517 ui: Fix invalid indentation with inlined patterns 2022-09-06 20:04:55 +02:00
WerWolv
37cc8f3aae patterns: Updated pattern language 2022-09-06 10:50:26 +02:00
WerWolv
6367152650 ux: Fixed welcome screen settings button not always working 2022-09-06 10:50:17 +02:00
WerWolv
ffbaef3872 build: Make sure cmake gets reconfigured when version file changes 2022-09-06 10:43:43 +02:00
WerWolv
a0b2473bf4 ui: Improved pattern color visualization 2022-09-05 23:34:20 +02:00
WerWolv
95a3104a56 sys: Only display FPS in debug builds 2022-09-05 22:37:28 +02:00
WerWolv
2d5f77730b patterns: Updated pattern language 2022-09-05 22:09:44 +02:00
WerWolv
033a0dfbb9 patterns: Updated pattern language 2022-09-05 14:16:44 +02:00
WerWolv
cb682b6e21 ui: Fixed graphics artifacts on welcome screen 2022-09-05 14:16:31 +02:00
WerWolv
7312908d4d resources: Invert colors of logo 2022-09-04 21:36:00 +02:00
WerWolv
b44f6035b3 resources: Added dark mode for logo text 2022-09-04 21:18:09 +02:00
WerWolv
b6bc8abf83 git: Added better logo to readme 2022-09-04 20:51:07 +02:00
WerWolv
c60c1154b9 patterns: Updated pattern language
Fixes #276
2022-09-04 20:37:40 +02:00
Jonathan Wright
219afb6244 build: Change appdata metadata file license to CC0 (#727) 2022-09-04 20:24:04 +02:00
WerWolv
22b6bdb5cf feat: Added Copy as -> Address option to Edit menu
Closes #725
2022-09-04 14:23:09 +02:00
WerWolv
d9a47fe815 fix: Crashes when resizing file
Fixes #721
2022-09-04 11:16:24 +02:00
Nik
45e987b413 git: Fixed Arch Linux package name in readme 2022-09-04 01:23:51 +02:00
Kainoa Kanter
a920696d03 git: Update AUR instructions (#722)
`yay install` is not a proper verb
2022-09-04 00:50:47 +02:00
68 changed files with 823 additions and 520 deletions

View File

@@ -321,7 +321,7 @@ jobs:
run: | run: |
cp -r build/DEBIAN build/DebDir cp -r build/DEBIAN build/DebDir
dpkg-deb -Zgzip --build build/DebDir dpkg-deb -Zgzip --build build/DebDir
mv build/DebDir.deb imhex-${{env.IMHEX_VERSION}}.deb mv build/DebDir.deb imhex-${{env.IMHEX_VERSION}}-Ubuntu-22.04.deb
# AppImage cmake build # AppImage cmake build
- name: 🛠️ Reconfigure build for AppImage - name: 🛠️ Reconfigure build for AppImage
@@ -345,10 +345,8 @@ jobs:
- name: 📦 Bundle AppImage - name: 📦 Bundle AppImage
run: | run: |
cd build-appimage cd build-appimage
mkdir -p ./AppDir/usr/share/metainfo export VERSION=${{env.IMHEX_VERSION}}
cp ../dist/imhex.appdata.xml ./AppDir/usr/share/metainfo/imhex.appdata.xml
appimage-builder --recipe ../dist/AppImageBuilder.yml appimage-builder --recipe ../dist/AppImageBuilder.yml
mv ImHex-AppImage-x86_64.AppImage ../imhex-${{env.IMHEX_VERSION}}.AppImage
cd .. cd ..
#- name: ⬆️ Upload Flatpak #- name: ⬆️ Upload Flatpak
@@ -361,14 +359,20 @@ jobs:
- name: ⬆️ Upload DEB - name: ⬆️ Upload DEB
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: Linux DEB (Ubuntu 22.04) name: Ubuntu 22.04 DEB
path: '*.deb' path: '*.deb'
- name: ⬆️ Upload AppImage - name: ⬆️ Upload AppImage
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: Linux AppImage name: Linux AppImage
path: '*.AppImage' path: 'build-appimage/*.AppImage'
- name: ⬆️ Upload AppImage zsync
uses: actions/upload-artifact@v3
with:
name: Linux AppImage zsync
path: 'build-appimage/*.AppImage.zsync'
# ArchLinux build # ArchLinux build
archlinux-build: archlinux-build:

View File

@@ -116,6 +116,9 @@ jobs:
- name: ✉️ Update C++ Plugin Template - name: ✉️ Update C++ Plugin Template
uses: mvasigh/dispatch-action@main uses: mvasigh/dispatch-action@main
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
if: "${{ env.RELEASE_TOKEN != '' }}"
with: with:
token: ${{ secrets.RELEASE_TOKEN }} token: ${{ secrets.RELEASE_TOKEN }}
repo: ImHex-Cpp-Plugin-Template repo: ImHex-Cpp-Plugin-Template
@@ -135,6 +138,7 @@ jobs:
shell: pwsh shell: pwsh
env: env:
WINGET_GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} WINGET_GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
if: "${{ env.WINGET_GITHUB_TOKEN != '' }}"
run: | run: |
$tagname = $env:GITHUB_REF.Replace("refs/tags/", "") $tagname = $env:GITHUB_REF.Replace("refs/tags/", "")
$version = $tagname.Replace("v", "") $version = $tagname.Replace("v", "")

1
.idea/vcs.xml generated
View File

@@ -8,6 +8,7 @@
<mapping directory="$PROJECT_DIR$/lib/external/libromfs" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/external/libromfs" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/external/nativefiledialog" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/external/nativefiledialog" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/external/pattern_language" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/external/pattern_language" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/external/pattern_language/external/cli11" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/external/pattern_language/external/fmt" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/external/pattern_language/external/fmt" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/external/xdgpp" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/external/xdgpp" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/external/yara/yara" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/external/yara/yara" vcs="Git" />

View File

@@ -1,4 +1,4 @@
<a href="https://imhex.werwolv.net"><h1 align="center" >:mag: ImHex</h1></a> <a href="https://imhex.werwolv.net"><h1 align="center" ><img height="100px" src="resources/projects/logo_text.svg"></h1></a>
<p align="center">A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.</p> <p align="center">A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.</p>
@@ -116,7 +116,7 @@ For format patterns, libraries, magic and constant files, check out the [ImHex-P
To use ImHex, the following minimal system requirements need to be met: To use ImHex, the following minimal system requirements need to be met:
- **OS**: Windows 7 or higher, macOS 10.15 (Catalina) or higher, "Modern" Linux (Ubuntu 22.04+, Fedora Stable/Rawhide, and Arch Linux are officially supported) - **OS**: Windows 7 or higher, macOS 10.15 (Catalina) or higher, "Modern" Linux (Ubuntu 22.04, Fedora Stable/Rawhide, and Arch Linux have official packages, other distributions can use the AppImage)
- **CPU**: x86_64 (64 Bit) - **CPU**: x86_64 (64 Bit)
- **GPU**: OpenGL 3.0 or higher (preferable a dedicated GPU and not Intel HD Graphics) - **GPU**: OpenGL 3.0 or higher (preferable a dedicated GPU and not Intel HD Graphics)
- **RAM**: 512MB, more may be required for more complicated analysis - **RAM**: 512MB, more may be required for more complicated analysis
@@ -129,7 +129,7 @@ To develop plugins for ImHex, use one of the following two templates projects to
- [Rust Plugin Template](https://github.com/WerWolv/ImHex-Rust-Plugin-Template) - [Rust Plugin Template](https://github.com/WerWolv/ImHex-Rust-Plugin-Template)
## Installing ## Installing
The following OSs have packages available in their respositories making it easy to install ImHex. The following OSs have packages available in their repositories making it easy to install ImHex.
### Fedora (36+) ### Fedora (36+)
``` ```
dnf install imhex dnf install imhex
@@ -139,7 +139,7 @@ dnf install imhex
### Arch Linux (AUR) ### Arch Linux (AUR)
``` ```
yay install imhex yay -S imhex-bin
``` ```
## Third Party Repositories ## Third Party Repositories
@@ -158,7 +158,7 @@ Nightlies are available via GitHub Actions [here](https://github.com/WerWolv/ImH
- MacOS • __x86_64__ - MacOS • __x86_64__
- [DMG](https://nightly.link/WerWolv/ImHex/workflows/build/master/macOS%20DMG.zip) - [DMG](https://nightly.link/WerWolv/ImHex/workflows/build/master/macOS%20DMG.zip)
- Linux • __x86_64__ - Linux • __x86_64__
- [Ubuntu DEB](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20DEB%20%28Ubuntu%2022.04%29.zip) - [Ubuntu 22.04 DEB](https://nightly.link/WerWolv/ImHex/workflows/build/master/Ubuntu%2022.04%20DEB.zip)
- [AppImage](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20AppImage.zip) - [AppImage](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20AppImage.zip)
- [Arch Package](https://nightly.link/WerWolv/ImHex/workflows/build/master/ArchLinux%20.pkg.tar.zst.zip) - [Arch Package](https://nightly.link/WerWolv/ImHex/workflows/build/master/ArchLinux%20.pkg.tar.zst.zip)
- [Fedora Rawhide RPM](https://nightly.link/WerWolv/ImHex/workflows/build/master/Fedora%20Rawhide%20RPM.zip) - [Fedora Rawhide RPM](https://nightly.link/WerWolv/ImHex/workflows/build/master/Fedora%20Rawhide%20RPM.zip)

View File

@@ -1 +1 @@
1.22.0 1.23.0

View File

@@ -265,6 +265,14 @@ macro(createPackage)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps RENAME imhex.png) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps RENAME imhex.png)
install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS}) install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS})
downloadImHexPatternsFiles("./share/imhex") downloadImHexPatternsFiles("./share/imhex")
# install AppStream file
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.imhex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
# install symlink for the old standard name
file(CREATE_LINK net.werwolv.imhex.metainfo.xml ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml SYMBOLIC)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
endif() endif()
if (CREATE_BUNDLE) if (CREATE_BUNDLE)
@@ -323,7 +331,9 @@ macro(setDefaultBuiltTypeIfUnset)
endmacro() endmacro()
function(loadVersion version) function(loadVersion version)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" read_version) set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${VERSION_FILE})
file(READ "${VERSION_FILE}" read_version)
set(${version} ${read_version} PARENT_SCOPE) set(${version} ${read_version} PARENT_SCOPE)
endfunction() endfunction()
@@ -382,6 +392,12 @@ function(downloadImHexPatternsFiles dest)
FetchContent_Populate(imhex_patterns) FetchContent_Populate(imhex_patterns)
else ()
# Maybe patterns are cloned to a subdirectory
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ImHex-Patterns")
endif ()
if (EXISTS ${imhex_patterns_SOURCE_DIR})
set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns magic) set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns magic)
foreach (FOLDER ${PATTERNS_FOLDERS_TO_INSTALL}) foreach (FOLDER ${PATTERNS_FOLDERS_TO_INSTALL})
install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION ${dest}) install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION ${dest})

View File

@@ -6,7 +6,7 @@ AppDir:
id: imhex id: imhex
name: ImHex name: ImHex
icon: imhex icon: imhex
version: AppImage version: "{{VERSION}}"
exec: usr/bin/imhex exec: usr/bin/imhex
exec_args: $@ exec_args: $@
apt: apt:
@@ -136,4 +136,5 @@ AppDir:
- usr/share/doc/*/TODO.* - usr/share/doc/*/TODO.*
AppImage: AppImage:
arch: x86_64 arch: x86_64
update-information: guess update-information: gh-releases-zsync|WerWolv|ImHex|latest|imhex-*.AppImage.zsync
file_name: imhex-{{VERSION}}.AppImage

33
dist/Arch/PKGBUILD vendored
View File

@@ -1,40 +1,29 @@
# Maintainer: iTrooz_ <itrooz at protonmail dot com> # Maintainer: iTrooz_ <itrooz at protonmail dot com>
# Contributor: Morten Linderud <foxboron@archlinux.org>
pkgname=imhex-bin pkgname=imhex-bin
pkgver=%version% pkgver=%version%
pkgrel=1 pkgrel=1
pkgdesc="A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM. " pkgdesc="A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM. "
arch=("x86_64") arch=("x86_64")
url="https://github.com/WerWolv/ImHex" url="https://github.com/WerWolv/ImHex"
repo=$url license=('GPL2')
license=('GPL 2.0')
groups=()
depends=(glfw mbedtls python freetype2 libglvnd dbus xdg-desktop-portal curl fmt yara nlohmann-json) depends=(glfw mbedtls python freetype2 libglvnd dbus xdg-desktop-portal curl fmt yara nlohmann-json)
makedepends=(git) makedepends=(git)
checkdepends=()
optdepends=()
provides=(imhex) provides=(imhex)
conflicts=(imhex) conflicts=(imhex)
replaces=() source=("$url/releases/download/v$pkgver/imhex-$pkgver-ArchLinux.pkg.tar.zst")
backup=()
options=()
source=($repo"/releases/download/v$pkgver/imhex-$pkgver-ArchLinux.pkg.tar.zst")
noextract=()
md5sums=(SKIP) md5sums=(SKIP)
validpgpkeys=()
package() { package() {
tar -xf imhex-$pkgver-ArchLinux.pkg.tar.zst install -Dm755 "$srcdir/usr/bin/imhex" "$pkgdir/usr/bin/imhex"
install -Dm644 "$srcdir/usr/lib/libimhex.so.$pkgver" "$pkgdir/usr/lib/libimhex.so.$pkgver"
install -DT $srcdir/usr/bin/imhex $pkgdir/usr/bin/imhex for plugin in "$srcdir/usr/lib/imhex/plugins/"*.hexplug; do
install -DT $srcdir/usr/lib/libimhex.so.$pkgver $pkgdir/usr/lib/libimhex.so.$pkgver install -Dm644 "$plugin" "$pkgdir/usr/lib/imhex/plugins/${plugin##*/}"
for plugin in $srcdir/usr/lib/imhex/plugins/*.hexplug;
do
install -DT $plugin $pkgdir/usr/lib/imhex/plugins/`basename $plugin`
done done
mkdir -p $pkgdir/usr/share/imhex install -d "$pkgdir/usr/share/imhex"
cp -r $srcdir/usr/share/imhex/{constants,encodings,includes,magic,patterns} $pkgdir/usr/share/imhex cp -r "$srcdir/usr/share/imhex/"{constants,encodings,includes,magic,patterns} "$pkgdir/usr/share/imhex"
cp -r $srcdir/usr/share/{applications,licenses} $pkgdir/usr/share cp -r "$srcdir/usr/share/"{applications,licenses} "$pkgdir/usr/share"
install -d $pkgdir/usr/share
} }

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>imhex</id>
<metadata_license>GPL-2.0</metadata_license>
<project_license>GPL-2.0</project_license>
<name>ImHex</name>
<summary>A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM</summary>
<description>
<p>ImHex is a feature-rich Hex Editor aimed towards Reverse Engineers working with foreign data formats, malware, executables and raw memory.
Besides all the features a common Hex Editor has, ImHex also features a custom scripting language used to declare and dissect data structures, support for running YARA rules, a node-based graphical data pre-processor and support for various data sources such as files, raw disks or GDB Servers.</p>
</description>
<launchable type="desktop-id">imhex.desktop</launchable>
<url type="homepage">https://imhex.werwolv.net</url>
<screenshots>
<screenshot type="default">
<image>https://user-images.githubusercontent.com/10835354/139717326-8044769d-527b-4d88-8adf-2d4ecafdca1f.png</image>
</screenshot>
</screenshots>
<provides>
<id>imhex.desktop</id>
</provides>
</component>

34
dist/net.werwolv.imhex.metainfo.xml vendored Normal file
View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>imhex</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0</project_license>
<name>ImHex</name>
<developer_name>WerWolv</developer_name>
<update_contact>hey@werwolv.net</update_contact>
<summary>A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM</summary>
<description>
<p>ImHex is a feature-rich Hex Editor aimed towards Reverse Engineers working with foreign data formats, malware, executables and raw memory.
Besides all the features a common Hex Editor has, ImHex also features a custom scripting language used to declare and dissect data structures, support for running YARA rules, a node-based graphical data pre-processor and support for various data sources such as files, raw disks or GDB Servers.</p>
</description>
<launchable type="desktop-id">imhex.desktop</launchable>
<url type="homepage">https://imhex.werwolv.net</url>
<screenshots>
<screenshot type="default">
<image>https://user-images.githubusercontent.com/10835354/139717326-8044769d-527b-4d88-8adf-2d4ecafdca1f.png</image>
</screenshot>
<screenshot>
<image>https://user-images.githubusercontent.com/10835354/139717323-1f8c9d52-f7eb-4f43-9f11-097ac728ed6c.png</image>
</screenshot>
</screenshots>
<provides>
<id>imhex.desktop</id>
</provides>
<categories>
<category>Development</category>
</categories>
</component>

2
dist/rpm/imhex.spec vendored
View File

@@ -84,5 +84,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/imhex.desktop
%{_datadir}/applications/imhex.desktop %{_datadir}/applications/imhex.desktop
%{_prefix}/lib64/libimhex.so.%{_version} %{_prefix}/lib64/libimhex.so.%{_version}
%{_prefix}/lib64/imhex/plugins/* %{_prefix}/lib64/imhex/plugins/*
%{_metainfodir}/net.werwolv.imhex.metainfo.xml
%{_metainfodir}/net.werwolv.imhex.appdata.xml
%changelog %changelog

View File

@@ -99,7 +99,7 @@
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details. // Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
//#define ImDrawIdx unsigned int #define ImDrawIdx unsigned int
//---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
//struct ImDrawList; //struct ImDrawList;

View File

@@ -136,7 +136,7 @@ namespace hex {
} }
std::unique_ptr<pl::PatternLanguage> createDefaultRuntime(prv::Provider *provider); void configureRuntime(pl::PatternLanguage &runtime, prv::Provider *provider);
void addPragma(const std::string &name, const pl::api::PragmaHandler &handler); void addPragma(const std::string &name, const pl::api::PragmaHandler &handler);

View File

@@ -179,10 +179,10 @@ namespace hex {
return result; return result;
} }
static constexpr auto CTRL = Key(static_cast<Keys>(0x1000'0000)); constexpr static auto CTRL = Key(static_cast<Keys>(0x1000'0000));
static constexpr auto ALT = Key(static_cast<Keys>(0x2000'0000)); constexpr static auto ALT = Key(static_cast<Keys>(0x2000'0000));
static constexpr auto SHIFT = Key(static_cast<Keys>(0x4000'0000)); constexpr static auto SHIFT = Key(static_cast<Keys>(0x4000'0000));
static constexpr auto SUPER = Key(static_cast<Keys>(0x8000'0000)); constexpr static auto SUPER = Key(static_cast<Keys>(0x8000'0000));
class ShortcutManager { class ShortcutManager {
public: public:

View File

@@ -40,6 +40,8 @@ namespace hex {
void interrupt(); void interrupt();
void setInterruptCallback(std::function<void()> callback);
private: private:
void finish(); void finish();
void interruption(); void interruption();
@@ -51,6 +53,7 @@ namespace hex {
std::string m_unlocalizedName; std::string m_unlocalizedName;
u64 m_currValue, m_maxValue; u64 m_currValue, m_maxValue;
std::thread m_thread; std::thread m_thread;
std::function<void()> m_interruptCallback;
bool m_shouldInterrupt = false; bool m_shouldInterrupt = false;

View File

@@ -31,7 +31,7 @@ namespace hex {
class Disassembler { class Disassembler {
public: public:
static constexpr cs_arch toCapstoneArchitecture(Architecture architecture) { constexpr static cs_arch toCapstoneArchitecture(Architecture architecture) {
return static_cast<cs_arch>(architecture); return static_cast<cs_arch>(architecture);
} }

View File

@@ -35,7 +35,7 @@ namespace hex {
Net(); Net();
~Net(); ~Net();
static constexpr u32 DefaultTimeout = 2'000; constexpr static u32 DefaultTimeout = 2'000;
std::future<Response<std::string>> getString(const std::string &url, u32 timeout = DefaultTimeout); std::future<Response<std::string>> getString(const std::string &url, u32 timeout = DefaultTimeout);
std::future<Response<nlohmann::json>> getJson(const std::string &url, u32 timeout = DefaultTimeout); std::future<Response<nlohmann::json>> getJson(const std::string &url, u32 timeout = DefaultTimeout);

View File

@@ -14,10 +14,6 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace pl {
class PatternLanguage;
}
namespace hex::prv { namespace hex::prv {
class Provider { class Provider {
@@ -70,8 +66,8 @@ namespace hex::prv {
[[nodiscard]] virtual std::string getName() const = 0; [[nodiscard]] virtual std::string getName() const = 0;
[[nodiscard]] virtual std::vector<std::pair<std::string, std::string>> getDataInformation() const = 0; [[nodiscard]] virtual std::vector<std::pair<std::string, std::string>> getDataInformation() const = 0;
[[nodiscard]] virtual bool open(); [[nodiscard]] virtual bool open() = 0;
virtual void close(); virtual void close() = 0;
void addPatch(u64 offset, const void *buffer, size_t size, bool createUndo = false); void addPatch(u64 offset, const void *buffer, size_t size, bool createUndo = false);
void createUndoPoint(); void createUndoPoint();

View File

@@ -241,29 +241,30 @@ namespace hex {
return functionName; return functionName;
} }
std::unique_ptr<pl::PatternLanguage> createDefaultRuntime(prv::Provider *provider) { void configureRuntime(pl::PatternLanguage &runtime, prv::Provider *provider) {
auto runtime = std::make_unique<pl::PatternLanguage>(); runtime.reset();
if (provider != nullptr) { if (provider != nullptr) {
runtime->setDataSource([provider](u64 offset, u8 *buffer, size_t size) { runtime.setDataSource([provider](u64 offset, u8 *buffer, size_t size) {
provider->read(offset, buffer, size); provider->read(offset, buffer, size);
}, provider->getBaseAddress(), provider->getActualSize()); }, provider->getBaseAddress(), provider->getActualSize());
} }
runtime->setIncludePaths(fs::getDefaultPaths(fs::ImHexPath::PatternsInclude) | fs::getDefaultPaths(fs::ImHexPath::Patterns)); runtime.setIncludePaths(fs::getDefaultPaths(fs::ImHexPath::PatternsInclude) | fs::getDefaultPaths(fs::ImHexPath::Patterns));
for (const auto &func : getFunctions()) { for (const auto &func : getFunctions()) {
if (func.dangerous) if (func.dangerous)
runtime->addDangerousFunction(func.ns, func.name, func.parameterCount, func.callback); runtime.addDangerousFunction(func.ns, func.name, func.parameterCount, func.callback);
else else
runtime->addFunction(func.ns, func.name, func.parameterCount, func.callback); runtime.addFunction(func.ns, func.name, func.parameterCount, func.callback);
} }
for (const auto &[name, callback] : getPragmas()) { for (const auto &[name, callback] : getPragmas()) {
runtime->addPragma(name, callback); runtime.addPragma(name, callback);
} }
return runtime; runtime.addDefine("__IMHEX__");
runtime.addDefine("__IMHEX_VERSION__", IMHEX_VERSION);
} }
void addPragma(const std::string &name, const pl::api::PragmaHandler &handler) { void addPragma(const std::string &name, const pl::api::PragmaHandler &handler) {

View File

@@ -208,7 +208,7 @@ namespace hex {
namespace ImHexApi::Provider { namespace ImHexApi::Provider {
static u32 s_currentProvider = std::numeric_limits<u32>::max(); static i64 s_currentProvider = -1;
static std::vector<prv::Provider *> s_providers; static std::vector<prv::Provider *> s_providers;
namespace impl { namespace impl {
@@ -247,7 +247,7 @@ namespace hex {
} }
bool isValid() { bool isValid() {
return !s_providers.empty() && s_currentProvider < s_providers.size(); return !s_providers.empty() && s_currentProvider < i64(s_providers.size());
} }
void markDirty() { void markDirty() {
@@ -308,6 +308,8 @@ namespace hex {
setCurrentProvider(0); setCurrentProvider(0);
provider->close(); provider->close();
EventManager::post<EventProviderClosed>(provider);
delete provider; delete provider;
} }

View File

@@ -48,7 +48,9 @@ namespace hex {
} }
Task::~Task() { Task::~Task() {
this->interrupt(); if (!this->isFinished())
this->interrupt();
this->m_thread.join(); this->m_thread.join();
} }
@@ -72,6 +74,13 @@ namespace hex {
std::scoped_lock lock(this->m_mutex); std::scoped_lock lock(this->m_mutex);
this->m_shouldInterrupt = true; this->m_shouldInterrupt = true;
if (this->m_interruptCallback)
this->m_interruptCallback();
}
void Task::setInterruptCallback(std::function<void()> callback) {
this->m_interruptCallback = std::move(callback);
} }
bool Task::isFinished() const { bool Task::isFinished() const {

View File

@@ -190,15 +190,26 @@ namespace hex {
curl_mimepart *part = curl_mime_addpart(mime); curl_mimepart *part = curl_mime_addpart(mime);
auto fileName = filePath.filename().string(); auto fileName = filePath.filename().string();
curl_mime_data_cb( curl_mime_data_cb(part, file.getSize(),
part, file.getSize(), [](char *buffer, size_t size, size_t nitems, void *arg) -> size_t { [](char *buffer, size_t size, size_t nitems, void *arg) -> size_t {
auto file = static_cast<FILE*>(arg); auto file = static_cast<FILE*>(arg);
return fread(buffer, size, nitems, file); }, [](void *arg, curl_off_t offset, int origin) -> int {
return fread(buffer, size, nitems, file);
},
[](void *arg, curl_off_t offset, int origin) -> int {
auto file = static_cast<FILE*>(arg); auto file = static_cast<FILE*>(arg);
fseek(file, offset, origin);
return CURL_SEEKFUNC_OK; }, [](void *arg) { if (fseek(file, offset, origin) != 0)
return CURL_SEEKFUNC_CANTSEEK;
else
return CURL_SEEKFUNC_OK;
},
[](void *arg) {
auto file = static_cast<FILE*>(arg); auto file = static_cast<FILE*>(arg);
fclose(file); }, file.getHandle());
fclose(file);
},
file.getHandle());
curl_mime_filename(part, fileName.c_str()); curl_mime_filename(part, fileName.c_str());
curl_mime_name(part, "file"); curl_mime_name(part, "file");

View File

@@ -233,7 +233,7 @@ namespace hex {
} }
std::string toEngineeringString(double value) { std::string toEngineeringString(double value) {
constexpr std::array Suffixes = { "a", "f", "p", "n", "u", "m", "", "k", "M", "G", "T", "P", "E" }; constexpr static std::array Suffixes = { "a", "f", "p", "n", "u", "m", "", "k", "M", "G", "T", "P", "E" };
int8_t suffixIndex = 6; int8_t suffixIndex = 6;
@@ -339,7 +339,7 @@ namespace hex {
auto c = [&] { return string[offset]; }; auto c = [&] { return string[offset]; };
if (c() == '\\') { if (c() == '\\') {
if ((offset + 2) >= string.length()) return {}; if ((offset + 2) > string.length()) return {};
offset++; offset++;

View File

@@ -170,14 +170,6 @@ namespace hex::prv {
return page; return page;
} }
bool Provider::open() {
EventManager::post<EventProviderOpened>(this);
return true;
}
void Provider::close() {
EventManager::post<EventProviderClosed>(this);
}
void Provider::addPatch(u64 offset, const void *buffer, size_t size, bool createUndo) { void Provider::addPatch(u64 offset, const void *buffer, size_t size, bool createUndo) {
if (this->m_patchTreeOffset > 0) { if (this->m_patchTreeOffset > 0) {
auto iter = this->m_patches.end(); auto iter = this->m_patches.end();

View File

@@ -52,11 +52,9 @@ int main(int argc, char **argv, char **envp) {
if (argc == 1) if (argc == 1)
; // No arguments provided ; // No arguments provided
else if (argc == 2) else if (argc >= 2) {
EventManager::post<RequestOpenFile>(argv[1]); for (auto i = 1; i < argc; i++)
else { EventManager::post<RequestOpenFile>(argv[i]);
hex::log::fatal("Usage: {} [<file_name>]", argv[0]);
return EXIT_FAILURE;
} }
window.loop(); window.loop();

View File

@@ -32,7 +32,39 @@ namespace hex {
static float g_titleBarHeight; static float g_titleBarHeight;
static ImGuiMouseCursor g_mouseCursorIcon; static ImGuiMouseCursor g_mouseCursorIcon;
static LRESULT windowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static LRESULT commonWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_COPYDATA:
{
auto message = reinterpret_cast<COPYDATASTRUCT *>(lParam);
if (message == nullptr) break;
auto data = reinterpret_cast<const char8_t *>(message->lpData);
if (data == nullptr) break;
std::fs::path path = data;
log::info("Opening file in existing instance: {}", path.string());
EventManager::post<RequestOpenFile>(path);
break;
}
case WM_SETTINGCHANGE:
{
if (lParam == 0) break;
if (LPCTSTR(lParam) == std::string_view("ImmersiveColorSet")) {
EventManager::post<EventOSThemeChanged>();
}
break;
}
default:
break;
}
return CallWindowProc((WNDPROC)g_oldWndProc, hwnd, uMsg, wParam, lParam);
}
static LRESULT borderlessWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) { switch (uMsg) {
case WM_NCACTIVATE: case WM_NCACTIVATE:
case WM_NCPAINT: case WM_NCPAINT:
@@ -106,11 +138,11 @@ namespace hex {
return HTNOWHERE; return HTNOWHERE;
} }
constexpr auto RegionClient = 0b0000; constexpr static auto RegionClient = 0b0000;
constexpr auto RegionLeft = 0b0001; constexpr static auto RegionLeft = 0b0001;
constexpr auto RegionRight = 0b0010; constexpr static auto RegionRight = 0b0010;
constexpr auto RegionTop = 0b0100; constexpr static auto RegionTop = 0b0100;
constexpr auto RegionBottom = 0b1000; constexpr static auto RegionBottom = 0b1000;
const auto result = const auto result =
RegionLeft * (cursor.x < (window.left + border.x)) | RegionLeft * (cursor.x < (window.left + border.x)) |
@@ -146,35 +178,11 @@ namespace hex {
} }
break; break;
} }
case WM_SETTINGCHANGE:
{
if (lParam == 0) break;
if (LPCTSTR(lParam) == std::string_view("ImmersiveColorSet")) {
EventManager::post<EventOSThemeChanged>();
}
break;
}
case WM_COPYDATA:
{
auto message = reinterpret_cast<COPYDATASTRUCT *>(lParam);
if (message == nullptr) break;
auto data = reinterpret_cast<const char8_t *>(message->lpData);
if (data == nullptr) break;
std::fs::path path = data;
log::info("Opening file in existing instance: {}", path.string());
EventManager::post<RequestOpenFile>(path);
break;
}
default: default:
break; break;
} }
return CallWindowProc((WNDPROC)g_oldWndProc, hwnd, uMsg, wParam, lParam); return commonWindowProc(hwnd, uMsg, wParam, lParam);
} }
@@ -255,7 +263,7 @@ namespace hex {
if (borderlessWindowMode) { if (borderlessWindowMode) {
g_oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)windowProc); g_oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)borderlessWindowProc);
MARGINS borderless = { 1, 1, 1, 1 }; MARGINS borderless = { 1, 1, 1, 1 };
::DwmExtendFrameIntoClientArea(hwnd, &borderless); ::DwmExtendFrameIntoClientArea(hwnd, &borderless);
@@ -265,6 +273,8 @@ namespace hex {
::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); ::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW); ::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW);
} else {
g_oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)commonWindowProc);
} }
// Catch heap corruption // Catch heap corruption

View File

@@ -129,9 +129,9 @@ namespace hex {
glfwSetWindowTitle(this->m_window, title.c_str()); glfwSetWindowTitle(this->m_window, title.c_str());
}); });
constexpr auto CrashBackupFileName = "crash_backup.hexproj"; constexpr static auto CrashBackupFileName = "crash_backup.hexproj";
EventManager::subscribe<EventAbnormalTermination>(this, [this, CrashBackupFileName](int) { EventManager::subscribe<EventAbnormalTermination>(this, [this](int) {
ImGui::SaveIniSettingsToDisk(this->m_imguiSettingsPath.string().c_str()); ImGui::SaveIniSettingsToDisk(this->m_imguiSettingsPath.string().c_str());
if (!ImHexApi::Provider::isDirty()) if (!ImHexApi::Provider::isDirty())

View File

@@ -52,9 +52,8 @@ add_library(${PROJECT_NAME} SHARED
source/content/views/view_provider_settings.cpp source/content/views/view_provider_settings.cpp
source/content/views/view_find.cpp source/content/views/view_find.cpp
source/content/helpers/math_evaluator.cpp
source/math_evaluator.cpp source/content/helpers/pattern_drawer.cpp
source/pattern_drawer.cpp
source/lang/de_DE.cpp source/lang/de_DE.cpp
source/lang/en_US.cpp source/lang/en_US.cpp

View File

@@ -98,7 +98,7 @@ namespace hex {
}; };
static i16 comparePrecedence(const Operator &a, const Operator &b); static i16 comparePrecedence(const Operator &a, const Operator &b);
static bool isLeftAssociative(const Operator op); static bool isLeftAssociative(const Operator &op);
static std::pair<Operator, size_t> toOperator(const std::string &input); static std::pair<Operator, size_t> toOperator(const std::string &input);
private: private:

View File

@@ -34,12 +34,6 @@ namespace hex {
void visit(pl::ptrn::PatternWideString& pattern) override; void visit(pl::ptrn::PatternWideString& pattern) override;
private: private:
void createDefaultEntry(const pl::ptrn::Pattern &pattern, const std::string &value, pl::core::Token::Literal &&literal) const;
void createLeafNode(const pl::ptrn::Pattern& pattern) const;
bool createTreeNode(const pl::ptrn::Pattern& pattern) const;
void makeSelectable(const pl::ptrn::Pattern &pattern) const;
void draw(pl::ptrn::Pattern& pattern); void draw(pl::ptrn::Pattern& pattern);
template<ArrayPattern T> template<ArrayPattern T>
@@ -53,19 +47,12 @@ namespace hex {
}); });
} }
this->drawArrayEnd(pattern, opened); this->drawArrayEnd(pattern, opened, pattern.isInlined());
} }
bool drawArrayRoot(pl::ptrn::Pattern& pattern, size_t entryCount, bool isInlined); bool drawArrayRoot(pl::ptrn::Pattern& pattern, size_t entryCount, bool isInlined);
void drawArrayNode(u64 idx, u64& displayEnd, pl::ptrn::Pattern& pattern); void drawArrayNode(u64 idx, u64& displayEnd, pl::ptrn::Pattern& pattern);
void drawArrayEnd(pl::ptrn::Pattern& pattern, bool opened); void drawArrayEnd(pl::ptrn::Pattern& pattern, bool opened, bool inlined);
void drawCommentTooltip(const pl::ptrn::Pattern &pattern) const;
void drawTypenameColumn(const pl::ptrn::Pattern& pattern, const std::string& pattern_name) const;
void drawNameColumn(const pl::ptrn::Pattern& pattern) const;
void drawColorColumn(const pl::ptrn::Pattern& pattern) const;
void drawOffsetColumn(const pl::ptrn::Pattern& pattern) const;
void drawSizeColumn(const pl::ptrn::Pattern& pattern) const;
u64& getDisplayEnd(const pl::ptrn::Pattern& pattern); u64& getDisplayEnd(const pl::ptrn::Pattern& pattern);

View File

@@ -15,6 +15,9 @@ namespace hex::plugin::builtin::prv {
[[nodiscard]] bool isResizable() const override { return false; } [[nodiscard]] bool isResizable() const override { return false; }
[[nodiscard]] bool isSavable() const override { return false; } [[nodiscard]] bool isSavable() const override { return false; }
[[nodiscard]] bool open() override { return true; }
void close() override { }
void readRaw(u64 offset, void *buffer, size_t size) override { hex::unused(offset, buffer, size); } void readRaw(u64 offset, void *buffer, size_t size) override { hex::unused(offset, buffer, size); }
void writeRaw(u64 offset, const void *buffer, size_t size) override { hex::unused(offset, buffer, size); } void writeRaw(u64 offset, const void *buffer, size_t size) override { hex::unused(offset, buffer, size); }
[[nodiscard]] size_t getActualSize() const override { return 0x00; } [[nodiscard]] size_t getActualSize() const override { return 0x00; }

View File

@@ -61,6 +61,7 @@ namespace hex::plugin::builtin {
struct Regex { struct Regex {
std::string pattern; std::string pattern;
bool fullMatch = true;
} regex; } regex;
struct BinaryPattern { struct BinaryPattern {

View File

@@ -1,15 +1,12 @@
#pragma once #pragma once
#include "pattern_drawer.hpp"
#include <hex.hpp> #include <hex.hpp>
#include <imgui.h>
#include <hex/ui/view.hpp> #include <hex/ui/view.hpp>
#include <content/helpers/pattern_drawer.hpp>
#include <vector> #include <vector>
#include <tuple> #include <tuple>
#include <cstdio>
namespace hex::plugin::builtin { namespace hex::plugin::builtin {

View File

@@ -5,7 +5,7 @@
#include <hex/helpers/utils.hpp> #include <hex/helpers/utils.hpp>
#include <hex/helpers/fmt.hpp> #include <hex/helpers/fmt.hpp>
#include "math_evaluator.hpp" #include <content/helpers/math_evaluator.hpp>
namespace hex::plugin::builtin { namespace hex::plugin::builtin {

View File

@@ -1,34 +1,42 @@
#include <hex/api/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/providers/buffered_reader.hpp>
#include <hex/helpers/fmt.hpp> #include <hex/helpers/fmt.hpp>
#include <hex/helpers/crypto.hpp>
namespace hex::plugin::builtin { namespace hex::plugin::builtin {
static std::string formatLanguageArray(prv::Provider *provider, u64 offset, size_t size, const std::string &start, const std::string &byteFormat, const std::string &end) { static std::string formatLanguageArray(prv::Provider *provider, u64 offset, size_t size, const std::string &start, const std::string &byteFormat, const std::string &end) {
constexpr auto NewLineIndent = "\n "; constexpr static auto NewLineIndent = "\n ";
constexpr static auto LineLength = 16;
std::string result = start; std::string result;
result.reserve(start.size() + hex::format(byteFormat, 0x00).size() * size + + std::string(NewLineIndent).size() / LineLength + end.size());
std::vector<u8> buffer(0x1'0000, 0x00); result += start;
for (u64 i = 0; i < size; i += buffer.size()) {
size_t readSize = std::min<u64>(buffer.size(), size - i);
provider->read(offset, buffer.data(), readSize);
for (u32 j = 0; j < readSize; j++) { auto reader = prv::BufferedReader(provider);
if (j % 0x10 == 0) reader.seek(offset);
result += NewLineIndent; reader.setEndAddress(offset + size);
result += hex::format(byteFormat, buffer[j]); u64 index = 0x00;
} for (u8 byte : reader) {
if ((index % LineLength) == 0x00)
result += NewLineIndent;
// Remove trailing comma result += hex::format(byteFormat, byte);
index++;
}
// Remove trailing comma
if (provider->getActualSize() > 0) {
result.pop_back(); result.pop_back();
result.pop_back(); result.pop_back();
} }
result += "\n"; result += "\n" + end;
result += end;
return result; return result;
} }
@@ -63,45 +71,78 @@ namespace hex::plugin::builtin {
return formatLanguageArray(provider, offset, size, "const data = new Uint8Array([", "0x{0:02X}, ", "]);"); return formatLanguageArray(provider, offset, size, "const data = new Uint8Array([", "0x{0:02X}, ", "]);");
}); });
ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.lua", [](prv::Provider *provider, u64 offset, size_t size) {
return formatLanguageArray(provider, offset, size, "data = {", "0x{0:02X}, ", "}");
});
ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.go", [](prv::Provider *provider, u64 offset, size_t size) {
return formatLanguageArray(provider, offset, size, "data := [...]byte {", "0x{0:02X}, ", "}");
});
ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.crystal", [](prv::Provider *provider, u64 offset, size_t size) {
return formatLanguageArray(provider, offset, size, "data = [", "0x{0:02X}, ", "] of UInt8");
});
ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.swift", [](prv::Provider *provider, u64 offset, size_t size) {
return formatLanguageArray(provider, offset, size, "let data: [Uint8] = [", "0x{0:02X}, ", "]");
});
ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.pascal", [](prv::Provider *provider, u64 offset, size_t size) {
return formatLanguageArray(provider, offset, size, hex::format("data: array[0..{0}] of Byte = (", size - 1), "${0:02X}, ", ")");
});
ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.base64", [](prv::Provider *provider, u64 offset, size_t size) {
std::vector<u8> data(size, 0x00);
provider->read(offset, data.data(), size);
auto result = crypt::encode64(data);
return std::string(result.begin(), result.end());
});
ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.ascii", [](prv::Provider *provider, u64 offset, size_t size) { ContentRegistry::DataFormatter::add("hex.builtin.view.hex_editor.copy.ascii", [](prv::Provider *provider, u64 offset, size_t size) {
std::string result = "Hex View 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n\n"; constexpr static auto HeaderLine = "Hex View 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n";
std::string result;
result.reserve(std::string(HeaderLine).size() * size / 0x10);
std::vector<u8> buffer(0x1'0000, 0x00); result += HeaderLine;
for (u64 byte = 0; byte < size; byte += buffer.size()) {
size_t readSize = std::min<u64>(buffer.size(), size - byte);
provider->read(offset, buffer.data(), readSize);
const auto end = (offset + readSize) - 1; auto reader = prv::BufferedReader(provider);
reader.seek(offset);
reader.setEndAddress((offset + size) - 1);
for (u32 col = offset >> 4; col <= (end >> 4); col++) { u64 address = offset & ~u64(0x0F);
result += hex::format("{0:08X} ", col << 4); std::string asciiRow;
for (u64 i = 0; i < 16; i++) { for (u8 byte : reader) {
if ((address % 0x10) == 0) {
result += hex::format(" {}", asciiRow);
result += hex::format("\n{0:08X} ", address);
if ((col == (offset >> 4) && i < (offset & 0xF)) || (col == (end >> 4) && i > (end & 0xF))) asciiRow.clear();
if (address == (offset & ~u64(0x0F))) {
for (u64 i = 0; i < (offset - address); i++) {
result += " "; result += " ";
else asciiRow += " ";
result += hex::format("{0:02X} ", buffer[((col << 4) - offset) + i]); }
address = offset;
if ((i & 0xF) == 0x7)
result += " ";
} }
}
result += hex::format("{0:02X} ", byte);
asciiRow += std::isprint(byte) ? char(byte) : '.';
if ((address % 0x10) == 0x07)
result += " "; result += " ";
for (u64 i = 0; i < 16; i++) { address++;
if ((col == (offset >> 4) && i < (offset & 0xF)) || (col == (end >> 4) && i > (end & 0xF)))
result += " ";
else {
u8 c = buffer[((col << 4) - offset) + i];
char displayChar = (c < 32 || c >= 128) ? '.' : c;
result += hex::format("{0}", displayChar);
}
}
result += "\n";
}
} }
if ((address % 0x10) != 0x00)
for (u32 i = 0; i < (0x10 - (address % 0x10)); i++)
result += " ";
result += hex::format(" {}", asciiRow);
return result; return result;
}); });
@@ -115,48 +156,46 @@ namespace hex::plugin::builtin {
" .textcolumn { color:#000000 }\n" " .textcolumn { color:#000000 }\n"
" </style>\n\n" " </style>\n\n"
" <code>\n" " <code>\n"
" <span class=\"offsetheader\">Hex View&nbsp&nbsp00 01 02 03 04 05 06 07&nbsp 08 09 0A 0B 0C 0D 0E 0F</span><br>\n"; " <span class=\"offsetheader\">Hex View&nbsp&nbsp00 01 02 03 04 05 06 07&nbsp 08 09 0A 0B 0C 0D 0E 0F</span>";
auto reader = prv::BufferedReader(provider);
reader.seek(offset);
reader.setEndAddress(offset + size);
std::vector<u8> buffer(0x1'0000, 0x00); u64 address = offset & ~u64(0x0F);
for (u64 byte = 0; byte < size; byte += buffer.size()) { std::string asciiRow;
size_t readSize = std::min<u64>(buffer.size(), size - byte); for (u8 byte : reader) {
provider->read(offset, buffer.data(), readSize); if ((address % 0x10) == 0) {
result += hex::format(" {}", asciiRow);
result += hex::format("<br>\n <span class=\"offsetcolumn\">{0:08X}</span>&nbsp&nbsp<span class=\"hexcolumn\">", address);
const auto end = (offset + readSize) - 1; asciiRow.clear();
for (u32 col = offset >> 4; col <= (end >> 4); col++) { if (address == (offset & ~u64(0x0F))) {
result += hex::format(" <span class=\"offsetcolumn\">{0:08X}</span>&nbsp&nbsp<span class=\"hexcolumn\">", col << 4); for (u64 i = 0; i < (offset - address); i++) {
for (u64 i = 0; i < 16; i++) { result += "&nbsp&nbsp&nbsp";
asciiRow += "&nbsp";
if ((col == (offset >> 4) && i < (offset & 0xF)) || (col == (end >> 4) && i > (end & 0xF)))
result += "&nbsp&nbsp ";
else
result += hex::format("{0:02X} ", buffer[((col << 4) - offset) + i]);
if ((i & 0xF) == 0x7)
result += "&nbsp";
}
result += "</span>&nbsp&nbsp<span class=\"textcolumn\">";
for (u64 i = 0; i < 16; i++) {
if ((col == (offset >> 4) && i < (offset & 0xF)) || (col == (end >> 4) && i > (end & 0xF)))
result += "&nbsp";
else {
u8 c = buffer[((col << 4) - offset) + i];
char displayChar = (c < 32 || c >= 128) ? '.' : c;
result += hex::format("{0}", displayChar);
} }
address = offset;
} }
result += "</span><br>\n"; result += "</span>";
} }
result += hex::format("{0:02X} ", byte);
asciiRow += std::isprint(byte) ? char(byte) : '.';
if ((address % 0x10) == 0x07)
result += "&nbsp";
address++;
} }
for (u32 i = 0; i < (0x10 - (address % 0x10)); i++)
result += "&nbsp&nbsp&nbsp";
result += asciiRow;
result += result +=
" </code>\n" "\n </code>\n"
"</div>\n"; "</div>\n";
return result; return result;

View File

@@ -32,7 +32,7 @@ namespace hex::plugin::builtin {
NodeBuffer() : Node("hex.builtin.nodes.constants.buffer.header", { dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "") }) { } NodeBuffer() : Node("hex.builtin.nodes.constants.buffer.header", { dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "") }) { }
void drawNode() override { void drawNode() override {
constexpr int StepSize = 1, FastStepSize = 10; constexpr static int StepSize = 1, FastStepSize = 10;
ImGui::PushItemWidth(100); ImGui::PushItemWidth(100);
ImGui::InputScalar("hex.builtin.nodes.constants.buffer.size"_lang, ImGuiDataType_U32, &this->m_size, &StepSize, &FastStepSize); ImGui::InputScalar("hex.builtin.nodes.constants.buffer.size"_lang, ImGuiDataType_U32, &this->m_size, &StepSize, &FastStepSize);

View File

@@ -21,7 +21,8 @@ namespace hex::plugin::builtin {
auto provider = ImHexApi::Provider::createProvider("hex.builtin.provider.file", true); auto provider = ImHexApi::Provider::createProvider("hex.builtin.provider.file", true);
if (auto *fileProvider = dynamic_cast<prv::FileProvider*>(provider); fileProvider != nullptr) { if (auto *fileProvider = dynamic_cast<prv::FileProvider*>(provider); fileProvider != nullptr) {
fileProvider->setPath(path); fileProvider->setPath(path);
(void)fileProvider->open(); if (fileProvider->open())
EventManager::post<EventProviderOpened>(fileProvider);
} }
} }
@@ -100,6 +101,8 @@ namespace hex::plugin::builtin {
TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); });
return; return;
} }
EventManager::post<EventProviderOpened>(provider);
} }
else if (provider->hasLoadInterface()) else if (provider->hasLoadInterface())
EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup")); EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup"));
@@ -107,7 +110,10 @@ namespace hex::plugin::builtin {
if (!provider->open() || !provider->isAvailable()) { if (!provider->open() || !provider->isAvailable()) {
View::showErrorPopup("hex.builtin.popup.error.open"_lang); View::showErrorPopup("hex.builtin.popup.error.open"_lang);
TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); });
return;
} }
EventManager::post<EventProviderOpened>(provider);
} }
}); });

View File

@@ -1,4 +1,4 @@
#include "math_evaluator.hpp" #include <content/helpers/math_evaluator.hpp>
#include <hex/helpers/utils.hpp> #include <hex/helpers/utils.hpp>
#include <hex/helpers/concepts.hpp> #include <hex/helpers/concepts.hpp>
@@ -6,7 +6,6 @@
#include <string> #include <string>
#include <queue> #include <queue>
#include <stack> #include <stack>
#include <stdexcept>
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
#include <optional> #include <optional>
@@ -19,7 +18,7 @@ namespace hex {
} }
template<typename T> template<typename T>
bool MathEvaluator<T>::isLeftAssociative(const Operator op) { bool MathEvaluator<T>::isLeftAssociative(const Operator &op) {
return (static_cast<u32>(op) & 0xF00) == 0; return (static_cast<u32>(op) & 0xF00) == 0;
} }

View File

@@ -1,4 +1,4 @@
#include "pattern_drawer.hpp" #include <content/helpers/pattern_drawer.hpp>
#include <pl/patterns/pattern_array_dynamic.hpp> #include <pl/patterns/pattern_array_dynamic.hpp>
#include <pl/patterns/pattern_array_static.hpp> #include <pl/patterns/pattern_array_static.hpp>
@@ -25,15 +25,100 @@
#include <imgui.h> #include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h> #include <hex/ui/imgui_imhex_extensions.h>
namespace {
constexpr static auto DisplayEndDefault = 50u;
constexpr static auto DisplayEndStep = 50u;
using namespace ::std::literals::string_literals;
};
namespace hex { namespace hex {
namespace {
constexpr auto DisplayEndDefault = 50U;
constexpr auto DisplayEndStep = 50U;
using namespace ::std::literals::string_literals;
void createLeafNode(const pl::ptrn::Pattern& pattern) {
ImGui::TreeNodeEx(pattern.getDisplayName().c_str(), ImGuiTreeNodeFlags_Leaf |
ImGuiTreeNodeFlags_NoTreePushOnOpen |
ImGuiTreeNodeFlags_SpanFullWidth |
ImGuiTreeNodeFlags_AllowItemOverlap);
}
bool createTreeNode(const pl::ptrn::Pattern& pattern) {
if (pattern.isSealed()) {
ImGui::Indent();
ImGui::TextUnformatted(pattern.getDisplayName().c_str());
ImGui::Unindent();
return false;
}
else
return ImGui::TreeNodeEx(pattern.getDisplayName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth);
}
void drawTypenameColumn(const pl::ptrn::Pattern& pattern, const std::string& pattern_name) {
ImGui::TextFormattedColored(ImColor(0xFFD69C56), pattern_name);
ImGui::SameLine();
ImGui::TextUnformatted(pattern.getTypeName().c_str());
ImGui::TableNextColumn();
}
void drawNameColumn(const pl::ptrn::Pattern& pattern) {
ImGui::TextUnformatted(pattern.getDisplayName().c_str());
ImGui::TableNextColumn();
}
void drawColorColumn(const pl::ptrn::Pattern& pattern) {
ImGui::ColorButton("color", ImColor(pattern.getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight()));
ImGui::TableNextColumn();
}
void drawOffsetColumn(const pl::ptrn::Pattern& pattern) {
ImGui::TextFormatted("0x{0:08X} : 0x{1:08X}", pattern.getOffset(), pattern.getOffset() + pattern.getSize() - (pattern.getSize() == 0 ? 0 : 1));
ImGui::TableNextColumn();
}
void drawSizeColumn(const pl::ptrn::Pattern& pattern) {
ImGui::TextFormatted("0x{0:04X}", pattern.getSize());
ImGui::TableNextColumn();
}
void drawCommentTooltip(const pl::ptrn::Pattern &pattern) {
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) && pattern.getComment() != nullptr) {
ImGui::BeginTooltip();
ImGui::TextUnformatted(pattern.getComment()->c_str());
ImGui::EndTooltip();
}
}
void makeSelectable(const pl::ptrn::Pattern &pattern) {
ImGui::PushID(static_cast<int>(pattern.getOffset()));
ImGui::PushID(pattern.getVariableName().c_str());
if (ImGui::Selectable("##PatternLine", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
ImHexApi::HexEditor::setSelection(pattern.getOffset(), pattern.getSize());
}
ImGui::SameLine(0, 0);
ImGui::PopID();
ImGui::PopID();
}
void createDefaultEntry(pl::ptrn::Pattern &pattern) {
ImGui::TableNextRow();
createLeafNode(pattern);
ImGui::TableNextColumn();
makeSelectable(pattern);
drawCommentTooltip(pattern);
ImGui::SameLine();
drawNameColumn(pattern);
drawColorColumn(pattern);
drawOffsetColumn(pattern);
drawSizeColumn(pattern);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName().empty() ? pattern.getTypeName() : pattern.getFormattedName());
ImGui::TableNextColumn();
ImGui::TextFormatted("{}", pattern.getFormattedValue());
}
}
void PatternDrawer::visit(pl::ptrn::PatternArrayDynamic& pattern) { void PatternDrawer::visit(pl::ptrn::PatternArrayDynamic& pattern) {
this->drawArray(pattern); this->drawArray(pattern);
} }
@@ -81,15 +166,12 @@ namespace hex {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
makeSelectable(pattern); makeSelectable(pattern);
drawCommentTooltip(pattern); drawCommentTooltip(pattern);
ImGui::TableNextColumn(); drawColorColumn(pattern);
drawOffsetColumn(pattern); drawOffsetColumn(pattern);
drawSizeColumn(pattern); drawSizeColumn(pattern);
drawTypenameColumn(pattern, "bitfield"); drawTypenameColumn(pattern, "bitfield");
ImGui::TextFormatted("{}", pattern.getFormattedValue()); ImGui::TextFormatted("{}", pattern.getFormattedValue());
} else {
ImGui::SameLine();
ImGui::TreeNodeEx("", ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_Leaf);
} }
if (open) { if (open) {
@@ -97,16 +179,17 @@ namespace hex {
this->draw(field); this->draw(field);
}); });
ImGui::TreePop(); if (!pattern.isInlined())
ImGui::TreePop();
} }
} }
void PatternDrawer::visit(pl::ptrn::PatternBoolean& pattern) { void PatternDrawer::visit(pl::ptrn::PatternBoolean& pattern) {
this->createDefaultEntry(pattern, pattern.getFormattedValue(), bool(hex::get_or<u128>(pattern.getValue(), 0x00))); createDefaultEntry(pattern);
} }
void PatternDrawer::visit(pl::ptrn::PatternCharacter& pattern) { void PatternDrawer::visit(pl::ptrn::PatternCharacter& pattern) {
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue()); createDefaultEntry(pattern);
} }
void PatternDrawer::visit(pl::ptrn::PatternEnum& pattern) { void PatternDrawer::visit(pl::ptrn::PatternEnum& pattern) {
@@ -125,11 +208,7 @@ namespace hex {
} }
void PatternDrawer::visit(pl::ptrn::PatternFloat& pattern) { void PatternDrawer::visit(pl::ptrn::PatternFloat& pattern) {
if (pattern.getSize() == 4) { createDefaultEntry(pattern);
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue());
} else if (pattern.getSize() == 8) {
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue());
}
} }
void PatternDrawer::visit(pl::ptrn::PatternPadding& pattern) { void PatternDrawer::visit(pl::ptrn::PatternPadding& pattern) {
@@ -147,32 +226,29 @@ namespace hex {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
makeSelectable(pattern); makeSelectable(pattern);
drawCommentTooltip(pattern); drawCommentTooltip(pattern);
ImGui::SameLine(0, 0);
drawColorColumn(pattern); drawColorColumn(pattern);
drawOffsetColumn(pattern); drawOffsetColumn(pattern);
drawSizeColumn(pattern); drawSizeColumn(pattern);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName()); ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName());
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}", pattern.getFormattedValue()); ImGui::TextFormatted("{}", pattern.getFormattedValue());
} else {
ImGui::SameLine();
ImGui::TreeNodeEx("", ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_Leaf);
} }
if (open) { if (open) {
pattern.getPointedAtPattern()->accept(*this); pattern.getPointedAtPattern()->accept(*this);
ImGui::TreePop(); if (!pattern.isInlined())
ImGui::TreePop();
} }
} }
void PatternDrawer::visit(pl::ptrn::PatternSigned& pattern) { void PatternDrawer::visit(pl::ptrn::PatternSigned& pattern) {
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue()); createDefaultEntry(pattern);
} }
void PatternDrawer::visit(pl::ptrn::PatternString& pattern) { void PatternDrawer::visit(pl::ptrn::PatternString& pattern) {
if (pattern.getSize() > 0) if (pattern.getSize() > 0)
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue()); createDefaultEntry(pattern);
} }
void PatternDrawer::visit(pl::ptrn::PatternStruct& pattern) { void PatternDrawer::visit(pl::ptrn::PatternStruct& pattern) {
@@ -185,14 +261,14 @@ namespace hex {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
makeSelectable(pattern); makeSelectable(pattern);
drawCommentTooltip(pattern); drawCommentTooltip(pattern);
ImGui::TableNextColumn(); if (pattern.isSealed())
drawColorColumn(pattern);
else
ImGui::TableNextColumn();
drawOffsetColumn(pattern); drawOffsetColumn(pattern);
drawSizeColumn(pattern); drawSizeColumn(pattern);
drawTypenameColumn(pattern, "struct"); drawTypenameColumn(pattern, "struct");
ImGui::TextFormatted("{}", pattern.getFormattedValue()); ImGui::TextFormatted("{}", pattern.getFormattedValue());
} else {
ImGui::SameLine();
ImGui::TreeNodeEx("", ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_Leaf);
} }
if (open) { if (open) {
@@ -200,7 +276,8 @@ namespace hex {
this->draw(member); this->draw(member);
}); });
ImGui::TreePop(); if (!pattern.isInlined())
ImGui::TreePop();
} }
} }
@@ -214,14 +291,14 @@ namespace hex {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
makeSelectable(pattern); makeSelectable(pattern);
drawCommentTooltip(pattern); drawCommentTooltip(pattern);
ImGui::TableNextColumn(); if (pattern.isSealed())
drawColorColumn(pattern);
else
ImGui::TableNextColumn();
drawOffsetColumn(pattern); drawOffsetColumn(pattern);
drawSizeColumn(pattern); drawSizeColumn(pattern);
drawTypenameColumn(pattern, "union"); drawTypenameColumn(pattern, "union");
ImGui::TextFormatted("{}", pattern.getFormattedValue()); ImGui::TextFormatted("{}", pattern.getFormattedValue());
} else {
ImGui::SameLine();
ImGui::TreeNodeEx("", ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_Leaf);
} }
if (open) { if (open) {
@@ -229,59 +306,22 @@ namespace hex {
this->draw(member); this->draw(member);
}); });
ImGui::TreePop(); if (!pattern.isInlined())
ImGui::TreePop();
} }
} }
void PatternDrawer::visit(pl::ptrn::PatternUnsigned& pattern) { void PatternDrawer::visit(pl::ptrn::PatternUnsigned& pattern) {
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue()); createDefaultEntry(pattern);
} }
void PatternDrawer::visit(pl::ptrn::PatternWideCharacter& pattern) { void PatternDrawer::visit(pl::ptrn::PatternWideCharacter& pattern) {
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue()); createDefaultEntry(pattern);
} }
void PatternDrawer::visit(pl::ptrn::PatternWideString& pattern) { void PatternDrawer::visit(pl::ptrn::PatternWideString& pattern) {
if (pattern.getSize() > 0) if (pattern.getSize() > 0)
this->createDefaultEntry(pattern, pattern.getFormattedValue(), pattern.getValue()); createDefaultEntry(pattern);
}
void PatternDrawer::createDefaultEntry(const pl::ptrn::Pattern &pattern, const std::string &value, pl::core::Token::Literal &&literal) const {
ImGui::TableNextRow();
createLeafNode(pattern);
ImGui::TableNextColumn();
makeSelectable(pattern);
drawCommentTooltip(pattern);
ImGui::SameLine();
drawNameColumn(pattern);
drawColorColumn(pattern);
drawOffsetColumn(pattern);
drawSizeColumn(pattern);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName().empty() ? pattern.getTypeName() : pattern.getFormattedName());
ImGui::TableNextColumn();
ImGui::TextFormatted("{}", pattern.formatDisplayValue(value, literal));
}
void PatternDrawer::makeSelectable(const pl::ptrn::Pattern &pattern) const {
ImGui::PushID(static_cast<int>(pattern.getOffset()));
ImGui::PushID(pattern.getVariableName().c_str());
if (ImGui::Selectable("##PatternLine", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
ImHexApi::HexEditor::setSelection(pattern.getOffset(), pattern.getSize());
}
ImGui::SameLine();
ImGui::PopID();
ImGui::PopID();
}
void PatternDrawer::drawCommentTooltip(const pl::ptrn::Pattern &pattern) const {
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) && pattern.getComment() != nullptr) {
ImGui::BeginTooltip();
ImGui::TextUnformatted(pattern.getComment()->c_str());
ImGui::EndTooltip();
}
} }
void PatternDrawer::draw(pl::ptrn::Pattern& pattern) { void PatternDrawer::draw(pl::ptrn::Pattern& pattern) {
@@ -303,7 +343,10 @@ namespace hex {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
makeSelectable(pattern); makeSelectable(pattern);
drawCommentTooltip(pattern); drawCommentTooltip(pattern);
ImGui::TableNextColumn(); if (pattern.isSealed())
drawColorColumn(pattern);
else
ImGui::TableNextColumn();
drawOffsetColumn(pattern); drawOffsetColumn(pattern);
drawSizeColumn(pattern); drawSizeColumn(pattern);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{0}", pattern.getTypeName()); ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{0}", pattern.getTypeName());
@@ -317,9 +360,6 @@ namespace hex {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}", pattern.getFormattedValue()); ImGui::TextFormatted("{}", pattern.getFormattedValue());
} else {
ImGui::SameLine();
ImGui::TreeNodeEx("", ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_Leaf);
} }
return open; return open;
@@ -328,7 +368,7 @@ namespace hex {
void PatternDrawer::drawArrayNode(u64 idx, u64& displayEnd, pl::ptrn::Pattern& pattern) { void PatternDrawer::drawArrayNode(u64 idx, u64& displayEnd, pl::ptrn::Pattern& pattern) {
u64 lastVisible = displayEnd - 1; u64 lastVisible = displayEnd - 1;
ImGui::PushID(pattern.getOffset()); ImGui::PushID(reinterpret_cast<void*>(pattern.getOffset()));
if (idx < lastVisible) { if (idx < lastVisible) {
this->draw(pattern); this->draw(pattern);
@@ -344,65 +384,23 @@ namespace hex {
ImGui::PopID(); ImGui::PopID();
} }
void PatternDrawer::drawArrayEnd(pl::ptrn::Pattern& pattern, bool opened) { void PatternDrawer::drawArrayEnd(pl::ptrn::Pattern& pattern, bool opened, bool inlined) {
if (opened) { if (opened) {
ImGui::TreePop(); if (!inlined)
ImGui::TreePop();
} else { } else {
auto& displayEnd = this->getDisplayEnd(pattern); auto& displayEnd = this->getDisplayEnd(pattern);
displayEnd = DisplayEndDefault; displayEnd = DisplayEndDefault;
} }
} }
void PatternDrawer::createLeafNode(const pl::ptrn::Pattern& pattern) const {
ImGui::TreeNodeEx(pattern.getDisplayName().c_str(), ImGuiTreeNodeFlags_Leaf |
ImGuiTreeNodeFlags_NoTreePushOnOpen |
ImGuiTreeNodeFlags_SpanFullWidth |
ImGuiTreeNodeFlags_AllowItemOverlap);
}
bool PatternDrawer::createTreeNode(const pl::ptrn::Pattern& pattern) const {
if (pattern.isSealed()) {
ImGui::Selectable(pattern.getDisplayName().c_str(), false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap);
return false;
}
else
return ImGui::TreeNodeEx(pattern.getDisplayName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth);
}
void PatternDrawer::drawTypenameColumn(const pl::ptrn::Pattern& pattern, const std::string& pattern_name) const {
ImGui::TextFormattedColored(ImColor(0xFFD69C56), pattern_name);
ImGui::SameLine();
ImGui::TextUnformatted(pattern.getTypeName().c_str());
ImGui::TableNextColumn();
}
void PatternDrawer::drawNameColumn(const pl::ptrn::Pattern& pattern) const {
ImGui::TextUnformatted(pattern.getDisplayName().c_str());
ImGui::TableNextColumn();
}
void PatternDrawer::drawColorColumn(const pl::ptrn::Pattern& pattern) const {
ImGui::ColorButton("color", ImColor(pattern.getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight()));
ImGui::TableNextColumn();
}
void PatternDrawer::drawOffsetColumn(const pl::ptrn::Pattern& pattern) const {
ImGui::TextFormatted("0x{0:08X} : 0x{1:08X}", pattern.getOffset(), pattern.getOffset() + pattern.getSize() - (pattern.getSize() == 0 ? 0 : 1));
ImGui::TableNextColumn();
}
void PatternDrawer::drawSizeColumn(const pl::ptrn::Pattern& pattern) const {
ImGui::TextFormatted("0x{0:04X}", pattern.getSize());
ImGui::TableNextColumn();
}
u64& PatternDrawer::getDisplayEnd(const pl::ptrn::Pattern& pattern) { u64& PatternDrawer::getDisplayEnd(const pl::ptrn::Pattern& pattern) {
auto it = m_displayEnd.find(&pattern); auto it = this->m_displayEnd.find(&pattern);
if (it != m_displayEnd.end()) { if (it != this->m_displayEnd.end()) {
return it->second; return it->second;
} }
auto [inserted, success] = m_displayEnd.emplace(&pattern, DisplayEndDefault); auto [value, success] = this->m_displayEnd.emplace(&pattern, DisplayEndDefault);
return inserted->second; return value->second;
} }
}; };

View File

@@ -13,10 +13,23 @@ namespace hex::plugin::builtin {
using namespace pl::core; using namespace pl::core;
using FunctionParameterCount = pl::api::FunctionParameterCount; using FunctionParameterCount = pl::api::FunctionParameterCount;
pl::api::Namespace nsStdHttp = { "builtin", "std", "http" }; pl::api::Namespace nsHexCore = { "builtin", "hex", "core" };
{
/* get_selection() */
ContentRegistry::PatternLanguage::addDangerousFunction(nsHexCore, "get_selection", FunctionParameterCount::none(), [](Evaluator *, auto) -> std::optional<Token::Literal> {
if (!ImHexApi::HexEditor::isSelectionValid())
return std::numeric_limits<u128>::max();
auto selection = ImHexApi::HexEditor::getSelection();
return u128(u128(selection->getStartAddress()) << 64 | u128(selection->getSize()));
});
}
pl::api::Namespace nsHexHttp = { "builtin", "hex", "http" };
{ {
/* get(url) */ /* get(url) */
ContentRegistry::PatternLanguage::addDangerousFunction(nsStdHttp, "get", FunctionParameterCount::exactly(1), [](Evaluator *, auto params) -> std::optional<Token::Literal> { ContentRegistry::PatternLanguage::addDangerousFunction(nsHexHttp, "get", FunctionParameterCount::exactly(1), [](Evaluator *, auto params) -> std::optional<Token::Literal> {
const auto url = Token::literalToString(params[0], false); const auto url = Token::literalToString(params[0], false);
hex::Net net; hex::Net net;

View File

@@ -41,6 +41,8 @@ namespace hex::plugin::builtin {
provider->loadSettings(providerSettings["settings"]); provider->loadSettings(providerSettings["settings"]);
if (!provider->open()) if (!provider->open())
success = false; success = false;
else
EventManager::post<EventProviderOpened>(provider);
} }
return success; return success;

View File

@@ -32,7 +32,7 @@
namespace hex::plugin::builtin::prv { namespace hex::plugin::builtin::prv {
DiskProvider::DiskProvider() : Provider() { DiskProvider::DiskProvider() : Provider() {
this->reloadDrives();
} }
bool DiskProvider::isAvailable() const { bool DiskProvider::isAvailable() const {
@@ -137,7 +137,7 @@ namespace hex::plugin::builtin::prv {
#endif #endif
return Provider::open(); return true;
} }
void DiskProvider::close() { void DiskProvider::close() {
@@ -156,8 +156,6 @@ namespace hex::plugin::builtin::prv {
this->m_diskHandle = -1; this->m_diskHandle = -1;
#endif #endif
Provider::close();
} }
void DiskProvider::readRaw(u64 offset, void *buffer, size_t size) { void DiskProvider::readRaw(u64 offset, void *buffer, size_t size) {
@@ -320,6 +318,9 @@ namespace hex::plugin::builtin::prv {
void DiskProvider::drawLoadInterface() { void DiskProvider::drawLoadInterface() {
#if defined(OS_WINDOWS) #if defined(OS_WINDOWS)
if (this->m_availableDrives.empty())
this->reloadDrives();
if (ImGui::BeginListBox("hex.builtin.provider.disk.selected_disk"_lang)) { if (ImGui::BeginListBox("hex.builtin.provider.disk.selected_disk"_lang)) {
for (const auto &drive : this->m_availableDrives) { for (const auto &drive : this->m_availableDrives) {

View File

@@ -300,7 +300,7 @@ namespace hex::plugin::builtin::prv {
#endif #endif
return Provider::open(); return true;
} }
void FileProvider::close() { void FileProvider::close() {
@@ -319,8 +319,6 @@ namespace hex::plugin::builtin::prv {
::close(this->m_file); ::close(this->m_file);
#endif #endif
Provider::close();
} }
void FileProvider::loadSettings(const nlohmann::json &settings) { void FileProvider::loadSettings(const nlohmann::json &settings) {

View File

@@ -273,7 +273,7 @@ namespace hex::plugin::builtin::prv {
} }
}); });
return Provider::open(); return true;
} else { } else {
return false; return false;
} }
@@ -285,8 +285,6 @@ namespace hex::plugin::builtin::prv {
if (this->m_cacheUpdateThread.joinable()) { if (this->m_cacheUpdateThread.joinable()) {
this->m_cacheUpdateThread.join(); this->m_cacheUpdateThread.join();
} }
Provider::close();
} }
bool GDBProvider::isConnected() const { bool GDBProvider::isConnected() const {

View File

@@ -210,12 +210,11 @@ namespace hex::plugin::builtin::prv {
this->m_dataSize = maxAddress + 1; this->m_dataSize = maxAddress + 1;
this->m_dataValid = true; this->m_dataValid = true;
return Provider::open(); return true;
} }
void IntelHexProvider::close() { void IntelHexProvider::close() {
Provider::close();
} }
[[nodiscard]] std::string IntelHexProvider::getName() const { [[nodiscard]] std::string IntelHexProvider::getName() const {

View File

@@ -190,11 +190,11 @@ namespace hex::plugin::builtin::prv {
this->m_dataSize = maxAddress + 1; this->m_dataSize = maxAddress + 1;
this->m_dataValid = true; this->m_dataValid = true;
return Provider::open(); return true;
} }
void MotorolaSRECProvider::close() { void MotorolaSRECProvider::close() {
Provider::close();
} }
[[nodiscard]] std::string MotorolaSRECProvider::getName() const { [[nodiscard]] std::string MotorolaSRECProvider::getName() const {

View File

@@ -19,7 +19,7 @@
#include <limits> #include <limits>
#include <llvm/Demangle/Demangle.h> #include <llvm/Demangle/Demangle.h>
#include "math_evaluator.hpp" #include <content/helpers/math_evaluator.hpp>
#include <imgui.h> #include <imgui.h>
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
@@ -974,7 +974,7 @@ namespace hex::plugin::builtin {
return; return;
} }
constexpr auto BufferSize = 0xFF'FFFF; constexpr static auto BufferSize = 0xFF'FFFF;
for (u64 partOffset = 0; partOffset < splitSize; partOffset += BufferSize) { for (u64 partOffset = 0; partOffset < splitSize; partOffset += BufferSize) {
partFile.write(file.readBytes(std::min<u64>(BufferSize, splitSize - partOffset))); partFile.write(file.readBytes(std::min<u64>(BufferSize, splitSize - partOffset)));
partFile.flush(); partFile.flush();
@@ -1103,7 +1103,7 @@ namespace hex::plugin::builtin {
return; return;
} }
constexpr auto BufferSize = 0xFF'FFFF; constexpr static auto BufferSize = 0xFF'FFFF;
auto inputSize = input.getSize(); auto inputSize = input.getSize();
for (u64 inputOffset = 0; inputOffset < inputSize; inputOffset += BufferSize) { for (u64 inputOffset = 0; inputOffset < inputSize; inputOffset += BufferSize) {
output.write(input.readBytes(std::min<u64>(BufferSize, inputSize - inputOffset))); output.write(input.readBytes(std::min<u64>(BufferSize, inputSize - inputOffset)));

View File

@@ -212,14 +212,16 @@ namespace hex::plugin::builtin {
}); });
} }
ContentRegistry::Interface::addFooterItem([] { #if defined(DEBUG)
static float framerate = 0; ContentRegistry::Interface::addFooterItem([] {
if (ImGui::HasSecondPassed()) { static float framerate = 0;
framerate = 1.0F / ImGui::GetIO().DeltaTime; if (ImGui::HasSecondPassed()) {
} framerate = 1.0F / ImGui::GetIO().DeltaTime;
}
ImGui::TextFormatted("FPS {0:2}.{1:02}", u32(framerate), u32(framerate * 100) % 100); ImGui::TextFormatted("FPS {0:2}.{1:02}", u32(framerate), u32(framerate * 100) % 100);
}); });
#endif
ContentRegistry::Interface::addFooterItem([] { ContentRegistry::Interface::addFooterItem([] {
auto taskCount = TaskManager::getRunningTaskCount(); auto taskCount = TaskManager::getRunningTaskCount();

View File

@@ -147,7 +147,7 @@ namespace hex::plugin::builtin {
ImGui::TableSetupColumn("Type"); ImGui::TableSetupColumn("Type");
ImGui::TableSetupColumn("Paths"); ImGui::TableSetupColumn("Paths");
constexpr std::array<std::pair<const char *, fs::ImHexPath>, 8> PathTypes = { constexpr static std::array<std::pair<const char *, fs::ImHexPath>, 8> PathTypes = {
{{ "Resources", fs::ImHexPath::Resources }, {{ "Resources", fs::ImHexPath::Resources },
{ "Config", fs::ImHexPath::Config }, { "Config", fs::ImHexPath::Config },
{ "Magic", fs::ImHexPath::Magic }, { "Magic", fs::ImHexPath::Magic },

View File

@@ -75,7 +75,7 @@ namespace hex::plugin::builtin {
} }
std::vector<ViewCommandPalette::CommandResult> ViewCommandPalette::getCommandResults(const std::string &input) { std::vector<ViewCommandPalette::CommandResult> ViewCommandPalette::getCommandResults(const std::string &input) {
constexpr auto MatchCommand = [](const std::string &currCommand, const std::string &commandToMatch) -> std::pair<MatchType, std::string_view> { constexpr static auto MatchCommand = [](const std::string &currCommand, const std::string &commandToMatch) -> std::pair<MatchType, std::string_view> {
if (currCommand.empty()) { if (currCommand.empty()) {
return { MatchType::InfoMatch, "" }; return { MatchType::InfoMatch, "" };
} else if (currCommand.size() <= commandToMatch.size()) { } else if (currCommand.size() <= commandToMatch.size()) {

View File

@@ -234,6 +234,9 @@ namespace hex::plugin::builtin {
reader.setEndAddress(searchRegion.getEndAddress()); reader.setEndAddress(searchRegion.getEndAddress());
auto sequence = hex::decodeByteString(settings.sequence); auto sequence = hex::decodeByteString(settings.sequence);
if (sequence.empty())
return { };
auto occurrence = reader.begin(); auto occurrence = reader.begin();
while (true) { while (true) {
occurrence = std::search(reader.begin(), reader.end(), std::boyer_moore_horspool_searcher(sequence.begin(), sequence.end())); occurrence = std::search(reader.begin(), reader.end(), std::boyer_moore_horspool_searcher(sequence.begin(), sequence.end()));
@@ -268,8 +271,13 @@ namespace hex::plugin::builtin {
std::string string(occurrence.region.getSize(), '\x00'); std::string string(occurrence.region.getSize(), '\x00');
provider->read(occurrence.region.getStartAddress(), string.data(), occurrence.region.getSize()); provider->read(occurrence.region.getStartAddress(), string.data(), occurrence.region.getSize());
if (std::regex_match(string, regex)) if (settings.fullMatch) {
result.push_back(occurrence); if (std::regex_match(string, regex))
result.push_back(occurrence);
} else {
if (std::regex_search(string, regex))
result.push_back(occurrence);
}
} }
return result; return result;
@@ -461,7 +469,7 @@ namespace hex::plugin::builtin {
ImGui::InputText("hex.builtin.common.value"_lang, settings.sequence); ImGui::InputText("hex.builtin.common.value"_lang, settings.sequence);
this->m_settingsValid = !settings.sequence.empty(); this->m_settingsValid = !settings.sequence.empty() && !hex::decodeByteString(settings.sequence).empty();
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
@@ -470,7 +478,7 @@ namespace hex::plugin::builtin {
mode = SearchSettings::Mode::Regex; mode = SearchSettings::Mode::Regex;
ImGui::InputText("hex.builtin.view.find.regex"_lang, settings.pattern); ImGui::InputText("hex.builtin.view.find.regex.pattern"_lang, settings.pattern);
try { try {
std::regex regex(settings.pattern); std::regex regex(settings.pattern);
@@ -482,6 +490,8 @@ namespace hex::plugin::builtin {
if (settings.pattern.empty()) if (settings.pattern.empty())
this->m_settingsValid = false; this->m_settingsValid = false;
ImGui::Checkbox("hex.builtin.view.find.regex.full_match"_lang, &settings.fullMatch);
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("hex.builtin.view.find.binary_pattern"_lang)) { if (ImGui::BeginTabItem("hex.builtin.view.find.binary_pattern"_lang)) {
@@ -514,6 +524,16 @@ namespace hex::plugin::builtin {
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextFormatted("hex.builtin.view.find.search.entries"_lang, this->m_foundOccurrences[provider].size()); ImGui::TextFormatted("hex.builtin.view.find.search.entries"_lang, this->m_foundOccurrences[provider].size());
ImGui::BeginDisabled(this->m_foundOccurrences[provider].empty());
{
if (ImGui::Button("hex.builtin.view.find.search.reset"_lang)) {
this->m_foundOccurrences[provider].clear();
this->m_sortedOccurrences[provider].clear();
this->m_occurrenceTree[provider].clear();
}
}
ImGui::EndDisabled();
} }
ImGui::EndDisabled(); ImGui::EndDisabled();

View File

@@ -5,7 +5,7 @@
#include <hex/providers/buffered_reader.hpp> #include <hex/providers/buffered_reader.hpp>
#include <hex/helpers/crypto.hpp> #include <hex/helpers/crypto.hpp>
#include "math_evaluator.hpp" #include <content/helpers/math_evaluator.hpp>
#include <imgui_internal.h> #include <imgui_internal.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@@ -1002,14 +1002,14 @@ namespace hex::plugin::builtin {
if ((ImGui::IsMouseDown(ImGuiMouseButton_Left) && this->m_selectionStart != this->m_selectionEnd)) { if ((ImGui::IsMouseDown(ImGuiMouseButton_Left) && this->m_selectionStart != this->m_selectionEnd)) {
auto fractionPerLine = 1.0 / (this->m_visibleRowCount + 1); auto fractionPerLine = 1.0 / (this->m_visibleRowCount + 1);
if (y == u64(clipper.DisplayStart + 2)) { if (y == u64(clipper.DisplayStart + 3)) {
if (i128(this->m_selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) <= (i64(clipper.DisplayStart + 2) * this->m_bytesPerRow)) { if (i128(this->m_selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) <= (i64(clipper.DisplayStart + 3) * this->m_bytesPerRow)) {
this->m_shouldScrollToSelection = false; this->m_shouldScrollToSelection = false;
ImGui::SetScrollHereY(fractionPerLine * 4); ImGui::SetScrollHereY(fractionPerLine * 5);
} }
} else if (y == u64(clipper.DisplayEnd - 2)) { } else if (y == u64(clipper.DisplayEnd - 3)) {
if (i128(this->m_selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) >= (i64(clipper.DisplayEnd - 2) * this->m_bytesPerRow)) { if (i128(this->m_selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) >= (i64(clipper.DisplayEnd - 3) * this->m_bytesPerRow)) {
this->m_shouldScrollToSelection = false; this->m_shouldScrollToSelection = false;
ImGui::SetScrollHereY(fractionPerLine * (this->m_visibleRowCount - 1)); ImGui::SetScrollHereY(fractionPerLine * (this->m_visibleRowCount - 1));
} }
@@ -1152,7 +1152,7 @@ namespace hex::plugin::builtin {
void ViewHexEditor::drawContent() { void ViewHexEditor::drawContent() {
if (ImGui::Begin(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { if (ImGui::Begin(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
const auto FooterSize = ImVec2(ImGui::GetContentRegionAvail().x, ImGui::GetTextLineHeightWithSpacing() * 3); const auto FooterSize = ImVec2(ImGui::GetContentRegionAvail().x, ImGui::GetTextLineHeightWithSpacing() * 2.3);
const auto TableSize = ImGui::GetContentRegionAvail() - ImVec2(0, FooterSize.y); const auto TableSize = ImGui::GetContentRegionAvail() - ImVec2(0, FooterSize.y);
this->drawPopup(); this->drawPopup();
@@ -1175,17 +1175,22 @@ namespace hex::plugin::builtin {
} }
static void copyBytes(const Region &selection) { static void copyBytes(const Region &selection) {
constexpr static auto Format = "{0:02X} ";
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
std::vector<u8> buffer(selection.size, 0x00); auto reader = prv::BufferedReader(provider);
provider->read(selection.getStartAddress() + provider->getBaseAddress() + provider->getCurrentPageAddress(), buffer.data(), buffer.size()); reader.seek(selection.getStartAddress() + provider->getBaseAddress() + provider->getCurrentPageAddress());
reader.setEndAddress(selection.getEndAddress() + provider->getBaseAddress() + provider->getCurrentPageAddress());
std::string str; std::string result;
for (const auto &byte : buffer) result.reserve(fmt::format(Format, 0x00).size() * selection.getSize());
str += hex::format("{0:02X} ", byte);
str.pop_back();
ImGui::SetClipboardText(str.c_str()); for (const auto &byte : reader)
result += fmt::format(Format, byte);
result.pop_back();
ImGui::SetClipboardText(result.c_str());
} }
static void pasteBytes(const Region &selection) { static void pasteBytes(const Region &selection) {
@@ -1526,6 +1531,8 @@ namespace hex::plugin::builtin {
if (ImGui::BeginMenu("hex.builtin.view.hex_editor.menu.edit.copy_as"_lang, selection.has_value() && providerValid)) { if (ImGui::BeginMenu("hex.builtin.view.hex_editor.menu.edit.copy_as"_lang, selection.has_value() && providerValid)) {
if (ImGui::MenuItem("hex.builtin.view.hex_editor.copy.hex"_lang, "CTRL + SHIFT + C")) if (ImGui::MenuItem("hex.builtin.view.hex_editor.copy.hex"_lang, "CTRL + SHIFT + C"))
copyString(*selection); copyString(*selection);
if (ImGui::MenuItem("hex.builtin.view.hex_editor.copy.address"_lang))
ImGui::SetClipboardText(hex::format("0x{:08X}", selection->getStartAddress()).c_str());
ImGui::Separator(); ImGui::Separator();

View File

@@ -2,7 +2,6 @@
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <pl/pattern_language.hpp>
#include <pl/patterns/pattern.hpp> #include <pl/patterns/pattern.hpp>
#include <provider_extra_data.hpp> #include <provider_extra_data.hpp>

View File

@@ -26,13 +26,13 @@ namespace hex::plugin::builtin {
static bool initialized = false; static bool initialized = false;
static TextEditor::LanguageDefinition langDef; static TextEditor::LanguageDefinition langDef;
if (!initialized) { if (!initialized) {
static constexpr std::array keywords = { constexpr static std::array keywords = {
"using", "struct", "union", "enum", "bitfield", "be", "le", "if", "else", "false", "true", "this", "parent", "addressof", "sizeof", "$", "while", "for", "fn", "return", "break", "continue", "namespace", "in", "out" "using", "struct", "union", "enum", "bitfield", "be", "le", "if", "else", "false", "true", "this", "parent", "addressof", "sizeof", "$", "while", "for", "fn", "return", "break", "continue", "namespace", "in", "out", "ref"
}; };
for (auto &k : keywords) for (auto &k : keywords)
langDef.mKeywords.insert(k); langDef.mKeywords.insert(k);
static constexpr std::array builtInTypes = { constexpr static std::array builtInTypes = {
"u8", "u16", "u24", "u32", "u48", "u64", "u96", "u128", "s8", "s16", "s24", "s32", "s48", "s64", "s96", "s128", "float", "double", "char", "char16", "bool", "padding", "str", "auto" "u8", "u16", "u24", "u32", "u48", "u64", "u96", "u128", "s8", "s16", "s24", "s32", "s48", "s64", "s96", "s128", "float", "double", "char", "char16", "bool", "padding", "str", "auto"
}; };
for (const auto name : builtInTypes) { for (const auto name : builtInTypes) {
@@ -80,7 +80,8 @@ namespace hex::plugin::builtin {
ViewPatternEditor::ViewPatternEditor() : View("hex.builtin.view.pattern_editor.name") { ViewPatternEditor::ViewPatternEditor() : View("hex.builtin.view.pattern_editor.name") {
this->m_parserRuntime = ContentRegistry::PatternLanguage::createDefaultRuntime(nullptr); this->m_parserRuntime = std::make_unique<pl::PatternLanguage>();
ContentRegistry::PatternLanguage::configureRuntime(*this->m_parserRuntime, nullptr);
this->m_textEditor.SetLanguageDefinition(PatternLanguage()); this->m_textEditor.SetLanguageDefinition(PatternLanguage());
this->m_textEditor.SetShowWhitespaces(false); this->m_textEditor.SetShowWhitespaces(false);
@@ -110,7 +111,8 @@ namespace hex::plugin::builtin {
EventManager::subscribe<EventProviderOpened>(this, [this](prv::Provider *provider) { EventManager::subscribe<EventProviderOpened>(this, [this](prv::Provider *provider) {
auto &patternLanguageData = ProviderExtraData::get(provider).patternLanguage; auto &patternLanguageData = ProviderExtraData::get(provider).patternLanguage;
patternLanguageData.runtime = ContentRegistry::PatternLanguage::createDefaultRuntime(provider); patternLanguageData.runtime = std::make_unique<pl::PatternLanguage>();
ContentRegistry::PatternLanguage::configureRuntime(*patternLanguageData.runtime, provider);
if (!this->m_autoLoadPatterns) if (!this->m_autoLoadPatterns)
return; return;
@@ -418,6 +420,7 @@ namespace hex::plugin::builtin {
if (this->m_dangerousFunctionCalled && !ImGui::IsPopupOpen(View::toWindowName("hex.builtin.view.pattern_editor.dangerous_function.name").c_str())) { if (this->m_dangerousFunctionCalled && !ImGui::IsPopupOpen(View::toWindowName("hex.builtin.view.pattern_editor.dangerous_function.name").c_str())) {
ImGui::OpenPopup(View::toWindowName("hex.builtin.view.pattern_editor.dangerous_function.name").c_str()); ImGui::OpenPopup(View::toWindowName("hex.builtin.view.pattern_editor.dangerous_function.name").c_str());
this->m_dangerousFunctionCalled = false;
} }
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.pattern_editor.dangerous_function.name").c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.pattern_editor.dangerous_function.name").c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
@@ -524,7 +527,7 @@ namespace hex::plugin::builtin {
ON_SCOPE_EXIT { ImGui::PopID(); }; ON_SCOPE_EXIT { ImGui::PopID(); };
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
constexpr const char *Types[] = { "I", "F", "S", "B" }; constexpr static const char *Types[] = { "I", "F", "S", "B" };
if (ImGui::BeginCombo("", Types[static_cast<int>(type)])) { if (ImGui::BeginCombo("", Types[static_cast<int>(type)])) {
for (auto i = 0; i < IM_ARRAYSIZE(Types); i++) { for (auto i = 0; i < IM_ARRAYSIZE(Types); i++) {
if (ImGui::Selectable(Types[i])) if (ImGui::Selectable(Types[i]))
@@ -704,51 +707,51 @@ namespace hex::plugin::builtin {
{ {
ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor())); ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor()));
ImGui::SameLine(0, 10); ImGui::SameLine(0, 10);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern->getFormattedName()); ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{} ", pattern->getFormattedName());
ImGui::SameLine(0, 5); ImGui::SameLine(0, 5);
ImGui::TextFormatted("{}", pattern->getDisplayName()); ImGui::TextFormatted("{}", pattern->getDisplayName());
ImGui::SameLine(); ImGui::SameLine();
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextFormatted("{}", pattern->getFormattedValue()); ImGui::TextFormatted("{} ", pattern->getFormattedValue());
if (ImGui::GetIO().KeyShift) { if (ImGui::GetIO().KeyShift) {
ImGui::Indent(); ImGui::Indent();
if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) { if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_NoClip)) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}: ", "hex.builtin.common.type"_lang); ImGui::TextFormatted("{} ", "hex.builtin.common.type"_lang);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}", pattern->getTypeName()); ImGui::TextFormatted(" {}", pattern->getTypeName());
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}: ", "hex.builtin.common.address"_lang); ImGui::TextFormatted("{} ", "hex.builtin.common.address"_lang);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("0x{:08X}", pattern->getOffset()); ImGui::TextFormatted(" 0x{:08X}", pattern->getOffset());
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}: ", "hex.builtin.common.size"_lang); ImGui::TextFormatted("{} ", "hex.builtin.common.size"_lang);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}", hex::toByteString(pattern->getSize())); ImGui::TextFormatted(" {}", hex::toByteString(pattern->getSize()));
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}: ", "hex.builtin.common.endian"_lang); ImGui::TextFormatted("{} ", "hex.builtin.common.endian"_lang);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}", pattern->getEndian() == std::endian::little ? "hex.builtin.common.little"_lang : "hex.builtin.common.big"_lang); ImGui::TextFormatted(" {}", pattern->getEndian() == std::endian::little ? "hex.builtin.common.little"_lang : "hex.builtin.common.big"_lang);
if (const auto &comment = pattern->getComment(); comment != nullptr) { if (const auto &comment = pattern->getComment(); comment != nullptr) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextFormatted("{}: ", "hex.builtin.common.comment"_lang); ImGui::TextFormatted("{} ", "hex.builtin.common.comment"_lang);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextWrapped("\"%s\"", comment->c_str()); ImGui::TextWrapped(" \"%s\"", comment->c_str());
} }
ImGui::EndTable(); ImGui::EndTable();
@@ -775,6 +778,7 @@ namespace hex::plugin::builtin {
void ViewPatternEditor::parsePattern(const std::string &code) { void ViewPatternEditor::parsePattern(const std::string &code) {
this->m_runningParsers++; this->m_runningParsers++;
ContentRegistry::PatternLanguage::configureRuntime(*this->m_parserRuntime, nullptr);
auto ast = this->m_parserRuntime->parseString(code); auto ast = this->m_parserRuntime->parseString(code);
this->m_patternVariables.clear(); this->m_patternVariables.clear();
@@ -815,14 +819,13 @@ namespace hex::plugin::builtin {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
auto &runtime = ProviderExtraData::get(provider).patternLanguage.runtime; auto &runtime = ProviderExtraData::get(provider).patternLanguage.runtime;
runtime->reset(); ContentRegistry::PatternLanguage::configureRuntime(*runtime, provider);
runtime->setIncludePaths(fs::getDefaultPaths(fs::ImHexPath::PatternsInclude) | fs::getDefaultPaths(fs::ImHexPath::Patterns));
runtime->setDataBaseAddress(provider->getBaseAddress());
runtime->setDataSize(provider->getActualSize());
EventManager::post<EventHighlightingChanged>(); EventManager::post<EventHighlightingChanged>();
TaskManager::createTask("hex.builtin.view.pattern_editor.evaluating", TaskManager::NoProgress, [this, &runtime, code](auto &) { TaskManager::createTask("hex.builtin.view.pattern_editor.evaluating", TaskManager::NoProgress, [this, &runtime, code](auto &task) {
task.setInterruptCallback([&runtime] { runtime->abort(); });
std::map<std::string, pl::core::Token::Literal> envVars; std::map<std::string, pl::core::Token::Literal> envVars;
for (const auto &[id, name, value, type] : this->m_envVarEntries) for (const auto &[id, name, value, type] : this->m_envVarEntries)
envVars.insert({ name, value }); envVars.insert({ name, value });

View File

@@ -36,6 +36,7 @@ namespace hex::plugin::builtin {
if (ImGui::Button("hex.builtin.common.open"_lang)) { if (ImGui::Button("hex.builtin.common.open"_lang)) {
if (provider->open()) { if (provider->open()) {
EventManager::post<EventProviderOpened>(provider);
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
else { else {

View File

@@ -11,8 +11,10 @@ namespace hex::plugin::builtin {
ViewSettings::ViewSettings() : View("hex.builtin.view.settings.name") { ViewSettings::ViewSettings() : View("hex.builtin.view.settings.name") {
EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) { EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) {
if (name == "Settings") { if (name == "Settings") {
TaskManager::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.settings.name").c_str()); }); TaskManager::doLater([this] {
this->getWindowOpenState() = true; ImGui::OpenPopup(View::toWindowName("hex.builtin.view.settings.name").c_str());
this->getWindowOpenState() = true;
});
} }
}); });

View File

@@ -99,6 +99,8 @@ namespace hex::plugin::builtin {
return; return;
} }
EventManager::post<EventProviderOpened>(provider);
updateRecentProviders(); updateRecentProviders();
} }
} }
@@ -340,7 +342,8 @@ namespace hex::plugin::builtin {
if (ImGui::Hyperlink("X")) { if (ImGui::Hyperlink("X")) {
auto provider = ImHexApi::Provider::createProvider("hex.builtin.provider.null"); auto provider = ImHexApi::Provider::createProvider("hex.builtin.provider.null");
if (provider != nullptr) if (provider != nullptr)
(void)provider->open(); if (provider->open())
EventManager::post<EventProviderOpened>(provider);
} }
} }
@@ -366,8 +369,6 @@ namespace hex::plugin::builtin {
} }
static void drawNoViewsBackground() { static void drawNoViewsBackground() {
if (isAnyViewOpen() && ImHexApi::Provider::isValid()) return;
if (ImGui::Begin("ImHexDockSpace")) { if (ImGui::Begin("ImHexDockSpace")) {
static char title[256]; static char title[256];
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", ImGui::GetCurrentWindow()->Name, ImGui::GetID("ImHexMainDock")); ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", ImGui::GetCurrentWindow()->Name, ImGui::GetID("ImHexMainDock"));
@@ -392,7 +393,10 @@ namespace hex::plugin::builtin {
updateRecentProviders(); updateRecentProviders();
(void)EventManager::subscribe<EventFrameBegin>(drawWelcomeScreen); (void)EventManager::subscribe<EventFrameBegin>(drawWelcomeScreen);
(void)EventManager::subscribe<EventFrameBegin>(drawNoViewsBackground); (void)EventManager::subscribe<EventFrameBegin>([]{
if (ImHexApi::Provider::isValid() && !isAnyViewOpen())
drawNoViewsBackground();
});
(void)EventManager::subscribe<EventSettingsChanged>([]() { (void)EventManager::subscribe<EventSettingsChanged>([]() {
{ {
@@ -524,7 +528,7 @@ namespace hex::plugin::builtin {
}); });
constexpr auto CrashBackupFileName = "crash_backup.hexproj"; constexpr static auto CrashBackupFileName = "crash_backup.hexproj";
for (const auto &path : fs::getDefaultPaths(fs::ImHexPath::Config)) { for (const auto &path : fs::getDefaultPaths(fs::ImHexPath::Config)) {
if (auto filePath = std::fs::path(path) / CrashBackupFileName; fs::exists(filePath)) { if (auto filePath = std::fs::path(path) / CrashBackupFileName; fs::exists(filePath)) {
s_safetyBackupPath = filePath; s_safetyBackupPath = filePath;

View File

@@ -133,7 +133,6 @@ namespace hex::plugin::builtin {
{ "hex.builtin.menu.view", "Ansicht" }, { "hex.builtin.menu.view", "Ansicht" },
{ "hex.builtin.menu.layout", "Layout" }, { "hex.builtin.menu.layout", "Layout" },
{ "hex.builtin.menu.view.fps", "FPS anzeigen" },
{ "hex.builtin.menu.view.demo", "ImGui Demo anzeigen" }, { "hex.builtin.menu.view.demo", "ImGui Demo anzeigen" },
{ "hex.builtin.menu.help", "Hilfe" }, { "hex.builtin.menu.help", "Hilfe" },
@@ -285,7 +284,8 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.file.save_as", "Speichern unter..." }, { "hex.builtin.view.hex_editor.file.save_as", "Speichern unter..." },
{ "hex.builtin.view.hex_editor.menu.edit.copy", "Kopieren" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "Kopieren" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "Kopieren als..." }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "Kopieren als..." },
{ "hex.builtin.view.hex_editor.copy.hex", "String" }, { "hex.builtin.view.hex_editor.copy.hex", "Hex String" },
{ "hex.builtin.view.hex_editor.copy.address", "Adresse" },
{ "hex.builtin.view.hex_editor.copy.c", "C Array" }, { "hex.builtin.view.hex_editor.copy.c", "C Array" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# Array" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# Array" },
@@ -293,7 +293,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python Array" }, { "hex.builtin.view.hex_editor.copy.python", "Python Array" },
{ "hex.builtin.view.hex_editor.copy.java", "Java Array" }, { "hex.builtin.view.hex_editor.copy.java", "Java Array" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" },
{ "hex.builtin.view.hex_editor.copy.ascii", "ASCII Art" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua Array" },
{ "hex.builtin.view.hex_editor.copy.go", "Go Array" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal Array" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift Array" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal Array" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
{ "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "Einfügen" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "Einfügen" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "Alles auswählen" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "Alles auswählen" },
@@ -414,11 +420,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" },
{ "hex.builtin.view.find.sequences", "Sequenzen" }, { "hex.builtin.view.find.sequences", "Sequenzen" },
{ "hex.builtin.view.find.regex", "Regex" }, { "hex.builtin.view.find.regex", "Regex" },
{ "hex.builtin.view.find.regex.pattern", "Pattern" },
{ "hex.builtin.view.find.regex.full_match", "Benötige volle übereinstimmung" },
{ "hex.builtin.view.find.binary_pattern", "Binärpattern" }, { "hex.builtin.view.find.binary_pattern", "Binärpattern" },
{ "hex.builtin.view.find.search", "Suchen" }, { "hex.builtin.view.find.search", "Suchen" },
{ "hex.builtin.view.find.context.copy", "Wert Kopieren" }, { "hex.builtin.view.find.context.copy", "Wert Kopieren" },
{ "hex.builtin.view.find.context.copy_demangle", "Demangled Wert Kopieren" }, { "hex.builtin.view.find.context.copy_demangle", "Demangled Wert Kopieren" },
{ "hex.builtin.view.find.search.entries", "{} Einträge gefunden" }, { "hex.builtin.view.find.search.entries", "{} Einträge gefunden" },
{ "hex.builtin.view.find.search.reset", "Zurücksetzen" },
{ "hex.builtin.command.calc.desc", "Rechner" }, { "hex.builtin.command.calc.desc", "Rechner" },
{ "hex.builtin.command.cmd.desc", "Command" }, { "hex.builtin.command.cmd.desc", "Command" },

View File

@@ -288,7 +288,8 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.menu.file.save_as", "Save As..." }, { "hex.builtin.view.hex_editor.menu.file.save_as", "Save As..." },
{ "hex.builtin.view.hex_editor.menu.edit.copy", "Copy" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "Copy" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "Copy as..." }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "Copy as..." },
{ "hex.builtin.view.hex_editor.copy.hex", "String" }, { "hex.builtin.view.hex_editor.copy.hex", "Hex String" },
{ "hex.builtin.view.hex_editor.copy.address", "Address" },
{ "hex.builtin.view.hex_editor.copy.c", "C Array" }, { "hex.builtin.view.hex_editor.copy.c", "C Array" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# Array" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# Array" },
@@ -296,7 +297,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python Array" }, { "hex.builtin.view.hex_editor.copy.python", "Python Array" },
{ "hex.builtin.view.hex_editor.copy.java", "Java Array" }, { "hex.builtin.view.hex_editor.copy.java", "Java Array" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" },
{ "hex.builtin.view.hex_editor.copy.ascii", "ASCII Art" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua Array" },
{ "hex.builtin.view.hex_editor.copy.go", "Go Array" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal Array" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift Array" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal Array" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
{ "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "Paste" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "Paste" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "Select all" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "Select all" },
@@ -419,11 +426,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" },
{ "hex.builtin.view.find.sequences", "Sequences" }, { "hex.builtin.view.find.sequences", "Sequences" },
{ "hex.builtin.view.find.regex", "Regex" }, { "hex.builtin.view.find.regex", "Regex" },
{ "hex.builtin.view.find.regex.pattern", "Pattern" },
{ "hex.builtin.view.find.regex.full_match", "Require full match" },
{ "hex.builtin.view.find.binary_pattern", "Binary Pattern" }, { "hex.builtin.view.find.binary_pattern", "Binary Pattern" },
{ "hex.builtin.view.find.search", "Search" }, { "hex.builtin.view.find.search", "Search" },
{ "hex.builtin.view.find.context.copy", "Copy Value" }, { "hex.builtin.view.find.context.copy", "Copy Value" },
{ "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" },
{ "hex.builtin.view.find.search.entries", "{} entries found" }, { "hex.builtin.view.find.search.entries", "{} entries found" },
{ "hex.builtin.view.find.search.reset", "Reset" },
{ "hex.builtin.command.calc.desc", "Calculator" }, { "hex.builtin.command.calc.desc", "Calculator" },

View File

@@ -289,7 +289,8 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.menu.file.save_as", "Salva come..." }, { "hex.builtin.view.hex_editor.menu.file.save_as", "Salva come..." },
{ "hex.builtin.view.hex_editor.menu.edit.copy", "Copia" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "Copia" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "Copia come..." }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "Copia come..." },
{ "hex.builtin.view.hex_editor.copy.hex", "Stringa" }, { "hex.builtin.view.hex_editor.copy.hex", "Hex Stringa" },
//{ "hex.builtin.view.hex_editor.copy.address", "Address" },
{ "hex.builtin.view.hex_editor.copy.c", "C Array" }, { "hex.builtin.view.hex_editor.copy.c", "C Array" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# Array" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# Array" },
@@ -297,7 +298,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python Array" }, { "hex.builtin.view.hex_editor.copy.python", "Python Array" },
{ "hex.builtin.view.hex_editor.copy.java", "Java Array" }, { "hex.builtin.view.hex_editor.copy.java", "Java Array" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" },
{ "hex.builtin.view.hex_editor.copy.ascii", "ASCII Art" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua Array" },
{ "hex.builtin.view.hex_editor.copy.go", "Go Array" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal Array" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift Array" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal Array" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
//{ "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "Incolla" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "Incolla" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "Seleziona tutti" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "Seleziona tutti" },
@@ -418,11 +425,14 @@ namespace hex::plugin::builtin {
// { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" },
// { "hex.builtin.view.find.sequences", "Sequences" }, // { "hex.builtin.view.find.sequences", "Sequences" },
// { "hex.builtin.view.find.regex", "Regex" }, // { "hex.builtin.view.find.regex", "Regex" },
//{ "hex.builtin.view.find.regex.pattern", "Pattern" },
//{ "hex.builtin.view.find.regex.full_match", "Require full match" },
// { "hex.builtin.view.find.binary_pattern", "Binary Pattern" }, // { "hex.builtin.view.find.binary_pattern", "Binary Pattern" },
// { "hex.builtin.view.find.search", "Search" }, // { "hex.builtin.view.find.search", "Search" },
// { "hex.builtin.view.find.context.copy", "Copy Value" }, // { "hex.builtin.view.find.context.copy", "Copy Value" },
// { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" },
// { "hex.builtin.view.find.search.entries", "{} entries found" }, // { "hex.builtin.view.find.search.entries", "{} entries found" },
// { "hex.builtin.view.find.search.reset", "Reset" },
{ "hex.builtin.command.calc.desc", "Calcolatrice" }, { "hex.builtin.command.calc.desc", "Calcolatrice" },
{ "hex.builtin.command.cmd.desc", "Comando" }, { "hex.builtin.command.cmd.desc", "Comando" },

View File

@@ -289,6 +289,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.menu.edit.copy", "コピー" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "コピー" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "〜としてコピー…" }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "〜としてコピー…" },
{ "hex.builtin.view.hex_editor.copy.hex", "文字列" }, { "hex.builtin.view.hex_editor.copy.hex", "文字列" },
//{ "hex.builtin.view.hex_editor.copy.address", "Address" },
{ "hex.builtin.view.hex_editor.copy.c", "C 配列" }, { "hex.builtin.view.hex_editor.copy.c", "C 配列" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ 配列" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ 配列" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# 配列" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# 配列" },
@@ -296,7 +297,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python 配列" }, { "hex.builtin.view.hex_editor.copy.python", "Python 配列" },
{ "hex.builtin.view.hex_editor.copy.java", "Java 配列" }, { "hex.builtin.view.hex_editor.copy.java", "Java 配列" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript 配列" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript 配列" },
{ "hex.builtin.view.hex_editor.copy.ascii", "アスキーアート" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua 配列" },
{ "hex.builtin.view.hex_editor.copy.go", "Go 配列" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal 配列" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift 配列" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal 配列" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
//{ "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "貼り付け" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "貼り付け" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "すべて選択" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "すべて選択" },
@@ -421,11 +428,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.find.strings.line_feeds", "ラインフィード" }, { "hex.builtin.view.find.strings.line_feeds", "ラインフィード" },
{ "hex.builtin.view.find.sequences", "通常検索" }, { "hex.builtin.view.find.sequences", "通常検索" },
{ "hex.builtin.view.find.regex", "正規表現" }, { "hex.builtin.view.find.regex", "正規表現" },
// { "hex.builtin.view.find.regex.pattern", "Pattern" },
// { "hex.builtin.view.find.regex.full_match", "Require full match" },
{ "hex.builtin.view.find.binary_pattern", "16進数" }, { "hex.builtin.view.find.binary_pattern", "16進数" },
{ "hex.builtin.view.find.search", "検索を実行" }, { "hex.builtin.view.find.search", "検索を実行" },
{ "hex.builtin.view.find.context.copy", "値をコピー" }, { "hex.builtin.view.find.context.copy", "値をコピー" },
// { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" },
{ "hex.builtin.view.find.search.entries", "一致件数: {}" }, { "hex.builtin.view.find.search.entries", "一致件数: {}" },
// { "hex.builtin.view.find.search.reset", "Reset" },
{ "hex.builtin.command.calc.desc", "電卓" }, { "hex.builtin.command.calc.desc", "電卓" },
{ "hex.builtin.command.cmd.desc", "コマンド" }, { "hex.builtin.command.cmd.desc", "コマンド" },

View File

@@ -136,7 +136,6 @@ namespace hex::plugin::builtin {
{ "hex.builtin.menu.view", "" }, { "hex.builtin.menu.view", "" },
{ "hex.builtin.menu.layout", "레이아웃" }, { "hex.builtin.menu.layout", "레이아웃" },
{ "hex.builtin.menu.view.fps", "FPS 표시하기" },
{ "hex.builtin.menu.view.demo", "ImGui Demo 표시하기" }, { "hex.builtin.menu.view.demo", "ImGui Demo 표시하기" },
{ "hex.builtin.menu.help", "도움말" }, { "hex.builtin.menu.help", "도움말" },
@@ -289,6 +288,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.menu.edit.copy", "복사" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "복사" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "다른 방법으로 복사..." }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "다른 방법으로 복사..." },
{ "hex.builtin.view.hex_editor.copy.hex", "문자열" }, { "hex.builtin.view.hex_editor.copy.hex", "문자열" },
//{ "hex.builtin.view.hex_editor.copy.address", "Address" },
{ "hex.builtin.view.hex_editor.copy.c", "C 배열" }, { "hex.builtin.view.hex_editor.copy.c", "C 배열" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ 배열" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ 배열" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# 배열" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# 배열" },
@@ -296,7 +296,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python 배열" }, { "hex.builtin.view.hex_editor.copy.python", "Python 배열" },
{ "hex.builtin.view.hex_editor.copy.java", "Java 배열" }, { "hex.builtin.view.hex_editor.copy.java", "Java 배열" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript 배열" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript 배열" },
{ "hex.builtin.view.hex_editor.copy.ascii", "ASCII 아트" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua 배열" },
{ "hex.builtin.view.hex_editor.copy.go", "Go 배열" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal 배열" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift 배열" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal 배열" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
//{ "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "붙여넣기" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "붙여넣기" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "모두 선택하기" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "모두 선택하기" },
@@ -419,11 +425,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.find.strings.line_feeds", "라인 피드" }, { "hex.builtin.view.find.strings.line_feeds", "라인 피드" },
{ "hex.builtin.view.find.sequences", "텍스트 시퀸스" }, { "hex.builtin.view.find.sequences", "텍스트 시퀸스" },
{ "hex.builtin.view.find.regex", "정규식" }, { "hex.builtin.view.find.regex", "정규식" },
// { "hex.builtin.view.find.regex.pattern", "Pattern" },
// { "hex.builtin.view.find.regex.full_match", "Require full match" },
{ "hex.builtin.view.find.binary_pattern", "바이너리 패턴" }, { "hex.builtin.view.find.binary_pattern", "바이너리 패턴" },
{ "hex.builtin.view.find.search", "검색" }, { "hex.builtin.view.find.search", "검색" },
{ "hex.builtin.view.find.context.copy", "값 복사" }, { "hex.builtin.view.find.context.copy", "값 복사" },
{ "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" },
{ "hex.builtin.view.find.search.entries", "{} 개 검색됨" }, { "hex.builtin.view.find.search.entries", "{} 개 검색됨" },
// { "hex.builtin.view.find.search.reset", "Reset" },
{ "hex.builtin.command.calc.desc", "계산기" }, { "hex.builtin.command.calc.desc", "계산기" },

View File

@@ -287,6 +287,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.menu.edit.copy", "Copiar" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "Copiar" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "Copiar como..." }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "Copiar como..." },
{ "hex.builtin.view.hex_editor.copy.hex", "String" }, { "hex.builtin.view.hex_editor.copy.hex", "String" },
//{ "hex.builtin.view.hex_editor.copy.address", "Address" },
{ "hex.builtin.view.hex_editor.copy.c", "C Array" }, { "hex.builtin.view.hex_editor.copy.c", "C Array" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ Array" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# Array" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# Array" },
@@ -294,7 +295,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python Array" }, { "hex.builtin.view.hex_editor.copy.python", "Python Array" },
{ "hex.builtin.view.hex_editor.copy.java", "Java Array" }, { "hex.builtin.view.hex_editor.copy.java", "Java Array" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript Array" },
{ "hex.builtin.view.hex_editor.copy.ascii", "ASCII Art" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua Array" },
{ "hex.builtin.view.hex_editor.copy.go", "Go Array" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal Array" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift Array" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal Array" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
//{ "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "Colar" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "Colar" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "Selecionar tudo" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "Selecionar tudo" },
@@ -416,11 +423,14 @@ namespace hex::plugin::builtin {
// { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" },
// { "hex.builtin.view.find.sequences", "Sequences" }, // { "hex.builtin.view.find.sequences", "Sequences" },
// { "hex.builtin.view.find.regex", "Regex" }, // { "hex.builtin.view.find.regex", "Regex" },
// { "hex.builtin.view.find.regex.pattern", "Pattern" },
// { "hex.builtin.view.find.regex.full_match", "Require full match" },
// { "hex.builtin.view.find.binary_pattern", "Binary Pattern" }, // { "hex.builtin.view.find.binary_pattern", "Binary Pattern" },
// { "hex.builtin.view.find.search", "Search" }, // { "hex.builtin.view.find.search", "Search" },
// { "hex.builtin.view.find.context.copy", "Copy Value" }, // { "hex.builtin.view.find.context.copy", "Copy Value" },
// { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" },
// { "hex.builtin.view.find.search.entries", "{} entries found" }, // { "hex.builtin.view.find.search.entries", "{} entries found" },
// { "hex.builtin.view.find.search.reset", "Reset" },
{ "hex.builtin.command.calc.desc", "Calculadora" }, { "hex.builtin.command.calc.desc", "Calculadora" },
{ "hex.builtin.command.cmd.desc", "Comando" }, { "hex.builtin.command.cmd.desc", "Comando" },

View File

@@ -81,13 +81,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.common.browse", "浏览..." }, { "hex.builtin.common.browse", "浏览..." },
{ "hex.builtin.common.choose_file", "选择文件" }, { "hex.builtin.common.choose_file", "选择文件" },
{ "hex.builtin.common.processing", "处理" }, { "hex.builtin.common.processing", "处理" },
//{ "hex.builtin.common.filter", "Filter" }, { "hex.builtin.common.filter", "过滤器" },
//{ "hex.builtin.common.value", "Value" }, { "hex.builtin.common.value", "" },
{ "hex.builtin.common.offset", "偏移" }, { "hex.builtin.common.offset", "偏移" },
//{ "hex.builtin.common.range", "Range" }, { "hex.builtin.common.range", "范围" },
//{ "hex.builtin.common.range.entire_data", "Entire Data" }, { "hex.builtin.common.range.entire_data", "所有数据" },
//{ "hex.builtin.common.range.selection", "Selection" }, { "hex.builtin.common.range.selection", "选区" },
//{ "hex.builtin.common.comment", "Comment" }, { "hex.builtin.common.comment", "注释" },
{ "hex.builtin.common.encoding.ascii", "ASCII" }, { "hex.builtin.common.encoding.ascii", "ASCII" },
{ "hex.builtin.common.encoding.utf16le", "UTF-16LE" }, { "hex.builtin.common.encoding.utf16le", "UTF-16LE" },
@@ -96,15 +96,15 @@ namespace hex::plugin::builtin {
{ "hex.builtin.popup.exit_application.title", "退出?" }, { "hex.builtin.popup.exit_application.title", "退出?" },
{ "hex.builtin.popup.exit_application.desc", "工程还有未保存的更改。\n确定要退出吗?" }, { "hex.builtin.popup.exit_application.desc", "工程还有未保存的更改。\n确定要退出吗?" },
//{ "hex.builtin.popup.close_provider.title", "Close Provider?" }, { "hex.builtin.popup.close_provider.title", "关闭提供器?" },
//{ "hex.builtin.popup.close_provider.desc", "You have unsaved changes made to this Provider.\nAre you sure you want to close it?" }, { "hex.builtin.popup.close_provider.desc", "有对此提供器做出的未保存的更改。\n你确定要关闭吗?" },
{ "hex.builtin.popup.error.read_only", "无法获得写权限,文件以只读方式打开。" }, { "hex.builtin.popup.error.read_only", "无法获得写权限,文件以只读方式打开。" },
{ "hex.builtin.popup.error.open", "打开文件失败!" }, { "hex.builtin.popup.error.open", "打开文件失败!" },
{ "hex.builtin.popup.error.create", "创建新文件失败!" }, { "hex.builtin.popup.error.create", "创建新文件失败!" },
//{ "hex.builtin.popup.error.task_exception", "Exception thrown in Task '{}':\n\n{}" }, { "hex.builtin.popup.error.task_exception", "任务 '{}' 异常:\n\n{}" },
{ "hex.builtin.menu.file", "文件" }, { "hex.builtin.menu.file", "文件" },
//{ "hex.builtin.menu.file.create_file", "New File..." }, { "hex.builtin.menu.file.create_file", "新建文件..." },
{ "hex.builtin.menu.file.open_file", "打开文件..." }, { "hex.builtin.menu.file.open_file", "打开文件..." },
{ "hex.builtin.menu.file.open_recent", "最近打开" }, { "hex.builtin.menu.file.open_recent", "最近打开" },
{ "hex.builtin.menu.file.clear_recent", "清除" }, { "hex.builtin.menu.file.clear_recent", "清除" },
@@ -125,8 +125,8 @@ namespace hex::plugin::builtin {
{ "hex.builtin.menu.file.export.ips32", "IPS32 补丁" }, { "hex.builtin.menu.file.export.ips32", "IPS32 补丁" },
{ "hex.builtin.menu.file.export.base64.popup.export_error", "文件不是有效的 Base64 格式!" }, { "hex.builtin.menu.file.export.base64.popup.export_error", "文件不是有效的 Base64 格式!" },
{ "hex.builtin.menu.file.export.popup.create", "无法导出文件。文件创建失败!" }, { "hex.builtin.menu.file.export.popup.create", "无法导出文件。文件创建失败!" },
//{ "hex.builtin.menu.file.bookmark.import", "Import bookmarks" }, { "hex.builtin.menu.file.bookmark.import", "导入书签" },
//{ "hex.builtin.menu.file.bookmark.export", "Export bookmarks" }, { "hex.builtin.menu.file.bookmark.export", "导出书签" },
{ "hex.builtin.menu.edit", "编辑" }, { "hex.builtin.menu.edit", "编辑" },
{ "hex.builtin.menu.edit.undo", "撤销" }, { "hex.builtin.menu.edit.undo", "撤销" },
@@ -279,17 +279,18 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.goto.offset.relative", "相对" }, { "hex.builtin.view.hex_editor.goto.offset.relative", "相对" },
{ "hex.builtin.view.hex_editor.goto.offset.begin", "起始" }, { "hex.builtin.view.hex_editor.goto.offset.begin", "起始" },
{ "hex.builtin.view.hex_editor.goto.offset.end", "末尾" }, { "hex.builtin.view.hex_editor.goto.offset.end", "末尾" },
//{ "hex.builtin.view.hex_editor.menu.file.select", "Select" }, { "hex.builtin.view.hex_editor.menu.file.select", "选择" },
// { "hex.builtin.view.hex_editor.select.offset.region", "Region" }, { "hex.builtin.view.hex_editor.select.offset.region", "区域" },
// { "hex.builtin.view.hex_editor.select.offset.begin", "Begin" }, { "hex.builtin.view.hex_editor.select.offset.begin", "起始" },
// { "hex.builtin.view.hex_editor.select.offset.end", "End" }, { "hex.builtin.view.hex_editor.select.offset.end", "结束" },
// { "hex.builtin.view.hex_editor.select.offset.size", "Size" }, { "hex.builtin.view.hex_editor.select.offset.size", "大小" },
// { "hex.builtin.view.hex_editor.select.select", "Select" }, { "hex.builtin.view.hex_editor.select.select", "选择" },
{ "hex.builtin.view.hex_editor.menu.file.save", "保存" }, { "hex.builtin.view.hex_editor.menu.file.save", "保存" },
{ "hex.builtin.view.hex_editor.menu.file.save_as", "另存为..." }, { "hex.builtin.view.hex_editor.menu.file.save_as", "另存为..." },
{ "hex.builtin.view.hex_editor.menu.edit.copy", "复制" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "复制" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "复制为..." }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "复制为..." },
{ "hex.builtin.view.hex_editor.copy.hex", "字符串" }, { "hex.builtin.view.hex_editor.copy.hex", "字符串" },
{ "hex.builtin.view.hex_editor.copy.address", "地址" },
{ "hex.builtin.view.hex_editor.copy.c", "C 数组" }, { "hex.builtin.view.hex_editor.copy.c", "C 数组" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ 数组" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ 数组" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# 数组" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# 数组" },
@@ -297,7 +298,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python 数组" }, { "hex.builtin.view.hex_editor.copy.python", "Python 数组" },
{ "hex.builtin.view.hex_editor.copy.java", "Java 数组" }, { "hex.builtin.view.hex_editor.copy.java", "Java 数组" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript 数组" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript 数组" },
{ "hex.builtin.view.hex_editor.copy.ascii", "Hex DumpASCII 艺术)" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua 数组" },
{ "hex.builtin.view.hex_editor.copy.go", "Go 数组" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal 数组" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift 数组" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal 数组" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
//{ "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "粘贴" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "粘贴" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "全选" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "全选" },
@@ -400,30 +407,33 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.provider_settings.name", "提供器设置" }, { "hex.builtin.view.provider_settings.name", "提供器设置" },
{ "hex.builtin.view.provider_settings.load_popup", "打开提供器" }, { "hex.builtin.view.provider_settings.load_popup", "打开提供器" },
// { "hex.builtin.view.provider_settings.load_error", "An error occurred while trying to open this provider!"}, { "hex.builtin.view.provider_settings.load_error", "尝试打开此提供器时出现错误"},
//{ "hex.builtin.view.find.name", "Find" }, { "hex.builtin.view.find.name", "查找" },
// { "hex.builtin.view.find.searching", "Searching..." }, { "hex.builtin.view.find.searching", "搜索中..." },
// { "hex.builtin.view.find.demangled", "Demangled" }, { "hex.builtin.view.find.demangled", "还原名" },
// { "hex.builtin.view.find.strings", "Strings" }, { "hex.builtin.view.find.strings", "字符串" },
// { "hex.builtin.view.find.strings.min_length", "Minimum length" }, { "hex.builtin.view.find.strings.min_length", "最短长度" },
// { "hex.builtin.view.find.strings.match_settings", "Match Settings" }, { "hex.builtin.view.find.strings.match_settings", "配置设置" },
// { "hex.builtin.view.find.strings.null_term", "Require Null Termination" }, { "hex.builtin.view.find.strings.null_term", "需要NULL终止" },
// { "hex.builtin.view.find.strings.chars", "Characters" }, { "hex.builtin.view.find.strings.chars", "字符" },
// { "hex.builtin.view.find.strings.lower_case", "Lower case letters" }, { "hex.builtin.view.find.strings.lower_case", "小写字母" },
// { "hex.builtin.view.find.strings.upper_case", "Upper case letters" }, { "hex.builtin.view.find.strings.upper_case", "大写字母" },
// { "hex.builtin.view.find.strings.numbers", "Numbers" }, { "hex.builtin.view.find.strings.numbers", "数字" },
// { "hex.builtin.view.find.strings.underscores", "Underscores" }, { "hex.builtin.view.find.strings.underscores", "下划线" },
// { "hex.builtin.view.find.strings.symbols", "Symbols" }, { "hex.builtin.view.find.strings.symbols", "符号" },
// { "hex.builtin.view.find.strings.spaces", "Spaces" }, { "hex.builtin.view.find.strings.spaces", "空格" },
// { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, { "hex.builtin.view.find.strings.line_feeds", "换行" },
// { "hex.builtin.view.find.sequences", "Sequences" }, { "hex.builtin.view.find.sequences", "序列" },
// { "hex.builtin.view.find.regex", "Regex" }, { "hex.builtin.view.find.regex", "正则表达式" },
// { "hex.builtin.view.find.binary_pattern", "Binary Pattern" }, // { "hex.builtin.view.find.regex.pattern", "Pattern" },
// { "hex.builtin.view.find.search", "Search" }, // { "hex.builtin.view.find.regex.full_match", "Require full match" },
// { "hex.builtin.view.find.context.copy", "Copy Value" }, { "hex.builtin.view.find.binary_pattern", "二进制模式" },
// { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, { "hex.builtin.view.find.search", "搜索" },
// { "hex.builtin.view.find.search.entries", "{} entries found" }, { "hex.builtin.view.find.context.copy", "复制值" },
{ "hex.builtin.view.find.context.copy_demangle", "复制值的还原名" },
{ "hex.builtin.view.find.search.entries", "{} 个结果" },
// { "hex.builtin.view.find.search.reset", "Reset" },
{ "hex.builtin.command.calc.desc", "计算器" }, { "hex.builtin.command.calc.desc", "计算器" },
{ "hex.builtin.command.cmd.desc", "指令" }, { "hex.builtin.command.cmd.desc", "指令" },
@@ -431,8 +441,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.command.web.desc", "网站解析" }, { "hex.builtin.command.web.desc", "网站解析" },
{ "hex.builtin.command.web.result", "导航到 '{0}'" }, { "hex.builtin.command.web.result", "导航到 '{0}'" },
// Use half width symbols for inspector names because displayable space { "hex.builtin.inspector.binary", "二进制8 位)" },
{ "hex.builtin.inspector.binary", "二进制(8位)" },
{ "hex.builtin.inspector.u8", "uint8_t" }, { "hex.builtin.inspector.u8", "uint8_t" },
{ "hex.builtin.inspector.i8", "int8_t" }, { "hex.builtin.inspector.i8", "int8_t" },
{ "hex.builtin.inspector.u16", "uint16_t" }, { "hex.builtin.inspector.u16", "uint16_t" },
@@ -445,12 +454,12 @@ namespace hex::plugin::builtin {
{ "hex.builtin.inspector.i48", "int48_t" }, { "hex.builtin.inspector.i48", "int48_t" },
{ "hex.builtin.inspector.u64", "uint64_t" }, { "hex.builtin.inspector.u64", "uint64_t" },
{ "hex.builtin.inspector.i64", "int64_t" }, { "hex.builtin.inspector.i64", "int64_t" },
{ "hex.builtin.inspector.float16", "半精度浮点(16位)" }, { "hex.builtin.inspector.float16", "half float16 位)" },
{ "hex.builtin.inspector.float", "float(32位单精度)" }, { "hex.builtin.inspector.float", "float32 位)" },
{ "hex.builtin.inspector.double", "double(64位双精度)" }, { "hex.builtin.inspector.double", "double64 位)" },
{ "hex.builtin.inspector.long_double", "long double(128位四精度)" }, { "hex.builtin.inspector.long_double", "long double128 位)" },
//{ "hex.builtin.inspector.sleb128", "Signed LEB128" }, { "hex.builtin.inspector.sleb128", "有符号LEB128" },
//{ "hex.builtin.inspector.uleb128", "Unsigned LEB128" }, { "hex.builtin.inspector.uleb128", "无符号LEB128" },
{ "hex.builtin.inspector.bool", "bool" }, { "hex.builtin.inspector.bool", "bool" },
{ "hex.builtin.inspector.ascii", "ASCII 字符" }, { "hex.builtin.inspector.ascii", "ASCII 字符" },
{ "hex.builtin.inspector.wide", "宽字符" }, { "hex.builtin.inspector.wide", "宽字符" },
@@ -709,7 +718,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.general", "通用" }, { "hex.builtin.setting.general", "通用" },
{ "hex.builtin.setting.general.show_tips", "在启动时显示每日提示" }, { "hex.builtin.setting.general.show_tips", "在启动时显示每日提示" },
{ "hex.builtin.setting.general.auto_load_patterns", "自动加载支持的模式" }, { "hex.builtin.setting.general.auto_load_patterns", "自动加载支持的模式" },
// { "hex.builtin.setting.general.sync_pattern_source", "Sync pattern source code between providers" }, { "hex.builtin.setting.general.sync_pattern_source", "在提供器间同步模式源码" },
{ "hex.builtin.setting.interface", "界面" }, { "hex.builtin.setting.interface", "界面" },
{ "hex.builtin.setting.interface.color", "颜色主题" }, { "hex.builtin.setting.interface.color", "颜色主题" },
{ "hex.builtin.setting.interface.color.system", "跟随系统" }, { "hex.builtin.setting.interface.color.system", "跟随系统" },
@@ -765,10 +774,10 @@ namespace hex::plugin::builtin {
{ "hex.builtin.provider.disk.disk_size", "磁盘大小" }, { "hex.builtin.provider.disk.disk_size", "磁盘大小" },
{ "hex.builtin.provider.disk.sector_size", "扇区大小" }, { "hex.builtin.provider.disk.sector_size", "扇区大小" },
{ "hex.builtin.provider.disk.reload", "刷新" }, { "hex.builtin.provider.disk.reload", "刷新" },
//{ "hex.builtin.provider.intel_hex", "Intel Hex Provider" }, { "hex.builtin.provider.intel_hex", "Intel Hex" },
// { "hex.builtin.provider.intel_hex.name", "Intel Hex {0}" }, { "hex.builtin.provider.intel_hex.name", "Intel Hex {0}" },
//{ "hex.builtin.provider.motorola_srec", "Motorola SREC Provider" }, { "hex.builtin.provider.motorola_srec", "Motorola SREC" },
// { "hex.builtin.provider.motorola_srec.name", "Motorola SREC {0}" }, { "hex.builtin.provider.motorola_srec.name", "Motorola SREC {0}" },
{ "hex.builtin.layouts.default", "默认" }, { "hex.builtin.layouts.default", "默认" },

View File

@@ -287,6 +287,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.menu.edit.copy", "複製" }, { "hex.builtin.view.hex_editor.menu.edit.copy", "複製" },
{ "hex.builtin.view.hex_editor.menu.edit.copy_as", "複製為..." }, { "hex.builtin.view.hex_editor.menu.edit.copy_as", "複製為..." },
{ "hex.builtin.view.hex_editor.copy.hex", "字串" }, { "hex.builtin.view.hex_editor.copy.hex", "字串" },
//{ "hex.builtin.view.hex_editor.copy.address", "Address" },
{ "hex.builtin.view.hex_editor.copy.c", "C 陣列" }, { "hex.builtin.view.hex_editor.copy.c", "C 陣列" },
{ "hex.builtin.view.hex_editor.copy.cpp", "C++ 陣列" }, { "hex.builtin.view.hex_editor.copy.cpp", "C++ 陣列" },
{ "hex.builtin.view.hex_editor.copy.csharp", "C# 陣列" }, { "hex.builtin.view.hex_editor.copy.csharp", "C# 陣列" },
@@ -294,7 +295,13 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.hex_editor.copy.python", "Python 陣列" }, { "hex.builtin.view.hex_editor.copy.python", "Python 陣列" },
{ "hex.builtin.view.hex_editor.copy.java", "Java 陣列" }, { "hex.builtin.view.hex_editor.copy.java", "Java 陣列" },
{ "hex.builtin.view.hex_editor.copy.js", "JavaScript 陣列" }, { "hex.builtin.view.hex_editor.copy.js", "JavaScript 陣列" },
{ "hex.builtin.view.hex_editor.copy.ascii", "ASCII 畫" }, { "hex.builtin.view.hex_editor.copy.lua", "Lua 陣列" },
{ "hex.builtin.view.hex_editor.copy.go", "Go 陣列" },
{ "hex.builtin.view.hex_editor.copy.crystal", "Crystal 陣列" },
{ "hex.builtin.view.hex_editor.copy.swift", "Swift 陣列" },
{ "hex.builtin.view.hex_editor.copy.pascal", "Pascal 陣列" },
{ "hex.builtin.view.hex_editor.copy.base64", "Base64" },
// { "hex.builtin.view.hex_editor.copy.ascii", "Text Area" },
{ "hex.builtin.view.hex_editor.copy.html", "HTML" }, { "hex.builtin.view.hex_editor.copy.html", "HTML" },
{ "hex.builtin.view.hex_editor.menu.edit.paste", "貼上" }, { "hex.builtin.view.hex_editor.menu.edit.paste", "貼上" },
{ "hex.builtin.view.hex_editor.menu.edit.select_all", "全選" }, { "hex.builtin.view.hex_editor.menu.edit.select_all", "全選" },
@@ -417,11 +424,14 @@ namespace hex::plugin::builtin {
// { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" }, // { "hex.builtin.view.find.strings.line_feeds", "Line Feeds" },
// { "hex.builtin.view.find.sequences", "Sequences" }, // { "hex.builtin.view.find.sequences", "Sequences" },
// { "hex.builtin.view.find.regex", "Regex" }, // { "hex.builtin.view.find.regex", "Regex" },
// { "hex.builtin.view.find.regex.pattern", "Pattern" },
// { "hex.builtin.view.find.regex.full_match", "Require full match" },
// { "hex.builtin.view.find.binary_pattern", "Binary Pattern" }, // { "hex.builtin.view.find.binary_pattern", "Binary Pattern" },
// { "hex.builtin.view.find.search", "Search" }, // { "hex.builtin.view.find.search", "Search" },
// { "hex.builtin.view.find.context.copy", "Copy Value" }, // { "hex.builtin.view.find.context.copy", "Copy Value" },
// { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" }, // { "hex.builtin.view.find.context.copy_demangle", "Copy Demangled Value" },
// { "hex.builtin.view.find.search.entries", "{} entries found" }, // { "hex.builtin.view.find.search.entries", "{} entries found" },
// { "hex.builtin.view.find.search.reset", "Reset" },
{ "hex.builtin.command.calc.desc", "計算機" }, { "hex.builtin.command.calc.desc", "計算機" },
{ "hex.builtin.command.cmd.desc", "命令" }, { "hex.builtin.command.cmd.desc", "命令" },

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="138.42885mm"
height="42.6539mm"
viewBox="0 0 138.42885 42.6539"
version="1.1"
id="svg1"
inkscape:export-filename="bitmap.png"
inkscape:export-xdpi="93.949997"
inkscape:export-ydpi="93.949997"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<style>
#text2 { fill:#d8dbe1; }
@media (prefers-color-scheme: light) {
#text2 { fill:#121419; }
}
</style>
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:export-bgcolor="#babec900" />
<defs
id="defs1">
<filter
style="color-interpolation-filters:sRGB"
inkscape:label="Drop Shadow"
id="filter30"
x="-0.037258737"
y="-0.14521736"
width="1.0745175"
height="1.2904347">
<feFlood
result="flood"
in="SourceGraphic"
flood-opacity="0.564706"
flood-color="rgb(0,0,0)"
id="feFlood29" />
<feGaussianBlur
result="blur"
in="SourceGraphic"
stdDeviation="2.000000"
id="feGaussianBlur29" />
<feOffset
result="offset"
in="blur"
dx="0.000000"
dy="0.000000"
id="feOffset29" />
<feComposite
result="comp1"
operator="in"
in="flood"
in2="offset"
id="feComposite29" />
<feComposite
result="comp2"
operator="over"
in="SourceGraphic"
in2="comp1"
id="feComposite30" />
</filter>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-44.395001,-12.770095)">
<text
xml:space="preserve"
style="font-size:45.1556px;line-height:0;fill-opacity:1;stroke-width:0.264583;filter:url(#filter30)"
x="45.943798"
y="49.901505"
id="text2"
inkscape:label="text2"><tspan
sodipodi:role="line"
id="tspan2"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:45.1556px;font-family:'Product Sans';-inkscape-font-specification:'Product Sans Bold';fill-opacity:1;stroke-width:0.264583"
x="45.943798"
y="49.901505">ImHex</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.