Compare commits

...

88 Commits

Author SHA1 Message Date
WerWolv
1508efac7a build: Bumped version to 1.37.2 2025-02-24 20:39:33 +01:00
WerWolv
16dc239e0f fix: Crashes when switching disassembler architecture while disassembling 2025-02-24 20:03:49 +01:00
WerWolv
899f00ed2f fix: Way too low sleep target fps 2025-02-24 20:03:43 +01:00
WerWolv
9ebfffd346 fix: Debug assertion 2025-02-24 20:03:37 +01:00
WerWolv
76b2c09450 build: Remove wrong hexpluglib bundling from rpms 2025-02-24 20:03:31 +01:00
WerWolv
69246de145 impr: Don't wake up frame rate limiter thread more often than necessary 2025-02-24 20:03:19 +01:00
WerWolv
aee4b4fdf6 build: Disable fortify source in debug builds 2025-02-24 20:03:10 +01:00
WerWolv
a6a78cef00 build: Make sure plugin libraries don't end up in lib folder 2025-02-20 11:43:13 +01:00
WerWolv
30b25a39a7 fix: Crash when closing provider that's open in the diff view 2025-02-20 10:40:52 +01:00
Jonathan Wright
1f0b5e1ee1 build: Fix using system lunasvg (#2131)
Fix capitalization for cmake find_package and lunasvg.h path
2025-02-20 10:40:45 +01:00
WerWolv
d6658c3471 fix: Broken Plugin API link 2025-02-20 10:40:37 +01:00
WerWolv
398eecaa1d fix: Potential division by zero on Windows 7
#2130
2025-02-20 10:40:27 +01:00
WerWolv
b6616c1a0f patterns: Updated pattern language
Fixes #2126
2025-02-18 23:20:24 +01:00
WerWolv
5d3315f51c fix: Occasional crash when switching fonts 2025-02-18 23:20:03 +01:00
WerWolv
ec7298f0c0 impr: Make CLI not hang for a second after each command on Linux 2025-02-18 23:19:57 +01:00
WerWolv
92c2018f71 fix: Prevent stack overread when calling dbus-send 2025-02-18 23:19:48 +01:00
WerWolv
956952021d impr: Make title bar icon always draw at the correct size 2025-02-18 23:19:41 +01:00
WerWolv
f112123d39 build: Bumped version to 1.37.1 2025-02-18 10:47:51 +01:00
WerWolv
1a1ef9e7e0 fix: Pattern Editor losing focus during auto evaluation
Fixes #2122
2025-02-18 10:27:10 +01:00
WerWolv
39543fbda8 build: Updated dependencies 2025-02-18 10:26:54 +01:00
WerWolv
835863523b build: Get rid of unused Toolchain file warning 2025-02-17 13:19:41 +01:00
WerWolv
e6c8c69fda fix: Remove unused event unsubscribes in disassembler 2025-02-17 13:07:22 +01:00
WerWolv
e2d30eeba2 fix: Crash when setting invalid font 2025-02-17 13:07:15 +01:00
WerWolv
1da82d1403 impr: Added missing ellipsis on Edit options 2025-02-17 11:21:43 +01:00
WerWolv
73b9df24cf fix: Closing one view breaking all other views 2025-02-17 10:17:23 +01:00
WerWolv
f93e1194d6 fix: Crash when loading process memory provider from project 2025-02-17 10:17:13 +01:00
WerWolv
677cff244d fix: Make sure fps counter values are initialized to zero 2025-02-16 23:46:20 +01:00
WerWolv
8d88e328fa fix: Don't execute EventDPIChanged multiple times 2025-02-16 22:53:35 +01:00
WerWolv
acb5ef561d fix: Wrong native scaling on Wayland 2025-02-16 21:55:38 +01:00
WerWolv
444b5219e2 fix: Crash when custom disassembler returns no bytes 2025-02-16 21:11:19 +01:00
WerWolv
a4c7e0db90 patterns: Updated pattern language 2025-02-16 21:06:14 +01:00
WerWolv
f4e1824b7b fix: Pattern editor being shifted to the left on evaluate 2025-02-16 20:53:29 +01:00
WerWolv
fcb5e18102 fix: Pattern console log logic 2025-02-16 20:53:20 +01:00
WerWolv
70d4e21c4b fix: Don't parse version string on every call 2025-02-16 20:53:12 +01:00
WerWolv
2e2d5d31bc build: Updated libwolv 2025-02-16 20:52:57 +01:00
WerWolv
01f4595aab build: Bumped version to 1.37.0 2025-02-16 17:13:50 +01:00
WerWolv
bf10d333cd fix: Default scale of Web version on macOS 2025-02-16 16:35:37 +01:00
WerWolv
267ef37cb6 fix: Use after free when logging during plugin unload 2025-02-16 16:19:00 +01:00
WerWolv
879e4c9d58 build: Move menu items handler into libimhex 2025-02-16 15:48:44 +01:00
WerWolv
67340e1526 impr: Make sure to only ever load plugins once 2025-02-16 15:14:23 +01:00
WerWolv
6ec8f9efe5 fix: Allow --select subcommand to work with hex numbers 2025-02-16 15:02:29 +01:00
WerWolv
c2b0560d91 git: Make sure entitlements are applied correctly to ARM macos builds 2025-02-16 14:58:29 +01:00
WerWolv
388071557e impr: Reduce opacity of modal backdrop 2025-02-16 14:33:17 +01:00
WerWolv
f6e3ede178 impr: Make hyperlink icons gray 2025-02-16 14:30:06 +01:00
WerWolv
a907550567 fix: Title bar backdrop not working correctly on macOS 2025-02-16 14:24:00 +01:00
WerWolv
c75a15dc3b patterns: Updated pattern language 2025-02-16 14:21:19 +01:00
WerWolv
83904aa1f1 fix: Disable alpha display in various color buttons 2025-02-16 14:12:58 +01:00
WerWolv
7d527fd2a6 feat: Added disassemblers tab to content store 2025-02-16 13:58:56 +01:00
paxcut
007e04bf37 fix: Auto evaluate not working when undoing changes (#2106)
The pattern editor was resetting the flag that marked text changes on
every frame, but resolving a text change may take more than one frame,
so instead I created a function that allows the resetting of the text
changed boolean from view pattern editor.

Currently, when a pattern is evaluated the pattern editor will lose
focus regardless of how evaluation was triggered. This is specially
annoying when using f5 or auto-evaluate. Now whenever a pattern is
evaluated, focus is given to the pattern editor when evaluation ends.

JumptoLine didn't work for empty lines.

Co-authored-by: Nik <werwolv98@gmail.com>
2025-02-16 12:20:22 +00:00
paxcut
caff49504e impr: Better home shortcut for pattern editor (#2105)
The old home shortcut moved the cursor to column zero of the current
line.
Most editors move cursor to the first non-space character instead.
2025-02-16 12:53:07 +01:00
WerWolv
aad38beaf5 fix: Dangerous for loop comparison 2025-02-16 11:56:07 +01:00
WerWolv
bdad733331 build: Document disabled MSVC warnings 2025-02-16 11:53:01 +01:00
WerWolv
bc26ade57e fix: Double -> Float truncation 2025-02-16 11:49:32 +01:00
WerWolv
ee52ff3b11 impr: Make toolbar buttons slightly easier to see 2025-02-16 11:48:28 +01:00
WerWolv
40b95f02e4 patterns: Updated pattern language 2025-02-16 11:42:27 +01:00
WerWolv
8777a85630 fix: Make title bar backdrop stay where it is on resize 2025-02-16 11:40:09 +01:00
WerWolv
870aeb34fc feat: Added a title bar backdrop color gradient 2025-02-16 11:33:41 +01:00
WerWolv
b03be212b3 git: Fixed AppImage runner caching 2025-02-16 11:11:24 +01:00
WerWolv
c8f7dbf85e fix: Remove settings scaling warning as it doesn't make any sense anymore now 2025-02-16 10:56:01 +01:00
WerWolv
9e826b4c8b fix: Make sure shortcuts migration routine runs again with this release 2025-02-16 10:48:29 +01:00
WerWolv
05d528b39a git: Disable attestation for pull requests again 2025-02-16 10:03:17 +01:00
Justus Garbe
6828c7c077 fix: crash when disassembler encounters invalid instructions (#2116) 2025-02-16 00:52:30 +01:00
WerWolv
54f3bc0262 impr: Use heuristic to determine backing scale factor on the web 2025-02-15 22:30:06 +01:00
WerWolv
e232a2b33d fix: Web build rendering 2025-02-15 22:23:49 +01:00
WerWolv
73a3b217a4 fix: Scaling on the web version 2025-02-15 21:26:03 +01:00
WerWolv
19f925c60b build: Disable stack protectors for the web build since emscripten doesn't support it 2025-02-15 21:08:05 +01:00
WerWolv
5fb488236b git: Fixed macOS DMGs not having their volume icon set 2025-02-15 21:05:50 +01:00
WerWolv
c84786f9ee git: Fixed name of macOS ARM64 release build 2025-02-15 21:05:35 +01:00
WerWolv
c1925ddf8d fix: Inverted logic of donation nag 2025-02-15 19:34:18 +01:00
WerWolv
cf194e332c impr: Move update button from welcome screen to the title bar and show a toast 2025-02-15 19:25:29 +01:00
WerWolv
d8877e7d8b build: Enabled various hardening flags on GCC and Clang 2025-02-15 19:15:34 +01:00
WerWolv
8b2184f8e3 updater: Fixed updater not working properly on macOS 2025-02-15 17:50:29 +01:00
WerWolv
a42e4c5299 updater: Added updater support for more platforms 2025-02-15 17:14:58 +01:00
WerWolv
419787e17c impr: Make auto updater work better on Windows 2025-02-15 16:46:36 +01:00
WerWolv
2d6da52a86 patterns: Updated pattern language
Fixes #2114
2025-02-15 16:10:09 +01:00
Nik
b46deb3fa0 git: Added MSVC build CI (#2115) 2025-02-15 15:44:16 +01:00
WerWolv
b70120a248 build: Updated libwolv 2025-02-15 11:16:50 +01:00
WerWolv
3a6a4011d0 feat: Added nag banners for donations 2025-02-15 11:15:56 +01:00
WerWolv
999c4d07b7 fix: More double -> float narrowing fixes 2025-02-15 11:15:39 +01:00
WerWolv
44b182c6ae impr: Handle upgrade paths better 2025-02-15 11:15:24 +01:00
WerWolv
de7bec547a build: Make VS preset use Ninja because _my god_ MSBuild sucks 2025-02-15 11:14:46 +01:00
WerWolv
5542c0bc00 fix: Multiple issues with provider load interfaces not working 2025-02-15 11:13:22 +01:00
WerWolv
83e0ce0042 fix: Corporate environment detection not working correctly 2025-02-15 11:09:20 +01:00
WerWolv
4685dea075 git: Fix attestation generation 2025-02-11 23:52:46 +01:00
WerWolv
599f63bc67 build: Updated libwolv 2025-02-11 23:45:55 +01:00
WerWolv
199f2aea77 build: Updated disassembler library 2025-02-11 23:09:15 +01:00
WerWolv
bff9b8b4b1 feat: Fixed string/char names in data inspector, added utf16 and utf32 string and char types 2025-02-11 23:05:56 +01:00
WerWolv
a83610bc06 build: Updated libwolv 2025-02-11 23:05:25 +01:00
77 changed files with 765 additions and 366 deletions

View File

@@ -15,8 +15,8 @@ env:
jobs:
# Windows build
win:
# Windows MINGW build
win_mingw:
runs-on: windows-2022
name: 🪟 Windows MINGW64
@@ -41,8 +41,8 @@ jobs:
uses: hendrikmuhs/ccache-action@v1
id: cache-ccache
with:
key: ${{ runner.os }}-ccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-ccache
key: ${{ runner.os }}-mingw-ccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-mingw-ccache
max-size: 1G
- name: 🟦 Install msys2
@@ -140,7 +140,7 @@ jobs:
- name: 🗝️ Generate build provenance attestations
uses: actions/attest-build-provenance@v2
if: github.event.pull_request.head.repo.full_name == github.repository
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
with:
subject-path: |
imhex-*.msi
@@ -178,6 +178,80 @@ jobs:
path: |
build/install/*
win_msvc:
runs-on: windows-2022
name: 🪟 Windows MSVC
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache"
permissions:
id-token: write
attestations: write
steps:
- name: 🧰 Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: 🫧 Setup Visual Studio Dev Environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: 📜 Setup ccache
uses: hendrikmuhs/ccache-action@v1
id: cache-ccache
with:
key: ${{ runner.os }}-msvc-ccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-msvc-ccache
max-size: 1G
- name: 📦 Install vcpkg
uses: friendlyanon/setup-vcpkg@v1
with: { committish: 7e21420f775f72ae938bdeb5e6068f722088f06a }
- name: ⬇️ Install dependencies
run: |
cp dist/vcpkg.json vcpkg.json
- name: ⬇️ Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: ⬇️ Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.100'
- name: 📜 Set version variable
run: |
"IMHEX_VERSION=$(Get-Content VERSION -Raw)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Windows cmake build
- name: 🛠️ Configure CMake
run: |
mkdir -p build
cmake -G "Ninja" -B build `
--preset vs2022 `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DCMAKE_C_COMPILER="$($(Get-Command cl.exe).Path)" `
-DCMAKE_CXX_COMPILER="$($(Get-Command cl.exe).Path)" `
-DCMAKE_C_COMPILER_LAUNCHER=ccache `
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache `
-DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" `
-DIMHEX_PATTERNS_PULL_MASTER=ON `
-DIMHEX_COMMIT_HASH_LONG="$env:GITHUB_SHA" `
-DIMHEX_COMMIT_BRANCH="$($env:GITHUB_REF -replace '.*/', '')" `
-DDOTNET_EXECUTABLE="C:/Program Files/dotnet/dotnet.exe" `
.
- name: 🛠️ Build
run: |
cd build
ninja
win-plugin-template-test:
runs-on: windows-2022
name: 🧪 Plugin Template Test
@@ -186,7 +260,7 @@ jobs:
run:
shell: msys2 {0}
needs: win
needs: win_mingw
env:
IMHEX_SDK_PATH: "${{ github.workspace }}/out/sdk"
@@ -369,7 +443,7 @@ jobs:
- name: 📦 Create DMG
run: |
brew install imagemagick
brew install graphicsmagick imagemagick
git clone https://github.com/sindresorhus/create-dmg
cd create-dmg
npm i && npm -g i
@@ -384,7 +458,7 @@ jobs:
- name: 🗝️ Generate build provenance attestations
uses: actions/attest-build-provenance@v2
if: github.event.pull_request.head.repo.full_name == github.repository
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
with:
subject-path: |
./*.dmg
@@ -426,6 +500,7 @@ jobs:
run: |
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_OUTPUT
docker buildx build . -f dist/macOS/arm64.Dockerfile --progress=plain --build-arg 'JOBS=4' --build-arg "BUILD_TYPE=$(BUILD_TYPE)" --build-context imhex=$(pwd) --output out
cp resources/dist/macos/Entitlements.plist out/Entitlements.plist
- name: ⬆️ Upload artifacts
uses: actions/upload-artifact@v4
@@ -448,7 +523,7 @@ jobs:
needs: macos-arm64
env:
IMHEX_VERSION: ${{ needs.macos-arm64-build.outputs.IMHEX_VERSION }}
IMHEX_VERSION: ${{ needs.macos-arm64.outputs.IMHEX_VERSION }}
permissions:
id-token: write
@@ -472,7 +547,7 @@ jobs:
cd out
mv imhex.app ImHex.app
codesign --remove-signature ImHex.app
codesign --force --deep --sign - ImHex.app
codesign --force --deep --entitlements Entitlements.plist --sign - ImHex.app
- name: 📁 Fix permissions
run: |
@@ -488,7 +563,7 @@ jobs:
- name: 📦 Create DMG
run: |
brew install imagemagick
brew install graphicsmagick imagemagick
git clone https://github.com/sindresorhus/create-dmg
cd create-dmg
npm i && npm -g i
@@ -503,7 +578,7 @@ jobs:
- name: 🗝️ Generate build provenance attestations
uses: actions/attest-build-provenance@v2
if: github.event.pull_request.head.repo.full_name == github.repository
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
with:
subject-path: |
./*.dmg
@@ -597,7 +672,7 @@ jobs:
- name: 🗝️ Generate build provenance attestations
uses: actions/attest-build-provenance@v2
if: github.event.pull_request.head.repo.full_name == github.repository
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
with:
subject-path: |
./*.deb
@@ -641,8 +716,8 @@ jobs:
uses: actions/cache@v4
with:
path: cache
key: appimage-ccache-${{ github.run_id }}
restore-keys: appimage-cache
key: appimage-ccache-${{ matrix.architecture }}-${{ github.run_id }}
restore-keys: appimage-ccache-${{ matrix.architecture }}
- name: 🐳 Inject /cache into docker
uses: reproducible-containers/buildkit-cache-dance@v2
@@ -659,7 +734,7 @@ jobs:
- name: 🗝️ Generate build provenance attestations
uses: actions/attest-build-provenance@v2
if: github.event.pull_request.head.repo.full_name == github.repository
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
with:
subject-path: |
out/*.AppImage
@@ -776,7 +851,7 @@ jobs:
- name: 🗝️ Generate build provenance attestations
uses: actions/attest-build-provenance@v2
if: github.event.pull_request.head.repo.full_name == github.repository
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
with:
subject-path: |
build/imhex-${{ env.IMHEX_VERSION }}-ArchLinux-x86_64.pkg.tar.zst
@@ -920,7 +995,7 @@ jobs:
- name: 🗝️ Generate build provenance attestations
uses: actions/attest-build-provenance@v2
if: github.event.pull_request.head.repo.full_name == github.repository
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
with:
subject-path: |
imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm

2
.gitignore vendored
View File

@@ -7,6 +7,7 @@ build*/
local/
venv/
.cache/
install/
*.mgc
*.kdev4
@@ -16,3 +17,4 @@ CMakeUserPresets.json
Brewfile.lock.json
.vs/
vcpkg.json

View File

@@ -49,12 +49,8 @@
{
"name": "vs2022",
"displayName": "Visual Studio 2022",
"generator": "Visual Studio 17 2022",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"architecture": {
"strategy": "set",
"value": "x64"
},
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}

View File

@@ -1 +1 @@
1.37.0.WIP
1.37.2

View File

@@ -381,6 +381,10 @@ endfunction()
macro(configureCMake)
message(STATUS "Configuring ImHex v${IMHEX_VERSION}")
if (DEFINED CMAKE_TOOLCHAIN_FILE)
message(STATUS "Using toolchain file: \"${CMAKE_TOOLCHAIN_FILE}\"")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Enable position independent code for all targets" FORCE)
# Configure use of recommended build tools
@@ -628,21 +632,25 @@ endmacro()
macro(setupCompilerFlags target)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
addCommonFlag("/W4" ${target})
addCommonFlag("/wd4127" ${target}) # conditional expression is constant
addCommonFlag("/wd4242" ${target}) # 'identifier': conversion from 'type1' to 'type2', possible loss of data
addCommonFlag("/wd4244" ${target}) # 'conversion': conversion from 'type1' to 'type2', possible loss of data
addCommonFlag("/wd4267" ${target}) # 'var': conversion from 'size_t' to 'type', possible loss of data
addCommonFlag("/wd4305" ${target}) # truncation from 'double' to 'float'
addCommonFlag("/wd4996" ${target}) # 'function': was declared deprecated
if (IMHEX_STRICT_WARNINGS)
addCommonFlag("/W4" ${target})
addCommonFlag("/wd4242" ${target})
addCommonFlag("/wd4244" ${target})
addCommonFlag("/wd4267" ${target})
addCommonFlag("/wd4996" ${target})
addCommonFlag("/wd4127" ${target})
addCommonFlag("/WX" ${target})
endif()
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
addCommonFlag("-Wall" ${target})
addCommonFlag("-Wextra" ${target})
addCommonFlag("-Wpedantic" ${target})
# Define strict compilation flags
if (IMHEX_STRICT_WARNINGS)
addCommonFlag("-Wall" ${target})
addCommonFlag("-Wextra" ${target})
addCommonFlag("-Wpedantic" ${target})
addCommonFlag("-Werror" ${target})
addCommonFlag("-Werror" ${target})
endif()
if (UNIX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -656,6 +664,17 @@ macro(setupCompilerFlags target)
addCCXXFlag("-Wno-array-bounds" ${target})
addCCXXFlag("-Wno-deprecated-declarations" ${target})
addCCXXFlag("-Wno-unknown-pragmas" ${target})
# Enable hardening flags
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
addCommonFlag("-U_FORTIFY_SOURCE" ${target})
addCommonFlag("-D_FORTIFY_SOURCE=3" ${target})
if (NOT EMSCRIPTEN)
addCommonFlag("-fstack-protector-strong" ${target})
endif()
endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -669,6 +688,12 @@ macro(setupCompilerFlags target)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${LLVM_PREFIX}/lib/c++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${LLVM_PREFIX}/lib/c++")
addCCXXFlag("-Wno-unknown-warning-option" ${target})
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG)
else()
add_compile_definitions(_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE)
endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
@@ -778,8 +803,8 @@ macro(addBundledLibraries)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/lunasvg EXCLUDE_FROM_ALL)
set(LUNASVG_LIBRARIES lunasvg)
else()
find_package(LunaSVG REQUIRED)
set(LUNASVG_LIBRARIES lunasvg)
find_package(lunasvg REQUIRED)
set(LUNASVG_LIBRARIES lunasvg::lunasvg)
endif()
if (NOT USE_SYSTEM_LLVM)
@@ -903,11 +928,17 @@ function(generateSDKDirectory)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/sdk/ DESTINATION "${SDK_PATH}")
install(TARGETS libimhex ARCHIVE DESTINATION "${SDK_PATH}/lib")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/ui DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE)
install(TARGETS ui ARCHIVE DESTINATION "${SDK_PATH}/lib")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/ui/include DESTINATION "${SDK_PATH}/lib/ui/include")
install(FILES ${CMAKE_SOURCE_DIR}/plugins/ui/CMakeLists.txt DESTINATION "${SDK_PATH}/lib/ui/")
if (WIN32)
install(TARGETS ui ARCHIVE DESTINATION "${SDK_PATH}/lib")
endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/fonts DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE)
install(TARGETS fonts ARCHIVE DESTINATION "${SDK_PATH}/lib")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/fonts/include DESTINATION "${SDK_PATH}/lib/fonts/include")
install(FILES ${CMAKE_SOURCE_DIR}/plugins/fonts/CMakeLists.txt DESTINATION "${SDK_PATH}/lib/fonts/")
if (WIN32)
install(TARGETS fonts ARCHIVE DESTINATION "${SDK_PATH}/lib")
endif()
endfunction()
function(addIncludesFromLibrary target library)

1
dist/rpm/imhex.spec vendored
View File

@@ -128,6 +128,5 @@ cp -a lib/third_party/xdgpp/LICENSE %{buildroot
%{_datadir}/mime/packages/%{name}.xml
%{_libdir}/libimhex.so*
%{_libdir}/%{name}/
%{_libdir}/*.hexpluglib
/usr/lib/debug/%{_libdir}/*.debug
%{_metainfodir}/net.werwolv.%{name}.metainfo.xml

View File

@@ -66,7 +66,10 @@ if (APPLE)
endif ()
endif ()
set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES} source/helpers/utils_macos.m)
set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES}
source/helpers/utils_macos.m
source/helpers/macos_menu.m
)
endif ()
if (IMHEX_EXTERNAL_PLUGIN_BUILD)

View File

@@ -81,7 +81,6 @@ void* PluginSubCommandsFunctionHelper<T>::getSubCommands() {
#define IMHEX_LIBRARY_SETUP(name) IMHEX_LIBRARY_SETUP_IMPL(name)
#define IMHEX_LIBRARY_SETUP_IMPL(name) \
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloaded library '{}'", name); } } HANDLER; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX void WOLV_TOKEN_CONCAT(initializeLibrary_, IMHEX_PLUGIN_NAME)(); \
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *WOLV_TOKEN_CONCAT(getLibraryName_, IMHEX_PLUGIN_NAME)() { return name; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX void WOLV_TOKEN_CONCAT(setImGuiContext_, IMHEX_PLUGIN_NAME)(ImGuiContext *ctx) { \
@@ -107,7 +106,6 @@ void* PluginSubCommandsFunctionHelper<T>::getSubCommands() {
IMHEX_PLUGIN_VISIBILITY_PREFIX void WOLV_TOKEN_CONCAT(initializeLibrary_, IMHEX_PLUGIN_NAME)()
#define IMHEX_PLUGIN_SETUP_IMPL(name, author, description) \
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::debug("Unloaded plugin '{}'", name); } } HANDLER; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginName() { return name; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginAuthor() { return author; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginDescription() { return description; } \

View File

@@ -749,13 +749,14 @@ namespace hex {
DSROLE_PRIMARY_DOMAIN_INFO_BASIC * info;
if ((DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE *)&info) == ERROR_SUCCESS) && (info != nullptr))
{
bool result = std::wstring(info->DomainNameFlat).empty();
bool result = std::wstring(info->DomainNameFlat) != L"WORKGROUP";
DsRoleFreeMemory(info);
return result;
} else {
DWORD size = 1024;
::GetComputerNameExA(ComputerNameDnsDomain, nullptr, &size);
DWORD size = 128;
char buffer[128];
::GetComputerNameExA(ComputerNameDnsDomain, buffer, &size);
return size > 0;
}
}
@@ -871,7 +872,8 @@ namespace hex {
SemanticVersion getImHexVersion() {
#if defined IMHEX_VERSION
return SemanticVersion(IMHEX_VERSION);
static auto version = SemanticVersion(IMHEX_VERSION);
return version;
#else
return {};
#endif
@@ -935,7 +937,7 @@ namespace hex {
}
EventImHexClosing::subscribe([executablePath, updateTypeString] {
hex::executeCommand(
hex::startProgram(
hex::format("\"{}\" \"{}\"",
wolv::util::toUTF8String(executablePath),
updateTypeString

View File

@@ -30,7 +30,11 @@ namespace hex {
return handle;
#else
auto handle = uintptr_t(dlopen(wolv::util::toUTF8String(path).c_str(), RTLD_LAZY));
const auto pathString = wolv::util::toUTF8String(path);
auto handle = uintptr_t(dlopen(pathString.c_str(), RTLD_NOLOAD));
if (handle == 0)
handle = uintptr_t(dlopen(pathString.c_str(), RTLD_NOW | RTLD_GLOBAL));
if (handle == 0) {
log::error("Loading library '{}' failed: {}!", wolv::util::toUTF8String(path.filename()), dlerror());

View File

@@ -327,6 +327,7 @@ namespace hex {
}
ImGui::SetNextWindowPos(position, ImGuiCond_Always, pivot);
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
if (ImGui::Begin("##TutorialMessage", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindowRead());

View File

@@ -44,7 +44,7 @@ namespace hex::paths {
if (includeSystemFolders) {
if (auto executablePath = wolv::io::fs::getExecutablePath(); executablePath.has_value()) {
paths.push_back(*executablePath);
paths.push_back(executablePath->parent_path());
}
}

View File

@@ -339,9 +339,9 @@ namespace hex {
void startProgram(const std::string &command) {
#if defined(OS_WINDOWS)
std::ignore = system(hex::format("start {0}", command).c_str());
std::ignore = system(hex::format("start \"\" {0}", command).c_str());
#elif defined(OS_MACOS)
std::ignore = system(hex::format("open {0}", command).c_str());
std::ignore = system(hex::format("{0}", command).c_str());
#elif defined(OS_LINUX)
executeCmd({"xdg-open", command});
#elif defined(OS_WEB)

View File

@@ -330,16 +330,21 @@ namespace ImGuiExt {
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
// Render
BeginGroup();
TextDisabled("%s", icon);
SameLine();
const ImU32 col = hovered ? GetColorU32(ImGuiCol_ButtonHovered) : GetColorU32(ImGuiCol_ButtonActive);
PushStyleColor(ImGuiCol_Text, ImU32(col));
Text("%s %s", icon, label);
TextUnformatted(label);
if (hovered)
GetWindowDrawList()->AddLine(ImVec2(pos.x, pos.y + size.y), pos + size, ImU32(col));
PopStyleColor();
EndGroup();
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);
return pressed;
}
@@ -821,8 +826,11 @@ namespace ImGuiExt {
PushStyleColor(ImGuiCol_Text, color);
// Render
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered
: ImGuiCol_MenuBarBg);
ImU32 col = 0x00;
if (held)
col = GetColorU32(ImGuiCol_ScrollbarGrabActive);
else if (hovered)
col = GetColorU32(ImGuiCol_ScrollbarGrabHovered);
RenderNavCursor(bb, id);
RenderFrame(bb.Min, bb.Max, col, false, style.FrameRounding);
RenderTextClipped(bb.Min + padding, bb.Max - padding, symbol, nullptr, &size, style.ButtonTextAlign, &bb);

View File

@@ -299,7 +299,7 @@ public:
void Render(const char* aTitle, const ImVec2& aSize = ImVec2(), bool aBorder = false);
void SetText(const std::string& aText);
void JumpToLine(int line);
void JumpToLine(int line=-1);
void JumpToCoords(const Coordinates &coords);
std::string GetText() const;
bool isEmpty() const {
@@ -352,6 +352,7 @@ public:
void SetReadOnly(bool aValue);
bool IsReadOnly() const { return mReadOnly; }
bool IsTextChanged() const { return mTextChanged; }
void SetTextChanged(bool aValue=false) { mTextChanged = aValue; }
bool IsCursorPositionChanged() const { return mCursorPositionChanged; }
bool IsBreakpointsChanged() const { return mBreakPointsChanged; }
void ClearBreakpointsChanged() { mBreakPointsChanged = false; }
@@ -578,7 +579,7 @@ private:
void HandleKeyboardInputs();
void HandleMouseInputs();
void RenderText(const char *aTitle, const ImVec2 &lineNumbersStartPos, const ImVec2 &textEditorSize);
void SetFocus();
float mLineSpacing = 1.0F;
Lines mLines;
EditorState mState = {};

View File

@@ -865,6 +865,18 @@ inline void TextUnformattedColoredAt(const ImVec2 &pos, const ImU32 &color, cons
ImGui::PopStyleColor();
}
void TextEditor::SetFocus() {
mState.mCursorPosition = mInteractiveStart = mInteractiveEnd = mFocusAtCoords;
mSelectionMode = SelectionMode::Normal;
SetSelection(mInteractiveStart, mInteractiveEnd, mSelectionMode);
ResetCursorBlinkTime();
EnsureCursorVisible();
if (!this->mReadOnly) {
ImGui::SetKeyboardFocusHere(-1);
mUpdateFocus = false;
}
}
void TextEditor::RenderText(const char *aTitle, const ImVec2 &lineNumbersStartPos, const ImVec2 &textEditorSize) {
/* Compute mCharAdvance regarding scaled font size (Ctrl + mouse wheel)*/
const float fontSize = ImGui::GetFont()->CalcTextSizeA(ImGui::GetFontSize(), FLT_MAX, -1.0f, "#", nullptr, nullptr).x;
@@ -1068,6 +1080,10 @@ void TextEditor::RenderText(const char *aTitle, const ImVec2 &lineNumbersStartPo
auto prevColor = line.empty() ? mPalette[(int)PaletteIndex::Default] : GetGlyphColor(line[0]);
ImVec2 bufferOffset;
if (mUpdateFocus && mFocusAtCoords == Coordinates(lineNo, 0)) {
SetFocus();
}
for (int i = 0; i < line.size();) {
auto &glyph = line[i];
auto color = GetGlyphColor(glyph);
@@ -1106,13 +1122,7 @@ void TextEditor::RenderText(const char *aTitle, const ImVec2 &lineNumbersStartPo
prevColor = color;
if (mUpdateFocus && mFocusAtCoords == Coordinates(lineNo, i)) {
mState.mCursorPosition = mInteractiveStart = mInteractiveEnd = mFocusAtCoords;
mSelectionMode = SelectionMode::Normal;
SetSelection(mInteractiveStart, mInteractiveEnd, mSelectionMode);
ResetCursorBlinkTime();
EnsureCursorVisible();
ImGui::SetKeyboardFocusHere(-1);
mUpdateFocus = false;
SetFocus();
}
if (glyph.mChar == '\t') {
@@ -1206,7 +1216,6 @@ void TextEditor::RenderText(const char *aTitle, const ImVec2 &lineNumbersStartPo
void TextEditor::Render(const char *aTitle, const ImVec2 &aSize, bool aBorder) {
mWithinRender = true;
mTextChanged = false;
mCursorPositionChanged = false;
auto scrollBg = ImGui::GetStyleColorVec4(ImGuiCol_ScrollbarBg);
@@ -1634,7 +1643,10 @@ void TextEditor::DeleteSelection() {
}
void TextEditor::JumpToLine(int line) {
auto newPos = Coordinates(line, 0);
auto newPos = mState.mCursorPosition;
if (line != -1) {
newPos = Coordinates(line , 0);
}
JumpToCoords(newPos);
}
@@ -1858,8 +1870,11 @@ void TextEditor::TextEditor::MoveBottom(bool aSelect) {
void TextEditor::MoveHome(bool aSelect) {
ResetCursorBlinkTime();
auto oldPos = mState.mCursorPosition;
SetCursorPosition(Coordinates(mState.mCursorPosition.mLine, 0));
auto &line = mLines[mState.mCursorPosition.mLine];
auto home=0;
while (isspace(line[home].mChar))
home++;
SetCursorPosition(Coordinates(mState.mCursorPosition.mLine, home));
if (mState.mCursorPosition != oldPos) {
if (aSelect) {
if (oldPos == mInteractiveStart)

View File

@@ -53,6 +53,9 @@ namespace hex {
void drawImGui();
void drawWithShader();
void unlockFrameRate();
void forceNewFrame();
GLFWwindow *m_window = nullptr;
std::string m_windowTitle, m_windowTitleFull;
@@ -64,17 +67,22 @@ namespace hex {
std::list<std::string> m_popupsToOpen;
std::set<int> m_pressedKeys;
std::atomic<bool> m_unlockFrameRate = true;
ImGuiExt::ImHexCustomData m_imguiCustomData;
u32 m_searchBarPosition = 0;
bool m_emergencyPopupOpen = false;
std::jthread m_frameRateThread;
std::chrono::duration<double, std::nano> m_remainingUnlockedTime;
std::mutex m_sleepMutex;
std::atomic<bool> m_sleepFlag;
std::condition_variable m_sleepCondVar;
std::mutex m_sleepMutex;
std::mutex m_wakeupMutex;
std::atomic<bool> m_wakeupFlag;
std::condition_variable m_wakeupCondVar;
gl::Shader m_postProcessingShader;
};

View File

@@ -40,16 +40,20 @@ namespace hex::init {
// On Windows, argv contains UTF-16 encoded strings, so we need to convert them to UTF-8
auto convertedCommandLine = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
if (convertedCommandLine == nullptr) {
log::error("Failed to convert command line arguments to UTF-8");
log::error("Failed to get command line arguments");
std::exit(EXIT_FAILURE);
}
// Skip the first argument (the executable path) and convert the rest to a vector of UTF-8 strings
for (int i = 1; i < argc; i += 1) {
std::wstring wcharArg = convertedCommandLine[i];
std::string utf8Arg = wolv::util::wstringToUtf8(wcharArg);
auto utf8Arg = wolv::util::wstringToUtf8(wcharArg);
if (!utf8Arg.has_value()) {
log::error("Failed to convert command line arguments to UTF-8");
std::exit(EXIT_FAILURE);
}
args.push_back(utf8Arg);
args.push_back(*utf8Arg);
}
::LocalFree(convertedCommandLine);

View File

@@ -488,7 +488,13 @@ namespace hex::init {
if (meanScale <= 0.0F)
meanScale = 1.0F;
meanScale /= hex::ImHexApi::System::getBackingScaleFactor();
#if defined(OS_WEB)
meanScale = 1.0F;
#endif
#if !defined(OS_LINUX)
meanScale /= hex::ImHexApi::System::getBackingScaleFactor();
#endif
ImHexApi::System::impl::setGlobalScale(meanScale);
ImHexApi::System::impl::setNativeScale(meanScale);

View File

@@ -42,12 +42,18 @@ namespace hex::messaging {
static auto listenerThread = std::jthread([](const std::stop_token &stopToken){
std::vector<u8> buffer(0xFFFF);
while (!stopToken.stop_requested()) {
while (true) {
int result = ::read(fifo, buffer.data(), buffer.size());
if (result > 0) {
EventNativeMessageReceived::post(std::vector<u8>{ buffer.begin(), buffer.begin() + result });
} else {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
if (stopToken.stop_requested())
break;
if (result <= 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
});

View File

@@ -161,7 +161,7 @@ namespace hex {
FILE *pipe = popen("dbus-send --session --print-reply --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' 2>&1", "r");
if (pipe == nullptr) return;
while (fgets(buffer.data(), buffer.size(), pipe) != nullptr)
while (fgets(buffer.data(), buffer.size() - 1, pipe) != nullptr)
result += buffer.data();
auto exitCode = WEXITSTATUS(pclose(pipe));

View File

@@ -161,12 +161,11 @@ namespace hex {
const float currScaleFactor = MAIN_THREAD_EM_ASM_DOUBLE({
try {
// Take square root of scaling to counter scaling applied by Browser
return Math.sqrt(window.devicePixelRatio);
return window.devicePixelRatio;
} catch (e) {
return 1.0;
}
});
}) / ImHexApi::System::getBackingScaleFactor();
if (prevScaleFactor != 0 && prevScaleFactor != currScaleFactor) {
EventDPIChanged::post(prevScaleFactor, currScaleFactor);
resizeCanvas();

View File

@@ -70,6 +70,9 @@ namespace hex {
const auto newScale = LOWORD(wParam) / 96.0F;
const auto oldScale = ImHexApi::System::getNativeScale();
if (u32(oldScale * 10) == u32(newScale * 10))
break;
EventDPIChanged::post(oldScale, newScale);
ImHexApi::System::impl::setNativeScale(newScale);
@@ -201,17 +204,20 @@ namespace hex {
i64 sleepTicks = 0;
i64 sleepMilliSeconds = 0;
if (delta >= 0) {
sleepTicks = delta / period;
} else {
sleepTicks = -1 + delta / period;
if (period > 0) {
if (delta >= 0) {
sleepTicks = delta / period;
} else {
sleepTicks = -1 + delta / period;
}
sleepMilliSeconds = delta - (period * sleepTicks);
const double sleepTime = std::round(1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
if (sleepTime >= 0.0) {
Sleep(DWORD(sleepTime));
}
}
sleepMilliSeconds = delta - (period * sleepTicks);
const double sleepTime = std::round(1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
if (sleepTime >= 0.0) {
Sleep(DWORD(sleepTime));
}
timeEndPeriod(granularity);
return WVR_REDRAW;
@@ -611,7 +617,7 @@ namespace hex {
glfwSetFramebufferSizeCallback(m_window, [](GLFWwindow* window, int width, int height) {
auto *win = static_cast<Window *>(glfwGetWindowUserPointer(window));
win->m_unlockFrameRate = true;
win->unlockFrameRate();
glViewport(0, 0, width, height);
ImHexApi::System::impl::setMainWindowSize(width, height);

View File

@@ -311,7 +311,7 @@ namespace hex {
// Unlock frame rate if any mouse button is being held down to allow drag scrolling to be smooth
if (ImGui::IsAnyMouseDown())
m_unlockFrameRate = true;
this->unlockFrameRate();
// Unlock frame rate if any modifier key is held down since they don't generate key repeat events
if (
@@ -320,12 +320,12 @@ namespace hex {
ImGui::IsKeyPressed(ImGuiKey_LeftSuper) || ImGui::IsKeyPressed(ImGuiKey_RightSuper) ||
ImGui::IsKeyPressed(ImGuiKey_LeftAlt) || ImGui::IsKeyPressed(ImGuiKey_RightAlt)
) {
m_unlockFrameRate = true;
this->unlockFrameRate();
}
// Unlock frame rate if there's more than one viewport since these don't call the glfw callbacks registered here
if (ImGui::GetPlatformIO().Viewports.size() > 1)
m_unlockFrameRate = true;
this->unlockFrameRate();
}
// Hide the window as soon as the render loop exits to make the window
@@ -334,6 +334,9 @@ namespace hex {
}
void Window::frameBegin() {
// Run all deferred calls
TaskManager::runDeferredCalls();
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
@@ -343,7 +346,7 @@ namespace hex {
auto &currentFont = ImGui::GetIO().Fonts;
for (const auto &[name, font] : fontDefinitions) {
// If the texture for this atlas has been built already, don't do it again
if (font == nullptr || font->ContainerAtlas->TexID != 0)
if (font == nullptr || font->ContainerAtlas == nullptr || font->ContainerAtlas->TexID != 0)
continue;
currentFont = font->ContainerAtlas;
@@ -353,7 +356,7 @@ namespace hex {
}
{
const auto &font = ImHexApi::Fonts::getFont("hex.fonts.font.default");
auto font = ImHexApi::Fonts::getFont("hex.fonts.font.default");
if (font == nullptr) {
const auto &io = ImGui::GetIO();
@@ -362,13 +365,15 @@ namespace hex {
ImFontConfig cfg;
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
cfg.SizePixels = ImHexApi::Fonts::DefaultFontSize;
io.Fonts->AddFontDefault(&cfg);
font = io.Fonts->AddFontDefault(&cfg);
ImGui_ImplOpenGL3_CreateFontsTexture();
io.Fonts->ClearInputData();
io.Fonts->ClearTexData();
} else {
currentFont = font->ContainerAtlas;
}
ImGui::SetCurrentFont(font);
}
}
@@ -682,9 +687,6 @@ namespace hex {
return banner->shouldClose();
});
}
// Run all deferred calls
TaskManager::runDeferredCalls();
}
void Window::frame() {
@@ -927,6 +929,23 @@ namespace hex {
#endif
}
void Window::unlockFrameRate() {
{
std::scoped_lock lock(m_wakeupMutex);
m_remainingUnlockedTime = std::chrono::seconds(2);
}
this->forceNewFrame();
}
void Window::forceNewFrame() {
std::scoped_lock lock(m_wakeupMutex);
m_wakeupFlag = true;
m_wakeupCondVar.notify_all();
}
void Window::initGLFW() {
auto initialWindowProperties = ImHexApi::System::getInitialWindowProperties();
glfwSetErrorCallback([](int error, const char *desc) {
@@ -1027,7 +1046,7 @@ namespace hex {
if (win == nullptr)
return;
win->m_unlockFrameRate = true;
win->unlockFrameRate();
};
static const auto isMainWindow = [](GLFWwindow *window) {
@@ -1163,7 +1182,7 @@ namespace hex {
Duration passedTime = {};
std::chrono::steady_clock::time_point startTime = {}, endTime = {};
Duration requestedFrameTime = {}, remainingUnlockedTime = {};
Duration requestedFrameTime = {};
float targetFps = 0;
const auto nativeFps = []() -> float {
@@ -1182,32 +1201,36 @@ namespace hex {
targetFps = ImHexApi::System::getTargetFPS();
if (m_unlockFrameRate.exchange(false)) {
remainingUnlockedTime = std::chrono::seconds(2);
}
// If the target frame rate is below 15, use the current monitor's refresh rate
if (targetFps < 15) {
targetFps = nativeFps;
}
passedTime += iterationTime;
if (remainingUnlockedTime > std::chrono::nanoseconds(0)) {
remainingUnlockedTime -= iterationTime;
} else {
targetFps = 5;
}
requestedFrameTime = (Duration(1.0E9) / targetFps) / 1.3;
if (passedTime >= requestedFrameTime) {
{
std::scoped_lock lock(m_sleepMutex);
m_sleepFlag = true;
m_sleepCondVar.notify_all();
passedTime = {};
if (m_remainingUnlockedTime > std::chrono::nanoseconds(0)) {
m_remainingUnlockedTime -= iterationTime;
} else {
targetFps = 5;
}
requestedFrameTime = (Duration(1.0E9) / targetFps) / 1.3;
if (passedTime >= requestedFrameTime) {
m_sleepFlag = true;
m_sleepCondVar.notify_all();
passedTime = {};
}
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
{
std::unique_lock lock(m_wakeupMutex);
m_wakeupCondVar.wait_for(lock, requestedFrameTime, [&] {
return m_wakeupFlag || stopToken.stop_requested();
});
}
endTime = std::chrono::steady_clock::now();
}

View File

@@ -7,14 +7,10 @@ add_executable(updater
target_compile_definitions(updater PRIVATE IMHEX_PROJECT_NAME="${PROJECT_NAME}")
target_link_libraries(updater PRIVATE libimhex ${FMT_LIBRARIES})
add_dependencies(main updater)
setupCompilerFlags(updater)
if (APPLE)
set(OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUNDLE_NAME}/Contents/MacOS")
else ()
set(OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif()
set_target_properties(updater PROPERTIES
OUTPUT_NAME "imhex-updater"
RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}
)

View File

@@ -79,13 +79,26 @@ std::string getUpdateType() {
if (!hex::ImHexApi::System::isPortableVersion())
return "win-msi";
#elif defined (OS_MACOS)
return "mac-dmg";
#if defined(__x86_64__)
return "macos-dmg-x86";
#elif defined(__arm64__)
return "macos-dmg-arm";
#endif
#elif defined (OS_LINUX)
if (hex::executeCommand("lsb_release -a | grep Ubuntu") == 0) {
if (hex::executeCommand("lsb_release -a | grep 22.") == 0)
return "linux-deb-22.04";
else if (hex::executeCommand("lsb_release -a | grep 23.") == 0)
return "linux-deb-23.04";
if (hex::executeCommand("grep 'ID=ubuntu' /etc/os-release") == 0) {
if (hex::executeCommand("grep 'VERSION_ID=\"24.04\"' /etc/os-release") == 0)
return "linux-deb-24.04";
else if (hex::executeCommand("grep 'VERSION_ID=\"24.10\"' /etc/os-release") == 0)
return "linux-deb-24.10";
} else if (hex::executeCommand("grep 'ID=fedora' /etc/os-release") == 0) {
if (hex::executeCommand("grep 'VERSION_ID=\"40\"' /etc/os-release") == 0)
return "linux-rpm-40";
else if (hex::executeCommand("grep 'VERSION_ID=\"41\"' /etc/os-release") == 0)
return "linux-rpm-41";
else if (hex::executeCommand("grep 'VERSION_ID=\"rawhide\"' /etc/os-release") == 0)
return "linux-rpm-rawhide";
} else if (hex::executeCommand("grep '^NAME=\"Arch Linux\"' /etc/os-release") == 0) {
return "linux-arch";
}
#endif
@@ -100,10 +113,15 @@ int installUpdate(const std::string &type, std::fs::path updatePath) {
};
constexpr static auto UpdateHandlers = {
UpdateHandler { "win-msi", ".msi", "msiexec /passive /package {}" },
UpdateHandler { "macos-dmg", ".dmg", "hdiutil attach {}" },
UpdateHandler { "linux-deb-22.04", ".deb", "sudo apt update && sudo apt install -y --fix-broken {}" },
UpdateHandler { "linux-deb-23.04", ".deb", "sudo apt update && sudo apt install -y --fix-broken {}" },
UpdateHandler { "win-msi", ".msi", "msiexec /i \"{}\" /qb" },
UpdateHandler { "macos-dmg-x86", ".dmg", "hdiutil attach -autoopen \"{}\"" },
UpdateHandler { "macos-dmg-arm", ".dmg", "hdiutil attach -autoopen \"{}\"" },
UpdateHandler { "linux-deb-24.04", ".deb", "sudo apt update && sudo apt install -y --fix-broken \"{}\"" },
UpdateHandler { "linux-deb-24.10", ".deb", "sudo apt update && sudo apt install -y --fix-broken \"{}\"" },
UpdateHandler { "linux-rpm-40", ".rpm", "sudo rpm -i \"{}\"" },
UpdateHandler { "linux-rpm-41", ".rpm", "sudo rpm -i \"{}\"" },
UpdateHandler { "linux-rpm-rawhide", ".rpm", "sudo rpm -i \"{}\"" },
UpdateHandler { "linux-arch", ".zst", "sudo pacman -Syy && sudo pacman -U --noconfirm \"{}\"" }
};
for (const auto &handler : UpdateHandlers) {

View File

@@ -286,6 +286,7 @@ namespace hex::plugin::builtin {
bool m_replaceMode = false;
bool m_openFindReplacePopUp = false;
bool m_openGotoLinePopUp = false;
bool m_patternEvaluating = false;
std::map<std::fs::path, std::string> m_patternNames;
ImRect m_textEditorHoverBox;

View File

@@ -17,6 +17,7 @@ namespace hex::plugin::builtin {
ImVec2 getMinSize() const override { return { -1, -1 }; }
ImVec2 getMaxSize() const override { return this->getMinSize(); }
ImGuiWindowFlags getWindowFlags() const override { return ImGuiWindowFlags_AlwaysAutoResize; }
bool hasCloseButton() const override {
return false;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 Farbe",
"hex.builtin.inspector.sleb128": "Signed LEB128",
"hex.builtin.inspector.string": "String",
"hex.builtin.inspector.string16": "Wide String",
"hex.builtin.inspector.wstring": "Wide String",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "Unsigned LEB128",
"hex.builtin.inspector.utf8": "UTF-8 code point",
"hex.builtin.inspector.wide": "Wide Character",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "Standard",
"hex.builtin.layouts.none.restore_default": "Standard-Layout wiederherstellen",
"hex.builtin.menu.edit": "Bearbeiten",
@@ -781,8 +781,8 @@
"hex.builtin.view.hex_editor.menu.file.load_encoding_file": "Benutzerdefinierte Enkodierung laden...",
"hex.builtin.view.hex_editor.menu.file.save": "Speichern",
"hex.builtin.view.hex_editor.menu.file.save_as": "Speichern unter...",
"hex.builtin.view.hex_editor.menu.file.search": "Suchen",
"hex.builtin.view.hex_editor.menu.edit.select": "Auswählen",
"hex.builtin.view.hex_editor.menu.file.search": "Suchen...",
"hex.builtin.view.hex_editor.menu.edit.select": "Auswählen...",
"hex.builtin.view.hex_editor.name": "Hex Editor",
"hex.builtin.view.hex_editor.search.find": "Suchen",
"hex.builtin.view.hex_editor.search.hex": "Hex",
@@ -1000,7 +1000,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "Pattern Language Dokumentation",
"hex.builtin.welcome.learn.plugins.desc": "Erweitere ImHex mit neuen Funktionen mit Plugins",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
"hex.builtin.welcome.quick_settings.simplified": "Simple Ansicht",
"hex.builtin.welcome.start.create_file": "Neue Datei erstellen",
@@ -1011,7 +1011,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Auto Backups",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Backup vom {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "Tipp des Tages",
"hex.builtin.welcome.update.desc": "ImHex {0} wurde gerade released! Downloade die neue Version hier",
"hex.builtin.welcome.update.desc": "ImHex {0} wurde gerade released!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Neues Update verfügbar!"
}

View File

@@ -97,7 +97,9 @@
"hex.builtin.inspector.rgba8": "RGBA8 Color",
"hex.builtin.inspector.sleb128": "Signed LEB128",
"hex.builtin.inspector.string": "String",
"hex.builtin.inspector.string16": "Wide String",
"hex.builtin.inspector.wstring": "Wide String",
"hex.builtin.inspector.string16": "String16",
"hex.builtin.inspector.string32": "String32",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -109,7 +111,9 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "Unsigned LEB128",
"hex.builtin.inspector.utf8": "UTF-8 code point",
"hex.builtin.inspector.wide": "Wide Character",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.inspector.char16": "char16_t",
"hex.builtin.inspector.char32": "char32_t",
"hex.builtin.layouts.default": "Default",
"hex.builtin.layouts.none.restore_default": "Restore default layout",
"hex.builtin.menu.edit": "Edit",
@@ -510,6 +514,7 @@
"hex.builtin.setting.interface.scaling.native": "Native",
"hex.builtin.setting.interface.scaling.fractional_warning": "The default font does not support fractional scaling. For better results, select a custom font in the 'Font' tab.",
"hex.builtin.setting.interface.show_header_command_palette": "Show Command Palette in Window Header",
"hex.builtin.setting.interface.show_titlebar_backdrop": "Show titlebar backdrop color",
"hex.builtin.setting.interface.style": "Styling",
"hex.builtin.setting.interface.use_native_menu_bar": "Use native menu bar",
"hex.builtin.setting.interface.window": "Window",
@@ -845,7 +850,7 @@
"hex.builtin.view.hex_editor.menu.file.save": "Save",
"hex.builtin.view.hex_editor.menu.file.save_as": "Save As...",
"hex.builtin.view.hex_editor.menu.file.search": "Search...",
"hex.builtin.view.hex_editor.menu.edit.select": "Select",
"hex.builtin.view.hex_editor.menu.edit.select": "Select...",
"hex.builtin.view.hex_editor.name": "Hex editor",
"hex.builtin.view.hex_editor.search.find": "Find",
"hex.builtin.view.hex_editor.search.hex": "Hex",
@@ -1054,6 +1059,7 @@
"hex.builtin.view.store.row.authors": "Authors",
"hex.builtin.view.store.row.name": "Name",
"hex.builtin.view.store.tab.constants": "Constants",
"hex.builtin.view.store.tab.disassemblers": "Disassemblers",
"hex.builtin.view.store.tab.encodings": "Encodings",
"hex.builtin.view.store.tab.includes": "Libraries",
"hex.builtin.view.store.tab.magic": "Magic Files",
@@ -1137,7 +1143,7 @@
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
"hex.builtin.welcome.learn.imhex.title": "ImHex Documentation",
"hex.builtin.welcome.learn.plugins.desc": "Extend ImHex with additional features using plugins",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
"hex.builtin.popup.create_workspace.title": "Create new Workspace",
"hex.builtin.popup.create_workspace.desc": "Enter a name for the new Workspace",
@@ -1155,7 +1161,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Auto Backups",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Backup from {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "Tip of the Day",
"hex.builtin.welcome.update.desc": "ImHex {0} just released! Download it here.",
"hex.builtin.welcome.update.desc": "ImHex {0} just released!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "New Update available!",
"hex.builtin.welcome.quick_settings.simplified": "Simplified"

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "Color RGBA8",
"hex.builtin.inspector.sleb128": "LEB128 con Signo",
"hex.builtin.inspector.string": "Cadena ",
"hex.builtin.inspector.string16": "Cadena (wide)",
"hex.builtin.inspector.wstring": "Cadena (wide)",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "",
"hex.builtin.inspector.uleb128": "LEB128 sin Signo",
"hex.builtin.inspector.utf8": "Código UTF-8",
"hex.builtin.inspector.wide": "Carácter (wide)",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "Por defecto",
"hex.builtin.layouts.none.restore_default": "",
"hex.builtin.menu.edit": "Editar",
@@ -777,8 +777,8 @@
"hex.builtin.view.hex_editor.menu.file.load_encoding_file": "Cargar codificación personalizada...",
"hex.builtin.view.hex_editor.menu.file.save": "Guardar",
"hex.builtin.view.hex_editor.menu.file.save_as": "Guardar como...",
"hex.builtin.view.hex_editor.menu.file.search": "Buscar",
"hex.builtin.view.hex_editor.menu.edit.select": "Seleccionar",
"hex.builtin.view.hex_editor.menu.file.search": "Buscar...",
"hex.builtin.view.hex_editor.menu.edit.select": "Seleccionar...",
"hex.builtin.view.hex_editor.name": "Editor hexadecimal",
"hex.builtin.view.hex_editor.search.find": "Buscar",
"hex.builtin.view.hex_editor.search.hex": "Hexadecimal",
@@ -994,7 +994,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "Documentación de Pattern Language",
"hex.builtin.welcome.learn.plugins.desc": "Extienda ImHex con características adicionales mediante plugins",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "API de Plugins",
"hex.builtin.welcome.quick_settings.simplified": "",
"hex.builtin.welcome.start.create_file": "Crear Nuevo Archivo",
@@ -1005,7 +1005,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "Consejo del día",
"hex.builtin.welcome.update.desc": "¡ImHex {0} está disponible! Descárguelo aquí.",
"hex.builtin.welcome.update.desc": "¡ImHex {0} está disponible!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Nueva actualización disponible!"
}

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 Szín",
"hex.builtin.inspector.sleb128": "Előjeles LEB128",
"hex.builtin.inspector.string": "String",
"hex.builtin.inspector.string16": "Széles string",
"hex.builtin.inspector.wstring": "Széles string",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "Előjeletlen LEB128",
"hex.builtin.inspector.utf8": "UTF-8 kód pont",
"hex.builtin.inspector.wide": "Széles karakter",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "Alapértelmezett",
"hex.builtin.layouts.none.restore_default": "Alapértelmezett elrendezés visszaállítása",
"hex.builtin.menu.edit": "Szerkesztés",
@@ -778,8 +778,8 @@
"hex.builtin.view.hex_editor.menu.file.load_encoding_file": "Saját kódolás betöltése...",
"hex.builtin.view.hex_editor.menu.file.save": "Mentés",
"hex.builtin.view.hex_editor.menu.file.save_as": "Mentés másként...",
"hex.builtin.view.hex_editor.menu.file.search": "Keresés",
"hex.builtin.view.hex_editor.menu.edit.select": "Kijelölés",
"hex.builtin.view.hex_editor.menu.file.search": "Keresés...",
"hex.builtin.view.hex_editor.menu.edit.select": "Kijelölés...",
"hex.builtin.view.hex_editor.name": "Hex szerkesztő",
"hex.builtin.view.hex_editor.search.find": "Kereső",
"hex.builtin.view.hex_editor.search.hex": "Hex",
@@ -1015,7 +1015,7 @@
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
"hex.builtin.welcome.learn.imhex.title": "ImHex dokumentáció",
"hex.builtin.welcome.learn.plugins.desc": "ImHex funkcióinak bővítése bővítményekkel",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "Bővítmény API",
"hex.builtin.popup.create_workspace.title": "Új munkaterület létrehozása",
"hex.builtin.popup.create_workspace.desc": "Adjon nevet az új munkaterületnek",
@@ -1033,7 +1033,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Automatikus mentések",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Biztonsági mentés: {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "A nap tippje",
"hex.builtin.welcome.update.desc": "Megjelent az ImHex {0}! Itt töltheted le.",
"hex.builtin.welcome.update.desc": "Megjelent az ImHex {0}!.",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Elérhető egy új frissítés!",
"hex.builtin.welcome.quick_settings.simplified": "Egyszerűsített"

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "Colori RGBA8",
"hex.builtin.inspector.sleb128": "",
"hex.builtin.inspector.string": "String",
"hex.builtin.inspector.string16": "Wide String",
"hex.builtin.inspector.wstring": "Wide String",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "",
"hex.builtin.inspector.utf8": "UTF-8 code point",
"hex.builtin.inspector.wide": "Wide Character",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "Default",
"hex.builtin.layouts.none.restore_default": "",
"hex.builtin.menu.edit": "Modifica",
@@ -995,7 +995,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "Documentazione dei Pattern",
"hex.builtin.welcome.learn.plugins.desc": "Espandi l'utilizzo di ImHex con i Plugin",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
"hex.builtin.welcome.quick_settings.simplified": "",
"hex.builtin.welcome.start.create_file": "Crea un nuovo File",
@@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "Consiglio del giorno",
"hex.builtin.welcome.update.desc": "ImHex {0} è appena stato rilasciato! Scaricalo qua",
"hex.builtin.welcome.update.desc": "ImHex {0} è appena stato rilasciato!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Nuovo aggiornamento disponibile!"
}

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 Color",
"hex.builtin.inspector.sleb128": "",
"hex.builtin.inspector.string": "String",
"hex.builtin.inspector.string16": "Wide String",
"hex.builtin.inspector.wstring": "Wide String",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "",
"hex.builtin.inspector.utf8": "UTF-8 code point",
"hex.builtin.inspector.wide": "Wide Character",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "標準",
"hex.builtin.layouts.none.restore_default": "",
"hex.builtin.menu.edit": "編集",
@@ -995,7 +995,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "ImHexオリジナル言語について",
"hex.builtin.welcome.learn.plugins.desc": "ImHexの機能を拡張する",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "プラグインAPI",
"hex.builtin.welcome.quick_settings.simplified": "",
"hex.builtin.welcome.start.create_file": "新規ファイルを作成",
@@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "今日の豆知識",
"hex.builtin.welcome.update.desc": "ImHex {0} がリリースされました。ここからダウンロードできます。",
"hex.builtin.welcome.update.desc": "ImHex {0} がリリースされました。",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "新しいアップデートが利用可能です。"
}

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 색상",
"hex.builtin.inspector.sleb128": "부호 있는 LEB128",
"hex.builtin.inspector.string": "문자열",
"hex.builtin.inspector.string16": "와이드 문자열",
"hex.builtin.inspector.wstring": "와이드 문자열",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "부호 없는 LEB128",
"hex.builtin.inspector.utf8": "UTF-8 코드 포인트",
"hex.builtin.inspector.wide": "와이드 문자",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "기본",
"hex.builtin.layouts.none.restore_default": "기본 레이아웃 복원",
"hex.builtin.menu.edit": "편집",
@@ -777,8 +777,8 @@
"hex.builtin.view.hex_editor.menu.file.load_encoding_file": "사용자 정의 인코딩 불러오기...",
"hex.builtin.view.hex_editor.menu.file.save": "저장",
"hex.builtin.view.hex_editor.menu.file.save_as": "다른 이름으로 저장...",
"hex.builtin.view.hex_editor.menu.file.search": "검색",
"hex.builtin.view.hex_editor.menu.edit.select": "선택",
"hex.builtin.view.hex_editor.menu.file.search": "검색...",
"hex.builtin.view.hex_editor.menu.edit.select": "선택...",
"hex.builtin.view.hex_editor.name": "헥스 편집기",
"hex.builtin.view.hex_editor.search.find": "찾기",
"hex.builtin.view.hex_editor.search.hex": "헥스",
@@ -995,7 +995,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "패턴 언어 문서",
"hex.builtin.welcome.learn.plugins.desc": "플러그인을 사용하여 추가 기능으로 ImHex를 확장하세요",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "플러그인 API",
"hex.builtin.welcome.quick_settings.simplified": "단순화",
"hex.builtin.welcome.start.create_file": "새 파일 만들기",
@@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "오늘의 팁",
"hex.builtin.welcome.update.desc": "ImHex {0}이(가) 출시되었습니다! 여기서 다운로드하세요.",
"hex.builtin.welcome.update.desc": "ImHex {0}이(가) 출시되었습니다!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "새 업데이트를 사용할 수 있습니다!"
}

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 Color",
"hex.builtin.inspector.sleb128": "",
"hex.builtin.inspector.string": "String",
"hex.builtin.inspector.string16": "Wide String",
"hex.builtin.inspector.wstring": "Wide String",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "",
"hex.builtin.inspector.utf8": "UTF-8 code point",
"hex.builtin.inspector.wide": "Wide Character",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "Default",
"hex.builtin.layouts.none.restore_default": "",
"hex.builtin.menu.edit": "Editar",
@@ -995,7 +995,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "Documentação da linguagem padrão",
"hex.builtin.welcome.learn.plugins.desc": "Estenda o ImHex com recursos adicionais usando plugins",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
"hex.builtin.welcome.quick_settings.simplified": "",
"hex.builtin.welcome.start.create_file": "Criar Novo Arquivo",
@@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "Dica do Dia",
"hex.builtin.welcome.update.desc": "ImHex {0} acabou de lançar! Baixe aqui.",
"hex.builtin.welcome.update.desc": "ImHex {0} acabou de lançar!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Nova atualização disponivel!"
}

View File

@@ -96,7 +96,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 цвет",
"hex.builtin.inspector.sleb128": "Знаковый LEB128",
"hex.builtin.inspector.string": "Строка",
"hex.builtin.inspector.string16": "Wide строка",
"hex.builtin.inspector.wstring": "Wide строка",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -108,7 +108,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "Беззнаковый LEB128",
"hex.builtin.inspector.utf8": "UTF-8 код",
"hex.builtin.inspector.wide": "Wide символ",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "По умолчанию",
"hex.builtin.layouts.none.restore_default": "Восстановить макет по умолчанию",
"hex.builtin.menu.edit": "Правка",
@@ -1111,7 +1111,7 @@
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
"hex.builtin.welcome.learn.imhex.title": "Документация ImHex",
"hex.builtin.welcome.learn.plugins.desc": "Расширьте возможности ImHex с помощью плагинов",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "API плагинов",
"hex.builtin.popup.create_workspace.title": "Создать новое пространство",
"hex.builtin.popup.create_workspace.desc": "Введите имя нового пространства",
@@ -1129,7 +1129,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Резервные копии",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Резервная копия от {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "Подсказка дня",
"hex.builtin.welcome.update.desc": "ImHex {0} только что вышел! Его можно скачать здесь.",
"hex.builtin.welcome.update.desc": "ImHex {0} только что вышел!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Доступно новое обновление!",
"hex.builtin.welcome.quick_settings.simplified": "Простой режим"

View File

@@ -123,7 +123,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 颜色",
"hex.builtin.inspector.sleb128": "有符号LEB128",
"hex.builtin.inspector.string": "字符串",
"hex.builtin.inspector.string16": "宽字符串",
"hex.builtin.inspector.wstring": "宽字符串",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -135,7 +135,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "无符号LEB128",
"hex.builtin.inspector.utf8": "UTF-8 码位",
"hex.builtin.inspector.wide": "宽字符",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "默认",
"hex.builtin.layouts.none.restore_default": "恢复默认布局",
"hex.builtin.menu.edit": "编辑",
@@ -849,7 +849,7 @@
"hex.builtin.view.hex_editor.menu.edit.paste_all": "粘贴全部",
"hex.builtin.view.hex_editor.menu.edit.remove": "删除……",
"hex.builtin.view.hex_editor.menu.edit.resize": "修改大小……",
"hex.builtin.view.hex_editor.menu.edit.select": "选择",
"hex.builtin.view.hex_editor.menu.edit.select": "选择……",
"hex.builtin.view.hex_editor.menu.edit.select_all": "全选",
"hex.builtin.view.hex_editor.menu.edit.set_base": "设置基地址",
"hex.builtin.view.hex_editor.menu.edit.set_page_size": "设置页面大小",
@@ -1058,7 +1058,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "模式文档",
"hex.builtin.welcome.learn.plugins.desc": "通过插件扩展 ImHex 获得更多功能",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "插件 API",
"hex.builtin.welcome.nightly_build": "你正在运行ImHex的夜间构建。\n\n请在GitHub问题跟踪器上报告您遇到的任何错误",
"hex.builtin.welcome.quick_settings.simplified": "简化",
@@ -1070,7 +1070,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "自动备份",
"hex.builtin.welcome.start.recent.auto_backups.backup": "备份于 {:%年-%月-%日 %时:%分:%秒}",
"hex.builtin.welcome.tip_of_the_day": "每日提示",
"hex.builtin.welcome.update.desc": "ImHex {0} 已发布!在这里下载。",
"hex.builtin.welcome.update.desc": "ImHex {0} 已发布!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "新的更新可用!"
}

View File

@@ -94,7 +94,7 @@
"hex.builtin.inspector.rgba8": "RGBA8 顏色",
"hex.builtin.inspector.sleb128": "有號數 LEB128",
"hex.builtin.inspector.string": "字串",
"hex.builtin.inspector.string16": "寬字串",
"hex.builtin.inspector.wstring": "寬字串",
"hex.builtin.inspector.time": "time_t",
"hex.builtin.inspector.time32": "time32_t",
"hex.builtin.inspector.time64": "time64_t",
@@ -106,7 +106,7 @@
"hex.builtin.inspector.u8": "uint8_t",
"hex.builtin.inspector.uleb128": "無號數 LEB128",
"hex.builtin.inspector.utf8": "UTF-8 code point",
"hex.builtin.inspector.wide": "框字元",
"hex.builtin.inspector.wide": "wchar_t",
"hex.builtin.layouts.default": "預設",
"hex.builtin.layouts.none.restore_default": "還原預設版面配置",
"hex.builtin.menu.edit": "編輯",
@@ -777,8 +777,8 @@
"hex.builtin.view.hex_editor.menu.file.load_encoding_file": "載入自訂編碼...",
"hex.builtin.view.hex_editor.menu.file.save": "儲存",
"hex.builtin.view.hex_editor.menu.file.save_as": "另存為...",
"hex.builtin.view.hex_editor.menu.file.search": "搜尋",
"hex.builtin.view.hex_editor.menu.edit.select": "選取",
"hex.builtin.view.hex_editor.menu.file.search": "搜尋...",
"hex.builtin.view.hex_editor.menu.edit.select": "選取...",
"hex.builtin.view.hex_editor.name": "十六進位編輯器",
"hex.builtin.view.hex_editor.search.find": "尋找",
"hex.builtin.view.hex_editor.search.hex": "十六進位",
@@ -995,7 +995,7 @@
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
"hex.builtin.welcome.learn.pattern.title": "模式語言說明文件",
"hex.builtin.welcome.learn.plugins.desc": " 使用外掛程式來拓展 ImHex 的功能",
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
"hex.builtin.welcome.learn.plugins.title": "外掛程式 API",
"hex.builtin.welcome.quick_settings.simplified": "",
"hex.builtin.welcome.start.create_file": "建立新檔案",
@@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "今日提示",
"hex.builtin.welcome.update.desc": "ImHex {0} 發布了!點此下載。",
"hex.builtin.welcome.update.desc": "ImHex {0} 發布了!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "有可用更新!"
}

View File

@@ -19,7 +19,7 @@
"header-active": "*#8787DDCC",
"header-hovered": "*#7272E5CC",
"menu-bar-background": "#535371FF",
"modal-window-dim-background": "#33333359",
"modal-window-dim-background": "#33333330",
"nav-highlight": "*#7272E5CC",
"nav-windowing-background": "#CCCCCC33",
"nav-windowing-highlight": "#FFFFFFB2",

View File

@@ -19,7 +19,7 @@
"header-active": "*#4296F9FF",
"header-hovered": "*#4296F9CC",
"menu-bar-background": "#232323FF",
"modal-window-dim-background": "#CCCCCC59",
"modal-window-dim-background": "#CCCCCC30",
"nav-highlight": "*#4296F9FF",
"nav-windowing-background": "#CCCCCC33",
"nav-windowing-highlight": "#FFFFFFB2",
@@ -68,10 +68,10 @@
"IEEE-tool-sign": "#5D5D7FFF",
"IEEE-tool-exp": "#5D7F5DFF",
"IEEE-tool-mantissa": "#7F5D5DFF",
"toolbar-blue": "#06539BFF",
"toolbar-blue": "#267BC9FF",
"toolbar-brown": "#DBB377FF",
"toolbar-gray": "#E6E6E6FF",
"toolbar-green": "#388B42FF",
"toolbar-green": "#59B364FF",
"toolbar-purple": "#672A78FF",
"toolbar-red": "#E74C3CFF",
"toolbar-yellow": "#F1C40FFF",

View File

@@ -19,7 +19,7 @@
"header-active": "*#4296F9FF",
"header-hovered": "*#4296F9CC",
"menu-bar-background": "#DBDBDBFF",
"modal-window-dim-background": "#33333359",
"modal-window-dim-background": "#33333330",
"nav-highlight": "*#4296F9CC",
"nav-windowing-background": "#33333333",
"nav-windowing-highlight": "#B2B2B2B2",

View File

@@ -435,10 +435,10 @@ namespace hex::plugin::builtin {
hex::subcommands::registerSubCommand("select", [](const std::vector<std::string> &args){
try {
if (args.size() == 1)
ImHexApi::HexEditor::setSelection(std::stoull(args[0]), 1);
ImHexApi::HexEditor::setSelection(std::stoull(args[0], nullptr, 0), 1);
else if (args.size() == 2) {
const auto start = std::stoull(args[0]);
const auto size = (std::stoull(args[1]) - start) + 1;
const auto start = std::stoull(args[0], nullptr, 0);
const auto size = (std::stoull(args[1], nullptr, 0) - start) + 1;
ImHexApi::HexEditor::setSelection(start, size);
} else {
log::error("Invalid number of arguments for select command!");

View File

@@ -363,16 +363,73 @@ namespace hex::plugin::builtin {
auto c = hex::changeEndianness(wideChar, endian);
auto value = hex::format("{0}", c <= 255 ? makePrintable(c) : wolv::util::wstringToUtf8(std::wstring(&c, 1)));
auto value = hex::format("{0}", c <= 255 ? makePrintable(c) : wolv::util::wstringToUtf8(std::wstring(&c, 1)).value_or("???"));
return [value] { ImGuiExt::TextFormatted("'{0}'", value.c_str()); return value; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
std::vector<u8> bytes;
auto wideString = wolv::util::utf8ToWstring(value.c_str(), "");
if (wideString.empty()) return bytes;
auto wideString = wolv::util::utf8ToWstring(value.c_str());
if (!wideString.has_value())
return bytes;
bytes.resize(wideString.size() * sizeof(wchar_t));
std::memcpy(bytes.data(), wideString.data(), bytes.size());
bytes.resize(wideString->size() * sizeof(wchar_t));
std::memcpy(bytes.data(), wideString->data(), bytes.size());
if (endian != std::endian::native)
std::reverse(bytes.begin(), bytes.end());
return bytes;
}
);
ContentRegistry::DataInspector::add("hex.builtin.inspector.char16", sizeof(char16_t),
[](auto buffer, auto endian, auto style) {
std::ignore = style;
char16_t wideChar = '\x00';
std::memcpy(&wideChar, buffer.data(), std::min(sizeof(char16_t), buffer.size()));
auto c = hex::changeEndianness(wideChar, endian);
auto value = hex::format("{0}", c <= 255 ? makePrintable(c) : wolv::util::utf16ToUtf8(std::u16string(&c, 1)).value_or("???"));
return [value] { ImGuiExt::TextFormatted("'{0}'", value.c_str()); return value; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
std::vector<u8> bytes;
auto wideString = wolv::util::utf8ToUtf16(value);
if (!wideString.has_value())
return bytes;
bytes.resize(wideString->size() * sizeof(char16_t));
std::memcpy(bytes.data(), wideString->data(), bytes.size());
if (endian != std::endian::native)
std::reverse(bytes.begin(), bytes.end());
return bytes;
}
);
ContentRegistry::DataInspector::add("hex.builtin.inspector.char32", sizeof(char32_t),
[](auto buffer, auto endian, auto style) {
std::ignore = style;
char32_t wideChar = '\x00';
std::memcpy(&wideChar, buffer.data(), std::min(sizeof(char32_t), buffer.size()));
auto c = hex::changeEndianness(wideChar, endian);
auto value = hex::format("{0}", c <= 255 ? makePrintable(c) : wolv::util::utf32ToUtf8(std::u32string(&c, 1)).value_or("???"));
return [value] { ImGuiExt::TextFormatted("'{0}'", value.c_str()); return value; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
std::vector<u8> bytes;
auto wideString = wolv::util::utf8ToUtf32(value);
if (!wideString.has_value())
return bytes;
bytes.resize(wideString->size() * sizeof(char32_t));
std::memcpy(bytes.data(), wideString->data(), bytes.size());
if (endian != std::endian::native)
std::reverse(bytes.begin(), bytes.end());
@@ -439,7 +496,7 @@ namespace hex::plugin::builtin {
}
);
ContentRegistry::DataInspector::add("hex.builtin.inspector.string16", 2,
ContentRegistry::DataInspector::add("hex.builtin.inspector.wstring", sizeof(wchar_t),
[](auto buffer, auto endian, auto style) {
std::ignore = buffer;
std::ignore = endian;
@@ -450,17 +507,15 @@ namespace hex::plugin::builtin {
std::string value, copyValue;
if (currSelection.has_value()) {
std::u16string stringBuffer(std::min<size_t>(currSelection->size, 0x1000), 0x00);
std::wstring stringBuffer(std::min<size_t>(currSelection->size * sizeof(wchar_t), 0x1000), 0x00);
ImHexApi::Provider::get()->read(currSelection->address, stringBuffer.data(), stringBuffer.size());
for (auto &c : stringBuffer)
c = hex::changeEndianness(c, endian);
auto it = std::remove_if(buffer.begin(), buffer.end(),
[](auto c) { return c == 0x00; });
buffer.erase(it, buffer.end());
std::erase_if(buffer, [](auto c) { return c == 0x00; });
auto string = wolv::util::utf16ToUtf8(stringBuffer, "Invalid");
auto string = wolv::util::wstringToUtf8(stringBuffer).value_or("Invalid");
value = copyValue = hex::encodeByteString({ string.begin(), string.end() });
if (value.size() > MaxStringLength) {
@@ -481,6 +536,86 @@ namespace hex::plugin::builtin {
}
);
ContentRegistry::DataInspector::add("hex.builtin.inspector.string16", sizeof(char16_t),
[](auto buffer, auto endian, auto style) {
std::ignore = buffer;
std::ignore = endian;
std::ignore = style;
auto currSelection = ImHexApi::HexEditor::getSelection();
std::string value, copyValue;
if (currSelection.has_value()) {
std::u16string stringBuffer(std::min<size_t>(currSelection->size * sizeof(char16_t), 0x1000), 0x00);
ImHexApi::Provider::get()->read(currSelection->address, stringBuffer.data(), stringBuffer.size());
for (auto &c : stringBuffer)
c = hex::changeEndianness(c, endian);
std::erase_if(buffer, [](auto c) { return c == 0x00; });
auto string = wolv::util::utf16ToUtf8(stringBuffer).value_or("Invalid");
value = copyValue = hex::encodeByteString({ string.begin(), string.end() });
if (value.size() > MaxStringLength) {
value.resize(MaxStringLength);
value += "...";
}
} else {
value = "";
copyValue = "";
}
return [value, copyValue] { ImGuiExt::TextFormatted("u\"{0}\"", value.c_str()); return copyValue; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
std::ignore = endian;
return hex::decodeByteString(value);
}
);
ContentRegistry::DataInspector::add("hex.builtin.inspector.string32", sizeof(char32_t),
[](auto buffer, auto endian, auto style) {
std::ignore = buffer;
std::ignore = endian;
std::ignore = style;
auto currSelection = ImHexApi::HexEditor::getSelection();
std::string value, copyValue;
if (currSelection.has_value()) {
std::u32string stringBuffer(std::min<size_t>(currSelection->size * sizeof(char32_t), 0x1000), 0x00);
ImHexApi::Provider::get()->read(currSelection->address, stringBuffer.data(), stringBuffer.size());
for (auto &c : stringBuffer)
c = hex::changeEndianness(c, endian);
std::erase_if(buffer, [](auto c) { return c == 0x00; });
auto string = wolv::util::utf32ToUtf8(stringBuffer).value_or("Invalid");
value = copyValue = hex::encodeByteString({ string.begin(), string.end() });
if (value.size() > MaxStringLength) {
value.resize(MaxStringLength);
value += "...";
}
} else {
value = "";
copyValue = "";
}
return [value, copyValue] { ImGuiExt::TextFormatted("U\"{0}\"", value.c_str()); return copyValue; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
std::ignore = endian;
return hex::decodeByteString(value);
}
);
#if defined(OS_WINDOWS)
ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(u32), [](auto buffer, auto endian, auto style) {
@@ -612,7 +747,7 @@ namespace hex::plugin::builtin {
auto copyValue = hex::format("#{:02X}{:02X}{:02X}", u8(0xFF * (color.Value.x)), u8(0xFF * (color.Value.y)), u8(0xFF * (color.Value.z)), 0xFF);
return [color, copyValue] {
ImGui::ColorButton("##inspectorColor", color, ImGuiColorEditFlags_None, ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight()));
ImGui::ColorButton("##inspectorColor", color, ImGuiColorEditFlags_AlphaOpaque, ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight()));
return copyValue;
};
});

View File

@@ -247,9 +247,13 @@ namespace hex::plugin::builtin {
EventFirstLaunch::post();
}
EventImHexUpdated::post(SemanticVersion(prevLaunchVersion), currVersion);
const auto prevLaunchVersionParsed = SemanticVersion(prevLaunchVersion);
ContentRegistry::Settings::write<std::string>("hex.builtin.setting.general", "hex.builtin.setting.general.prev_launch_version", currVersion.get(false));
if (currVersion != prevLaunchVersionParsed) {
EventImHexUpdated::post(prevLaunchVersionParsed, currVersion);
ContentRegistry::Settings::write<std::string>("hex.builtin.setting.general", "hex.builtin.setting.general.prev_launch_version", currVersion.get(false));
}
});
EventWindowDeinitializing::subscribe([](GLFWwindow *window) {

View File

@@ -24,7 +24,7 @@
#include <wolv/literals.hpp>
#include <romfs/romfs.hpp>
#include <ui/menu_items.hpp>
#include <hex/helpers/menu_items.hpp>
#include <GLFW/glfw3.h>

View File

@@ -45,7 +45,7 @@ namespace hex::plugin::builtin {
ImGui::EndTabBar();
}
if(ImGuiExt::IconHyperlink(ICON_VS_SEARCH, "hex.builtin.view.hex_editor.search.advanced"_lang)) {
if (ImGuiExt::IconHyperlink(ICON_VS_SEARCH, "hex.builtin.view.hex_editor.search.advanced"_lang)) {
TaskManager::doLater([editor] {
const auto& view = ContentRegistry::Views::getViewByName("hex.builtin.view.find.name");
@@ -286,25 +286,29 @@ namespace hex::plugin::builtin {
}
case Encoding::UTF16: {
auto utf16 = wolv::util::utf8ToUtf16(s_inputString);
if (!utf16.has_value())
return;
for (auto &c: utf16) {
for (auto &c : *utf16) {
swapEndianness(c, Encoding::UTF16, m_stringEndianness);
}
std::copy(reinterpret_cast<const u8 *>(utf16.data()),
reinterpret_cast<const u8 *>(utf16.data() + utf16.size()),
std::copy(reinterpret_cast<const u8 *>(utf16->data()),
reinterpret_cast<const u8 *>(utf16->data() + utf16->size()),
std::back_inserter(m_searchByteSequence));
break;
}
case Encoding::UTF32: {
auto utf32 = wolv::util::utf8ToUtf32(s_inputString);
if (!utf32.has_value())
return;
for (auto &c: utf32) {
for (auto &c : *utf32) {
swapEndianness(c, Encoding::UTF32, m_stringEndianness);
}
std::copy(reinterpret_cast<const u8 *>(utf32.data()),
reinterpret_cast<const u8 *>(utf32.data() + utf32.size()),
std::copy(reinterpret_cast<const u8 *>(utf32->data()),
reinterpret_cast<const u8 *>(utf32->data() + utf32->size()),
std::back_inserter(m_searchByteSequence));
break;
}

View File

@@ -463,16 +463,16 @@ namespace hex::plugin::builtin {
ImGui::PushItemWidth(300_scaled);
if (ImGui::BeginListBox("hex.builtin.provider.disk.selected_disk"_lang)) {
ImGui::PushID(1);
for (const auto &[path, friendlyName] : m_availableDrives) {
ImGui::PushID(path.c_str());
if (ImGui::Selectable(friendlyName.c_str(), m_path == path)) {
m_path = path;
m_friendlyName = friendlyName;
}
ImGui::PopID();
ImGuiExt::InfoTooltip(path.c_str());
}
ImGui::PopID();
ImGui::EndListBox();
}

View File

@@ -33,6 +33,9 @@
namespace hex::plugin::builtin {
bool ProcessMemoryProvider::open() {
if (m_selectedProcess == nullptr)
return false;
#if defined(OS_WINDOWS)
m_processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, m_selectedProcess->id);
if (m_processHandle == nullptr)

View File

@@ -52,9 +52,10 @@ namespace hex::plugin::builtin {
return false;
EventProviderClosing::subscribe(this, [this](const prv::Provider *provider, bool*) {
if (m_provider == provider)
if (m_provider == provider) {
ImHexApi::Provider::remove(this, false);
m_provider = nullptr;
m_provider = nullptr;
}
});
return true;

View File

@@ -21,7 +21,7 @@
#include <ranges>
#include <unordered_set>
#include <ui/menu_items.hpp>
#include <hex/helpers/menu_items.hpp>
namespace hex::plugin::builtin::recent {
@@ -280,7 +280,7 @@ namespace hex::plugin::builtin::recent {
icon = ICON_VS_FILE_BINARY;
}
if (ImGuiExt::Hyperlink(hex::format("{} {}", icon, hex::limitStringLength(recentEntry.displayName, 32)).c_str())) {
if (ImGuiExt::IconHyperlink(icon, hex::limitStringLength(recentEntry.displayName, 32).c_str())) {
loadRecentEntry(recentEntry);
break;
}
@@ -341,7 +341,7 @@ namespace hex::plugin::builtin::recent {
if (s_autoBackupsFound) {
ImGui::Separator();
if (ImGuiExt::Hyperlink(hex::format("{} {}", ICON_VS_ARCHIVE, "hex.builtin.welcome.start.recent.auto_backups"_lang).c_str()))
if (ImGuiExt::IconHyperlink(ICON_VS_ARCHIVE, "hex.builtin.welcome.start.recent.auto_backups"_lang))
PopupAutoBackups::open();
}
}

View File

@@ -27,8 +27,6 @@ namespace hex::plugin::builtin {
namespace {
bool s_showScalingWarning = true;
/*
Values of this setting:
0 - do not check for updates on startup
@@ -191,11 +189,6 @@ namespace hex::plugin::builtin {
else if (m_value > 10)
m_value = 10;
if (s_showScalingWarning && (u32(m_value * 10) % 10) != 0) {
ImGui::SameLine();
ImGuiExt::HelpHover("hex.builtin.setting.interface.scaling.fractional_warning"_lang, ICON_VS_WARNING, ImGuiExt::GetCustomColorU32(ImGuiCustomCol_ToolbarRed));
}
return changed;
}
@@ -757,6 +750,8 @@ namespace hex::plugin::builtin {
ThemeManager::setAccentColor(colorPicker->getColor());
});
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.interface", "hex.builtin.setting.interface.style", "hex.builtin.setting.interface.show_titlebar_backdrop", true);
ContentRegistry::Settings::add<ScalingWidget>("hex.builtin.setting.interface", "hex.builtin.setting.interface.style", "hex.builtin.setting.interface.scaling_factor")
.requiresRestart();
@@ -914,7 +909,7 @@ namespace hex::plugin::builtin {
ContentRegistry::Settings::add<ToolbarIconsWidget>("hex.builtin.setting.toolbar", "", "hex.builtin.setting.toolbar.icons");
}
ImHexApi::System::addMigrationRoutine("v1.36.3", [] {
ImHexApi::System::addMigrationRoutine("v1.37.0", [] {
log::warn("Resetting shortcut key settings for them to work with this version of ImHex");
for (const auto &category : ContentRegistry::Settings::impl::getSettings()) {

View File

@@ -248,7 +248,7 @@ namespace hex::plugin::builtin {
}, nullptr);
ImPlot::SetupAxisTicks(ImAxis_Y1, 0, largestFrameTime * 1.25F, 3);
static std::vector<double> values(100);
static std::vector<double> values(100, 0.0);
values.push_back(ImHexApi::System::getLastFrameTime());
if (values.size() > 100)
@@ -541,6 +541,15 @@ namespace hex::plugin::builtin {
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save", ImGuiCustomCol_ToolbarBlue);
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save_as", ImGuiCustomCol_ToolbarBlue);
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.menu.edit.bookmark.create", ImGuiCustomCol_ToolbarGreen);
const auto &initArgs = ImHexApi::System::getInitArguments();
if (auto it = initArgs.find("update-available"); it != initArgs.end()) {
ContentRegistry::Interface::addTitleBarButton(ICON_VS_GIFT, "hex.builtin.welcome.update.title", [] {
ImHexApi::System::updateImHex(ImHexApi::System::UpdateType::Stable);
});
ui::ToastInfo::open(hex::format("hex.builtin.welcome.update.desc"_lang, it->second));
}
});
}

View File

@@ -20,7 +20,7 @@
#include <wolv/utils/string.hpp>
#include <string>
#include <ui/menu_items.hpp>
#include <hex/helpers/menu_items.hpp>
namespace hex::plugin::builtin {

View File

@@ -100,7 +100,7 @@ namespace hex::plugin::builtin {
{
// Draw bookmark header
ImGui::ColorButton("##color", ImColor(bookmark.color));
ImGui::ColorButton("##color", ImColor(bookmark.color), ImGuiColorEditFlags_AlphaOpaque);
ImGui::SameLine(0, 10);
ImGuiExt::TextFormatted("{} ", bookmark.name);

View File

@@ -56,7 +56,7 @@ namespace hex::plugin::builtin {
auto region = occurrence.value.region;
const auto value = this->decodeValue(ImHexApi::Provider::get(), occurrence.value, 256);
ImGui::ColorButton("##color", ImColor(HighlightColor()));
ImGui::ColorButton("##color", ImColor(HighlightColor()), ImGuiColorEditFlags_AlphaOpaque);
ImGui::SameLine(0, 10);
ImGuiExt::TextFormatted("{} ", value);

View File

@@ -25,7 +25,7 @@
#include <content/popups/popup_blocking_task.hpp>
#include <content/popups/hex_editor/popup_hex_editor_find.hpp>
#include <pl/patterns/pattern.hpp>
#include <ui/menu_items.hpp>
#include <hex/helpers/menu_items.hpp>
#include <wolv/literals.hpp>
using namespace std::literals::string_literals;
@@ -622,7 +622,7 @@ namespace hex::plugin::builtin {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::ColorButton(tooltip.getValue().c_str(), ImColor(tooltip.getColor()));
ImGui::ColorButton(tooltip.getValue().c_str(), ImColor(tooltip.getColor()), ImGuiColorEditFlags_AlphaOpaque);
ImGui::SameLine(0, 10);
ImGui::TextUnformatted(tooltip.getValue().c_str());

View File

@@ -36,7 +36,7 @@
#include <content/global_actions.hpp>
#include <fonts/fonts.hpp>
#include <ui/menu_items.hpp>
#include <hex/helpers/menu_items.hpp>
namespace hex::plugin::builtin {
@@ -333,9 +333,9 @@ namespace hex::plugin::builtin {
const auto availableSize = g.CurrentWindow->Size;
const auto windowPosition = ImGui::GetCursorScreenPos();
auto textEditorSize = availableSize;
textEditorSize.y *= 3.5 / 5.0;
textEditorSize.y *= 3.5F / 5.0F;
textEditorSize.y -= ImGui::GetTextLineHeightWithSpacing();
textEditorSize.y = std::clamp(textEditorSize.y + height,200.0F, availableSize.y-200.0F);
textEditorSize.y = std::clamp(textEditorSize.y + height, 200.0F, availableSize.y - 200.0F);
if (g.NavWindow != nullptr) {
std::string name = g.NavWindow->Name;
@@ -579,7 +579,7 @@ namespace hex::plugin::builtin {
}
}
if (m_textEditor.IsTextChanged()) {
if (m_textEditor.IsTextChanged() && !m_hasUnevaluatedChanges) {
m_hasUnevaluatedChanges = true;
m_lastEditorChangeTime = std::chrono::steady_clock::now();
ImHexApi::Provider::markDirty();
@@ -587,7 +587,6 @@ namespace hex::plugin::builtin {
if (m_hasUnevaluatedChanges && m_runningEvaluators == 0 && m_runningParsers == 0) {
if ((std::chrono::steady_clock::now() - m_lastEditorChangeTime) > std::chrono::seconds(1LL)) {
m_hasUnevaluatedChanges = false;
auto code = m_textEditor.GetText();
EventPatternEditorChanged::post(code);
@@ -598,6 +597,8 @@ namespace hex::plugin::builtin {
if (m_runAutomatically)
m_triggerAutoEvaluate = true;
});
m_hasUnevaluatedChanges = false;
m_textEditor.SetTextChanged();
}
}
@@ -1425,7 +1426,7 @@ namespace hex::plugin::builtin {
const auto &currScope = evaluator->getScope(-m_debuggerScopeIndex);
if (ImGui::BeginCombo("##scope", displayValue(currScope.parent, m_debuggerScopeIndex).c_str())) {
for (size_t i = 0; i < evaluator->getScopeCount(); i++) {
auto &scope = evaluator->getScope(-i);
auto &scope = evaluator->getScope(-i32(i));
if (ImGui::Selectable(displayValue(scope.parent, i).c_str(), i == size_t(m_debuggerScopeIndex))) {
m_debuggerScopeIndex = i;
@@ -1691,7 +1692,7 @@ namespace hex::plugin::builtin {
ImGui::PushID(pattern);
{
const bool shiftHeld = ImGui::GetIO().KeyShift;
ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor()));
ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor()), ImGuiColorEditFlags_AlphaOpaque);
ImGui::SameLine(0, 10);
ImGuiExt::TextFormattedColored(TextEditor::GetPalette()[u32(TextEditor::PaletteIndex::KnownIdentifier)], "{} ", pattern->getFormattedName());
ImGui::SameLine(0, 5);
@@ -1899,6 +1900,7 @@ namespace hex::plugin::builtin {
m_accessHistory = {};
m_accessHistoryIndex = 0;
m_patternEvaluating = true;
EventHighlightingChanged::post();
@@ -1947,7 +1949,8 @@ namespace hex::plugin::builtin {
runtime.setLogCallback([this, provider](auto level, auto message) {
std::scoped_lock lock(m_logMutex);
for (auto line : wolv::util::splitString(message, "\n")) {
auto lines = wolv::util::splitString(message, "\n");
for (auto &line : lines) {
if (!wolv::util::trim(line).empty()) {
switch (level) {
using enum pl::core::LogConsole::Level;

View File

@@ -9,7 +9,7 @@
namespace hex::plugin::builtin {
ViewProviderSettings::ViewProviderSettings() : View::Modal("hex.builtin.view.provider_settings.name") {
EventProviderOpened::subscribe(this, [this](const hex::prv::Provider *provider) {
EventProviderCreated::subscribe(this, [this](const hex::prv::Provider *provider) {
if (provider->hasLoadInterface() && !provider->shouldSkipLoadInterface())
this->getWindowOpenState() = true;
});
@@ -28,7 +28,7 @@ namespace hex::plugin::builtin {
}
ViewProviderSettings::~ViewProviderSettings() {
EventProviderOpened::unsubscribe(this);
EventProviderCreated::unsubscribe(this);
}
void ViewProviderSettings::drawContent() {

View File

@@ -38,15 +38,16 @@ namespace hex::plugin::builtin {
m_httpRequest.setTimeout(30'0000);
addCategory("hex.builtin.view.store.tab.patterns", "patterns", &paths::Patterns);
addCategory("hex.builtin.view.store.tab.includes", "includes", &paths::PatternsInclude);
addCategory("hex.builtin.view.store.tab.magic", "magic", &paths::Magic, []{
addCategory("hex.builtin.view.store.tab.patterns", "patterns", &paths::Patterns);
addCategory("hex.builtin.view.store.tab.includes", "includes", &paths::PatternsInclude);
addCategory("hex.builtin.view.store.tab.magic", "magic", &paths::Magic, []{
magic::compile();
});
addCategory("hex.builtin.view.store.tab.nodes", "nodes", &paths::Nodes);
addCategory("hex.builtin.view.store.tab.encodings", "encodings", &paths::Encodings);
addCategory("hex.builtin.view.store.tab.constants", "constants", &paths::Constants);
addCategory("hex.builtin.view.store.tab.themes", "themes", &paths::Themes, [this]{
addCategory("hex.builtin.view.store.tab.nodes", "nodes", &paths::Nodes);
addCategory("hex.builtin.view.store.tab.encodings", "encodings", &paths::Encodings);
addCategory("hex.builtin.view.store.tab.disassemblers","disassemblers", &paths::Disassemblers);
addCategory("hex.builtin.view.store.tab.constants", "constants", &paths::Constants);
addCategory("hex.builtin.view.store.tab.themes", "themes", &paths::Themes, [this]{
auto themeFile = wolv::io::File(m_downloadPath, wolv::io::File::Mode::Read);
ThemeManager::addTheme(themeFile.readString());

View File

@@ -37,6 +37,8 @@
#include <string>
#include <random>
#include <banners/banner_button.hpp>
#include <banners/banner_icon.hpp>
namespace hex::plugin::builtin {
@@ -377,14 +379,6 @@ namespace hex::plugin::builtin {
}
ImGuiExt::EndSubWindow();
if (ImHexApi::System::getInitArguments().contains("update-available")) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.update.title"_lang, hex::format("hex.builtin.welcome.update.desc"_lang, ImHexApi::System::getInitArgument("update-available")).c_str(), ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0)))
ImHexApi::System::updateImHex(ImHexApi::System::UpdateType::Stable);
}
ImGui::EndTable();
}
ImGui::SameLine();
@@ -765,6 +759,21 @@ namespace hex::plugin::builtin {
TaskManager::doLater([]{
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.crash.name");
});
} else {
std::random_device rd;
if (ImHexApi::System::isCorporateEnvironment()) {
if (rd() % 25 == 0) {
ui::BannerButton::open(ICON_VS_HEART, "Using ImHex for professional work? Ask your boss to sponsor us and get private E-Mail support and more!", ImColor(0x68, 0xA7, 0x70), "Donate Now!", [] {
hex::openWebpage("https://imhex.werwolv.net/donate_work");
});
}
} else {
if (rd() % 75 == 0) {
ui::BannerButton::open(ICON_VS_HEART, "ImHex needs your help to stay alive! Donate now to fund infrastructure and further development", ImColor(0x68, 0xA7, 0x70), "Donate Now!", [] {
hex::openWebpage("https://github.com/sponsors/WerWolv");
});
}
}
}
// Load info banner texture either locally or from the server

View File

@@ -12,7 +12,7 @@
#include <imgui_internal.h>
#include <random>
#include <hex/ui/imgui_imhex_extensions.h>
#include <ui/menu_items.hpp>
#include <hex/helpers/menu_items.hpp>
#include <fonts/vscode_icons.hpp>
#include <hex/api/tutorial_manager.hpp>
@@ -35,6 +35,16 @@ namespace hex::plugin::builtin {
bool s_showSearchBar = true;
bool s_displayShortcutHighlights = true;
bool s_useNativeMenuBar = false;
bool s_showTitlebarBackDrop = true;
void drawTitleBarBackDrop() {
if (!s_showTitlebarBackDrop)
return;
const auto diameter = 800_scaled;
const auto pos = ImHexApi::System::getMainWindowPosition() - ImVec2(0, diameter / 2);
ImGui::GetWindowDrawList()->AddShadowCircle(pos, diameter / 2, ImGui::GetColorU32(ImGuiCol_ButtonActive, 0.8F), diameter / 4, ImVec2());
}
void createNestedMenu(std::span<const UnlocalizedString> menuItems, const char *icon, const Shortcut &shortcut, View *view, const ContentRegistry::Interface::impl::MenuCallback &callback, const ContentRegistry::Interface::impl::EnabledCallback &enabledCallback, const ContentRegistry::Interface::impl::SelectedCallback &selectedCallback) {
const auto &name = menuItems.front();
@@ -402,7 +412,7 @@ namespace hex::plugin::builtin {
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
#if defined(OS_WINDOWS)
ImGui::SetCursorPosX(5_scaled);
ImGui::Image(*s_logoTexture, s_logoTexture->getSize() * u32(1_scaled));
ImGui::Image(*s_logoTexture, s_logoTexture->getSize() * 0.1_scaled);
ImGui::SetCursorPosX(5_scaled);
ImGui::InvisibleButton("##logo", ImVec2(menuBarHeight, menuBarHeight));
if (ImGui::IsItemHovered() && ImGui::IsAnyMouseDown())
@@ -438,6 +448,7 @@ namespace hex::plugin::builtin {
menu::enableNativeMenuBar(false);
if (ImGui::BeginMainMenuBar()) {
drawTitleBarBackDrop();
ImGui::Dummy({});
ImGui::PopStyleVar(2);
@@ -477,6 +488,7 @@ namespace hex::plugin::builtin {
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0F);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
if (ImGui::BeginMenuBar()) {
drawTitleBarBackDrop();
for (const auto &callback : ContentRegistry::Interface::impl::getToolbarItems()) {
callback();
ImGui::SameLine();
@@ -652,6 +664,10 @@ namespace hex::plugin::builtin {
s_useNativeMenuBar = value.get<bool>(true);
});
ContentRegistry::Settings::onChange("hex.builtin.setting.interface", "hex.builtin.setting.interface.show_titlebar_backdrop", [](const ContentRegistry::Settings::SettingsValue &value) {
s_showTitlebarBackDrop = value.get<bool>(true);
});
ContentRegistry::Settings::onChange("hex.builtin.setting.interface", "hex.builtin.setting.interface.randomize_window_title", [](const ContentRegistry::Settings::SettingsValue &value) {
const bool randomTitle = value.get<bool>(false);
if (randomTitle) {

View File

@@ -122,6 +122,7 @@ namespace hex::plugin::diffing {
column.provider = -1;
column.hexEditor.setSelectionUnchecked(std::nullopt, std::nullopt);
column.diffTree.clear();
column.differences.clear();
}
}
@@ -354,32 +355,34 @@ namespace hex::plugin::diffing {
// Draw changes
ImGui::TableNextColumn();
ImGui::Indent();
switch (typeA) {
case DifferenceType::Insertion:
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
providers[a.provider]->read(regionA.start, data.data(), data.size());
drawByteString(data);
break;
case DifferenceType::Mismatch:
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
providers[a.provider]->read(regionA.start, data.data(), data.size());
drawByteString(data);
if (a.provider != -1 && b.provider != -1) {
switch (typeA) {
case DifferenceType::Insertion:
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
providers[a.provider]->read(regionA.start, data.data(), data.size());
drawByteString(data);
break;
case DifferenceType::Mismatch:
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
providers[a.provider]->read(regionA.start, data.data(), data.size());
drawByteString(data);
ImGui::SameLine(0, 0);
ImGuiExt::TextFormatted(" {} ", ICON_VS_ARROW_RIGHT);
ImGui::SameLine(0, 0);
ImGui::SameLine(0, 0);
ImGuiExt::TextFormatted(" {} ", ICON_VS_ARROW_RIGHT);
ImGui::SameLine(0, 0);
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
providers[b.provider]->read(regionB.start, data.data(), data.size());
drawByteString(data);
break;
case DifferenceType::Deletion:
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
providers[b.provider]->read(regionB.start, data.data(), data.size());
drawByteString(data);
break;
default:
break;
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
providers[b.provider]->read(regionB.start, data.data(), data.size());
drawByteString(data);
break;
case DifferenceType::Deletion:
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
providers[b.provider]->read(regionB.start, data.data(), data.size());
drawByteString(data);
break;
default:
break;
}
}
ImGui::Unindent();

View File

@@ -46,7 +46,8 @@ namespace hex::plugin::disasm {
for (u8 byte : instruction.bytes)
disassembly.bytes += hex::format("{0:02X} ", byte);
disassembly.bytes.pop_back();
if (!disassembly.bytes.empty())
disassembly.bytes.pop_back();
return disassembly;
}

View File

@@ -34,8 +34,6 @@ namespace hex::plugin::disasm {
}
ViewDisassembler::~ViewDisassembler() {
EventDataChanged::unsubscribe(this);
EventRegionSelected::unsubscribe(this);
EventProviderDeleted::unsubscribe(this);
}
@@ -54,6 +52,10 @@ namespace hex::plugin::disasm {
// Create a capstone disassembler instance
if (currArchitecture->start()) {
ON_SCOPE_EXIT {
currArchitecture->end();
};
std::vector<u8> buffer(1_MiB, 0x00);
const u64 codeOffset = region.getStartAddress() - m_imageBaseAddress;
@@ -80,6 +82,9 @@ namespace hex::plugin::disasm {
disassembly.push_back(instruction.value());
if (instruction->size == 0 || instruction->size > code.size())
break;
code = code.subspan(instruction->size);
instructionDataAddress += instruction->size;
instructionLoadAddress += instruction->size;
@@ -92,8 +97,6 @@ namespace hex::plugin::disasm {
if (hadError) break;
hadError = true;
}
currArchitecture->end();
}
});
}
@@ -135,59 +138,64 @@ namespace hex::plugin::disasm {
auto &region = m_regionToDisassemble.get(provider);
auto &range = m_range.get(provider);
// Draw region selection picker
ui::regionSelectionPicker(&region, provider, &range, true, true);
ImGuiExt::Header("hex.disassembler.view.disassembler.position"_lang);
// Draw base address input
ImGui::BeginDisabled(m_disassemblerTask.isRunning());
{
auto &address = m_imageLoadAddress.get(provider);
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_load_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
ImGui::SameLine();
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_load_address.hint"_lang, ICON_VS_INFO);
}
// Draw region selection picker
ui::regionSelectionPicker(&region, provider, &range, true, true);
// Draw code region start address input
ImGui::BeginDisabled(m_range == ui::RegionType::EntireData);
{
auto &address = m_imageBaseAddress.get(provider);
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_base_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
ImGui::SameLine();
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_base_address.hint"_lang, ICON_VS_INFO);
ImGuiExt::Header("hex.disassembler.view.disassembler.position"_lang);
// Draw base address input
{
auto &address = m_imageLoadAddress.get(provider);
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_load_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
ImGui::SameLine();
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_load_address.hint"_lang, ICON_VS_INFO);
}
// Draw code region start address input
ImGui::BeginDisabled(m_range == ui::RegionType::EntireData);
{
auto &address = m_imageBaseAddress.get(provider);
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_base_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
ImGui::SameLine();
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_base_address.hint"_lang, ICON_VS_INFO);
}
ImGui::EndDisabled();
// Draw settings
{
ImGuiExt::Header("hex.ui.common.settings"_lang);
// Draw architecture selector
const auto &architectures = ContentRegistry::Disassembler::impl::getArchitectures();
if (architectures.empty()) {
ImGuiExt::TextSpinner("hex.disassembler.view.disassembler.arch"_lang);
} else {
const auto &currArchitecture = m_currArchitecture.get(provider);
if (currArchitecture == nullptr) {
m_currArchitecture = architectures.begin()->second();
}
if (ImGui::BeginCombo("hex.disassembler.view.disassembler.arch"_lang, currArchitecture->getName().c_str())) {
for (const auto &[name, creator] : architectures) {
if (ImGui::Selectable(name.c_str(), name == currArchitecture->getName())) {
m_currArchitecture = creator();
}
}
ImGui::EndCombo();
}
// Draw sub-settings for each architecture
if (ImGuiExt::BeginBox()) {
currArchitecture->drawSettings();
}
ImGuiExt::EndBox();
}
}
}
ImGui::EndDisabled();
// Draw settings
{
ImGuiExt::Header("hex.ui.common.settings"_lang);
// Draw architecture selector
const auto &architectures = ContentRegistry::Disassembler::impl::getArchitectures();
if (architectures.empty()) {
ImGuiExt::TextSpinner("hex.disassembler.view.disassembler.arch"_lang);
} else {
const auto &currArchitecture = m_currArchitecture.get(provider);
if (currArchitecture == nullptr) {
m_currArchitecture = architectures.begin()->second();
}
if (ImGui::BeginCombo("hex.disassembler.view.disassembler.arch"_lang, currArchitecture->getName().c_str())) {
for (const auto &[name, creator] : architectures) {
if (ImGui::Selectable(name.c_str(), name == currArchitecture->getName())) {
m_currArchitecture = creator();
}
}
ImGui::EndCombo();
}
// Draw sub-settings for each architecture
if (ImGuiExt::BeginBox()) {
currArchitecture->drawSettings();
}
ImGuiExt::EndBox();
}
}
// Draw disassemble button
ImGui::BeginDisabled(m_disassemblerTask.isRunning() || region.getStartAddress() < m_imageBaseAddress);

View File

@@ -65,7 +65,9 @@ namespace hex::fonts {
return;
}
loadFont(widget, name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
TaskManager::doLater([&name, &font, &widget] {
loadFont(widget, name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
});
});
loadFont(widget.getWidget(), name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());

View File

@@ -17,11 +17,4 @@ add_imhex_plugin(
LIBRARIES
fonts
LIBRARY_PLUGIN
)
if (APPLE)
target_sources(ui PRIVATE source/ui/macos_menu.m)
find_library(FOUNDATION NAMES Foundation REQUIRED)
find_library(COCOA NAMES Cocoa REQUIRED)
target_link_libraries(ui PUBLIC ${FOUNDATION} ${COCOA})
endif()
)

View File

@@ -13,7 +13,7 @@ namespace hex::ui {
: Banner(color), m_icon(icon), m_message(std::move(message)), m_buttonText(std::move(buttonText)), m_buttonCallback(std::move(buttonCallback)) { }
void drawContent() override {
const std::string buttonText = Lang(m_buttonText);
const std::string buttonText = hex::format(" {} ", Lang(m_buttonText).get());
const auto buttonSize = ImGui::CalcTextSize(buttonText.c_str());
const auto iconSize = ImGui::CalcTextSize(m_icon);
const auto textHeight = std::max(ImGui::CalcTextSize(Lang(m_message)).y, iconSize.y);
@@ -37,11 +37,14 @@ namespace hex::ui {
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - buttonSize.x - 20_scaled);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2_scaled);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1_scaled);
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_Tab));
if (ImGui::SmallButton(buttonText.c_str())) {
m_buttonCallback();
this->close();
}
ImGui::PopStyleVar(1);
ImGui::PopStyleColor();
ImGui::PopStyleVar(2);
}
private:

View File

@@ -564,7 +564,7 @@ namespace hex::ui {
ImGui::TableSetupColumn("");
// Byte columns
for (u16 i = 0; i < columnCount; i++) {
for (u64 i = 0; i < columnCount; i++) {
if (isColumnSeparatorColumn(i, columnCount))
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, SeparatorColumWidth);

View File

@@ -1,4 +1,4 @@
#include <ui/menu_items.hpp>
#include <../../../../lib/libimhex/include/hex/helpers/menu_items.hpp>
#include <imgui.h>
#include <imgui_internal.h>

View File

@@ -119,7 +119,7 @@ namespace hex::ui {
void drawOffsetColumns(const pl::ptrn::Pattern& pattern) {
auto *bitfieldMember = dynamic_cast<const pl::ptrn::PatternBitfieldMember*>(&pattern);
if (bitfieldMember != nullptr && bitfieldMember->getParentBitfield() != nullptr) {
if (bitfieldMember != nullptr && bitfieldMember->getParent() != nullptr) {
drawOffsetColumnForBitfieldMember(*bitfieldMember);
return;
}
@@ -179,7 +179,7 @@ namespace hex::ui {
return;
}
if (auto *bitfieldMember = dynamic_cast<const pl::ptrn::PatternBitfieldMember*>(&pattern); bitfieldMember != nullptr && bitfieldMember->getParentBitfield() != nullptr)
if (auto *bitfieldMember = dynamic_cast<const pl::ptrn::PatternBitfieldMember*>(&pattern); bitfieldMember != nullptr && bitfieldMember->getParent() != nullptr)
drawSizeColumnForBitfieldMember(*bitfieldMember);
else {
ImGui::TableNextColumn();